| 1 | <?xml version="1.0" encoding="UTF-8" ?> |
| 2 | <class name="OpenXRAPIExtension" inherits="RefCounted" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../doc/class.xsd"> |
| 3 | <brief_description> |
| 4 | Makes the OpenXR API available for GDExtension. |
| 5 | </brief_description> |
| 6 | <description> |
| 7 | [OpenXRAPIExtension] makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the [method get_instance_proc_addr] method, and the OpenXR instance through [method get_instance]. |
| 8 | It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension. |
| 9 | </description> |
| 10 | <tutorials> |
| 11 | <link title="XrResult documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html</link> |
| 12 | <link title="XrInstance documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html</link> |
| 13 | <link title="XrSpace documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html</link> |
| 14 | <link title="XrSession documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html</link> |
| 15 | <link title="XrSystemId documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html</link> |
| 16 | <link title="xrBeginSession documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html</link> |
| 17 | <link title="XrPosef documentation">https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html</link> |
| 18 | </tutorials> |
| 19 | <methods> |
| 20 | <method name="action_get_handle"> |
| 21 | <return type="int" /> |
| 22 | <param index="0" name="action" type="RID" /> |
| 23 | <description> |
| 24 | Returns the corresponding [code]XrAction[/code] OpenXR handle for the given action RID. |
| 25 | </description> |
| 26 | </method> |
| 27 | <method name="begin_debug_label_region"> |
| 28 | <return type="void" /> |
| 29 | <param index="0" name="label_name" type="String" /> |
| 30 | <description> |
| 31 | Begins a new debug label region, this label will be reported in debug messages for any calls following this until [method end_debug_label_region] is called. Debug labels can be stacked. |
| 32 | </description> |
| 33 | </method> |
| 34 | <method name="can_render"> |
| 35 | <return type="bool" /> |
| 36 | <description> |
| 37 | Returns [code]true[/code] if OpenXR is initialized for rendering with an XR viewport. |
| 38 | </description> |
| 39 | </method> |
| 40 | <method name="end_debug_label_region"> |
| 41 | <return type="void" /> |
| 42 | <description> |
| 43 | Marks the end of a debug label region. Removes the latest debug label region added by calling [method begin_debug_label_region]. |
| 44 | </description> |
| 45 | </method> |
| 46 | <method name="find_action"> |
| 47 | <return type="RID" /> |
| 48 | <param index="0" name="name" type="String" /> |
| 49 | <param index="1" name="action_set" type="RID" /> |
| 50 | <description> |
| 51 | Returns the [RID] corresponding to an [code]Action[/code] of a matching name, optionally limited to a specified action set. |
| 52 | </description> |
| 53 | </method> |
| 54 | <method name="get_error_string"> |
| 55 | <return type="String" /> |
| 56 | <param index="0" name="result" type="int" /> |
| 57 | <description> |
| 58 | Returns an error string for the given [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url]. |
| 59 | </description> |
| 60 | </method> |
| 61 | <method name="get_hand_tracker"> |
| 62 | <return type="int" /> |
| 63 | <param index="0" name="hand_index" type="int" /> |
| 64 | <description> |
| 65 | Returns the corresponding [code]XRHandTrackerEXT[/code] handle for the given hand index value. |
| 66 | </description> |
| 67 | </method> |
| 68 | <method name="get_instance"> |
| 69 | <return type="int" /> |
| 70 | <description> |
| 71 | Returns the [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrInstance.html]XrInstance[/url] created during the initialization of the OpenXR API. |
| 72 | </description> |
| 73 | </method> |
| 74 | <method name="get_instance_proc_addr"> |
| 75 | <return type="int" /> |
| 76 | <param index="0" name="name" type="String" /> |
| 77 | <description> |
| 78 | 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 [code]0[/code]. |
| 79 | [b]Note:[/b] [code]openxr/util.h[/code] contains utility macros for acquiring OpenXR functions, e.g. [code]GDEXTENSION_INIT_XR_FUNC_V(xrCreateAction)[/code]. |
| 80 | </description> |
| 81 | </method> |
| 82 | <method name="get_next_frame_time"> |
| 83 | <return type="int" /> |
| 84 | <description> |
| 85 | Returns the predicted display timing for the next frame. |
| 86 | </description> |
| 87 | </method> |
| 88 | <method name="get_openxr_version"> |
| 89 | <return type="int" /> |
| 90 | <description> |
| 91 | Returns the version of OpenXR that was initialized. Only valid after the OpenXR instance has been created. See [url=https://registry.khronos.org/OpenXR/specs/1.1/html/xrspec.html#XR_MAKE_VERSION]XR_MAKE_VERSION[/url] for how the version is calculated. |
| 92 | </description> |
| 93 | </method> |
| 94 | <method name="get_play_space"> |
| 95 | <return type="int" /> |
| 96 | <description> |
| 97 | Returns the play space, which is an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html]XrSpace[/url] cast to an integer. |
| 98 | </description> |
| 99 | </method> |
| 100 | <method name="get_predicted_display_time"> |
| 101 | <return type="int" /> |
| 102 | <description> |
| 103 | Returns the predicted display timing for the current frame. |
| 104 | </description> |
| 105 | </method> |
| 106 | <method name="get_projection_layer"> |
| 107 | <return type="int" /> |
| 108 | <description> |
| 109 | Returns a pointer to the render state's [code]XrCompositionLayerProjection[/code] struct. |
| 110 | [b]Note:[/b] This method should only be called from the rendering thread. |
| 111 | </description> |
| 112 | </method> |
| 113 | <method name="get_render_state_z_far"> |
| 114 | <return type="float" /> |
| 115 | <description> |
| 116 | Returns the far boundary value of the camera frustum. |
| 117 | [b]Note:[/b] This is only accessible in the render thread. |
| 118 | </description> |
| 119 | </method> |
| 120 | <method name="get_render_state_z_near"> |
| 121 | <return type="float" /> |
| 122 | <description> |
| 123 | Returns the near boundary value of the camera frustum. |
| 124 | [b]Note:[/b] This is only accessible in the render thread. |
| 125 | </description> |
| 126 | </method> |
| 127 | <method name="get_session"> |
| 128 | <return type="int" /> |
| 129 | <description> |
| 130 | Returns the OpenXR session, which is an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSession.html]XrSession[/url] cast to an integer. |
| 131 | </description> |
| 132 | </method> |
| 133 | <method name="get_supported_swapchain_formats"> |
| 134 | <return type="PackedInt64Array" /> |
| 135 | <description> |
| 136 | Returns an array of supported swapchain formats. |
| 137 | </description> |
| 138 | </method> |
| 139 | <method name="get_swapchain_format_name"> |
| 140 | <return type="String" /> |
| 141 | <param index="0" name="swapchain_format" type="int" /> |
| 142 | <description> |
| 143 | Returns the name of the specified swapchain format. |
| 144 | </description> |
| 145 | </method> |
| 146 | <method name="get_system_id"> |
| 147 | <return type="int" /> |
| 148 | <description> |
| 149 | Returns the ID of the system, which is an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSystemId.html]XrSystemId[/url] cast to an integer. |
| 150 | </description> |
| 151 | </method> |
| 152 | <method name="insert_debug_label"> |
| 153 | <return type="void" /> |
| 154 | <param index="0" name="label_name" type="String" /> |
| 155 | <description> |
| 156 | Inserts a debug label, this label is reported in any debug message resulting from the OpenXR calls that follows, until any of [method begin_debug_label_region], [method end_debug_label_region], or [method insert_debug_label] is called. |
| 157 | </description> |
| 158 | </method> |
| 159 | <method name="is_environment_blend_mode_alpha_supported"> |
| 160 | <return type="int" enum="OpenXRAPIExtension.OpenXRAlphaBlendModeSupport" /> |
| 161 | <description> |
| 162 | Returns [enum OpenXRAPIExtension.OpenXRAlphaBlendModeSupport] denoting if [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is really supported, emulated or not supported at all. |
| 163 | </description> |
| 164 | </method> |
| 165 | <method name="is_initialized"> |
| 166 | <return type="bool" /> |
| 167 | <description> |
| 168 | Returns [code]true[/code] if OpenXR is initialized. |
| 169 | </description> |
| 170 | </method> |
| 171 | <method name="is_running"> |
| 172 | <return type="bool" /> |
| 173 | <description> |
| 174 | Returns [code]true[/code] if OpenXR is running ([url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/xrBeginSession.html]xrBeginSession[/url] was successfully called and the swapchains were created). |
| 175 | </description> |
| 176 | </method> |
| 177 | <method name="openxr_is_enabled" qualifiers="static"> |
| 178 | <return type="bool" /> |
| 179 | <param index="0" name="check_run_in_editor" type="bool" /> |
| 180 | <description> |
| 181 | Returns [code]true[/code] if OpenXR is enabled. |
| 182 | </description> |
| 183 | </method> |
| 184 | <method name="openxr_swapchain_acquire"> |
| 185 | <return type="void" /> |
| 186 | <param index="0" name="swapchain" type="int" /> |
| 187 | <description> |
| 188 | Acquires the image of the provided swapchain. |
| 189 | </description> |
| 190 | </method> |
| 191 | <method name="openxr_swapchain_create"> |
| 192 | <return type="int" /> |
| 193 | <param index="0" name="create_flags" type="int" /> |
| 194 | <param index="1" name="usage_flags" type="int" /> |
| 195 | <param index="2" name="swapchain_format" type="int" /> |
| 196 | <param index="3" name="width" type="int" /> |
| 197 | <param index="4" name="height" type="int" /> |
| 198 | <param index="5" name="sample_count" type="int" /> |
| 199 | <param index="6" name="array_size" type="int" /> |
| 200 | <description> |
| 201 | Returns a pointer to a new swapchain created using the provided parameters. |
| 202 | </description> |
| 203 | </method> |
| 204 | <method name="openxr_swapchain_free"> |
| 205 | <return type="void" /> |
| 206 | <param index="0" name="swapchain" type="int" /> |
| 207 | <description> |
| 208 | Destroys the provided swapchain and frees it from memory. |
| 209 | </description> |
| 210 | </method> |
| 211 | <method name="openxr_swapchain_get_image"> |
| 212 | <return type="RID" /> |
| 213 | <param index="0" name="swapchain" type="int" /> |
| 214 | <description> |
| 215 | Returns the RID of the provided swapchain's image. |
| 216 | </description> |
| 217 | </method> |
| 218 | <method name="openxr_swapchain_get_swapchain"> |
| 219 | <return type="int" /> |
| 220 | <param index="0" name="swapchain" type="int" /> |
| 221 | <description> |
| 222 | Returns the [code]XrSwapchain[/code] handle of the provided swapchain. |
| 223 | </description> |
| 224 | </method> |
| 225 | <method name="openxr_swapchain_release"> |
| 226 | <return type="void" /> |
| 227 | <param index="0" name="swapchain" type="int" /> |
| 228 | <description> |
| 229 | Releases the image of the provided swapchain. |
| 230 | </description> |
| 231 | </method> |
| 232 | <method name="register_composition_layer_provider"> |
| 233 | <return type="void" /> |
| 234 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 235 | <description> |
| 236 | Registers the given extension as a composition layer provider. |
| 237 | [b]Note:[/b] This cannot be called after the OpenXR session has started. However, it can be called in [method OpenXRExtensionWrapper._on_session_created]. |
| 238 | </description> |
| 239 | </method> |
| 240 | <method name="register_frame_info_extension"> |
| 241 | <return type="void" /> |
| 242 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 243 | <description> |
| 244 | Registers the given extension as modifying frame info via the [method OpenXRExtensionWrapper._set_frame_wait_info_and_get_next_pointer], [method OpenXRExtensionWrapper._set_view_locate_info_and_get_next_pointer], or [method OpenXRExtensionWrapper._set_frame_end_info_and_get_next_pointer] virtual methods. |
| 245 | [b]Note:[/b] This cannot be called after the OpenXR session has started. However, it can be called in [method OpenXRExtensionWrapper._on_session_created]. |
| 246 | </description> |
| 247 | </method> |
| 248 | <method name="register_projection_views_extension"> |
| 249 | <return type="void" /> |
| 250 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 251 | <description> |
| 252 | Registers the given extension as a provider of additional data structures to projections views. |
| 253 | [b]Note:[/b] This cannot be called after the OpenXR session has started. However, it can be called in [method OpenXRExtensionWrapper._on_session_created]. |
| 254 | </description> |
| 255 | </method> |
| 256 | <method name="set_custom_play_space"> |
| 257 | <return type="void" /> |
| 258 | <param index="0" name="space" type="const void*" /> |
| 259 | <description> |
| 260 | Sets the reference space used by OpenXR to the given [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrSpace.html]XrSpace[/url] (cast to a [code]void *[/code]). |
| 261 | </description> |
| 262 | </method> |
| 263 | <method name="set_emulate_environment_blend_mode_alpha_blend"> |
| 264 | <return type="void" /> |
| 265 | <param index="0" name="enabled" type="bool" /> |
| 266 | <description> |
| 267 | If set to [code]true[/code], an OpenXR extension is loaded which is capable of emulating the [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] blend mode. |
| 268 | </description> |
| 269 | </method> |
| 270 | <method name="set_object_name"> |
| 271 | <return type="void" /> |
| 272 | <param index="0" name="object_type" type="int" /> |
| 273 | <param index="1" name="object_handle" type="int" /> |
| 274 | <param index="2" name="object_name" type="String" /> |
| 275 | <description> |
| 276 | Set the object name of an OpenXR object, used for debug output. [param object_type] must be a valid OpenXR [code]XrObjectType[/code] enum and [param object_handle] must be a valid OpenXR object handle. |
| 277 | </description> |
| 278 | </method> |
| 279 | <method name="set_render_region"> |
| 280 | <return type="void" /> |
| 281 | <param index="0" name="render_region" type="Rect2i" /> |
| 282 | <description> |
| 283 | Sets the render region to [param render_region], overriding the normal render target's rect. |
| 284 | </description> |
| 285 | </method> |
| 286 | <method name="set_velocity_depth_texture"> |
| 287 | <return type="void" /> |
| 288 | <param index="0" name="render_target" type="RID" /> |
| 289 | <description> |
| 290 | Sets the render target of the velocity depth texture. |
| 291 | </description> |
| 292 | </method> |
| 293 | <method name="set_velocity_target_size"> |
| 294 | <return type="void" /> |
| 295 | <param index="0" name="target_size" type="Vector2i" /> |
| 296 | <description> |
| 297 | Sets the target size of the velocity and velocity depth textures. |
| 298 | </description> |
| 299 | </method> |
| 300 | <method name="set_velocity_texture"> |
| 301 | <return type="void" /> |
| 302 | <param index="0" name="render_target" type="RID" /> |
| 303 | <description> |
| 304 | Sets the render target of the velocity texture. |
| 305 | </description> |
| 306 | </method> |
| 307 | <method name="transform_from_pose"> |
| 308 | <return type="Transform3D" /> |
| 309 | <param index="0" name="pose" type="const void*" /> |
| 310 | <description> |
| 311 | Creates a [Transform3D] from an [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrPosef.html]XrPosef[/url]. |
| 312 | </description> |
| 313 | </method> |
| 314 | <method name="unregister_composition_layer_provider"> |
| 315 | <return type="void" /> |
| 316 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 317 | <description> |
| 318 | Unregisters the given extension as a composition layer provider. |
| 319 | [b]Note:[/b] This cannot be called while the OpenXR session is still running. |
| 320 | </description> |
| 321 | </method> |
| 322 | <method name="unregister_frame_info_extension"> |
| 323 | <return type="void" /> |
| 324 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 325 | <description> |
| 326 | Unregisters the given extension as modifying frame info. |
| 327 | [b]Note:[/b] This cannot be called while the OpenXR session is still running. |
| 328 | </description> |
| 329 | </method> |
| 330 | <method name="unregister_projection_views_extension"> |
| 331 | <return type="void" /> |
| 332 | <param index="0" name="extension" type="OpenXRExtensionWrapper" /> |
| 333 | <description> |
| 334 | Unregisters the given extension as a provider of additional data structures to projections views. |
| 335 | [b]Note:[/b] This cannot be called while the OpenXR session is still running. |
| 336 | </description> |
| 337 | </method> |
| 338 | <method name="update_main_swapchain_size"> |
| 339 | <return type="void" /> |
| 340 | <description> |
| 341 | Request the recommended resolution from the OpenXR runtime and update the main swapchain size if it has changed. |
| 342 | </description> |
| 343 | </method> |
| 344 | <method name="xr_result"> |
| 345 | <return type="bool" /> |
| 346 | <param index="0" name="result" type="int" /> |
| 347 | <param index="1" name="format" type="String" /> |
| 348 | <param index="2" name="args" type="Array" /> |
| 349 | <description> |
| 350 | Returns [code]true[/code] if the provided [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url] (cast to an integer) is successful. Otherwise returns [code]false[/code] and prints the [url=https://registry.khronos.org/OpenXR/specs/1.0/man/html/XrResult.html]XrResult[/url] converted to a string, with the specified additional information. |
| 351 | </description> |
| 352 | </method> |
| 353 | </methods> |
| 354 | <constants> |
| 355 | <constant name="OPENXR_ALPHA_BLEND_MODE_SUPPORT_NONE" value="0" enum="OpenXRAlphaBlendModeSupport"> |
| 356 | Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] isn't supported at all. |
| 357 | </constant> |
| 358 | <constant name="OPENXR_ALPHA_BLEND_MODE_SUPPORT_REAL" value="1" enum="OpenXRAlphaBlendModeSupport"> |
| 359 | Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is really supported. |
| 360 | </constant> |
| 361 | <constant name="OPENXR_ALPHA_BLEND_MODE_SUPPORT_EMULATING" value="2" enum="OpenXRAlphaBlendModeSupport"> |
| 362 | Means that [constant XRInterface.XR_ENV_BLEND_MODE_ALPHA_BLEND] is emulated. |
| 363 | </constant> |
| 364 | </constants> |
| 365 | </class> |