Files
godot-docs-l10n/classes/zh_Hans/class_projection.rst

750 lines
48 KiB
ReStructuredText
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

:github_url: hide
.. _class_Projection:
Projection
==========
用于 3D 投影变换的 4×4 矩阵。
.. rst-class:: classref-introduction-group
描述
----
用于 3D 投影变换的 4×4 矩阵,可以表示平移、旋转、缩放、倾斜和透视分割等变换,由四个 :ref:`Vector4<class_Vector4>` 列组成。
对于纯粹的线性变换(平移、旋转和缩放),建议使用 :ref:`Transform3D<class_Transform3D>`\ ,因为它的性能更强,内存占用更少。
在内部作为 :ref:`Camera3D<class_Camera3D>` 的投影矩阵使用。
.. note::
通过 C# 使用该 API 时会有显著不同,详见 :ref:`doc_c_sharp_differences`\ 。
.. rst-class:: classref-reftable-group
属性
----
.. table::
:widths: auto
+-------------------------------+---------------------------------------+-------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`w<class_Projection_property_w>` | ``Vector4(0, 0, 0, 1)`` |
+-------------------------------+---------------------------------------+-------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`x<class_Projection_property_x>` | ``Vector4(1, 0, 0, 0)`` |
+-------------------------------+---------------------------------------+-------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`y<class_Projection_property_y>` | ``Vector4(0, 1, 0, 0)`` |
+-------------------------------+---------------------------------------+-------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`z<class_Projection_property_z>` | ``Vector4(0, 0, 1, 0)`` |
+-------------------------------+---------------------------------------+-------------------------+
.. rst-class:: classref-reftable-group
构造函数
--------
.. table::
:widths: auto
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>`\ (\ ) |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>`\ (\ from\: :ref:`Projection<class_Projection>`\ ) |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>`\ (\ from\: :ref:`Transform3D<class_Transform3D>`\ ) |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`Projection<class_Projection_constructor_Projection>`\ (\ x_axis\: :ref:`Vector4<class_Vector4>`, y_axis\: :ref:`Vector4<class_Vector4>`, z_axis\: :ref:`Vector4<class_Vector4>`, w_axis\: :ref:`Vector4<class_Vector4>`\ ) |
+-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
方法
----
.. table::
:widths: auto
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_depth_correction<class_Projection_method_create_depth_correction>`\ (\ flip_y\: :ref:`bool<class_bool>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_fit_aabb<class_Projection_method_create_fit_aabb>`\ (\ aabb\: :ref:`AABB<class_AABB>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_for_hmd<class_Projection_method_create_for_hmd>`\ (\ eye\: :ref:`int<class_int>`, 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\: :ref:`float<class_float>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_frustum<class_Projection_method_create_frustum>`\ (\ 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\: :ref:`float<class_float>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_frustum_aspect<class_Projection_method_create_frustum_aspect>`\ (\ size\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, offset\: :ref:`Vector2<class_Vector2>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_light_atlas_rect<class_Projection_method_create_light_atlas_rect>`\ (\ rect\: :ref:`Rect2<class_Rect2>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_orthogonal<class_Projection_method_create_orthogonal>`\ (\ 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\: :ref:`float<class_float>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_orthogonal_aspect<class_Projection_method_create_orthogonal_aspect>`\ (\ size\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_perspective<class_Projection_method_create_perspective>`\ (\ fovy\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`create_perspective_hmd<class_Projection_method_create_perspective_hmd>`\ (\ fovy\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>`, eye\: :ref:`int<class_int>`, intraocular_dist\: :ref:`float<class_float>`, convergence_dist\: :ref:`float<class_float>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`determinant<class_Projection_method_determinant>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`flipped_y<class_Projection_method_flipped_y>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_aspect<class_Projection_method_get_aspect>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_far_plane_half_extents<class_Projection_method_get_far_plane_half_extents>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_fov<class_Projection_method_get_fov>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_fovy<class_Projection_method_get_fovy>`\ (\ fovx\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`\ ) |static| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_lod_multiplier<class_Projection_method_get_lod_multiplier>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_pixels_per_meter<class_Projection_method_get_pixels_per_meter>`\ (\ for_pixel_width\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Plane<class_Plane>` | :ref:`get_projection_plane<class_Projection_method_get_projection_plane>`\ (\ plane\: :ref:`int<class_int>`\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Vector2<class_Vector2>` | :ref:`get_viewport_half_extents<class_Projection_method_get_viewport_half_extents>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_z_far<class_Projection_method_get_z_far>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`float<class_float>` | :ref:`get_z_near<class_Projection_method_get_z_near>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`inverse<class_Projection_method_inverse>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_orthogonal<class_Projection_method_is_orthogonal>`\ (\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`jitter_offseted<class_Projection_method_jitter_offseted>`\ (\ offset\: :ref:`Vector2<class_Vector2>`\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`perspective_znear_adjusted<class_Projection_method_perspective_znear_adjusted>`\ (\ new_znear\: :ref:`float<class_float>`\ ) |const| |
+-------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
运算符
------
.. table::
:widths: auto
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator !=<class_Projection_operator_neq_Projection>`\ (\ right\: :ref:`Projection<class_Projection>`\ ) |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| :ref:`Projection<class_Projection>` | :ref:`operator *<class_Projection_operator_mul_Projection>`\ (\ right\: :ref:`Projection<class_Projection>`\ ) |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`operator *<class_Projection_operator_mul_Vector4>`\ (\ right\: :ref:`Vector4<class_Vector4>`\ ) |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`operator ==<class_Projection_operator_eq_Projection>`\ (\ right\: :ref:`Projection<class_Projection>`\ ) |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
| :ref:`Vector4<class_Vector4>` | :ref:`operator []<class_Projection_operator_idx_int>`\ (\ index\: :ref:`int<class_int>`\ ) |
+-------------------------------------+-----------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
枚举
----
.. _enum_Projection_Planes:
.. rst-class:: classref-enumeration
enum **Planes**: :ref:`🔗<enum_Projection_Planes>`
.. _class_Projection_constant_PLANE_NEAR:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_NEAR** = ``0``
该投影的近裁剪平面的索引值。
.. _class_Projection_constant_PLANE_FAR:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_FAR** = ``1``
该投影的远裁剪平面的索引值。
.. _class_Projection_constant_PLANE_LEFT:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_LEFT** = ``2``
该投影的左裁剪平面的索引值。
.. _class_Projection_constant_PLANE_TOP:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_TOP** = ``3``
该投影的上裁剪平面的索引值。
.. _class_Projection_constant_PLANE_RIGHT:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_RIGHT** = ``4``
该投影的右裁剪平面的索引值。
.. _class_Projection_constant_PLANE_BOTTOM:
.. rst-class:: classref-enumeration-constant
:ref:`Planes<enum_Projection_Planes>` **PLANE_BOTTOM** = ``5``
该投影的下裁剪平面的索引值。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
常量
----
.. _class_Projection_constant_IDENTITY:
.. rst-class:: classref-constant
**IDENTITY** = ``Projection(1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1)`` :ref:`🔗<class_Projection_constant_IDENTITY>`
未定义变换的 **Projection**\ 。对其他数据结构使用时,不会进行任何变换。
.. _class_Projection_constant_ZERO:
.. rst-class:: classref-constant
**ZERO** = ``Projection(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0)`` :ref:`🔗<class_Projection_constant_ZERO>`
所有值都初始化为 0 的 **Projection**\ 。对其他数据结构使用时,会进行清零操作。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
属性说明
--------
.. _class_Projection_property_w:
.. rst-class:: classref-property
:ref:`Vector4<class_Vector4>` **w** = ``Vector4(0, 0, 0, 1)`` :ref:`🔗<class_Projection_property_w>`
投影矩阵的 W 向量(第 3 列)。相当于数组索引 ``3``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_property_x:
.. rst-class:: classref-property
:ref:`Vector4<class_Vector4>` **x** = ``Vector4(1, 0, 0, 0)`` :ref:`🔗<class_Projection_property_x>`
投影矩阵的 X 向量(第 0 列)。相当于数组索引 ``0``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_property_y:
.. rst-class:: classref-property
:ref:`Vector4<class_Vector4>` **y** = ``Vector4(0, 1, 0, 0)`` :ref:`🔗<class_Projection_property_y>`
投影矩阵的 Y 向量(第 1 列)。相当于数组索引 ``1``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_property_z:
.. rst-class:: classref-property
:ref:`Vector4<class_Vector4>` **z** = ``Vector4(0, 0, 1, 0)`` :ref:`🔗<class_Projection_property_z>`
投影矩阵的 Z 向量(第 2 列)。相当于数组索引 ``2``\ 。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
构造函数说明
------------
.. _class_Projection_constructor_Projection:
.. rst-class:: classref-constructor
:ref:`Projection<class_Projection>` **Projection**\ (\ ) :ref:`🔗<class_Projection_constructor_Projection>`
构造默认初始化的 **Projection**\ ,与 :ref:`IDENTITY<class_Projection_constant_IDENTITY>` 相同。
\ **注意:**\ 在 C# 中构造的 **Projection** 与 :ref:`ZERO<class_Projection_constant_ZERO>` 相同。
.. rst-class:: classref-item-separator
----
.. rst-class:: classref-constructor
:ref:`Projection<class_Projection>` **Projection**\ (\ from\: :ref:`Projection<class_Projection>`\ )
构造给定 **Projection** 的副本。
.. rst-class:: classref-item-separator
----
.. rst-class:: classref-constructor
:ref:`Projection<class_Projection>` **Projection**\ (\ from\: :ref:`Transform3D<class_Transform3D>`\ )
将 Projection 作为给定 :ref:`Transform3D<class_Transform3D>` 的副本进行构造。
.. rst-class:: classref-item-separator
----
.. rst-class:: classref-constructor
:ref:`Projection<class_Projection>` **Projection**\ (\ x_axis\: :ref:`Vector4<class_Vector4>`, y_axis\: :ref:`Vector4<class_Vector4>`, z_axis\: :ref:`Vector4<class_Vector4>`, w_axis\: :ref:`Vector4<class_Vector4>`\ )
从四个 :ref:`Vector4<class_Vector4>` 值(矩阵列)构造 Projection。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
方法说明
--------
.. _class_Projection_method_create_depth_correction:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_depth_correction**\ (\ flip_y\: :ref:`bool<class_bool>`\ ) |static| :ref:`🔗<class_Projection_method_create_depth_correction>`
创建新的 **Projection**\ ,将位置从深度 ``-1````1`` 的范围投影到 ``0````1`` 的范围,并将投影后的位置根据 ``flip_y`` 垂直翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_fit_aabb:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_fit_aabb**\ (\ aabb\: :ref:`AABB<class_AABB>`\ ) |static| :ref:`🔗<class_Projection_method_create_fit_aabb>`
创建新的 **Projection**\ ,将给定的投影进行缩放,从而适应投影空间中的给定 :ref:`AABB<class_AABB>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_for_hmd:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_for_hmd**\ (\ eye\: :ref:`int<class_int>`, 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\: :ref:`float<class_float>`\ ) |static| :ref:`🔗<class_Projection_method_create_for_hmd>`
创建新的 **Projection**\ ,将位置投影至头戴显示器中,使用给定的 X:Y 纵横比、双眼间距、显示器宽度、到镜头的距离、过采样系数以及深度裁剪平面。
\ ``eye`` 设为 1 时创建的是左眼投影,设为 2 时则为右眼。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_frustum:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_frustum**\ (\ 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\: :ref:`float<class_float>`\ ) |static| :ref:`🔗<class_Projection_method_create_frustum>`
创建新的 **Projection**\ ,将位置投影至平截头台中,平截头台由给定的裁剪平面指定。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_frustum_aspect:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_frustum_aspect**\ (\ size\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, offset\: :ref:`Vector2<class_Vector2>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| :ref:`🔗<class_Projection_method_create_frustum_aspect>`
创建新的 **Projection**\ 将位置投影至平截头台中平截头台由给定的大小、X:Y 纵横比、偏移量以及裁剪平面指定。
\ ``flip_fov`` 决定投影视野是否按对角线翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_light_atlas_rect:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_light_atlas_rect**\ (\ rect\: :ref:`Rect2<class_Rect2>`\ ) |static| :ref:`🔗<class_Projection_method_create_light_atlas_rect>`
创建新的 **Projection**\ ,将位置投影至给定的 :ref:`Rect2<class_Rect2>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_orthogonal:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_orthogonal**\ (\ 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\: :ref:`float<class_float>`\ ) |static| :ref:`🔗<class_Projection_method_create_orthogonal>`
创建新的 **Projection**\ ,使用给定裁剪平面的正交投影对位置进行投影。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_orthogonal_aspect:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_orthogonal_aspect**\ (\ size\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| :ref:`🔗<class_Projection_method_create_orthogonal_aspect>`
创建新的 **Projection**\ 使用正交投影对位置进行投影正交投影由给定的大小、X:Y 纵横比以及裁剪平面指定。
\ ``flip_fov`` 决定投影视野是否按对角线翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_perspective:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_perspective**\ (\ fovy\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>` = false\ ) |static| :ref:`🔗<class_Projection_method_create_perspective>`
创建新的 **Projection**\ ,使用透视投影对位置进行投影,透视投影由给定的 Y 轴视野单位为度、X:Y 纵横比以及裁剪平面指定。
\ ``flip_fov`` 决定投影视野是否按对角线翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_create_perspective_hmd:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **create_perspective_hmd**\ (\ fovy\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`, z_near\: :ref:`float<class_float>`, z_far\: :ref:`float<class_float>`, flip_fov\: :ref:`bool<class_bool>`, eye\: :ref:`int<class_int>`, intraocular_dist\: :ref:`float<class_float>`, convergence_dist\: :ref:`float<class_float>`\ ) |static| :ref:`🔗<class_Projection_method_create_perspective_hmd>`
创建新的 **Projection**\ ,使用透视投影对位置进行投影,透视投影由给定的 Y 轴视野单位为度、X:Y 纵横比以及裁剪平面指定。投影会针对头戴显示器进行调整,使用给定的双眼间距以及与能够聚焦的点的距离。
\ ``eye`` 设为 1 时创建的是左眼投影,设为 2 时则为右眼。
\ ``flip_fov`` 决定投影视野是否按对角线翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_determinant:
.. rst-class:: classref-method
:ref:`float<class_float>` **determinant**\ (\ ) |const| :ref:`🔗<class_Projection_method_determinant>`
返回一个标量值,该标量值是区域被该矩阵缩放的有符号系数。如果符号是负的,则矩阵翻转该区域的方向。
行列式可用于计算矩阵的可逆性或求解涉及矩阵的线性方程组,以及其他应用。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_flipped_y:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **flipped_y**\ (\ ) |const| :ref:`🔗<class_Projection_method_flipped_y>`
返回这个 **Projection** 的副本Y 列中数值的符号都进行了翻转。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_aspect:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_aspect**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_aspect>`
返回该 **Projection** 视口的 X:Y 纵横比。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_far_plane_half_extents:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_far_plane_half_extents**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_far_plane_half_extents>`
返回投影远裁剪平面的尺寸除以二。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_fov:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_fov**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_fov>`
返回该投影的水平视场角(单位为度)。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_fovy:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_fovy**\ (\ fovx\: :ref:`float<class_float>`, aspect\: :ref:`float<class_float>`\ ) |static| :ref:`🔗<class_Projection_method_get_fovy>`
返回与给定水平视场角(以度为单位)和长宽比相关联的投影的垂直视场角(以度为单位)。
\ **注意:**\ 与 **Projection** 中的大多数方法不同,\ ``aspect`` 需要是 1 除以 X:Y 纵横比。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_lod_multiplier:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_lod_multiplier**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_lod_multiplier>`
返回这个 **Projection** 对可见细节级别的缩放系数。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_pixels_per_meter:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_pixels_per_meter**\ (\ for_pixel_width\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Projection_method_get_pixels_per_meter>`
返回 ``for_pixel_width`` 除以近平面上视口的宽度,单位为米,该宽度已应用 **Projection**\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_projection_plane:
.. rst-class:: classref-method
:ref:`Plane<class_Plane>` **get_projection_plane**\ (\ plane\: :ref:`int<class_int>`\ ) |const| :ref:`🔗<class_Projection_method_get_projection_plane>`
返回这个 **Projection** 的裁剪平面,索引由 ``plane`` 给定。
\ ``plane`` 应该等于 :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>`:ref:`PLANE_BOTTOM<class_Projection_constant_PLANE_BOTTOM>`\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_viewport_half_extents:
.. rst-class:: classref-method
:ref:`Vector2<class_Vector2>` **get_viewport_half_extents**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_viewport_half_extents>`
返回视口平面的尺寸除以二,这个 **Projection** 会把位置投影至该平面。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_z_far:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_z_far**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_z_far>`
返回该 **Projection** 中的距离,超过这个距离的位置会被裁剪。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_get_z_near:
.. rst-class:: classref-method
:ref:`float<class_float>` **get_z_near**\ (\ ) |const| :ref:`🔗<class_Projection_method_get_z_near>`
返回该 **Projection** 中的距离,未达到这个距离的位置会被裁剪。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_inverse:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **inverse**\ (\ ) |const| :ref:`🔗<class_Projection_method_inverse>`
返回执行这个 **Projection** 的逆投影变换的 **Projection**\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_is_orthogonal:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_orthogonal**\ (\ ) |const| :ref:`🔗<class_Projection_method_is_orthogonal>`
如果该 **Projection** 进行的是正交投影,则返回 ``true``\ 。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_jitter_offseted:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **jitter_offseted**\ (\ offset\: :ref:`Vector2<class_Vector2>`\ ) |const| :ref:`🔗<class_Projection_method_jitter_offseted>`
返回一个 **Projection**\ X 和 Y 的取值由给定的 :ref:`Vector2<class_Vector2>` 和最后一列中对应的第一个和第二个值相加而来。
.. rst-class:: classref-item-separator
----
.. _class_Projection_method_perspective_znear_adjusted:
.. rst-class:: classref-method
:ref:`Projection<class_Projection>` **perspective_znear_adjusted**\ (\ new_znear\: :ref:`float<class_float>`\ ) |const| :ref:`🔗<class_Projection_method_perspective_znear_adjusted>`
返回一个 **Projection**\ ,将其近裁剪距离调整为 ``new_znear``\ 。
\ **注意:**\ 原始的 **Projection** 必须为透视投影。
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
运算符说明
----------
.. _class_Projection_operator_neq_Projection:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator !=**\ (\ right\: :ref:`Projection<class_Projection>`\ ) :ref:`🔗<class_Projection_operator_neq_Projection>`
如果投影不相等,则返回 ``true``\ 。
\ **注意:**\ 由于浮点精度误差,即使投影实际上相等,也可能会返回 ``true`` 。可能会在 Godot 的未来版本中添加 ``is_equal_approx`` 方法。
.. rst-class:: classref-item-separator
----
.. _class_Projection_operator_mul_Projection:
.. rst-class:: classref-operator
:ref:`Projection<class_Projection>` **operator ***\ (\ right\: :ref:`Projection<class_Projection>`\ ) :ref:`🔗<class_Projection_operator_mul_Projection>`
返回一个 **Projection**\ ,应用了这个 **Projection**``right`` 的组合变换。
.. rst-class:: classref-item-separator
----
.. _class_Projection_operator_mul_Vector4:
.. rst-class:: classref-operator
:ref:`Vector4<class_Vector4>` **operator ***\ (\ right\: :ref:`Vector4<class_Vector4>`\ ) :ref:`🔗<class_Projection_operator_mul_Vector4>`
使用这个 **Projection** 矩阵将给定的 :ref:`Vector4<class_Vector4>` 进行投影(相乘)。
.. rst-class:: classref-item-separator
----
.. _class_Projection_operator_eq_Projection:
.. rst-class:: classref-operator
:ref:`bool<class_bool>` **operator ==**\ (\ right\: :ref:`Projection<class_Projection>`\ ) :ref:`🔗<class_Projection_operator_eq_Projection>`
如果投影相等,则返回 ``true``\ 。
\ **注意:**\ 由于浮点精度错误,即使投影实际上相等,也可能会返回 ``false``\ 。可能会在 Godot 的未来版本中添加 ``is_equal_approx`` 方法。
.. rst-class:: classref-item-separator
----
.. _class_Projection_operator_idx_int:
.. rst-class:: classref-operator
:ref:`Vector4<class_Vector4>` **operator []**\ (\ index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_Projection_operator_idx_int>`
返回具有给定索引的 **Projection** 的列。
索引按以下顺序排列x、y、z、w。
.. |virtual| replace:: :abbr:`virtual (本方法通常需要用户覆盖才能生效。)`
.. |required| replace:: :abbr:`required (This method is required to be overridden when extending its base class.)`
.. |const| replace:: :abbr:`const (本方法无副作用,不会修改该实例的任何成员变量。)`
.. |vararg| replace:: :abbr:`vararg (本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。)`
.. |constructor| replace:: :abbr:`constructor (本方法用于构造某个类型。)`
.. |static| replace:: :abbr:`static (调用本方法无需实例,可直接使用类名进行调用。)`
.. |operator| replace:: :abbr:`operator (本方法描述的是使用本类型作为左操作数的有效运算符。)`
.. |bitfield| replace:: :abbr:`BitField (这个值是由下列位标志构成位掩码的整数。)`
.. |void| replace:: :abbr:`void (无返回值。)`