Table of Contents

Class OpenXRExtensionWrapperExtension

Allows clients to implement OpenXR extensions with GDExtension.

Inheritance
OpenXRExtensionWrapperExtension

Remarks

OpenXRExtensionWrapperExtension allows clients to implement OpenXR extensions with GDExtension. The extension should be registered with register_extension_wrapper.

Methods

_get_composition_layer(int)

Qualifiers: virtual

Returns a pointer to an XrCompositionLayerBaseHeader struct to provide the given composition layer.

This will only be called if the extension previously registered itself with OpenXRAPIExtension.register_composition_layer_provider.

int _get_composition_layer(int index)

Parameters

index int

_get_composition_layer_count

Qualifiers: virtual

Returns the number of composition layers this extension wrapper provides via OpenXRExtensionWrapperExtension._get_composition_layer.

This will only be called if the extension previously registered itself with OpenXRAPIExtension.register_composition_layer_provider.

int _get_composition_layer_count

_get_composition_layer_order(int)

Qualifiers: virtual

Returns an integer that will be used to sort the given composition layer provided via OpenXRExtensionWrapperExtension._get_composition_layer. Lower numbers will move the layer to the front of the list, and higher numbers to the end. The default projection layer has an order of 0, so layers provided by this method should probably be above or below (but not exactly) 0.

This will only be called if the extension previously registered itself with OpenXRAPIExtension.register_composition_layer_provider.

int _get_composition_layer_order(int index)

Parameters

index int

_get_requested_extensions

Qualifiers: virtual

Returns a Dictionary of OpenXR extensions related to this extension. The Dictionary should contain the name of the extension, mapped to a bool * cast to an integer:

  • If the bool * is a nullptr this extension is mandatory.

  • If the bool * points to a boolean, the boolean will be updated to true if the extension is enabled.

Dictionary _get_requested_extensions

_get_suggested_tracker_names

Qualifiers: virtual

Returns a PackedStringArray of positional tracker names that are used within the extension wrapper.

PackedStringArray _get_suggested_tracker_names

_get_viewport_composition_layer_extension_properties

Qualifiers: virtual

Gets an array of Dictionarys that represent properties, just like _get_property_list, that will be added to OpenXRCompositionLayer nodes.

Dictionary[] _get_viewport_composition_layer_extension_properties

_get_viewport_composition_layer_extension_property_defaults

Qualifiers: virtual

Gets a Dictionary containing the default values for the properties returned by _get_viewport_composition_layer_extension_properties.

Dictionary _get_viewport_composition_layer_extension_property_defaults

_on_before_instance_created

Qualifiers: virtual

Called before the OpenXR instance is created.

void _on_before_instance_created

_on_event_polled(const void*)

Qualifiers: virtual

Called when there is an OpenXR event to process. When implementing, return true if the event was handled, return false otherwise.

bool _on_event_polled(const void* event)

Parameters

event const void*

_on_instance_created(int)

Qualifiers: virtual

Called right after the OpenXR instance is created.

void _on_instance_created(int instance)

Parameters

instance int

_on_instance_destroyed

Qualifiers: virtual

Called right before the OpenXR instance is destroyed.

void _on_instance_destroyed

_on_main_swapchains_created

Qualifiers: virtual

Called right after the main swapchains are (re)created.

void _on_main_swapchains_created

_on_post_draw_viewport(RID)

Qualifiers: virtual

Called right after the given viewport is rendered.

Note: The draw commands might only be queued at this point, not executed.

void _on_post_draw_viewport(RID viewport)

Parameters

viewport RID

_on_pre_draw_viewport(RID)

Qualifiers: virtual

Called right before the given viewport is rendered.

void _on_pre_draw_viewport(RID viewport)

Parameters

viewport RID

_on_pre_render

Qualifiers: virtual

Called right before the XR viewports begin their rendering step.

void _on_pre_render

_on_process

Qualifiers: virtual

Called as part of the OpenXR process handling. This happens right before general and physics processing steps of the main loop. During this step controller data is queried and made available to game logic.

void _on_process

_on_register_metadata

Qualifiers: virtual

Allows extensions to register additional controller metadata. This function is called even when the OpenXR API is not constructed as the metadata needs to be available to the editor.

Extensions should also provide metadata regardless of whether they are supported on the host system. The controller data is used to setup action maps for users who may have access to the relevant hardware.

void _on_register_metadata

_on_session_created(int)

Qualifiers: virtual

Called right after the OpenXR session is created.

