Documentation
¶
Overview ¶
graphics.gd/classdb/OpenXRAPIExtension makes OpenXR available for GDExtension. It provides the OpenXR API to GDExtension through the Instance.GetInstanceProcAddr method, and the OpenXR instance through Instance.GetInstance.
It also provides methods for querying the status of OpenXR initialization, and helper methods for ease of use of the API with GDExtension.
Index ¶
- func OpenxrIsEnabled(check_run_in_editor bool) bool
- type Advanced
- type Any
- type Extension
- type ID
- type Instance
- func (self Instance) ActionGetHandle(action RID.Action) int
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsOpenXRAPIExtension() Instance
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) BeginDebugLabelRegion(label_name string)
- func (self Instance) CanRender() bool
- func (self Instance) EndDebugLabelRegion()
- func (self Instance) FindAction(name string, action_set RID.ActionSet) RID.Action
- func (self Instance) GetErrorString(result int) string
- func (self Instance) GetHandTracker(hand_index int) int
- func (self Instance) GetInstance() int
- func (self Instance) GetInstanceProcAddr(name string) int
- func (self Instance) GetNextFrameTime() int
- func (self Instance) GetPlaySpace() int
- func (self Instance) GetPredictedDisplayTime() int
- func (self Instance) GetProjectionLayer() int
- func (self Instance) GetRenderStateZFar() Float.X
- func (self Instance) GetRenderStateZNear() Float.X
- func (self Instance) GetSession() int
- func (self Instance) GetSupportedSwapchainFormats() []int64
- func (self Instance) GetSwapchainFormatName(swapchain_format int) string
- func (self Instance) GetSystemId() int
- func (self Instance) ID() ID
- func (self Instance) InsertDebugLabel(label_name string)
- func (self Instance) IsEnvironmentBlendModeAlphaSupported() OpenXRAlphaBlendModeSupport
- func (self Instance) IsInitialized() bool
- func (self Instance) IsRunning() bool
- func (self Instance) OpenxrSwapchainAcquire(swapchain int)
- func (self Instance) OpenxrSwapchainCreate(create_flags int, usage_flags int, swapchain_format int, width int, height int, ...) int
- func (self Instance) OpenxrSwapchainFree(swapchain int)
- func (self Instance) OpenxrSwapchainGetImage(swapchain int) RID.Texture
- func (self Instance) OpenxrSwapchainGetSwapchain(swapchain int) int
- func (self Instance) OpenxrSwapchainRelease(swapchain int)
- func (self Instance) RegisterCompositionLayerProvider(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) RegisterFrameInfoExtension(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) RegisterProjectionViewsExtension(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) SetCustomPlaySpace(space gdextension.Pointer)
- func (self Instance) SetEmulateEnvironmentBlendModeAlphaBlend(enabled bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetObjectName(object_type int, object_handle int, object_name string)
- func (self Instance) SetRenderRegion(render_region Rect2i.PositionSize)
- func (self Instance) SetVelocityDepthTexture(render_target RID.Framebuffer)
- func (self Instance) SetVelocityTargetSize(target_size Vector2i.XY)
- func (self Instance) SetVelocityTexture(render_target RID.Framebuffer)
- func (self Instance) TransformFromPose(pose gdextension.Pointer) Transform3D.BasisOrigin
- func (self Instance) UnregisterCompositionLayerProvider(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) UnregisterFrameInfoExtension(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) UnregisterProjectionViewsExtension(extension OpenXRExtensionWrapper.Instance)
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) XrResult(result int, format string, args []any) bool
- type OpenXRAlphaBlendModeSupport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OpenxrIsEnabled ¶
Returns true if OpenXR is enabled.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsOpenXRAPIExtension ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.OpenXRAPIExtension
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func GetFromWrapper ¶
func GetFromWrapper(peer OpenXRExtensionWrapper.Instance) Instance
Returns the created [OpenXRAPIExtension], which can be used to access the OpenXR API.
func (Instance) ActionGetHandle ¶
Returns the corresponding XrAction OpenXR handle for the given action RID.
func (Instance) AsOpenXRAPIExtension ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) BeginDebugLabelRegion ¶
Begins a new debug label region, this label will be reported in debug messages for any calls following this until Instance.EndDebugLabelRegion is called. Debug labels can be stacked.
func (Instance) CanRender ¶
Returns true if OpenXR is initialized for rendering with an XR viewport.
func (Instance) EndDebugLabelRegion ¶
func (self Instance) EndDebugLabelRegion()
Marks the end of a debug label region. Removes the latest debug label region added by calling Instance.BeginDebugLabelRegion.
func (Instance) FindAction ¶
Returns the [Resource.ID] corresponding to an Action of a matching name, optionally limited to a specified action set.
func (Instance) GetErrorString ¶
Returns an error string for the given XrResult.
func (Instance) GetHandTracker ¶
Returns the corresponding XRHandTrackerEXT handle for the given hand index value.
func (Instance) GetInstance ¶
Returns the XrInstance created during the initialization of the OpenXR API.
func (Instance) GetInstanceProcAddr ¶
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).
func (Instance) GetNextFrameTime ¶
Returns the predicted display timing for the next frame.
func (Instance) GetPlaySpace ¶
Returns the play space, which is an XrSpace cast to an integer.
func (Instance) GetPredictedDisplayTime ¶
Returns the predicted display timing for the current frame.
func (Instance) GetProjectionLayer ¶
Returns a pointer to the render state's XrCompositionLayerProjection struct.
Note: This method should only be called from the rendering thread.
func (Instance) GetRenderStateZFar ¶
Returns the far boundary value of the camera frustum.
Note: This is only accessible in the render thread.
func (Instance) GetRenderStateZNear ¶
Returns the near boundary value of the camera frustum.
Note: This is only accessible in the render thread.
func (Instance) GetSession ¶
Returns the OpenXR session, which is an XrSession cast to an integer.
func (Instance) GetSupportedSwapchainFormats ¶
Returns an array of supported swapchain formats.
func (Instance) GetSwapchainFormatName ¶
Returns the name of the specified swapchain format.
func (Instance) GetSystemId ¶
Returns the id of the system, which is an XrSystemId cast to an integer.
func (Instance) InsertDebugLabel ¶
Inserts a debug label, this label is reported in any debug message resulting from the OpenXR calls that follows, until any of Instance.BeginDebugLabelRegion, Instance.EndDebugLabelRegion, or Instance.InsertDebugLabel is called.
func (Instance) IsEnvironmentBlendModeAlphaSupported ¶
func (self Instance) IsEnvironmentBlendModeAlphaSupported() OpenXRAlphaBlendModeSupport
Returns [OpenXRAPIExtension.OpenXRAlphaBlendModeSupport] denoting if [Xrinterface.XrEnvBlendModeAlphaBlend] is really supported, emulated or not supported at all.
func (Instance) IsInitialized ¶
Returns true if OpenXR is initialized.
func (Instance) IsRunning ¶
Returns true if OpenXR is running (xrBeginSession was successfully called and the swapchains were created).
func (Instance) OpenxrSwapchainAcquire ¶
Acquires the image of the provided swapchain.
func (Instance) OpenxrSwapchainCreate ¶
func (self Instance) OpenxrSwapchainCreate(create_flags int, usage_flags int, swapchain_format int, width int, height int, sample_count int, array_size int) int
Returns a pointer to a new swapchain created using the provided parameters.
func (Instance) OpenxrSwapchainFree ¶
Destroys the provided swapchain and frees it from memory.
func (Instance) OpenxrSwapchainGetImage ¶
Returns the RID of the provided swapchain's image.
func (Instance) OpenxrSwapchainGetSwapchain ¶
Returns the XrSwapchain handle of the provided swapchain.
func (Instance) OpenxrSwapchainRelease ¶
Releases the image of the provided swapchain.
func (Instance) RegisterCompositionLayerProvider ¶
func (self Instance) RegisterCompositionLayerProvider(extension OpenXRExtensionWrapper.Instance)
Registers the given extension as a composition layer provider.
func (Instance) RegisterFrameInfoExtension ¶
func (self Instance) RegisterFrameInfoExtension(extension OpenXRExtensionWrapper.Instance)
Registers the given extension as modifying frame info via the graphics.gd/classdb/OpenXRExtensionWrapper.Instance.SetFrameWaitInfoAndGetNextPointer, graphics.gd/classdb/OpenXRExtensionWrapper.Instance.SetViewLocateInfoAndGetNextPointer, or graphics.gd/classdb/OpenXRExtensionWrapper.Instance.SetFrameEndInfoAndGetNextPointer virtual methods.
func (Instance) RegisterProjectionViewsExtension ¶
func (self Instance) RegisterProjectionViewsExtension(extension OpenXRExtensionWrapper.Instance)
Registers the given extension as a provider of additional data structures to projections views.
func (Instance) SetCustomPlaySpace ¶
func (self Instance) SetCustomPlaySpace(space gdextension.Pointer)
Sets the reference space used by OpenXR to the given XrSpace (cast to a void *).
func (Instance) SetEmulateEnvironmentBlendModeAlphaBlend ¶
If set to true, an OpenXR extension is loaded which is capable of emulating the [Xrinterface.XrEnvBlendModeAlphaBlend] blend mode.
func (Instance) SetObjectName ¶
Set the object name of an OpenXR object, used for debug output. 'object_type' must be a valid OpenXR XrObjectType enum and 'object_handle' must be a valid OpenXR object handle.
func (Instance) SetRenderRegion ¶
func (self Instance) SetRenderRegion(render_region Rect2i.PositionSize)
Sets the render region to 'render_region', overriding the normal render target's rect.
func (Instance) SetVelocityDepthTexture ¶
func (self Instance) SetVelocityDepthTexture(render_target RID.Framebuffer)
Sets the render target of the velocity depth texture.
func (Instance) SetVelocityTargetSize ¶
Sets the target size of the velocity and velocity depth textures.
func (Instance) SetVelocityTexture ¶
func (self Instance) SetVelocityTexture(render_target RID.Framebuffer)
Sets the render target of the velocity texture.
func (Instance) TransformFromPose ¶
func (self Instance) TransformFromPose(pose gdextension.Pointer) Transform3D.BasisOrigin
Creates a [Transform3D.BasisOrigin] from an XrPosef.
func (Instance) UnregisterCompositionLayerProvider ¶
func (self Instance) UnregisterCompositionLayerProvider(extension OpenXRExtensionWrapper.Instance)
Unregisters the given extension as a composition layer provider.
func (Instance) UnregisterFrameInfoExtension ¶
func (self Instance) UnregisterFrameInfoExtension(extension OpenXRExtensionWrapper.Instance)
Unregisters the given extension as modifying frame info.
func (Instance) UnregisterProjectionViewsExtension ¶
func (self Instance) UnregisterProjectionViewsExtension(extension OpenXRExtensionWrapper.Instance)
Unregisters the given extension as a provider of additional data structures to projections views.
type OpenXRAlphaBlendModeSupport ¶
type OpenXRAlphaBlendModeSupport int //gd:OpenXRAPIExtension.OpenXRAlphaBlendModeSupport
const ( // Means that [Xrinterface.XrEnvBlendModeAlphaBlend] isn't supported at all. OpenxrAlphaBlendModeSupportNone OpenXRAlphaBlendModeSupport = 0 // Means that [Xrinterface.XrEnvBlendModeAlphaBlend] is really supported. OpenxrAlphaBlendModeSupportReal OpenXRAlphaBlendModeSupport = 1 // Means that [Xrinterface.XrEnvBlendModeAlphaBlend] is emulated. OpenxrAlphaBlendModeSupportEmulating OpenXRAlphaBlendModeSupport = 2 )