Debian Codegraph @

doc/classes/Projection.xml

raw symbols SCIP
1 <?xml version="1.0" encoding="UTF-8" ?>
2 <class name="Projection" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../class.xsd">
3 <brief_description>
4 A 4×4 matrix for 3D projective transformations.
5 </brief_description>
6 <description>
7 A 4×4 matrix used for 3D projective transformations. It can represent transformations such as translation, rotation, scaling, shearing, and perspective division. It consists of four [Vector4] columns.
8 For purely linear transformations (translation, rotation, and scale), it is recommended to use [Transform3D], as it is more performant and requires less memory.
9 Used internally as [Camera3D]'s projection matrix.
10 </description>
11 <tutorials>
12 </tutorials>
13 <constructors>
14 <constructor name="Projection">
15 <return type="Projection" />
16 <description>
17 Constructs a default-initialized [Projection] identical to [constant IDENTITY].
18 [b]Note:[/b] In C#, this constructs a [Projection] identical to [constant ZERO].
19 </description>
20 </constructor>
21 <constructor name="Projection">
22 <return type="Projection" />
23 <param index="0" name="from" type="Projection" />
24 <description>
25 Constructs a [Projection] as a copy of the given [Projection].
26 </description>
27 </constructor>
28 <constructor name="Projection">
29 <return type="Projection" />
30 <param index="0" name="from" type="Transform3D" />
31 <description>
32 Constructs a Projection as a copy of the given [Transform3D].
33 </description>
34 </constructor>
35 <constructor name="Projection">
36 <return type="Projection" />
37 <param index="0" name="x_axis" type="Vector4" />
38 <param index="1" name="y_axis" type="Vector4" />
39 <param index="2" name="z_axis" type="Vector4" />
40 <param index="3" name="w_axis" type="Vector4" />
41 <description>
42 Constructs a Projection from four [Vector4] values (matrix columns).
43 </description>
44 </constructor>
45 </constructors>
46 <methods>
47 <method name="create_depth_correction" qualifiers="static">
48 <return type="Projection" />
49 <param index="0" name="flip_y" type="bool" />
50 <description>
51 Creates a new [Projection] that projects positions from a depth range of [code]-1[/code] to [code]1[/code] to one that ranges from [code]0[/code] to [code]1[/code], and flips the projected positions vertically, according to [param flip_y].
52 </description>
53 </method>
54 <method name="create_fit_aabb" qualifiers="static">
55 <return type="Projection" />
56 <param index="0" name="aabb" type="AABB" />
57 <description>
58 Creates a new [Projection] that scales a given projection to fit around a given [AABB] in projection space.
59 </description>
60 </method>
61 <method name="create_for_hmd" qualifiers="static">
62 <return type="Projection" />
63 <param index="0" name="eye" type="int" />
64 <param index="1" name="aspect" type="float" />
65 <param index="2" name="intraocular_dist" type="float" />
66 <param index="3" name="display_width" type="float" />
67 <param index="4" name="display_to_lens" type="float" />
68 <param index="5" name="oversample" type="float" />
69 <param index="6" name="z_near" type="float" />
70 <param index="7" name="z_far" type="float" />
71 <description>
72 Creates a new [Projection] for projecting positions onto a head-mounted display with the given X:Y aspect ratio, distance between eyes, display width, distance to lens, oversampling factor, and depth clipping planes.
73 [param eye] creates the projection for the left eye when set to 1, or the right eye when set to 2.
74 </description>
75 </method>
76 <method name="create_frustum" qualifiers="static">
77 <return type="Projection" />
78 <param index="0" name="left" type="float" />
79 <param index="1" name="right" type="float" />
80 <param index="2" name="bottom" type="float" />
81 <param index="3" name="top" type="float" />
82 <param index="4" name="z_near" type="float" />
83 <param index="5" name="z_far" type="float" />
84 <description>
85 Creates a new [Projection] that projects positions in a frustum with the given clipping planes.
86 </description>
87 </method>
88 <method name="create_frustum_aspect" qualifiers="static">
89 <return type="Projection" />
90 <param index="0" name="size" type="float" />
91 <param index="1" name="aspect" type="float" />
92 <param index="2" name="offset" type="Vector2" />
93 <param index="3" name="z_near" type="float" />
94 <param index="4" name="z_far" type="float" />
95 <param index="5" name="flip_fov" type="bool" default="false" />
96 <description>
97 Creates a new [Projection] that projects positions in a frustum with the given size, X:Y aspect ratio, offset, and clipping planes.
98 [param flip_fov] determines whether the projection's field of view is flipped over its diagonal.
99 </description>
100 </method>
101 <method name="create_light_atlas_rect" qualifiers="static">
102 <return type="Projection" />
103 <param index="0" name="rect" type="Rect2" />
104 <description>
105 Creates a new [Projection] that projects positions into the given [Rect2].
106 </description>
107 </method>
108 <method name="create_orthogonal" qualifiers="static">
109 <return type="Projection" />
110 <param index="0" name="left" type="float" />
111 <param index="1" name="right" type="float" />
112 <param index="2" name="bottom" type="float" />
113 <param index="3" name="top" type="float" />
114 <param index="4" name="z_near" type="float" />
115 <param index="5" name="z_far" type="float" />
116 <description>
117 Creates a new [Projection] that projects positions using an orthogonal projection with the given clipping planes.
118 </description>
119 </method>
120 <method name="create_orthogonal_aspect" qualifiers="static">
121 <return type="Projection" />
122 <param index="0" name="size" type="float" />
123 <param index="1" name="aspect" type="float" />
124 <param index="2" name="z_near" type="float" />
125 <param index="3" name="z_far" type="float" />
126 <param index="4" name="flip_fov" type="bool" default="false" />
127 <description>
128 Creates a new [Projection] that projects positions using an orthogonal projection with the given size, X:Y aspect ratio, and clipping planes.
129 [param flip_fov] determines whether the projection's field of view is flipped over its diagonal.
130 </description>
131 </method>
132 <method name="create_perspective" qualifiers="static">
133 <return type="Projection" />
134 <param index="0" name="fovy" type="float" />
135 <param index="1" name="aspect" type="float" />
136 <param index="2" name="z_near" type="float" />
137 <param index="3" name="z_far" type="float" />
138 <param index="4" name="flip_fov" type="bool" default="false" />
139 <description>
140 Creates a new [Projection] that projects positions using a perspective projection with the given Y-axis field of view (in degrees), X:Y aspect ratio, and clipping planes.
141 [param flip_fov] determines whether the projection's field of view is flipped over its diagonal.
142 </description>
143 </method>
144 <method name="create_perspective_hmd" qualifiers="static">
145 <return type="Projection" />
146 <param index="0" name="fovy" type="float" />
147 <param index="1" name="aspect" type="float" />
148 <param index="2" name="z_near" type="float" />
149 <param index="3" name="z_far" type="float" />
150 <param index="4" name="flip_fov" type="bool" />
151 <param index="5" name="eye" type="int" />
152 <param index="6" name="intraocular_dist" type="float" />
153 <param index="7" name="convergence_dist" type="float" />
154 <description>
155 Creates a new [Projection] that projects positions using a perspective projection with the given Y-axis field of view (in degrees), X:Y aspect ratio, and clipping distances. The projection is adjusted for a head-mounted display with the given distance between eyes and distance to a point that can be focused on.
156 [param eye] creates the projection for the left eye when set to 1, or the right eye when set to 2.
157 [param flip_fov] determines whether the projection's field of view is flipped over its diagonal.
158 </description>
159 </method>
160 <method name="determinant" qualifiers="const">
161 <return type="float" />
162 <description>
163 Returns a scalar value that is the signed factor by which areas are scaled by this matrix. If the sign is negative, the matrix flips the orientation of the area.
164 The determinant can be used to calculate the invertibility of a matrix or solve linear systems of equations involving the matrix, among other applications.
165 </description>
166 </method>
167 <method name="flipped_y" qualifiers="const">
168 <return type="Projection" />
169 <description>
170 Returns a copy of this [Projection] with the signs of the values of the Y column flipped.
171 </description>
172 </method>
173 <method name="get_aspect" qualifiers="const">
174 <return type="float" />
175 <description>
176 Returns the X:Y aspect ratio of this [Projection]'s viewport.
177 </description>
178 </method>
179 <method name="get_far_plane_half_extents" qualifiers="const">
180 <return type="Vector2" />
181 <description>
182 Returns the dimensions of the far clipping plane of the projection, divided by two.
183 </description>
184 </method>
185 <method name="get_fov" qualifiers="const">
186 <return type="float" />
187 <description>
188 Returns the horizontal field of view of the projection (in degrees).
189 </description>
190 </method>
191 <method name="get_fovy" qualifiers="static">
192 <return type="float" />
193 <param index="0" name="fovx" type="float" />
194 <param index="1" name="aspect" type="float" />
195 <description>
196 Returns the vertical field of view of the projection (in degrees) associated with the given horizontal field of view (in degrees) and aspect ratio.
197 [b]Note:[/b] Unlike most methods of [Projection], [param aspect] is expected to be 1 divided by the X:Y aspect ratio.
198 </description>
199 </method>
200 <method name="get_lod_multiplier" qualifiers="const">
201 <return type="float" />
202 <description>
203 Returns the factor by which the visible level of detail is scaled by this [Projection].
204 </description>
205 </method>
206 <method name="get_pixels_per_meter" qualifiers="const">
207 <return type="int" />
208 <param index="0" name="for_pixel_width" type="int" />
209 <description>
210 Returns [param for_pixel_width] divided by the viewport's width measured in meters on the near plane, after this [Projection] is applied.
211 </description>
212 </method>
213 <method name="get_projection_plane" qualifiers="const">
214 <return type="Plane" />
215 <param index="0" name="plane" type="int" />
216 <description>
217 Returns the clipping plane of this [Projection] whose index is given by [param plane].
218 [param plane] should be equal to one of [constant PLANE_NEAR], [constant PLANE_FAR], [constant PLANE_LEFT], [constant PLANE_TOP], [constant PLANE_RIGHT], or [constant PLANE_BOTTOM].
219 </description>
220 </method>
221 <method name="get_viewport_half_extents" qualifiers="const">
222 <return type="Vector2" />
223 <description>
224 Returns the dimensions of the viewport plane that this [Projection] projects positions onto, divided by two.
225 </description>
226 </method>
227 <method name="get_z_far" qualifiers="const">
228 <return type="float" />
229 <description>
230 Returns the distance for this [Projection] beyond which positions are clipped.
231 </description>
232 </method>
233 <method name="get_z_near" qualifiers="const">
234 <return type="float" />
235 <description>
236 Returns the distance for this [Projection] before which positions are clipped.
237 </description>
238 </method>
239 <method name="inverse" qualifiers="const">
240 <return type="Projection" />
241 <description>
242 Returns a [Projection] that performs the inverse of this [Projection]'s projective transformation.
243 </description>
244 </method>
245 <method name="is_orthogonal" qualifiers="const">
246 <return type="bool" />
247 <description>
248 Returns [code]true[/code] if this [Projection] performs an orthogonal projection.
249 </description>
250 </method>
251 <method name="jitter_offseted" qualifiers="const">
252 <return type="Projection" />
253 <param index="0" name="offset" type="Vector2" />
254 <description>
255 Returns a [Projection] with the X and Y values from the given [Vector2] added to the first and second values of the final column respectively.
256 </description>
257 </method>
258 <method name="perspective_znear_adjusted" qualifiers="const">
259 <return type="Projection" />
260 <param index="0" name="new_znear" type="float" />
261 <description>
262 Returns a [Projection] with the near clipping distance adjusted to be [param new_znear].
263 [b]Note:[/b] The original [Projection] must be a perspective projection.
264 </description>
265 </method>
266 </methods>
267 <members>
268 <member name="w" type="Vector4" setter="" getter="" default="Vector4(0, 0, 0, 1)">
269 The projection matrix's W vector (column 3). Equivalent to array index [code]3[/code].
270 </member>
271 <member name="x" type="Vector4" setter="" getter="" default="Vector4(1, 0, 0, 0)">
272 The projection matrix's X vector (column 0). Equivalent to array index [code]0[/code].
273 </member>
274 <member name="y" type="Vector4" setter="" getter="" default="Vector4(0, 1, 0, 0)">
275 The projection matrix's Y vector (column 1). Equivalent to array index [code]1[/code].
276 </member>
277 <member name="z" type="Vector4" setter="" getter="" default="Vector4(0, 0, 1, 0)">
278 The projection matrix's Z vector (column 2). Equivalent to array index [code]2[/code].
279 </member>
280 </members>
281 <constants>
282 <constant name="PLANE_NEAR" value="0" enum="Planes">
283 The index value of the projection's near clipping plane.
284 </constant>
285 <constant name="PLANE_FAR" value="1" enum="Planes">
286 The index value of the projection's far clipping plane.
287 </constant>
288 <constant name="PLANE_LEFT" value="2" enum="Planes">
289 The index value of the projection's left clipping plane.
290 </constant>
291 <constant name="PLANE_TOP" value="3" enum="Planes">
292 The index value of the projection's top clipping plane.
293 </constant>
294 <constant name="PLANE_RIGHT" value="4" enum="Planes">
295 The index value of the projection's right clipping plane.
296 </constant>
297 <constant name="PLANE_BOTTOM" value="5" enum="Planes">
298 The index value of the projection bottom clipping plane.
299 </constant>
300 <constant name="IDENTITY" value="Projection(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)">
301 A [Projection] with no transformation defined. When applied to other data structures, no transformation is performed.
302 </constant>
303 <constant name="ZERO" value="Projection(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)">
304 A [Projection] with all values initialized to 0. When applied to other data structures, they will be zeroed.
305 </constant>
306 </constants>
307 <operators>
308 <operator name="operator !=">
309 <return type="bool" />
310 <param index="0" name="right" type="Projection" />
311 <description>
312 Returns [code]true[/code] if the projections are not equal.
313 [b]Note:[/b] Due to floating-point precision errors, this may return [code]true[/code], even if the projections are virtually equal. An [code]is_equal_approx[/code] method may be added in a future version of Godot.
314 </description>
315 </operator>
316 <operator name="operator *">
317 <return type="Projection" />
318 <param index="0" name="right" type="Projection" />
319 <description>
320 Returns a [Projection] that applies the combined transformations of this [Projection] and [param right].
321 </description>
322 </operator>
323 <operator name="operator *">
324 <return type="Vector4" />
325 <param index="0" name="right" type="Vector4" />
326 <description>
327 Projects (multiplies) the given [Vector4] by this [Projection] matrix.
328 </description>
329 </operator>
330 <operator name="operator ==">
331 <return type="bool" />
332 <param index="0" name="right" type="Projection" />
333 <description>
334 Returns [code]true[/code] if the projections are equal.
335 [b]Note:[/b] Due to floating-point precision errors, this may return [code]false[/code], even if the projections are virtually equal. An [code]is_equal_approx[/code] method may be added in a future version of Godot.
336 </description>
337 </operator>
338 <operator name="operator []">
339 <return type="Vector4" />
340 <param index="0" name="index" type="int" />
341 <description>
342 Returns the column of the [Projection] with the given index.
343 Indices are in the following order: x, y, z, w.
344 </description>
345 </operator>
346 </operators>
347 </class>