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
ActionGetHandle(Rid)
Returns the corresponding XrAction OpenXR handle for the given action RID.
public ulong ActionGetHandle(Rid action)
Parameters
actionRid
Returns
BeginDebugLabelRegion(string)
Begins a new debug label region, this label will be reported in debug messages for any calls following this until EndDebugLabelRegion() is called. Debug labels can be stacked.
public void BeginDebugLabelRegion(string labelName)
Parameters
labelNamestring
CanRender()
Returns true if OpenXR is initialized for rendering with an XR viewport.
public bool CanRender()
Returns
EndDebugLabelRegion()
Marks the end of a debug label region. Removes the latest debug label region added by calling BeginDebugLabelRegion(string).
public void EndDebugLabelRegion()
FindAction(string, Rid)
Returns the Rid corresponding to an Action of a matching name, optionally limited to a specified action set.
public Rid FindAction(string name, Rid actionSet)
Parameters
Returns
GetErrorString(ulong)
Returns an error string for the given XrResult.
public string GetErrorString(ulong result)
Parameters
resultulong
Returns
GetHandTracker(int)
Returns the corresponding XRHandTrackerEXT handle for the given hand index value.
public ulong GetHandTracker(int handIndex)
Parameters
handIndexint
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
namestring
Returns
GetNextFrameTime()
Returns the predicted display 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
GetPredictedDisplayTime()
Returns the predicted display timing for the current frame.
public long GetPredictedDisplayTime()
Returns
GetProjectionLayer()
Returns a pointer to the render state's XrCompositionLayerProjection struct.
Note: This method should only be called from the rendering thread.
public ulong GetProjectionLayer()
Returns
GetRenderStateZFar()
Returns the far boundary value of the camera frustum.
Note: This is only accessible in the render thread.
public double GetRenderStateZFar()
Returns
GetRenderStateZNear()
Returns the near boundary value of the camera frustum.
Note: This is only accessible in the render thread.
public double GetRenderStateZNear()
Returns
GetSession()
Returns the OpenXR session, which is an XrSession cast to an integer.
public ulong GetSession()
Returns
GetSupportedSwapchainFormats()
Returns an array of supported swapchain formats.
public long[] GetSupportedSwapchainFormats()
Returns
- long[]
GetSwapchainFormatName(long)
Returns the name of the specified swapchain format.
public string GetSwapchainFormatName(long swapchainFormat)
Parameters
swapchainFormatlong
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
methodgodot_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
signalgodot_string_nameName of the signal to check for.
Returns
InsertDebugLabel(string)
Inserts a debug label, this label is reported in any debug message resulting from the OpenXR calls that follows, until any of BeginDebugLabelRegion(string), EndDebugLabelRegion(), or InsertDebugLabel(string) is called.
public void InsertDebugLabel(string labelName)
Parameters
labelNamestring
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
methodgodot_string_nameName of the method to invoke.
argsNativeVariantPtrArgsArguments to use with the invoked method.
retgodot_variantValue returned by the invoked method.
Returns
IsEnvironmentBlendModeAlphaSupported()
Returns OpenXRApiExtension.OpenXRAlphaBlendModeSupport denoting if AlphaBlend is really supported, emulated or not supported at all.
public OpenXRApiExtension.OpenXRAlphaBlendModeSupport IsEnvironmentBlendModeAlphaSupported()
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
checkRunInEditorbool
Returns
OpenxrSwapchainAcquire(ulong)
Acquires the image of the provided swapchain.
public void OpenxrSwapchainAcquire(ulong swapchain)
Parameters
swapchainulong
OpenxrSwapchainCreate(ulong, ulong, long, uint, uint, uint, uint)
Returns a pointer to a new swapchain created using the provided parameters.
public ulong OpenxrSwapchainCreate(ulong createFlags, ulong usageFlags, long swapchainFormat, uint width, uint height, uint sampleCount, uint arraySize)
Parameters
createFlagsulongusageFlagsulongswapchainFormatlongwidthuintheightuintsampleCountuintarraySizeuint
Returns
OpenxrSwapchainFree(ulong)
Destroys the provided swapchain and frees it from memory.
public void OpenxrSwapchainFree(ulong swapchain)
Parameters
swapchainulong
OpenxrSwapchainGetImage(ulong)
Returns the RID of the provided swapchain's image.
public Rid OpenxrSwapchainGetImage(ulong swapchain)
Parameters
swapchainulong
Returns
OpenxrSwapchainGetSwapchain(ulong)
Returns the XrSwapchain handle of the provided swapchain.
public ulong OpenxrSwapchainGetSwapchain(ulong swapchain)
Parameters
swapchainulong
Returns
OpenxrSwapchainRelease(ulong)
Releases the image of the provided swapchain.
public void OpenxrSwapchainRelease(ulong swapchain)
Parameters
swapchainulong
RegisterCompositionLayerProvider(OpenXRExtensionWrapperExtension)
Registers the given extension as a composition layer provider.
public void RegisterCompositionLayerProvider(OpenXRExtensionWrapperExtension extension)
Parameters
extensionOpenXRExtensionWrapperExtension
RegisterProjectionViewsExtension(OpenXRExtensionWrapperExtension)
Registers the given extension as a provider of additional data structures to projections views.
public void RegisterProjectionViewsExtension(OpenXRExtensionWrapperExtension extension)
Parameters
extensionOpenXRExtensionWrapperExtension
SetEmulateEnvironmentBlendModeAlphaBlend(bool)
If set to true, an OpenXR extension is loaded which is capable of emulating the AlphaBlend blend mode.
public void SetEmulateEnvironmentBlendModeAlphaBlend(bool enabled)
Parameters
enabledbool
SetObjectName(long, ulong, string)
Set the object name of an OpenXR object, used for debug output. objectType must be a valid OpenXR XrObjectType enum and objectHandle must be a valid OpenXR object handle.
public void SetObjectName(long objectType, ulong objectHandle, string objectName)
Parameters
SetRenderRegion(Rect2I)
Sets the render region to renderRegion, overriding the normal render target's rect.
public void SetRenderRegion(Rect2I renderRegion)
Parameters
renderRegionRect2I
SetVelocityDepthTexture(Rid)
Sets the render target of the velocity depth texture.
public void SetVelocityDepthTexture(Rid renderTarget)
Parameters
renderTargetRid
SetVelocityTargetSize(Vector2I)
Sets the target size of the velocity and velocity depth textures.
public void SetVelocityTargetSize(Vector2I targetSize)
Parameters
targetSizeVector2I
SetVelocityTexture(Rid)
Sets the render target of the velocity texture.
public void SetVelocityTexture(Rid renderTarget)
Parameters
renderTargetRid
UnregisterCompositionLayerProvider(OpenXRExtensionWrapperExtension)
Unregisters the given extension as a composition layer provider.
public void UnregisterCompositionLayerProvider(OpenXRExtensionWrapperExtension extension)
Parameters
extensionOpenXRExtensionWrapperExtension
UnregisterProjectionViewsExtension(OpenXRExtensionWrapperExtension)
Unregisters the given extension as a provider of additional data structures to projections views.
public void UnregisterProjectionViewsExtension(OpenXRExtensionWrapperExtension extension)
Parameters
extensionOpenXRExtensionWrapperExtension
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)