Files
godot-docs/classes/class_openxrapiextension.rst
2023-09-02 03:18:36 +00:00

265 lines
14 KiB
ReStructuredText

:github_url: hide
.. DO NOT EDIT THIS FILE!!!
.. Generated automatically from Godot engine sources.
.. Generator: https://github.com/godotengine/godot/tree/master/doc/tools/make_rst.py.
.. XML source: https://github.com/godotengine/godot/tree/master/modules/openxr/doc_classes/OpenXRAPIExtension.xml.
.. _class_OpenXRAPIExtension:
OpenXRAPIExtension
==================
**Inherits:** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
Makes the OpenXR API available for GDExtension.
.. rst-class:: classref-introduction-group
Description
-----------
**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>`.
It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.
.. rst-class:: classref-introduction-group
Tutorials
---------
- `XrResult documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__
- `XrInstance documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html>`__
- `XrSpace documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html>`__
- `XrSession documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html>`__
- `XrSystemId documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html>`__
- `xrBeginSession documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html>`__
- `XrPosef documentation <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html>`__
.. rst-class:: classref-reftable-group
Methods
-------
.. table::
:widths: auto
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`can_render<class_OpenXRAPIExtension_method_can_render>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_error_string<class_OpenXRAPIExtension_method_get_error_string>` **(** :ref:`int<class_int>` result **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_instance<class_OpenXRAPIExtension_method_get_instance>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_instance_proc_addr<class_OpenXRAPIExtension_method_get_instance_proc_addr>` **(** :ref:`String<class_String>` name **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_next_frame_time<class_OpenXRAPIExtension_method_get_next_frame_time>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_play_space<class_OpenXRAPIExtension_method_get_play_space>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_session<class_OpenXRAPIExtension_method_get_session>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`get_swapchain_format_name<class_OpenXRAPIExtension_method_get_swapchain_format_name>` **(** :ref:`int<class_int>` swapchain_format **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`int<class_int>` | :ref:`get_system_id<class_OpenXRAPIExtension_method_get_system_id>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_initialized<class_OpenXRAPIExtension_method_is_initialized>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_running<class_OpenXRAPIExtension_method_is_running>` **(** **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`openxr_is_enabled<class_OpenXRAPIExtension_method_openxr_is_enabled>` **(** :ref:`bool<class_bool>` check_run_in_editor **)** |static| |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`Transform3D<class_Transform3D>` | :ref:`transform_from_pose<class_OpenXRAPIExtension_method_transform_from_pose>` **(** const void* pose **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`xr_result<class_OpenXRAPIExtension_method_xr_result>` **(** :ref:`int<class_int>` result, :ref:`String<class_String>` format, :ref:`Array<class_Array>` args **)** |
+---------------------------------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_OpenXRAPIExtension_method_can_render:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **can_render** **(** **)**
Returns ``true`` if OpenXR is initialized for rendering with an XR viewport.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_error_string:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_error_string** **(** :ref:`int<class_int>` result **)**
Returns an error string for the given `XrResult <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html>`__.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_instance:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_instance** **(** **)**
Returns the `XrInstance <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html>`__ created during the initialization of the OpenXR API.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_instance_proc_addr:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_instance_proc_addr** **(** :ref:`String<class_String>` name **)**
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``.
\ **Note:** ``openxr/util.h`` contains utility macros for acquiring OpenXR functions, e.g. ``GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction)``.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_next_frame_time:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_next_frame_time** **(** **)**
Returns the timing for the next frame.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_play_space:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_play_space** **(** **)**
Returns the play space, which is an `XrSpace <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html>`__ cast to an integer.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_session:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_session** **(** **)**
Returns the OpenXR session, which is an `XrSession <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html>`__ cast to an integer.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_swapchain_format_name:
.. rst-class:: classref-method
:ref:`String<class_String>` **get_swapchain_format_name** **(** :ref:`int<class_int>` swapchain_format **)**
Returns the name of the specified swapchain format.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_get_system_id:
.. rst-class:: classref-method
:ref:`int<class_int>` **get_system_id** **(** **)**
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.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_is_initialized:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_initialized** **(** **)**
Returns ``true`` if OpenXR is initialized.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_is_running:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_running** **(** **)**
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).
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_openxr_is_enabled:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **openxr_is_enabled** **(** :ref:`bool<class_bool>` check_run_in_editor **)** |static|
Returns ``true`` if OpenXR is enabled.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_transform_from_pose:
.. rst-class:: classref-method
:ref:`Transform3D<class_Transform3D>` **transform_from_pose** **(** const void* pose **)**
Creates a :ref:`Transform3D<class_Transform3D>` from an `XrPosef <https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html>`__.
.. rst-class:: classref-item-separator
----
.. _class_OpenXRAPIExtension_method_xr_result:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **xr_result** **(** :ref:`int<class_int>` result, :ref:`String<class_String>` format, :ref:`Array<class_Array>` args **)**
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.
.. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
.. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
.. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
.. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
.. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
.. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`
.. |bitfield| replace:: :abbr:`BitField (This value is an integer composed as a bitmask of the following flags.)`