Table of Contents

Class XRInterfaceExtension

Base class for XR interface extensions (plugins).

Inheritance
XRInterfaceExtension

Remarks

External XR interface plugins should inherit from this class.

See Also

Methods

_end_frame

Qualifiers: virtual

Called if interface is active and queues have been submitted.

void _end_frame

_get_anchor_detection_is_enabled

Qualifiers: virtualconst

Return true if anchor detection is enabled for this interface.

bool _get_anchor_detection_is_enabled

_get_camera_feed_id

Qualifiers: virtualconst

Returns the camera feed ID for the CameraFeed registered with the CameraServer that should be presented as the background on an AR capable device (if applicable).

int _get_camera_feed_id

_get_camera_transform

Qualifiers: virtual

Returns the Transform3D that positions the XRCamera3D in the world.

Transform3D _get_camera_transform

_get_capabilities

Qualifiers: virtualconst

Returns the capabilities of this interface.

int _get_capabilities

_get_color_texture

Qualifiers: virtual

Return color texture into which to render (if applicable).

RID _get_color_texture

_get_depth_texture

Qualifiers: virtual

Return depth texture into which to render (if applicable).

RID _get_depth_texture

_get_name

Qualifiers: virtualconst

Returns the name of this interface.

StringName _get_name

_get_play_area

Qualifiers: virtualconst

Returns a PackedVector3Array that represents the play areas boundaries (if applicable).

PackedVector3Array _get_play_area

_get_play_area_mode

Qualifiers: virtualconst

Returns the play area mode that sets up our play area.

int _get_play_area_mode

_get_projection_for_view(int, float, float, float)

Qualifiers: virtual

Returns the projection matrix for the given view as a PackedFloat64Array.

PackedFloat64Array _get_projection_for_view(int view, float aspect, float z_near, float z_far)

Parameters

view int
aspect float
z_near float
z_far float

_get_render_target_size

Qualifiers: virtual

Returns the size of our render target for this interface, this overrides the size of the Viewport marked as the xr viewport.

Vector2 _get_render_target_size

_get_suggested_pose_names(StringName)

Qualifiers: virtualconst

Returns a PackedStringArray with pose names configured by this interface. Note that user configuration can override this list.

PackedStringArray _get_suggested_pose_names(StringName tracker_name)

Parameters

tracker_name StringName

_get_suggested_tracker_names

Qualifiers: virtualconst

Returns a PackedStringArray with tracker names configured by this interface. Note that user configuration can override this list.

PackedStringArray _get_suggested_tracker_names

_get_system_info

Qualifiers: virtualconst

Returns a Dictionary with system information related to this interface.

Dictionary _get_system_info

_get_tracking_status

Qualifiers: virtualconst

Returns a TrackingStatus specifying the current status of our tracking.

int _get_tracking_status

_get_transform_for_view(int, Transform3D)

Qualifiers: virtual

Returns a Transform3D for a given view.

Transform3D _get_transform_for_view(int view, Transform3D cam_transform)

Parameters

view int
cam_transform Transform3D

_get_velocity_texture

Qualifiers: virtual

Return velocity texture into which to render (if applicable).

RID _get_velocity_texture

_get_view_count

Qualifiers: virtual

Returns the number of views this interface requires, 1 for mono, 2 for stereoscopic.

int _get_view_count

_get_vrs_texture

Qualifiers: virtual

RID _get_vrs_texture

_initialize

Qualifiers: virtual

Initializes the interface, returns true on success.

bool _initialize

_is_initialized

Qualifiers: virtualconst

Returns true if this interface has been initialized.

bool _is_initialized

_post_draw_viewport(RID, Rect2)

Qualifiers: virtual

Called after the XR Viewport draw logic has completed.

void _post_draw_viewport(RID render_target, Rect2 screen_rect)

Parameters

render_target RID
screen_rect Rect2

_pre_draw_viewport(RID)

Qualifiers: virtual

Called if this is our primary XRInterfaceExtension before we start processing a Viewport for every active XR Viewport, returns true if that viewport should be rendered. An XR interface may return false if the user has taken off their headset and we can pause rendering.

bool _pre_draw_viewport(RID render_target)

Parameters

render_target RID

_pre_render

Qualifiers: virtual

Called if this XRInterfaceExtension is active before rendering starts. Most XR interfaces will sync tracking at this point in time.

void _pre_render

_process

Qualifiers: virtual

Called if this XRInterfaceExtension is active before our physics and game process is called. Most XR interfaces will update its XRPositionalTrackers at this point in time.

void _process

_set_anchor_detection_is_enabled(bool)

Qualifiers: virtual

Enables anchor detection on this interface if supported.

void _set_anchor_detection_is_enabled(bool enabled)

Parameters

enabled bool

_set_play_area_mode(int)

Qualifiers: virtualconst

Set the play area mode for this interface.

bool _set_play_area_mode(int mode)

Parameters

mode int

_supports_play_area_mode(int)

Qualifiers: virtualconst

Returns true if this interface supports this play area mode.

bool _supports_play_area_mode(int mode)

Parameters

mode int

_trigger_haptic_pulse(String, StringName, float, float, float, float)

Qualifiers: virtual

Triggers a haptic pulse to be emitted on the specified tracker.

void _trigger_haptic_pulse(String action_name, StringName tracker_name, float frequency, float amplitude, float duration_sec, float delay_sec)

Parameters

action_name String
tracker_name StringName
frequency float
amplitude float
duration_sec float
delay_sec float

_uninitialize

Qualifiers: virtual

Uninitialize the interface.

void _uninitialize

add_blit(RID, Rect2, Rect2i, bool, int, bool, Vector2, float, float, float, float)

Blits our render results to screen optionally applying lens distortion. This can only be called while processing _commit_views.

void add_blit(RID render_target, Rect2 src_rect, Rect2i dst_rect, bool use_layer, int layer, bool apply_lens_distortion, Vector2 eye_center, float k1, float k2, float upscale, float aspect_ratio)

Parameters

render_target RID
src_rect Rect2
dst_rect Rect2i
use_layer bool
layer int
apply_lens_distortion bool
eye_center Vector2
k1 float
k2 float
upscale float
aspect_ratio float

get_color_texture

RID get_color_texture

get_depth_texture

RID get_depth_texture

get_render_target_texture(RID)

Returns a valid RID for a texture to which we should render the current frame if supported by the interface.

RID get_render_target_texture(RID render_target)

Parameters

render_target RID

get_velocity_texture

RID get_velocity_texture