class_projection.rst 46 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/master/doc/classes/Projection.xml.
  6. .. _class_Projection:
  7. Projection
  8. ==========
  9. A 4×4 matrix for 3D projective transformations.
  10. .. rst-class:: classref-introduction-group
  11. Description
  12. -----------
  13. A 4x4 matrix used for 3D projective transformations. It can represent transformations such as translation, rotation, scaling, shearing, and perspective division. It consists of four :ref:`Vector4<class_Vector4>` columns.
  14. For purely linear transformations (translation, rotation, and scale), it is recommended to use :ref:`Transform3D<class_Transform3D>`, as it is more performant and requires less memory.
  15. Used internally as :ref:`Camera3D<class_Camera3D>`'s projection matrix.
  16. .. note::
  17. There are notable differences when using this API with C#. See :ref:`doc_c_sharp_differences` for more information.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +-------------------------------+---------------------------------------+-------------------------+
  24. | :ref:`Vector4<class_Vector4>` | :ref:`w<class_Projection_property_w>` | ``Vector4(0, 0, 0, 1)`` |
  25. +-------------------------------+---------------------------------------+-------------------------+
  26. | :ref:`Vector4<class_Vector4>` | :ref:`x<class_Projection_property_x>` | ``Vector4(1, 0, 0, 0)`` |
  27. +-------------------------------+---------------------------------------+-------------------------+
  28. | :ref:`Vector4<class_Vector4>` | :ref:`y<class_Projection_property_y>` | ``Vector4(0, 1, 0, 0)`` |
  29. +-------------------------------+---------------------------------------+-------------------------+
  30. | :ref:`Vector4<class_Vector4>` | :ref:`z<class_Projection_property_z>` | ``Vector4(0, 0, 1, 0)`` |
  31. +-------------------------------+---------------------------------------+-------------------------+
  32. .. rst-class:: classref-reftable-group
  33. Constructors
  34. ------------
  35. .. table::
  36. :widths: auto
  37. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>` **(** **)** |
  39. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>` **(** :ref:`Projection<class_Projection>` from **)** |
  41. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>` **(** :ref:`Transform3D<class_Transform3D>` from **)** |
  43. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>` **(** :ref:`Vector4<class_Vector4>` x_axis, :ref:`Vector4<class_Vector4>` y_axis, :ref:`Vector4<class_Vector4>` z_axis, :ref:`Vector4<class_Vector4>` w_axis **)** |
  45. +-------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. .. rst-class:: classref-reftable-group
  47. Methods
  48. -------
  49. .. table::
  50. :widths: auto
  51. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`Projection<class_Projection>` | :ref:`create_depth_correction<class_Projection_method_create_depth_correction>` **(** :ref:`bool<class_bool>` flip_y **)** |static| |
  53. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`Projection<class_Projection>` | :ref:`create_fit_aabb<class_Projection_method_create_fit_aabb>` **(** :ref:`AABB<class_AABB>` aabb **)** |static| |
  55. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`Projection<class_Projection>` | :ref:`create_for_hmd<class_Projection_method_create_for_hmd>` **(** :ref:`int<class_int>` eye, :ref:`float<class_float>` aspect, :ref:`float<class_float>` intraocular_dist, :ref:`float<class_float>` display_width, :ref:`float<class_float>` display_to_lens, :ref:`float<class_float>` oversample, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static| |
  57. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`Projection<class_Projection>` | :ref:`create_frustum<class_Projection_method_create_frustum>` **(** :ref:`float<class_float>` left, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom, :ref:`float<class_float>` top, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static| |
  59. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`Projection<class_Projection>` | :ref:`create_frustum_aspect<class_Projection_method_create_frustum_aspect>` **(** :ref:`float<class_float>` size, :ref:`float<class_float>` aspect, :ref:`Vector2<class_Vector2>` offset, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static| |
  61. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | :ref:`Projection<class_Projection>` | :ref:`create_light_atlas_rect<class_Projection_method_create_light_atlas_rect>` **(** :ref:`Rect2<class_Rect2>` rect **)** |static| |
  63. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | :ref:`Projection<class_Projection>` | :ref:`create_orthogonal<class_Projection_method_create_orthogonal>` **(** :ref:`float<class_float>` left, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom, :ref:`float<class_float>` top, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static| |
  65. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Projection<class_Projection>` | :ref:`create_orthogonal_aspect<class_Projection_method_create_orthogonal_aspect>` **(** :ref:`float<class_float>` size, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static| |
  67. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | :ref:`Projection<class_Projection>` | :ref:`create_perspective<class_Projection_method_create_perspective>` **(** :ref:`float<class_float>` fovy, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static| |
  69. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`Projection<class_Projection>` | :ref:`create_perspective_hmd<class_Projection_method_create_perspective_hmd>` **(** :ref:`float<class_float>` fovy, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov, :ref:`int<class_int>` eye, :ref:`float<class_float>` intraocular_dist, :ref:`float<class_float>` convergence_dist **)** |static| |
  71. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. | :ref:`float<class_float>` | :ref:`determinant<class_Projection_method_determinant>` **(** **)** |const| |
  73. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  74. | :ref:`Projection<class_Projection>` | :ref:`flipped_y<class_Projection_method_flipped_y>` **(** **)** |const| |
  75. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  76. | :ref:`float<class_float>` | :ref:`get_aspect<class_Projection_method_get_aspect>` **(** **)** |const| |
  77. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  78. | :ref:`Vector2<class_Vector2>` | :ref:`get_far_plane_half_extents<class_Projection_method_get_far_plane_half_extents>` **(** **)** |const| |
  79. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  80. | :ref:`float<class_float>` | :ref:`get_fov<class_Projection_method_get_fov>` **(** **)** |const| |
  81. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  82. | :ref:`float<class_float>` | :ref:`get_fovy<class_Projection_method_get_fovy>` **(** :ref:`float<class_float>` fovx, :ref:`float<class_float>` aspect **)** |static| |
  83. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  84. | :ref:`float<class_float>` | :ref:`get_lod_multiplier<class_Projection_method_get_lod_multiplier>` **(** **)** |const| |
  85. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  86. | :ref:`int<class_int>` | :ref:`get_pixels_per_meter<class_Projection_method_get_pixels_per_meter>` **(** :ref:`int<class_int>` for_pixel_width **)** |const| |
  87. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  88. | :ref:`Plane<class_Plane>` | :ref:`get_projection_plane<class_Projection_method_get_projection_plane>` **(** :ref:`int<class_int>` plane **)** |const| |
  89. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  90. | :ref:`Vector2<class_Vector2>` | :ref:`get_viewport_half_extents<class_Projection_method_get_viewport_half_extents>` **(** **)** |const| |
  91. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  92. | :ref:`float<class_float>` | :ref:`get_z_far<class_Projection_method_get_z_far>` **(** **)** |const| |
  93. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  94. | :ref:`float<class_float>` | :ref:`get_z_near<class_Projection_method_get_z_near>` **(** **)** |const| |
  95. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  96. | :ref:`Projection<class_Projection>` | :ref:`inverse<class_Projection_method_inverse>` **(** **)** |const| |
  97. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  98. | :ref:`bool<class_bool>` | :ref:`is_orthogonal<class_Projection_method_is_orthogonal>` **(** **)** |const| |
  99. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  100. | :ref:`Projection<class_Projection>` | :ref:`jitter_offseted<class_Projection_method_jitter_offseted>` **(** :ref:`Vector2<class_Vector2>` offset **)** |const| |
  101. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  102. | :ref:`Projection<class_Projection>` | :ref:`perspective_znear_adjusted<class_Projection_method_perspective_znear_adjusted>` **(** :ref:`float<class_float>` new_znear **)** |const| |
  103. +-------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  104. .. rst-class:: classref-reftable-group
  105. Operators
  106. ---------
  107. .. table::
  108. :widths: auto
  109. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  110. | :ref:`bool<class_bool>` | :ref:`operator !=<class_Projection_operator_neq_Projection>` **(** :ref:`Projection<class_Projection>` right **)** |
  111. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  112. | :ref:`Projection<class_Projection>` | :ref:`operator *<class_Projection_operator_mul_Projection>` **(** :ref:`Projection<class_Projection>` right **)** |
  113. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  114. | :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Projection_operator_mul_Vector4>` **(** :ref:`Vector4<class_Vector4>` right **)** |
  115. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`bool<class_bool>` | :ref:`operator ==<class_Projection_operator_eq_Projection>` **(** :ref:`Projection<class_Projection>` right **)** |
  117. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`Vector4<class_Vector4>` | :ref:`operator []<class_Projection_operator_idx_int>` **(** :ref:`int<class_int>` index **)** |
  119. +-------------------------------------+--------------------------------------------------------------------------------------------------------------------+
  120. .. rst-class:: classref-section-separator
  121. ----
  122. .. rst-class:: classref-descriptions-group
  123. Constants
  124. ---------
  125. .. _class_Projection_constant_PLANE_NEAR:
  126. .. rst-class:: classref-constant
  127. **PLANE_NEAR** = ``0``
  128. The index value of the projection's near clipping plane.
  129. .. _class_Projection_constant_PLANE_FAR:
  130. .. rst-class:: classref-constant
  131. **PLANE_FAR** = ``1``
  132. The index value of the projection's far clipping plane.
  133. .. _class_Projection_constant_PLANE_LEFT:
  134. .. rst-class:: classref-constant
  135. **PLANE_LEFT** = ``2``
  136. The index value of the projection's left clipping plane.
  137. .. _class_Projection_constant_PLANE_TOP:
  138. .. rst-class:: classref-constant
  139. **PLANE_TOP** = ``3``
  140. The index value of the projection's top clipping plane.
  141. .. _class_Projection_constant_PLANE_RIGHT:
  142. .. rst-class:: classref-constant
  143. **PLANE_RIGHT** = ``4``
  144. The index value of the projection's right clipping plane.
  145. .. _class_Projection_constant_PLANE_BOTTOM:
  146. .. rst-class:: classref-constant
  147. **PLANE_BOTTOM** = ``5``
  148. The index value of the projection bottom clipping plane.
  149. .. _class_Projection_constant_IDENTITY:
  150. .. rst-class:: classref-constant
  151. **IDENTITY** = ``Projection(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)``
  152. A **Projection** with no transformation defined. When applied to other data structures, no transformation is performed.
  153. .. _class_Projection_constant_ZERO:
  154. .. rst-class:: classref-constant
  155. **ZERO** = ``Projection(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)``
  156. A **Projection** with all values initialized to 0. When applied to other data structures, they will be zeroed.
  157. .. rst-class:: classref-section-separator
  158. ----
  159. .. rst-class:: classref-descriptions-group
  160. Property Descriptions
  161. ---------------------
  162. .. _class_Projection_property_w:
  163. .. rst-class:: classref-property
  164. :ref:`Vector4<class_Vector4>` **w** = ``Vector4(0, 0, 0, 1)``
  165. The projection matrix's W vector (column 3). Equivalent to array index ``3``.
  166. .. rst-class:: classref-item-separator
  167. ----
  168. .. _class_Projection_property_x:
  169. .. rst-class:: classref-property
  170. :ref:`Vector4<class_Vector4>` **x** = ``Vector4(1, 0, 0, 0)``
  171. The projection matrix's X vector (column 0). Equivalent to array index ``0``.
  172. .. rst-class:: classref-item-separator
  173. ----
  174. .. _class_Projection_property_y:
  175. .. rst-class:: classref-property
  176. :ref:`Vector4<class_Vector4>` **y** = ``Vector4(0, 1, 0, 0)``
  177. The projection matrix's Y vector (column 1). Equivalent to array index ``1``.
  178. .. rst-class:: classref-item-separator
  179. ----
  180. .. _class_Projection_property_z:
  181. .. rst-class:: classref-property
  182. :ref:`Vector4<class_Vector4>` **z** = ``Vector4(0, 0, 1, 0)``
  183. The projection matrix's Z vector (column 2). Equivalent to array index ``2``.
  184. .. rst-class:: classref-section-separator
  185. ----
  186. .. rst-class:: classref-descriptions-group
  187. Constructor Descriptions
  188. ------------------------
  189. .. _class_Projection_constructor_Projection:
  190. .. rst-class:: classref-constructor
  191. :ref:`Projection<class_Projection>` **Projection** **(** **)**
  192. Constructs a default-initialized **Projection** set to :ref:`IDENTITY<class_Projection_constant_IDENTITY>`.
  193. .. rst-class:: classref-item-separator
  194. ----
  195. .. rst-class:: classref-constructor
  196. :ref:`Projection<class_Projection>` **Projection** **(** :ref:`Projection<class_Projection>` from **)**
  197. Constructs a **Projection** as a copy of the given **Projection**.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. rst-class:: classref-constructor
  201. :ref:`Projection<class_Projection>` **Projection** **(** :ref:`Transform3D<class_Transform3D>` from **)**
  202. Constructs a Projection as a copy of the given :ref:`Transform3D<class_Transform3D>`.
  203. .. rst-class:: classref-item-separator
  204. ----
  205. .. rst-class:: classref-constructor
  206. :ref:`Projection<class_Projection>` **Projection** **(** :ref:`Vector4<class_Vector4>` x_axis, :ref:`Vector4<class_Vector4>` y_axis, :ref:`Vector4<class_Vector4>` z_axis, :ref:`Vector4<class_Vector4>` w_axis **)**
  207. Constructs a Projection from four :ref:`Vector4<class_Vector4>` values (matrix columns).
  208. .. rst-class:: classref-section-separator
  209. ----
  210. .. rst-class:: classref-descriptions-group
  211. Method Descriptions
  212. -------------------
  213. .. _class_Projection_method_create_depth_correction:
  214. .. rst-class:: classref-method
  215. :ref:`Projection<class_Projection>` **create_depth_correction** **(** :ref:`bool<class_bool>` flip_y **)** |static|
  216. Creates a new **Projection** that projects positions from a depth range of ``-1`` to ``1`` to one that ranges from ``0`` to ``1``, and flips the projected positions vertically, according to ``flip_y``.
  217. .. rst-class:: classref-item-separator
  218. ----
  219. .. _class_Projection_method_create_fit_aabb:
  220. .. rst-class:: classref-method
  221. :ref:`Projection<class_Projection>` **create_fit_aabb** **(** :ref:`AABB<class_AABB>` aabb **)** |static|
  222. Creates a new **Projection** that scales a given projection to fit around a given :ref:`AABB<class_AABB>` in projection space.
  223. .. rst-class:: classref-item-separator
  224. ----
  225. .. _class_Projection_method_create_for_hmd:
  226. .. rst-class:: classref-method
  227. :ref:`Projection<class_Projection>` **create_for_hmd** **(** :ref:`int<class_int>` eye, :ref:`float<class_float>` aspect, :ref:`float<class_float>` intraocular_dist, :ref:`float<class_float>` display_width, :ref:`float<class_float>` display_to_lens, :ref:`float<class_float>` oversample, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static|
  228. 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.
  229. \ ``eye`` creates the projection for the left eye when set to 1, or the right eye when set to 2.
  230. .. rst-class:: classref-item-separator
  231. ----
  232. .. _class_Projection_method_create_frustum:
  233. .. rst-class:: classref-method
  234. :ref:`Projection<class_Projection>` **create_frustum** **(** :ref:`float<class_float>` left, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom, :ref:`float<class_float>` top, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static|
  235. Creates a new **Projection** that projects positions in a frustum with the given clipping planes.
  236. .. rst-class:: classref-item-separator
  237. ----
  238. .. _class_Projection_method_create_frustum_aspect:
  239. .. rst-class:: classref-method
  240. :ref:`Projection<class_Projection>` **create_frustum_aspect** **(** :ref:`float<class_float>` size, :ref:`float<class_float>` aspect, :ref:`Vector2<class_Vector2>` offset, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static|
  241. Creates a new **Projection** that projects positions in a frustum with the given size, X:Y aspect ratio, offset, and clipping planes.
  242. \ ``flip_fov`` determines whether the projection's field of view is flipped over its diagonal.
  243. .. rst-class:: classref-item-separator
  244. ----
  245. .. _class_Projection_method_create_light_atlas_rect:
  246. .. rst-class:: classref-method
  247. :ref:`Projection<class_Projection>` **create_light_atlas_rect** **(** :ref:`Rect2<class_Rect2>` rect **)** |static|
  248. Creates a new **Projection** that projects positions into the given :ref:`Rect2<class_Rect2>`.
  249. .. rst-class:: classref-item-separator
  250. ----
  251. .. _class_Projection_method_create_orthogonal:
  252. .. rst-class:: classref-method
  253. :ref:`Projection<class_Projection>` **create_orthogonal** **(** :ref:`float<class_float>` left, :ref:`float<class_float>` right, :ref:`float<class_float>` bottom, :ref:`float<class_float>` top, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far **)** |static|
  254. Creates a new **Projection** that projects positions using an orthogonal projection with the given clipping planes.
  255. .. rst-class:: classref-item-separator
  256. ----
  257. .. _class_Projection_method_create_orthogonal_aspect:
  258. .. rst-class:: classref-method
  259. :ref:`Projection<class_Projection>` **create_orthogonal_aspect** **(** :ref:`float<class_float>` size, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static|
  260. Creates a new **Projection** that projects positions using an orthogonal projection with the given size, X:Y aspect ratio, and clipping planes.
  261. \ ``flip_fov`` determines whether the projection's field of view is flipped over its diagonal.
  262. .. rst-class:: classref-item-separator
  263. ----
  264. .. _class_Projection_method_create_perspective:
  265. .. rst-class:: classref-method
  266. :ref:`Projection<class_Projection>` **create_perspective** **(** :ref:`float<class_float>` fovy, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov=false **)** |static|
  267. 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.
  268. \ ``flip_fov`` determines whether the projection's field of view is flipped over its diagonal.
  269. .. rst-class:: classref-item-separator
  270. ----
  271. .. _class_Projection_method_create_perspective_hmd:
  272. .. rst-class:: classref-method
  273. :ref:`Projection<class_Projection>` **create_perspective_hmd** **(** :ref:`float<class_float>` fovy, :ref:`float<class_float>` aspect, :ref:`float<class_float>` z_near, :ref:`float<class_float>` z_far, :ref:`bool<class_bool>` flip_fov, :ref:`int<class_int>` eye, :ref:`float<class_float>` intraocular_dist, :ref:`float<class_float>` convergence_dist **)** |static|
  274. 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.
  275. \ ``eye`` creates the projection for the left eye when set to 1, or the right eye when set to 2.
  276. \ ``flip_fov`` determines whether the projection's field of view is flipped over its diagonal.
  277. .. rst-class:: classref-item-separator
  278. ----
  279. .. _class_Projection_method_determinant:
  280. .. rst-class:: classref-method
  281. :ref:`float<class_float>` **determinant** **(** **)** |const|
  282. 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.
  283. The determinant can be used to calculate the invertibility of a matrix or solve linear systems of equations involving the matrix, among other applications.
  284. .. rst-class:: classref-item-separator
  285. ----
  286. .. _class_Projection_method_flipped_y:
  287. .. rst-class:: classref-method
  288. :ref:`Projection<class_Projection>` **flipped_y** **(** **)** |const|
  289. Returns a copy of this **Projection** with the signs of the values of the Y column flipped.
  290. .. rst-class:: classref-item-separator
  291. ----
  292. .. _class_Projection_method_get_aspect:
  293. .. rst-class:: classref-method
  294. :ref:`float<class_float>` **get_aspect** **(** **)** |const|
  295. Returns the X:Y aspect ratio of this **Projection**'s viewport.
  296. .. rst-class:: classref-item-separator
  297. ----
  298. .. _class_Projection_method_get_far_plane_half_extents:
  299. .. rst-class:: classref-method
  300. :ref:`Vector2<class_Vector2>` **get_far_plane_half_extents** **(** **)** |const|
  301. Returns the dimensions of the far clipping plane of the projection, divided by two.
  302. .. rst-class:: classref-item-separator
  303. ----
  304. .. _class_Projection_method_get_fov:
  305. .. rst-class:: classref-method
  306. :ref:`float<class_float>` **get_fov** **(** **)** |const|
  307. Returns the horizontal field of view of the projection (in degrees).
  308. .. rst-class:: classref-item-separator
  309. ----
  310. .. _class_Projection_method_get_fovy:
  311. .. rst-class:: classref-method
  312. :ref:`float<class_float>` **get_fovy** **(** :ref:`float<class_float>` fovx, :ref:`float<class_float>` aspect **)** |static|
  313. Returns the vertical field of view of the projection (in degrees) associated with the given horizontal field of view (in degrees) and aspect ratio.
  314. .. rst-class:: classref-item-separator
  315. ----
  316. .. _class_Projection_method_get_lod_multiplier:
  317. .. rst-class:: classref-method
  318. :ref:`float<class_float>` **get_lod_multiplier** **(** **)** |const|
  319. Returns the factor by which the visible level of detail is scaled by this **Projection**.
  320. .. rst-class:: classref-item-separator
  321. ----
  322. .. _class_Projection_method_get_pixels_per_meter:
  323. .. rst-class:: classref-method
  324. :ref:`int<class_int>` **get_pixels_per_meter** **(** :ref:`int<class_int>` for_pixel_width **)** |const|
  325. Returns the number of pixels with the given pixel width displayed per meter, after this **Projection** is applied.
  326. .. rst-class:: classref-item-separator
  327. ----
  328. .. _class_Projection_method_get_projection_plane:
  329. .. rst-class:: classref-method
  330. :ref:`Plane<class_Plane>` **get_projection_plane** **(** :ref:`int<class_int>` plane **)** |const|
  331. Returns the clipping plane of this **Projection** whose index is given by ``plane``.
  332. \ ``plane`` should be equal to one of :ref:`PLANE_NEAR<class_Projection_constant_PLANE_NEAR>`, :ref:`PLANE_FAR<class_Projection_constant_PLANE_FAR>`, :ref:`PLANE_LEFT<class_Projection_constant_PLANE_LEFT>`, :ref:`PLANE_TOP<class_Projection_constant_PLANE_TOP>`, :ref:`PLANE_RIGHT<class_Projection_constant_PLANE_RIGHT>`, or :ref:`PLANE_BOTTOM<class_Projection_constant_PLANE_BOTTOM>`.
  333. .. rst-class:: classref-item-separator
  334. ----
  335. .. _class_Projection_method_get_viewport_half_extents:
  336. .. rst-class:: classref-method
  337. :ref:`Vector2<class_Vector2>` **get_viewport_half_extents** **(** **)** |const|
  338. Returns the dimensions of the viewport plane that this **Projection** projects positions onto, divided by two.
  339. .. rst-class:: classref-item-separator
  340. ----
  341. .. _class_Projection_method_get_z_far:
  342. .. rst-class:: classref-method
  343. :ref:`float<class_float>` **get_z_far** **(** **)** |const|
  344. Returns the distance for this **Projection** beyond which positions are clipped.
  345. .. rst-class:: classref-item-separator
  346. ----
  347. .. _class_Projection_method_get_z_near:
  348. .. rst-class:: classref-method
  349. :ref:`float<class_float>` **get_z_near** **(** **)** |const|
  350. Returns the distance for this **Projection** before which positions are clipped.
  351. .. rst-class:: classref-item-separator
  352. ----
  353. .. _class_Projection_method_inverse:
  354. .. rst-class:: classref-method
  355. :ref:`Projection<class_Projection>` **inverse** **(** **)** |const|
  356. Returns a **Projection** that performs the inverse of this **Projection**'s projective transformation.
  357. .. rst-class:: classref-item-separator
  358. ----
  359. .. _class_Projection_method_is_orthogonal:
  360. .. rst-class:: classref-method
  361. :ref:`bool<class_bool>` **is_orthogonal** **(** **)** |const|
  362. Returns ``true`` if this **Projection** performs an orthogonal projection.
  363. .. rst-class:: classref-item-separator
  364. ----
  365. .. _class_Projection_method_jitter_offseted:
  366. .. rst-class:: classref-method
  367. :ref:`Projection<class_Projection>` **jitter_offseted** **(** :ref:`Vector2<class_Vector2>` offset **)** |const|
  368. Returns a **Projection** with the X and Y values from the given :ref:`Vector2<class_Vector2>` added to the first and second values of the final column respectively.
  369. .. rst-class:: classref-item-separator
  370. ----
  371. .. _class_Projection_method_perspective_znear_adjusted:
  372. .. rst-class:: classref-method
  373. :ref:`Projection<class_Projection>` **perspective_znear_adjusted** **(** :ref:`float<class_float>` new_znear **)** |const|
  374. Returns a **Projection** with the near clipping distance adjusted to be ``new_znear``.
  375. \ **Note:** The original **Projection** must be a perspective projection.
  376. .. rst-class:: classref-section-separator
  377. ----
  378. .. rst-class:: classref-descriptions-group
  379. Operator Descriptions
  380. ---------------------
  381. .. _class_Projection_operator_neq_Projection:
  382. .. rst-class:: classref-operator
  383. :ref:`bool<class_bool>` **operator !=** **(** :ref:`Projection<class_Projection>` right **)**
  384. Returns ``true`` if the projections are not equal.
  385. \ **Note:** Due to floating-point precision errors, this may return ``true``, even if the projections are virtually equal. An ``is_equal_approx`` method may be added in a future version of Godot.
  386. .. rst-class:: classref-item-separator
  387. ----
  388. .. _class_Projection_operator_mul_Projection:
  389. .. rst-class:: classref-operator
  390. :ref:`Projection<class_Projection>` **operator *** **(** :ref:`Projection<class_Projection>` right **)**
  391. Returns a **Projection** that applies the combined transformations of this **Projection** and ``right``.
  392. .. rst-class:: classref-item-separator
  393. ----
  394. .. _class_Projection_operator_mul_Vector4:
  395. .. rst-class:: classref-operator
  396. :ref:`Vector4<class_Vector4>` **operator *** **(** :ref:`Vector4<class_Vector4>` right **)**
  397. Projects (multiplies) the given :ref:`Vector4<class_Vector4>` by this **Projection** matrix.
  398. .. rst-class:: classref-item-separator
  399. ----
  400. .. _class_Projection_operator_eq_Projection:
  401. .. rst-class:: classref-operator
  402. :ref:`bool<class_bool>` **operator ==** **(** :ref:`Projection<class_Projection>` right **)**
  403. Returns ``true`` if the projections are equal.
  404. \ **Note:** Due to floating-point precision errors, this may return ``false``, even if the projections are virtually equal. An ``is_equal_approx`` method may be added in a future version of Godot.
  405. .. rst-class:: classref-item-separator
  406. ----
  407. .. _class_Projection_operator_idx_int:
  408. .. rst-class:: classref-operator
  409. :ref:`Vector4<class_Vector4>` **operator []** **(** :ref:`int<class_int>` index **)**
  410. Returns the column of the **Projection** with the given index.
  411. Indices are in the following order: x, y, z, w.
  412. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  413. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  414. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  415. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  416. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  417. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  418. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`