class_openxrcompositionlayer.rst 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  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/modules/openxr/doc_classes/OpenXRCompositionLayer.xml.
  6. .. _class_OpenXRCompositionLayer:
  7. OpenXRCompositionLayer
  8. ======================
  9. **Experimental:** This class may be changed or removed in future versions.
  10. **Inherits:** :ref:`Node3D<class_Node3D>` **<** :ref:`Node<class_Node>` **<** :ref:`Object<class_Object>`
  11. **Inherited By:** :ref:`OpenXRCompositionLayerCylinder<class_OpenXRCompositionLayerCylinder>`, :ref:`OpenXRCompositionLayerEquirect<class_OpenXRCompositionLayerEquirect>`, :ref:`OpenXRCompositionLayerQuad<class_OpenXRCompositionLayerQuad>`
  12. The parent class of all OpenXR composition layer nodes.
  13. .. rst-class:: classref-introduction-group
  14. Description
  15. -----------
  16. Composition layers allow 2D viewports to be displayed inside of the headset by the XR compositor through special projections that retain their quality. This allows for rendering clear text while keeping the layer at a native resolution.
  17. \ **Note:** If the OpenXR runtime doesn't support the given composition layer type, a fallback mesh can be generated with a :ref:`ViewportTexture<class_ViewportTexture>`, in order to emulate the composition layer.
  18. .. rst-class:: classref-reftable-group
  19. Properties
  20. ----------
  21. .. table::
  22. :widths: auto
  23. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  24. | :ref:`bool<class_bool>` | :ref:`alpha_blend<class_OpenXRCompositionLayer_property_alpha_blend>` | ``false`` |
  25. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  26. | :ref:`Vector2i<class_Vector2i>` | :ref:`android_surface_size<class_OpenXRCompositionLayer_property_android_surface_size>` | ``Vector2i(1024, 1024)`` |
  27. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  28. | :ref:`bool<class_bool>` | :ref:`enable_hole_punch<class_OpenXRCompositionLayer_property_enable_hole_punch>` | ``false`` |
  29. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  30. | :ref:`SubViewport<class_SubViewport>` | :ref:`layer_viewport<class_OpenXRCompositionLayer_property_layer_viewport>` | |
  31. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  32. | :ref:`int<class_int>` | :ref:`sort_order<class_OpenXRCompositionLayer_property_sort_order>` | ``1`` |
  33. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  34. | :ref:`bool<class_bool>` | :ref:`use_android_surface<class_OpenXRCompositionLayer_property_use_android_surface>` | ``false`` |
  35. +---------------------------------------+-----------------------------------------------------------------------------------------+--------------------------+
  36. .. rst-class:: classref-reftable-group
  37. Methods
  38. -------
  39. .. table::
  40. :widths: auto
  41. +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`JavaObject<class_JavaObject>` | :ref:`get_android_surface<class_OpenXRCompositionLayer_method_get_android_surface>`\ (\ ) |
  43. +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`Vector2<class_Vector2>` | :ref:`intersects_ray<class_OpenXRCompositionLayer_method_intersects_ray>`\ (\ origin\: :ref:`Vector3<class_Vector3>`, direction\: :ref:`Vector3<class_Vector3>`\ ) |const| |
  45. +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`bool<class_bool>` | :ref:`is_natively_supported<class_OpenXRCompositionLayer_method_is_natively_supported>`\ (\ ) |const| |
  47. +-------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. .. rst-class:: classref-section-separator
  49. ----
  50. .. rst-class:: classref-descriptions-group
  51. Property Descriptions
  52. ---------------------
  53. .. _class_OpenXRCompositionLayer_property_alpha_blend:
  54. .. rst-class:: classref-property
  55. :ref:`bool<class_bool>` **alpha_blend** = ``false`` :ref:`🔗<class_OpenXRCompositionLayer_property_alpha_blend>`
  56. .. rst-class:: classref-property-setget
  57. - |void| **set_alpha_blend**\ (\ value\: :ref:`bool<class_bool>`\ )
  58. - :ref:`bool<class_bool>` **get_alpha_blend**\ (\ )
  59. Enables the blending the layer using its alpha channel.
  60. Can be combined with :ref:`Viewport.transparent_bg<class_Viewport_property_transparent_bg>` to give the layer a transparent background.
  61. .. rst-class:: classref-item-separator
  62. ----
  63. .. _class_OpenXRCompositionLayer_property_android_surface_size:
  64. .. rst-class:: classref-property
  65. :ref:`Vector2i<class_Vector2i>` **android_surface_size** = ``Vector2i(1024, 1024)`` :ref:`🔗<class_OpenXRCompositionLayer_property_android_surface_size>`
  66. .. rst-class:: classref-property-setget
  67. - |void| **set_android_surface_size**\ (\ value\: :ref:`Vector2i<class_Vector2i>`\ )
  68. - :ref:`Vector2i<class_Vector2i>` **get_android_surface_size**\ (\ )
  69. The size of the Android surface to create if :ref:`use_android_surface<class_OpenXRCompositionLayer_property_use_android_surface>` is enabled.
  70. .. rst-class:: classref-item-separator
  71. ----
  72. .. _class_OpenXRCompositionLayer_property_enable_hole_punch:
  73. .. rst-class:: classref-property
  74. :ref:`bool<class_bool>` **enable_hole_punch** = ``false`` :ref:`🔗<class_OpenXRCompositionLayer_property_enable_hole_punch>`
  75. .. rst-class:: classref-property-setget
  76. - |void| **set_enable_hole_punch**\ (\ value\: :ref:`bool<class_bool>`\ )
  77. - :ref:`bool<class_bool>` **get_enable_hole_punch**\ (\ )
  78. Enables a technique called "hole punching", which allows putting the composition layer behind the main projection layer (i.e. setting :ref:`sort_order<class_OpenXRCompositionLayer_property_sort_order>` to a negative value) while "punching a hole" through everything rendered by Godot so that the layer is still visible.
  79. This can be used to create the illusion that the composition layer exists in the same 3D space as everything rendered by Godot, allowing objects to appear to pass both behind or in front of the composition layer.
  80. .. rst-class:: classref-item-separator
  81. ----
  82. .. _class_OpenXRCompositionLayer_property_layer_viewport:
  83. .. rst-class:: classref-property
  84. :ref:`SubViewport<class_SubViewport>` **layer_viewport** :ref:`🔗<class_OpenXRCompositionLayer_property_layer_viewport>`
  85. .. rst-class:: classref-property-setget
  86. - |void| **set_layer_viewport**\ (\ value\: :ref:`SubViewport<class_SubViewport>`\ )
  87. - :ref:`SubViewport<class_SubViewport>` **get_layer_viewport**\ (\ )
  88. The :ref:`SubViewport<class_SubViewport>` to render on the composition layer.
  89. .. rst-class:: classref-item-separator
  90. ----
  91. .. _class_OpenXRCompositionLayer_property_sort_order:
  92. .. rst-class:: classref-property
  93. :ref:`int<class_int>` **sort_order** = ``1`` :ref:`🔗<class_OpenXRCompositionLayer_property_sort_order>`
  94. .. rst-class:: classref-property-setget
  95. - |void| **set_sort_order**\ (\ value\: :ref:`int<class_int>`\ )
  96. - :ref:`int<class_int>` **get_sort_order**\ (\ )
  97. The sort order for this composition layer. Higher numbers will be shown in front of lower numbers.
  98. \ **Note:** This will have no effect if a fallback mesh is being used.
  99. .. rst-class:: classref-item-separator
  100. ----
  101. .. _class_OpenXRCompositionLayer_property_use_android_surface:
  102. .. rst-class:: classref-property
  103. :ref:`bool<class_bool>` **use_android_surface** = ``false`` :ref:`🔗<class_OpenXRCompositionLayer_property_use_android_surface>`
  104. .. rst-class:: classref-property-setget
  105. - |void| **set_use_android_surface**\ (\ value\: :ref:`bool<class_bool>`\ )
  106. - :ref:`bool<class_bool>` **get_use_android_surface**\ (\ )
  107. If enabled, an Android surface will be created (with the dimensions from :ref:`android_surface_size<class_OpenXRCompositionLayer_property_android_surface_size>`) which will provide the 2D content for the composition layer, rather than using :ref:`layer_viewport<class_OpenXRCompositionLayer_property_layer_viewport>`.
  108. See :ref:`get_android_surface<class_OpenXRCompositionLayer_method_get_android_surface>` for information about how to get the surface so that your application can draw to it.
  109. \ **Note:** This will only work in Android builds.
  110. .. rst-class:: classref-section-separator
  111. ----
  112. .. rst-class:: classref-descriptions-group
  113. Method Descriptions
  114. -------------------
  115. .. _class_OpenXRCompositionLayer_method_get_android_surface:
  116. .. rst-class:: classref-method
  117. :ref:`JavaObject<class_JavaObject>` **get_android_surface**\ (\ ) :ref:`🔗<class_OpenXRCompositionLayer_method_get_android_surface>`
  118. Returns a :ref:`JavaObject<class_JavaObject>` representing an ``android.view.Surface`` if :ref:`use_android_surface<class_OpenXRCompositionLayer_property_use_android_surface>` is enabled and OpenXR has created the surface. Otherwise, this will return ``null``.
  119. \ **Note:** The surface can only be created during an active OpenXR session. So, if :ref:`use_android_surface<class_OpenXRCompositionLayer_property_use_android_surface>` is enabled outside of an OpenXR session, it won't be created until a new session fully starts.
  120. .. rst-class:: classref-item-separator
  121. ----
  122. .. _class_OpenXRCompositionLayer_method_intersects_ray:
  123. .. rst-class:: classref-method
  124. :ref:`Vector2<class_Vector2>` **intersects_ray**\ (\ origin\: :ref:`Vector3<class_Vector3>`, direction\: :ref:`Vector3<class_Vector3>`\ ) |const| :ref:`🔗<class_OpenXRCompositionLayer_method_intersects_ray>`
  125. Returns UV coordinates where the given ray intersects with the composition layer. ``origin`` and ``direction`` must be in global space.
  126. Returns ``Vector2(-1.0, -1.0)`` if the ray doesn't intersect.
  127. .. rst-class:: classref-item-separator
  128. ----
  129. .. _class_OpenXRCompositionLayer_method_is_natively_supported:
  130. .. rst-class:: classref-method
  131. :ref:`bool<class_bool>` **is_natively_supported**\ (\ ) |const| :ref:`🔗<class_OpenXRCompositionLayer_method_is_natively_supported>`
  132. Returns ``true`` if the OpenXR runtime natively supports this composition layer type.
  133. \ **Note:** This will only return an accurate result after the OpenXR session has started.
  134. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  135. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  136. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  137. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  138. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  139. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  140. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  141. .. |void| replace:: :abbr:`void (No return value.)`