Skip to content

XRInterfaceExtension

Inherits: XRInterface < RefCounted < Object

Base class for XR interface extensions (plugins).

External XR interface plugins should inherit from this class.

Returns Method
void _end_frame() virtual
bool _get_anchor_detection_is_enabled() virtual const
int _get_camera_feed_id() virtual const
Array[Transform3D] _get_camera_offsets(tracker_name: StringName) virtual
Array[Projection] _get_camera_projections(tracker_name: StringName, aspect: float, z_near: float, z_far: float) virtual
Transform3D _get_camera_transform() virtual
int _get_capabilities() virtual const
RID _get_color_texture() virtual
RID _get_depth_texture() virtual
StringName _get_name() virtual const
PackedVector3Array _get_play_area() virtual const
XRInterface.PlayAreaMode _get_play_area_mode() virtual const
Vector2 _get_render_target_size() virtual
PackedStringArray _get_suggested_pose_names(tracker_name: StringName) virtual const
PackedStringArray _get_suggested_tracker_names() virtual const
Dictionary _get_system_info() virtual const
XRInterface.TrackingStatus _get_tracking_status() virtual const
RID _get_velocity_texture() virtual
int _get_view_count() virtual
RID _get_vrs_texture() virtual
XRInterface.VRSTextureFormat _get_vrs_texture_format() virtual
bool _initialize() virtual
bool _is_initialized() virtual const
void _post_draw_viewport(render_target: RID, screen_rect: Rect2) virtual
bool _pre_draw_viewport(render_target: RID) virtual
void _pre_render() virtual
void _process() virtual
void _set_anchor_detection_is_enabled(enabled: bool) virtual
bool _set_play_area_mode(mode: XRInterface.PlayAreaMode) virtual const
bool _supports_play_area_mode(mode: XRInterface.PlayAreaMode) virtual const
void _trigger_haptic_pulse(action_name: String, tracker_name: StringName, frequency: float, amplitude: float, duration_sec: float, delay_sec: float) virtual
void _uninitialize() virtual
void add_blit(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)
RID get_color_texture()
RID get_depth_texture()
RID get_render_target_texture(render_target: RID)
RID get_velocity_texture()

_end_frame

void _end_frame() virtual

Called if interface is active and queues have been submitted.

_get_anchor_detection_is_enabled

bool _get_anchor_detection_is_enabled() virtual const

Return true if anchor detection is enabled for this interface.

_get_camera_feed_id

int _get_camera_feed_id() virtual const

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

_get_camera_offsets

Array[Transform3D] _get_camera_offsets(tracker_name: StringName) virtual

Gets an array of offset transforms for each view for tracker tracker_name. tracker_name must refer to an XRPositionalTracker used as a camera. Returns an empty array if this interface is not responsible for this tracker.

_get_camera_projections

Array[Projection] _get_camera_projections(tracker_name: StringName, aspect: float, z_near: float, z_far: float) virtual

Gets an array of projection matrices for each view for tracker tracker_name. tracker_name must refer to an XRPositionalTracker used as a camera. Returns an empty array if this interface is not responsible for this tracker.

_get_camera_transform

Transform3D _get_camera_transform() virtual

Returns the Transform3D that positions the XRCamera3D in the world.

_get_capabilities

int _get_capabilities() virtual const

Returns the capabilities of this interface.

_get_color_texture

RID _get_color_texture() virtual

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

_get_depth_texture

RID _get_depth_texture() virtual

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

_get_name

StringName _get_name() virtual const

Returns the name of this interface.

_get_play_area

PackedVector3Array _get_play_area() virtual const

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

_get_play_area_mode

XRInterface.PlayAreaMode _get_play_area_mode() virtual const

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

_get_render_target_size

Vector2 _get_render_target_size() virtual

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

_get_suggested_pose_names

PackedStringArray _get_suggested_pose_names(tracker_name: StringName) virtual const

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

_get_suggested_tracker_names

PackedStringArray _get_suggested_tracker_names() virtual const

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

_get_system_info

Dictionary _get_system_info() virtual const

Returns a Dictionary with system information related to this interface.

_get_tracking_status

XRInterface.TrackingStatus _get_tracking_status() virtual const

Returns the current status of our tracking.

_get_velocity_texture

RID _get_velocity_texture() virtual

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

_get_view_count

int _get_view_count() virtual

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

_get_vrs_texture

RID _get_vrs_texture() virtual

_get_vrs_texture_format

XRInterface.VRSTextureFormat _get_vrs_texture_format() virtual

Returns the format of the texture returned by _get_vrs_texture().

_initialize

bool _initialize() virtual

Initializes the interface, returns true on success.

_is_initialized

bool _is_initialized() virtual const

Returns true if this interface has been initialized.

_post_draw_viewport

void _post_draw_viewport(render_target: RID, screen_rect: Rect2) virtual

Called after the XR Viewport draw logic has completed.

_pre_draw_viewport

bool _pre_draw_viewport(render_target: RID) 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.

_pre_render

void _pre_render() virtual

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

_process

void _process() 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.

_set_anchor_detection_is_enabled

void _set_anchor_detection_is_enabled(enabled: bool) virtual

Enables anchor detection on this interface if supported.

_set_play_area_mode

bool _set_play_area_mode(mode: XRInterface.PlayAreaMode) virtual const

Set the play area mode for this interface.

_supports_play_area_mode

bool _supports_play_area_mode(mode: XRInterface.PlayAreaMode) virtual const

Returns true if this interface supports this play area mode.

_trigger_haptic_pulse

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

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

_uninitialize

void _uninitialize() virtual

Uninitialize the interface.

add_blit

void add_blit(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)

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

get_color_texture

RID get_color_texture()

get_depth_texture

RID get_depth_texture()

get_render_target_texture

RID get_render_target_texture(render_target: RID)

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

get_velocity_texture

RID get_velocity_texture()