OpenXRExtensionWrapper

package
v0.0.0-...-357ca8a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 20, 2025 License: MIT Imports: 23 Imported by: 0

Documentation

Overview

OpenXRExtensionWrapper allows implementing OpenXR extensions with GDExtension. The extension should be registered with RegisterExtensionWrapper.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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 Any

type Any interface {
	gd.IsClass
	AsOpenXRExtensionWrapper() Instance
}

type Extension

type Extension[T gdclass.Interface] struct{ gdclass.Extension[T, Instance] }

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]See Interface for methods that can be overridden by T.

func (*Extension[T]) AsObject

func (self *Extension[T]) AsObject() [1]gd.Object

func (*Extension[T]) AsOpenXRExtensionWrapper

func (self *Extension[T]) AsOpenXRExtensionWrapper() Instance

type ID

type ID Object.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.

func (ID) Instance

func (id ID) Instance() (Instance, bool)

type Implementation

type Implementation = implementation

Implementation implements Interface with empty methods.

type Instance

type Instance [1]gdclass.OpenXRExtensionWrapper

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 New

func New() Instance

func (Instance) AsObject

func (self Instance) AsObject() [1]gd.Object

func (Instance) AsOpenXRExtensionWrapper

func (self Instance) AsOpenXRExtensionWrapper() Instance

func (Instance) ID

func (self Instance) ID() ID

func (Instance) RegisterExtensionWrapper

func (self Instance) RegisterExtensionWrapper()

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

func (*Instance) SetObject

func (self *Instance) SetObject(obj [1]gd.Object) bool

func (Instance) Virtual

func (self Instance) Virtual(name string) reflect.Value

type Interface