void _on_session_created(int session)

Parameters

session int

_on_session_destroyed

Qualifiers: virtual

Called right before the OpenXR session is destroyed.

void _on_session_destroyed

_on_state_exiting

Qualifiers: virtual

Called when the OpenXR session state is changed to exiting.

void _on_state_exiting

_on_state_focused

Qualifiers: virtual

Called when the OpenXR session state is changed to focused. This state is the active state when the game runs.

void _on_state_focused

_on_state_idle

Qualifiers: virtual

Called when the OpenXR session state is changed to idle.

void _on_state_idle

_on_state_loss_pending

Qualifiers: virtual

Called when the OpenXR session state is changed to loss pending.

void _on_state_loss_pending

_on_state_ready

Qualifiers: virtual

Called when the OpenXR session state is changed to ready. This means OpenXR is ready to set up the session.

void _on_state_ready

_on_state_stopping

Qualifiers: virtual

Called when the OpenXR session state is changed to stopping.

void _on_state_stopping

_on_state_synchronized

Qualifiers: virtual

Called when the OpenXR session state is changed to synchronized. OpenXR also returns to this state when the application loses focus.

void _on_state_synchronized

_on_state_visible

Qualifiers: virtual

Called when the OpenXR session state is changed to visible. This means OpenXR is now ready to receive frames.

void _on_state_visible

_on_viewport_composition_layer_destroyed(const void*)

Qualifiers: virtual

Called when a composition layer created via OpenXRCompositionLayer is destroyed.

layer is a pointer to an XrCompositionLayerBaseHeader struct.

void _on_viewport_composition_layer_destroyed(const void* layer)

Parameters

layer const void*

_set_android_surface_swapchain_create_info_and_get_next_pointer(Dictionary, void*)

Qualifiers: virtual

Adds additional data structures to Android surface swapchains created by OpenXRCompositionLayer.

property_values contains the values of the properties returned by _get_viewport_composition_layer_extension_properties.

int _set_android_surface_swapchain_create_info_and_get_next_pointer(Dictionary property_values, void* next_pointer)

Parameters

property_values Dictionary
next_pointer void*

_set_hand_joint_locations_and_get_next_pointer(int, void*)

Qualifiers: virtual

Adds additional data structures when each hand tracker is created.

int _set_hand_joint_locations_and_get_next_pointer(int hand_index, void* next_pointer)

Parameters

hand_index int
next_pointer void*

_set_instance_create_info_and_get_next_pointer(void*)

Qualifiers: virtual

Adds additional data structures when the OpenXR instance is created.

int _set_instance_create_info_and_get_next_pointer(void* next_pointer)

Parameters

next_pointer void*

_set_projection_views_and_get_next_pointer(int, void*)

Qualifiers: virtual

Adds additional data structures to the projection view of the given view_index.

int _set_projection_views_and_get_next_pointer(int view_index, void* next_pointer)

Parameters

view_index int
next_pointer void*

_set_session_create_and_get_next_pointer(void*)

Qualifiers: virtual

Adds additional data structures when the OpenXR session is created.

int _set_session_create_and_get_next_pointer(void* next_pointer)

Parameters

next_pointer void*

_set_swapchain_create_info_and_get_next_pointer(void*)

Qualifiers: virtual

Adds additional data structures when creating OpenXR swapchains.

int _set_swapchain_create_info_and_get_next_pointer(void* next_pointer)

Parameters

next_pointer void*

_set_system_properties_and_get_next_pointer(void*)

Qualifiers: virtual

Adds additional data structures when querying OpenXR system abilities.

int _set_system_properties_and_get_next_pointer(void* next_pointer)

Parameters

next_pointer void*

_set_viewport_composition_layer_and_get_next_pointer(const void*, Dictionary, void*)

Qualifiers: virtual

Adds additional data structures to composition layers created by OpenXRCompositionLayer.

property_values contains the values of the properties returned by _get_viewport_composition_layer_extension_properties.

layer is a pointer to an XrCompositionLayerBaseHeader struct.

int _set_viewport_composition_layer_and_get_next_pointer(const void* layer, Dictionary property_values, void* next_pointer)

Parameters

layer const void*
property_values Dictionary
next_pointer void*

get_openxr_api

Returns the created OpenXRAPIExtension, which can be used to access the OpenXR API.

OpenXRAPIExtension get_openxr_api

register_extension_wrapper

Registers the extension. This should happen at core module initialization level.

void register_extension_wrapper