Class OpenXRApiExtension
- Namespace
- Godot
- Assembly
- GodotSharp.dll
OpenXRApiExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the GetInstanceProcAddr(string) method, and the OpenXR instance through GetInstance().
It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.
[GodotClassName("OpenXRAPIExtension")]
public class OpenXRApiExtension : RefCounted, IDisposable
- Inheritance
-
OpenXRApiExtension
- Implements
- Inherited Members
Constructors
OpenXRApiExtension()
public OpenXRApiExtension()
Methods
CanRender()
Returns true
if OpenXR is initialized for rendering with an XR viewport.
public bool CanRender()
Returns
GetErrorString(ulong)
Returns an error string for the given XrResult.
public string GetErrorString(ulong result)
Parameters
result
ulong
Returns
GetInstance()
Returns the XrInstance created during the initialization of the OpenXR API.
public ulong GetInstance()
Returns
GetInstanceProcAddr(string)
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)
.
public ulong GetInstanceProcAddr(string name)
Parameters
name
string
Returns
GetNextFrameTime()
Returns the timing for the next frame.
public long GetNextFrameTime()
Returns
GetPlaySpace()
Returns the play space, which is an XrSpace cast to an integer.
public ulong GetPlaySpace()
Returns
GetSession()
Returns the OpenXR session, which is an XrSession cast to an integer.
public ulong GetSession()
Returns
GetSwapchainFormatName(long)
Returns the name of the specified swapchain format.
public string GetSwapchainFormatName(long swapchainFormat)
Parameters
swapchainFormat
long
Returns
GetSystemId()
Returns the id of the system, which is a XrSystemId cast to an integer.
public ulong GetSystemId()
Returns
HasGodotClassMethod(in godot_string_name)
Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.
protected override bool HasGodotClassMethod(in godot_string_name method)
Parameters
method
godot_string_nameName of the method to check for.
Returns
HasGodotClassSignal(in godot_string_name)
Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.
protected override bool HasGodotClassSignal(in godot_string_name signal)
Parameters
signal
godot_string_nameName of the signal to check for.
Returns
InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)
Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.
protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)
Parameters
method
godot_string_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsInitialized()
Returns true
if OpenXR is initialized.
public bool IsInitialized()
Returns
IsRunning()
Returns true
if OpenXR is running (xrBeginSession was successfully called and the swapchains were created).
public bool IsRunning()
Returns
OpenxrIsEnabled(bool)
Returns true
if OpenXR is enabled.
public static bool OpenxrIsEnabled(bool checkRunInEditor)
Parameters
checkRunInEditor
bool
Returns
XRResult(ulong, string, Array)
Returns true
if the provided XrResult (cast to an integer) is successful. Otherwise returns false
and prints the XrResult converted to a string, with the specified additional information.
public bool XRResult(ulong result, string format, Array args)