type Interface interface {
	// Returns a data structure of OpenXR extensions related to this extension. The data structure 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.
	GetRequestedExtensions() map[string]*bool
	// Adds additional data structures when querying OpenXR system abilities.
	SetSystemPropertiesAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures when the OpenXR instance is created.
	SetInstanceCreateInfoAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures when the OpenXR session is created.
	SetSessionCreateAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures when creating OpenXR swapchains.
	SetSwapchainCreateInfoAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures when each hand tracker is created.
	SetHandJointLocationsAndGetNextPointer(hand_index int, next_pointer gdextension.Pointer) int
	// Adds additional data structures to the projection view of the given 'view_index'.
	SetProjectionViewsAndGetNextPointer(view_index int, next_pointer gdextension.Pointer) int
	// Adds additional data structures to XrFrameWaitInfo.
	//
	// This will only be called if the extension previously registered itself with [OpenXRAPIExtension.RegisterFrameInfoExtension].
	//
	// [OpenXRAPIExtension.RegisterFrameInfoExtension]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterFrameInfoExtension
	SetFrameWaitInfoAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures to XrFrameEndInfo.
	//
	// This will only be called if the extension previously registered itself with [OpenXRAPIExtension.RegisterFrameInfoExtension].
	//
	// [OpenXRAPIExtension.RegisterFrameInfoExtension]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterFrameInfoExtension
	SetFrameEndInfoAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures to XrViewLocateInfo.
	//
	// This will only be called if the extension previously registered itself with [OpenXRAPIExtension.RegisterFrameInfoExtension].
	//
	// [OpenXRAPIExtension.RegisterFrameInfoExtension]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterFrameInfoExtension
	SetViewLocateInfoAndGetNextPointer(next_pointer gdextension.Pointer) int
	// Adds additional data structures to XrReferenceSpaceCreateInfo.
	SetReferenceSpaceCreateInfoAndGetNextPointer(reference_space_type int, next_pointer gdextension.Pointer) int
	// Returns the number of composition layers this extension wrapper provides via [GetCompositionLayer].
	//
	// This will only be called if the extension previously registered itself with [OpenXRAPIExtension.RegisterCompositionLayerProvider].
	//
	// [GetCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRExtensionWrapper#Interface
	// [OpenXRAPIExtension.RegisterCompositionLayerProvider]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterCompositionLayerProvider
	GetCompositionLayerCount() int
	// 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.RegisterCompositionLayerProvider].
	//
	// [OpenXRAPIExtension.RegisterCompositionLayerProvider]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterCompositionLayerProvider
	GetCompositionLayer(index int) int
	// Returns an integer that will be used to sort the given composition layer provided via [GetCompositionLayer]. 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.RegisterCompositionLayerProvider].
	//
	// [GetCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRExtensionWrapper#Interface
	// [OpenXRAPIExtension.RegisterCompositionLayerProvider]: https://pkg.go.dev/graphics.gd/classdb/OpenXRAPIExtension#Instance.RegisterCompositionLayerProvider
	GetCompositionLayerOrder(index int) int
	// Returns a []string of positional tracker names that are used within the extension wrapper.
	GetSuggestedTrackerNames() []string
	// 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.
	OnRegisterMetadata()
	// Called before the OpenXR instance is created.
	OnBeforeInstanceCreated()
	// Called right after the OpenXR instance is created.
	OnInstanceCreated(instance int)
	// Called right before the OpenXR instance is destroyed.
	OnInstanceDestroyed()
	// Called right after the OpenXR session is created.
	OnSessionCreated(session int)
	// 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.
	OnProcess()
	// Called when OpenXR has performed its action sync.
	OnSyncActions()
	// Called right before the XR viewports begin their rendering step.
	OnPreRender()
	// Called right after the main swapchains are (re)created.
	OnMainSwapchainsCreated()
	// Called right before the given viewport is rendered.
	OnPreDrawViewport(viewport RID.Viewport)
	// Called right after the given viewport is rendered.
	//
	// Note: The draw commands might only be queued at this point, not executed.
	OnPostDrawViewport(viewport RID.Viewport)
	// Called right before the OpenXR session is destroyed.
	OnSessionDestroyed()
	// Called when the OpenXR session state is changed to idle.
	OnStateIdle()
	// Called when the OpenXR session state is changed to ready. This means OpenXR is ready to set up the session.
	OnStateReady()
	// Called when the OpenXR session state is changed to synchronized. OpenXR also returns to this state when the application loses focus.
	OnStateSynchronized()
	// Called when the OpenXR session state is changed to visible. This means OpenXR is now ready to receive frames.
	OnStateVisible()
	// Called when the OpenXR session state is changed to focused. This state is the active state when the game runs.
	OnStateFocused()
	// Called when the OpenXR session state is changed to stopping.
	OnStateStopping()
	// Called when the OpenXR session state is changed to loss pending.
	OnStateLossPending()
	// Called when the OpenXR session state is changed to exiting.
	OnStateExiting()
	// Called when there is an OpenXR event to process. When implementing, return true if the event was handled, return false otherwise.
	OnEventPolled(event gdextension.Pointer) bool
	// Adds additional data structures to composition layers created by [OpenXRCompositionLayer].
	//
	// 'property_values' contains the values of the properties returned by [GetViewportCompositionLayerExtensionProperties].
	//
	// 'layer' is a pointer to an XrCompositionLayerBaseHeader struct.
	//
	// [GetViewportCompositionLayerExtensionProperties]: https://pkg.go.dev/graphics.gd/classdb/OpenXRExtensionWrapper#Interface
	// [OpenXRCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRCompositionLayer
	SetViewportCompositionLayerAndGetNextPointer(layer gdextension.Pointer, property_values Object.PropertyInfo, next_pointer gdextension.Pointer) int
	// Gets an array of data structures that represent properties, just like [Object.GetPropertyList], that will be added to [OpenXRCompositionLayer] nodes.
	//
	// [Object.GetPropertyList]: https://pkg.go.dev/graphics.gd/variant/Object#GetPropertyList
	// [OpenXRCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRCompositionLayer
	GetViewportCompositionLayerExtensionProperties() [][]struct{}
	// Gets a data structure containing the default values for the properties returned by [GetViewportCompositionLayerExtensionProperties].
	//
	// [GetViewportCompositionLayerExtensionProperties]: https://pkg.go.dev/graphics.gd/classdb/OpenXRExtensionWrapper#Interface
	GetViewportCompositionLayerExtensionPropertyDefaults() map[string]interface{}
	// Called when a composition layer created via [OpenXRCompositionLayer] is destroyed.
	//
	// 'layer' is a pointer to an XrCompositionLayerBaseHeader struct.
	//
	// [OpenXRCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRCompositionLayer
	OnViewportCompositionLayerDestroyed(layer gdextension.Pointer)
	// Adds additional data structures to Android surface swapchains created by [OpenXRCompositionLayer].
	//
	// 'property_values' contains the values of the properties returned by [GetViewportCompositionLayerExtensionProperties].
	//
	// [GetViewportCompositionLayerExtensionProperties]: https://pkg.go.dev/graphics.gd/classdb/OpenXRExtensionWrapper#Interface
	// [OpenXRCompositionLayer]: https://pkg.go.dev/graphics.gd/classdb/OpenXRCompositionLayer
	SetAndroidSurfaceSwapchainCreateInfoAndGetNextPointer(property_values Object.PropertyInfo, next_pointer gdextension.Pointer) int
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL