class_openxrapiextension.rst 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388
  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/4.3/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.3/modules/openxr/doc_classes/OpenXRAPIExtension.xml.
  6. .. _class_OpenXRAPIExtension:
  7. OpenXRAPIExtension
  8. ==================
  9. **Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. Makes the OpenXR API available for GDExtension.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. **OpenXRAPIExtension** makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the :ref:`get_instance_proc_addr<class_OpenXRAPIExtension_method_get_instance_proc_addr>` method, and the OpenXR instance through :ref:`get_instance<class_OpenXRAPIExtension_method_get_instance>`.
  15. It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.
  16. .. rst-class:: classref-introduction-group
  17. Tutorials
  18. ---------
  19. - `XrResult documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__
  20. - `XrInstance documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html>`__
  21. - `XrSpace documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html>`__
  22. - `XrSession documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html>`__
  23. - `XrSystemId documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html>`__
  24. - `xrBeginSession documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html>`__
  25. - `XrPosef documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html>`__
  26. .. rst-class:: classref-reftable-group
  27. Methods
  28. -------
  29. .. table::
  30. :widths: auto
  31. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  32. | :ref:`bool<class_bool>` | :ref:`can_render<class_OpenXRAPIExtension_method_can_render>`\ (\ ) |
  33. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  34. | :ref:`String<class_String>` | :ref:`get_error_string<class_OpenXRAPIExtension_method_get_error_string>`\ (\ result\: :ref:`int<class_int>`\ ) |
  35. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  36. | :ref:`int<class_int>` | :ref:`get_hand_tracker<class_OpenXRAPIExtension_method_get_hand_tracker>`\ (\ hand_index\: :ref:`int<class_int>`\ ) |
  37. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  38. | :ref:`int<class_int>` | :ref:`get_instance<class_OpenXRAPIExtension_method_get_instance>`\ (\ ) |
  39. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  40. | :ref:`int<class_int>` | :ref:`get_instance_proc_addr<class_OpenXRAPIExtension_method_get_instance_proc_addr>`\ (\ name\: :ref:`String<class_String>`\ ) |
  41. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  42. | :ref:`int<class_int>` | :ref:`get_next_frame_time<class_OpenXRAPIExtension_method_get_next_frame_time>`\ (\ ) |
  43. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  44. | :ref:`int<class_int>` | :ref:`get_play_space<class_OpenXRAPIExtension_method_get_play_space>`\ (\ ) |
  45. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  46. | :ref:`int<class_int>` | :ref:`get_predicted_display_time<class_OpenXRAPIExtension_method_get_predicted_display_time>`\ (\ ) |
  47. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  48. | :ref:`int<class_int>` | :ref:`get_session<class_OpenXRAPIExtension_method_get_session>`\ (\ ) |
  49. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  50. | :ref:`String<class_String>` | :ref:`get_swapchain_format_name<class_OpenXRAPIExtension_method_get_swapchain_format_name>`\ (\ swapchain_format\: :ref:`int<class_int>`\ ) |
  51. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  52. | :ref:`int<class_int>` | :ref:`get_system_id<class_OpenXRAPIExtension_method_get_system_id>`\ (\ ) |
  53. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  54. | :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` | :ref:`is_environment_blend_mode_alpha_supported<class_OpenXRAPIExtension_method_is_environment_blend_mode_alpha_supported>`\ (\ ) |
  55. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  56. | :ref:`bool<class_bool>` | :ref:`is_initialized<class_OpenXRAPIExtension_method_is_initialized>`\ (\ ) |
  57. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  58. | :ref:`bool<class_bool>` | :ref:`is_running<class_OpenXRAPIExtension_method_is_running>`\ (\ ) |
  59. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  60. | :ref:`bool<class_bool>` | :ref:`openxr_is_enabled<class_OpenXRAPIExtension_method_openxr_is_enabled>`\ (\ check_run_in_editor\: :ref:`bool<class_bool>`\ ) |static| |
  61. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  62. | |void| | :ref:`register_composition_layer_provider<class_OpenXRAPIExtension_method_register_composition_layer_provider>`\ (\ extension\: :ref:`OpenXRExtensionWrapperExtension<class_OpenXRExtensionWrapperExtension>`\ ) |
  63. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  64. | |void| | :ref:`set_emulate_environment_blend_mode_alpha_blend<class_OpenXRAPIExtension_method_set_emulate_environment_blend_mode_alpha_blend>`\ (\ enabled\: :ref:`bool<class_bool>`\ ) |
  65. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  66. | :ref:`Transform3D<class_Transform3D>` | :ref:`transform_from_pose<class_OpenXRAPIExtension_method_transform_from_pose>`\ (\ pose\: ``const void*``\ ) |
  67. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  68. | |void| | :ref:`unregister_composition_layer_provider<class_OpenXRAPIExtension_method_unregister_composition_layer_provider>`\ (\ extension\: :ref:`OpenXRExtensionWrapperExtension<class_OpenXRExtensionWrapperExtension>`\ ) |
  69. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  70. | :ref:`bool<class_bool>` | :ref:`xr_result<class_OpenXRAPIExtension_method_xr_result>`\ (\ result\: :ref:`int<class_int>`, format\: :ref:`String<class_String>`, args\: :ref:`Array<class_Array>`\ ) |
  71. +-----------------------------------------------------------------------------------------+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
  72. .. rst-class:: classref-section-separator
  73. ----
  74. .. rst-class:: classref-descriptions-group
  75. Enumerations
  76. ------------
  77. .. _enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport:
  78. .. rst-class:: classref-enumeration
  79. enum **OpenXRAlphaBlendModeSupport**: :ref:`🔗<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>`
  80. .. _class_OpenXRAPIExtension_constant_OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE:
  81. .. rst-class:: classref-enumeration-constant
  82. :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` **OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE** = ``0``
  83. Means that :ref:`XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` isn't supported at all.
  84. .. _class_OpenXRAPIExtension_constant_OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL:
  85. .. rst-class:: classref-enumeration-constant
  86. :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` **OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL** = ``1``
  87. Means that :ref:`XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` is really supported.
  88. .. _class_OpenXRAPIExtension_constant_OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING:
  89. .. rst-class:: classref-enumeration-constant
  90. :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` **OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING** = ``2``
  91. Means that :ref:`XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` is emulated.
  92. .. rst-class:: classref-section-separator
  93. ----
  94. .. rst-class:: classref-descriptions-group
  95. Method Descriptions
  96. -------------------
  97. .. _class_OpenXRAPIExtension_method_can_render:
  98. .. rst-class:: classref-method
  99. :ref:`bool<class_bool>` **can_render**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_can_render>`
  100. Returns ``true`` if OpenXR is initialized for rendering with an XR viewport.
  101. .. rst-class:: classref-item-separator
  102. ----
  103. .. _class_OpenXRAPIExtension_method_get_error_string:
  104. .. rst-class:: classref-method
  105. :ref:`String<class_String>` **get_error_string**\ (\ result\: :ref:`int<class_int>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_error_string>`
  106. Returns an error string for the given `XrResult <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__.
  107. .. rst-class:: classref-item-separator
  108. ----
  109. .. _class_OpenXRAPIExtension_method_get_hand_tracker:
  110. .. rst-class:: classref-method
  111. :ref:`int<class_int>` **get_hand_tracker**\ (\ hand_index\: :ref:`int<class_int>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_hand_tracker>`
  112. Returns the corresponding ``XRHandTrackerEXT`` handle for the given hand index value.
  113. .. rst-class:: classref-item-separator
  114. ----
  115. .. _class_OpenXRAPIExtension_method_get_instance:
  116. .. rst-class:: classref-method
  117. :ref:`int<class_int>` **get_instance**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_instance>`
  118. Returns the `XrInstance <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html>`__ created during the initialization of the OpenXR API.
  119. .. rst-class:: classref-item-separator
  120. ----
  121. .. _class_OpenXRAPIExtension_method_get_instance_proc_addr:
  122. .. rst-class:: classref-method
  123. :ref:`int<class_int>` **get_instance_proc_addr**\ (\ name\: :ref:`String<class_String>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_instance_proc_addr>`
  124. Returns the function pointer of the OpenXR function with the specified name, cast to an integer. If the function with the given name does not exist, the method returns ``0``.
  125. \ **Note:** ``openxr/util.h`` contains utility macros for acquiring OpenXR functions, e.g. ``GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction)``.
  126. .. rst-class:: classref-item-separator
  127. ----
  128. .. _class_OpenXRAPIExtension_method_get_next_frame_time:
  129. .. rst-class:: classref-method
  130. :ref:`int<class_int>` **get_next_frame_time**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_next_frame_time>`
  131. Returns the predicted display timing for the next frame.
  132. .. rst-class:: classref-item-separator
  133. ----
  134. .. _class_OpenXRAPIExtension_method_get_play_space:
  135. .. rst-class:: classref-method
  136. :ref:`int<class_int>` **get_play_space**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_play_space>`
  137. Returns the play space, which is an `XrSpace <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html>`__ cast to an integer.
  138. .. rst-class:: classref-item-separator
  139. ----
  140. .. _class_OpenXRAPIExtension_method_get_predicted_display_time:
  141. .. rst-class:: classref-method
  142. :ref:`int<class_int>` **get_predicted_display_time**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_predicted_display_time>`
  143. Returns the predicted display timing for the current frame.
  144. .. rst-class:: classref-item-separator
  145. ----
  146. .. _class_OpenXRAPIExtension_method_get_session:
  147. .. rst-class:: classref-method
  148. :ref:`int<class_int>` **get_session**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_session>`
  149. Returns the OpenXR session, which is an `XrSession <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html>`__ cast to an integer.
  150. .. rst-class:: classref-item-separator
  151. ----
  152. .. _class_OpenXRAPIExtension_method_get_swapchain_format_name:
  153. .. rst-class:: classref-method
  154. :ref:`String<class_String>` **get_swapchain_format_name**\ (\ swapchain_format\: :ref:`int<class_int>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_swapchain_format_name>`
  155. Returns the name of the specified swapchain format.
  156. .. rst-class:: classref-item-separator
  157. ----
  158. .. _class_OpenXRAPIExtension_method_get_system_id:
  159. .. rst-class:: classref-method
  160. :ref:`int<class_int>` **get_system_id**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_get_system_id>`
  161. Returns the id of the system, which is a `XrSystemId <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html>`__ cast to an integer.
  162. .. rst-class:: classref-item-separator
  163. ----
  164. .. _class_OpenXRAPIExtension_method_is_environment_blend_mode_alpha_supported:
  165. .. rst-class:: classref-method
  166. :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` **is_environment_blend_mode_alpha_supported**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_is_environment_blend_mode_alpha_supported>`
  167. Returns :ref:`OpenXRAlphaBlendModeSupport<enum_OpenXRAPIExtension_OpenXRAlphaBlendModeSupport>` denoting if :ref:`XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` is really supported, emulated or not supported at all.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_OpenXRAPIExtension_method_is_initialized:
  171. .. rst-class:: classref-method
  172. :ref:`bool<class_bool>` **is_initialized**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_is_initialized>`
  173. Returns ``true`` if OpenXR is initialized.
  174. .. rst-class:: classref-item-separator
  175. ----
  176. .. _class_OpenXRAPIExtension_method_is_running:
  177. .. rst-class:: classref-method
  178. :ref:`bool<class_bool>` **is_running**\ (\ ) :ref:`🔗<class_OpenXRAPIExtension_method_is_running>`
  179. Returns ``true`` if OpenXR is running (`xrBeginSession <https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html>`__ was successfully called and the swapchains were created).
  180. .. rst-class:: classref-item-separator
  181. ----
  182. .. _class_OpenXRAPIExtension_method_openxr_is_enabled:
  183. .. rst-class:: classref-method
  184. :ref:`bool<class_bool>` **openxr_is_enabled**\ (\ check_run_in_editor\: :ref:`bool<class_bool>`\ ) |static| :ref:`🔗<class_OpenXRAPIExtension_method_openxr_is_enabled>`
  185. Returns ``true`` if OpenXR is enabled.
  186. .. rst-class:: classref-item-separator
  187. ----
  188. .. _class_OpenXRAPIExtension_method_register_composition_layer_provider:
  189. .. rst-class:: classref-method
  190. |void| **register_composition_layer_provider**\ (\ extension\: :ref:`OpenXRExtensionWrapperExtension<class_OpenXRExtensionWrapperExtension>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_register_composition_layer_provider>`
  191. Registers the given extension as a composition layer provider.
  192. .. rst-class:: classref-item-separator
  193. ----
  194. .. _class_OpenXRAPIExtension_method_set_emulate_environment_blend_mode_alpha_blend:
  195. .. rst-class:: classref-method
  196. |void| **set_emulate_environment_blend_mode_alpha_blend**\ (\ enabled\: :ref:`bool<class_bool>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_set_emulate_environment_blend_mode_alpha_blend>`
  197. If set to ``true``, an OpenXR extension is loaded which is capable of emulating the :ref:`XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND<class_XRInterface_constant_XR_ENV_BLEND_MODE_ALPHA_BLEND>` blend mode.
  198. .. rst-class:: classref-item-separator
  199. ----
  200. .. _class_OpenXRAPIExtension_method_transform_from_pose:
  201. .. rst-class:: classref-method
  202. :ref:`Transform3D<class_Transform3D>` **transform_from_pose**\ (\ pose\: ``const void*``\ ) :ref:`🔗<class_OpenXRAPIExtension_method_transform_from_pose>`
  203. Creates a :ref:`Transform3D<class_Transform3D>` from an `XrPosef <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html>`__.
  204. .. rst-class:: classref-item-separator
  205. ----
  206. .. _class_OpenXRAPIExtension_method_unregister_composition_layer_provider:
  207. .. rst-class:: classref-method
  208. |void| **unregister_composition_layer_provider**\ (\ extension\: :ref:`OpenXRExtensionWrapperExtension<class_OpenXRExtensionWrapperExtension>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_unregister_composition_layer_provider>`
  209. Unregisters the given extension as a composition layer provider.
  210. .. rst-class:: classref-item-separator
  211. ----
  212. .. _class_OpenXRAPIExtension_method_xr_result:
  213. .. rst-class:: classref-method
  214. :ref:`bool<class_bool>` **xr_result**\ (\ result\: :ref:`int<class_int>`, format\: :ref:`String<class_String>`, args\: :ref:`Array<class_Array>`\ ) :ref:`🔗<class_OpenXRAPIExtension_method_xr_result>`
  215. Returns ``true`` if the provided `XrResult <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__ (cast to an integer) is successful. Otherwise returns ``false`` and prints the `XrResult <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__ converted to a string, with the specified additional information.
  216. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  217. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  218. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  219. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  220. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  221. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
  222. .. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`
  223. .. |void| replace:: :abbr:`void (No return value.)`