XRInterfaceExtension
Base class for XR interface extensions (plugins).
XRInterfaceExtension.swift:11class XRInterfaceExtension
External XR interface plugins should inherit from this class.
Superclasses
class XRInterface
Base class for an XR interface implementation.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
Instance members
func addBlit(renderTarget: RID, srcRect: Rect2, dstRect: Rect2i, useLayer: Bool, layer: UInt32, applyLensDistortion: Bool, eyeCenter: Vector2, k1: Double, k2: Double, upscale: Double, aspectRatio: Double
) Blits our render results to screen optionally applying lens distortion. This can only be called while processing
_commit_views
.func getColorTexture(
) -> RID func getDepthTexture(
) -> RID func getRenderTargetTexture(renderTarget: RID
) -> RID Returns a valid
RID
for a texture to which we should render the current frame if supported by the interface.func getVelocityTexture(
) -> RID
Show implementation details (31)
Hide implementation details
func _endFrame(
) Called if interface is active and queues have been submitted.
func _getAnchorDetectionIsEnabled(
) -> Bool Return
true
if anchor detection is enabled for this interface.func _getCameraFeedId(
) -> Int32 Returns the camera feed ID for the
CameraFeed
registered with theCameraServer
that should be presented as the background on an AR capable device (if applicable).func _getCameraTransform(
) -> Transform3D Returns the
Transform3D
that positions theXRCamera3D
in the world.func _getCapabilities(
) -> UInt32 Returns the capabilities of this interface.
func _getColorTexture(
) -> RID Return color texture into which to render (if applicable).
func _getDepthTexture(
) -> RID Return depth texture into which to render (if applicable).
func _getName(
) -> StringName Returns the name of this interface.
func _getPlayArea(
) -> PackedVector3Array Returns an
PackedVector3Array
that denotes the play areas boundaries (if applicable).func _getPlayAreaMode(
) -> XRInterface.PlayAreaMode Returns the
XRInterface.PlayAreaMode
that sets up our play area.func _getProjectionForView(UInt32, aspect: Double, zNear: Double, zFar: Double
) -> PackedFloat64Array Returns the projection matrix for the given view as a
PackedFloat64Array
.func _getRenderTargetSize(
) -> Vector2 Returns the size of our render target for this interface, this overrides the size of the
Viewport
marked as the xr viewport.func _getSuggestedPoseNames(trackerName: StringName
) -> PackedStringArray Returns a
PackedStringArray
with pose names configured by this interface. Note that user configuration can override this list.func _getSuggestedTrackerNames(
) -> PackedStringArray Returns a
PackedStringArray
with tracker names configured by this interface. Note that user configuration can override this list.func _getSystemInfo(
) -> GDictionary Returns a
GDictionary
with system information related to this interface.func _getTrackingStatus(
) -> XRInterface.TrackingStatus Returns a
XRInterface.TrackingStatus
specifying the current status of our tracking.func _getTransformForView(UInt32, camTransform: Transform3D
) -> Transform3D Returns a
Transform3D
for a given view.func _getVelocityTexture(
) -> RID Return velocity texture into which to render (if applicable).
func _getViewCount(
) -> UInt32 Returns the number of views this interface requires, 1 for mono, 2 for stereoscopic.
func _getVrsTexture(
) -> RID func _initialize(
) -> Bool Initializes the interface, returns
true
on success.func _isInitialized(
) -> Bool Returns
true
if this interface has been initialized.func _postDrawViewport(renderTarget: RID, screenRect: Rect2
) Called after the XR
Viewport
draw logic has completed.func _preDrawViewport(renderTarget: RID
) -> Bool Called if this is our primary
XRInterfaceExtension
before we start processing aViewport
for every active XRViewport
, returnstrue
if that viewport should be rendered. An XR interface may returnfalse
if the user has taken off their headset and we can pause rendering.func _preRender(
) Called if this
XRInterfaceExtension
is active before rendering starts. Most XR interfaces will sync tracking at this point in time.func _process(
) Called if this
XRInterfaceExtension
is active before our physics and game process is called. Most XR interfaces will update itsXRPositionalTracker
s at this point in time.func _setAnchorDetectionIsEnabled(Bool
) Enables anchor detection on this interface if supported.
func _setPlayAreaMode(XRInterface.PlayAreaMode
) -> Bool Set the play area mode for this interface.
func _supportsPlayAreaMode(XRInterface.PlayAreaMode
) -> Bool Returns
true
if this interface supports this play area mode.func _triggerHapticPulse(actionName: String, trackerName: StringName, frequency: Double, amplitude: Double, durationSec: Double, delaySec: Double
) Triggers a haptic pulse to be emitted on the specified tracker.
func _uninitialize(
) Uninitialize the interface.