reckfellENGINE

XRInterface

Base class for an XR interface implementation.

On this page
class XRInterfaceReckfellSharpInherits RefCounted

Base class for an XR interface implementation.

This class needs to be implemented to make an AR or VR platform available to Reckfell and these should be implemented as C++ modules or ReckfellExtension modules. Part of the interface is exposed to C# so you can detect, enable and configure an AR or VR platform. Interfaces should be written in such a way that simply enabling them will give us a working setup. You can query the available interfaces through XRServer.

Declarations checked against C# SDK 1.0.0. Expand a name to see declarations and documentation.

Properties4

ArIsAnchorDetectionEnabledProperty
# ArIsAnchorDetectionEnabled
C#
public bool ArIsAnchorDetectionEnabled { get; set; }

On an AR interface, true if anchor detection is enabled.

EnvironmentBlendModeProperty
# EnvironmentBlendMode
C#
public XRInterface.EnvironmentBlendModeEnum EnvironmentBlendMode { get; set; }

Requested interface composition mode. The base getter returns Opaque; OpenXR can emulate AlphaBlend with another internal mode. The property setter reports no rejection: use SetEnvironmentBlendMode to handle success. Not a camera-video readiness flag or a TransparentBg setting.

InterfaceIsPrimaryProperty
# InterfaceIsPrimary
C#
public bool InterfaceIsPrimary { get; set; }

true if this is the primary interface.

XRPlayAreaModeProperty
# XRPlayAreaMode
C#
public XRInterface.PlayAreaMode XRPlayAreaMode { get; set; }

The play area mode for this interface.

Methods30

GetAnchorDetectionIsEnabledbool
# GetAnchorDetectionIsEnabled
C#
public bool GetAnchorDetectionIsEnabled();
Returns bool
GetCameraFeedIdint
# GetCameraFeedId
C#
public int GetCameraFeedId();

If this is an AR interface that requires displaying a camera feed as the background, this method returns the feed ID in the CameraServer for this interface.

Returns int
GetCameraOffsetsReckfell.Collections.Array<Transform3D>
# GetCameraOffsets
C#
public Reckfell.Collections.Array<Transform3D> GetCameraOffsets(StringName trackerName);

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.

Parameters
NameTypeDefault
trackerNameStringName—
Returns Reckfell.Collections.Array<Transform3D>
GetCameraProjectionsReckfell.Collections.Array<Projection>
# GetCameraProjections
C#
public Reckfell.Collections.Array<Projection> GetCameraProjections(StringName trackerName, double aspect, double near, double far);

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.

Parameters
NameTypeDefault
trackerNameStringName—
aspectdouble—
neardouble—
fardouble—
Returns Reckfell.Collections.Array<Projection>
GetCapabilitiesuint
# GetCapabilities
C#
public uint GetCapabilities();

Returns a combination of XRInterface.Capabilities flags providing information about the capabilities of this interface.

Returns uint
GetEnvironmentBlendModeXRInterface.EnvironmentBlendModeEnum
# GetEnvironmentBlendMode
C#
public XRInterface.EnvironmentBlendModeEnum GetEnvironmentBlendMode();

Returns the implementation-reported mode: requested mode in OpenXR, Opaque in the base interface. Establishes no active session, focus, video delivery or user consent. Configure Viewport background transparency separately for alpha.

Returns XRInterface.EnvironmentBlendModeEnum

Interface-reported mode, not a guarantee of video delivery.

GetNameStringName
# GetName
C#
public StringName GetName();

Returns the name of this interface ("OpenXR", "OpenVR", "OpenHMD", "ARKit", etc.).

Returns StringName
GetPlayAreaVector3[]
# GetPlayArea
C#
public Vector3[] GetPlayArea();

Returns an array of vectors that represent the physical play area mapped to the virtual space around the XROrigin3D point. The points form a convex polygon that can be used to react to or visualize the play area. This returns an empty array if this feature is not supported or if the information is not yet available.

Returns Vector3[]
GetPlayAreaModeXRInterface.PlayAreaMode
# GetPlayAreaMode
C#
public XRInterface.PlayAreaMode GetPlayAreaMode();
Returns XRInterface.PlayAreaMode
GetProjectionForViewProjection · Deprecated
# GetProjectionForView
C#
public Projection GetProjectionForView(uint view, double aspect, double near, double far);

Returns the projection matrix for a view/eye.

Parameters
NameTypeDefault
viewuint—
aspectdouble—
neardouble—
fardouble—
Returns Projection
GetRenderTargetSizeVector2
# GetRenderTargetSize
C#
public Vector2 GetRenderTargetSize();

Returns the resolution at which we should render our intermediate results before things like lens distortion are applied by the VR platform.

Returns Vector2
GetSupportedEnvironmentBlendModesReckfell.Collections.Array
# GetSupportedEnvironmentBlendModes
C#
public Reckfell.Collections.Array GetSupportedEnvironmentBlendModes();

Returns a new container of EnvironmentBlendModeEnum values. The base implementation contains Opaque; OpenXR without an internal API returns an empty list and can add emulated AlphaBlend after startup. Check membership through Contains, not an index converted to bool. Dispose the container, not the borrowed interface.

Returns Reckfell.Collections.Array

New Array of enum values, possibly empty. Check membership of the requested mode.

GetSystemInfoReckfell.Collections.Dictionary
# GetSystemInfo
C#
public Reckfell.Collections.Dictionary GetSystemInfo();

Returns a Reckfell.Collections.Dictionary with extra system info. Interfaces are expected to return XRRuntimeName and XRRuntimeVersion providing info about the used XR runtime. Additional entries may be provided specific to an interface. **Note:**This information may only be available after XRInterface.Initialize was successfully called.

Returns Reckfell.Collections.Dictionary
GetTrackingStatusXRInterface.TrackingStatus
# GetTrackingStatus
C#
public XRInterface.TrackingStatus GetTrackingStatus();

If supported, returns the status of our tracking. This will allow you to provide feedback to the user whether there are issues with positional tracking.

Returns XRInterface.TrackingStatus
GetTransformForViewTransform3D · Deprecated
# GetTransformForView
C#
public Transform3D GetTransformForView(uint view, Transform3D camTransform);

Returns the transform for a view/eye. view is the view/eye index. cam_transform is the transform that maps device coordinates to scene coordinates, typically the Entity3D.GlobalTransform of the current XROrigin3D.

Parameters
NameTypeDefault
viewuint—
camTransformTransform3D—
Returns Transform3D
GetViewCountuint
# GetViewCount
C#
public uint GetViewCount();

Returns the number of views that need to be rendered for this device. 1 for Monoscopic, 2 for Stereoscopic.

Returns uint
Initializebool
# Initialize
C#
public bool Initialize();

Call this to initialize this interface. The first interface that is initialized is identified as the primary interface and it will be used for rendering output. After initializing the interface you want to use you then need to enable the AR/VR mode of a viewport and rendering should commence. Note: You must enable the XR mode on the main viewport for any device that uses the main output of Reckfell, such as for mobile VR. If you do this for a platform that handles its own output (such as OpenVR) Reckfell will show just one eye without distortion on screen. Alternatively, you can add a separate viewport node to your scene and enable AR/VR on that viewport. It will be used to output to the HMD, leaving you free to do anything you like in the main window, such as using a separate camera as a spectator camera or rendering something completely different. While currently not used, you can activate additional interfaces. You may wish to do this if you want to track controllers from other platforms. However, at this point in time only one interface can render to an HMD.

Returns bool
IsInitializedbool
# IsInitialized
C#
public bool IsInitialized();

Returns true if this interface has been initialized.

Returns bool
IsPassthroughEnabledbool · Deprecated
# IsPassthroughEnabled
C#
public bool IsPassthroughEnabled();

Obsolete. Compare GetEnvironmentBlendMode() with AlphaBlend instead. OpenXR only compares its reported mode, not camera frames, session focus or permissions; the base interface returns false.

Returns bool

Legacy comparison with AlphaBlend, not a hardware video check.

IsPassthroughSupportedbool · Deprecated
# IsPassthroughSupported
C#
public bool IsPassthroughSupported();

Obsolete; use GetSupportedEnvironmentBlendModes and AlphaBlend membership. Current OpenXR has a defect: find returns an index converted to bool; −1 becomes true and index 0 false. True for an empty uninitialized list was reproduced. Not fixed; do not use this result as a capability gate.

Returns bool

Unreliable legacy bool in current OpenXR; an empty list incorrectly yields true.

IsPrimarybool
# IsPrimary
C#
public bool IsPrimary();
Returns bool
SetAnchorDetectionIsEnabledvoid
# SetAnchorDetectionIsEnabled
C#
public void SetAnchorDetectionIsEnabled(bool enable);
Parameters
NameTypeDefault
enablebool—
SetEnvironmentBlendModebool
# SetEnvironmentBlendMode
C#
public bool SetEnvironmentBlendMode(XRInterface.EnvironmentBlendModeEnum mode);

Requests a mode and returns the implementation setter result. Check supported modes and the bool; change TransparentBg separately only after acceptance. OpenXR without an API returns false, while its internal API can retain a request before initialization for later validation. Success establishes neither video nor focus.

Parameters
NameTypeDefault
modeXRInterface.EnvironmentBlendModeEnum—
mode

Requested Opaque, Additive or AlphaBlend from supported modes, not a list index.

Returns bool

Whether the implementation accepted the request; not a check of Viewport transparency or passthrough quality.

SetPlayAreaModebool
# SetPlayAreaMode
C#
public bool SetPlayAreaMode(XRInterface.PlayAreaMode mode);

Sets the active play area mode, will return false if the mode can't be used with this interface. Note: Changing this after the interface has already been initialized can be jarring for the player, so it's recommended to recenter on the HMD with XRServer.CenterOnHmd (if switching to XRInterface.PlayAreaMode.Stage) or make the switch during a scene change.

Parameters
NameTypeDefault
modeXRInterface.PlayAreaMode—
Returns bool
SetPrimaryvoid
# SetPrimary
C#
public void SetPrimary(bool primary);
Parameters
NameTypeDefault
primarybool—
StartPassthroughbool · Deprecated
# StartPassthrough
C#
public bool StartPassthrough();

Obsolete. OpenXR simply calls SetEnvironmentBlendMode(AlphaBlend); the base implementation returns false. Enables no Viewport transparency and initializes no session. New code should explicitly check supported modes and SetEnvironmentBlendMode success.

Returns bool

Legacy AlphaBlend request result, not scene-configuration success.

StopPassthroughvoid · Deprecated
# StopPassthrough
C#
public void StopPassthrough();

Obsolete. OpenXR requests Opaque without returning success; the base implementation does nothing. Restores neither the previous blend mode nor TransparentBg. Save state and perform an explicit reverse switch with a checked bool.

SupportsPlayAreaModebool
# SupportsPlayAreaMode
C#
public bool SupportsPlayAreaMode(XRInterface.PlayAreaMode mode);

Call this to find out if a given play area mode is supported by this interface.

Parameters
NameTypeDefault
modeXRInterface.PlayAreaMode—
Returns bool
TriggerHapticPulsevoid
# TriggerHapticPulse
C#
public void TriggerHapticPulse(string actionName, StringName trackerName, double frequency, double amplitude, double durationSec, double delaySec);

Triggers a haptic pulse on a device associated with this interface. action_name is the name of the action for this pulse. tracker_name is optional and can be used to direct the pulse to a specific device provided that device is bound to this haptic. frequency is the frequency of the pulse, set to 0.0 to have the system use a default frequency. amplitude is the amplitude of the pulse between 0.0 and 1.0. duration_sec is the duration of the pulse in seconds. delay_sec is a delay in seconds before the pulse is given.

Parameters
NameTypeDefault
actionNamestring—
trackerNameStringName—
frequencydouble—
amplitudedouble—
durationSecdouble—
delaySecdouble—
Uninitializevoid
# Uninitialize
C#
public void Uninitialize();

Turns the interface off.

Signals and events1

PlayAreaChangedEvent
# PlayAreaChanged
C#
public event XRInterface.PlayAreaChangedEventHandler PlayAreaChanged;

Emitted when the play area is changed. This can be a result of the player resetting the boundary or entering a new play area, the player changing the play area mode, the world scale changing or the player resetting their headset orientation.

Handler parameters
NameTypeDefault
modelong—

XRInterface.Capabilities

ValueDescription
Ar = 16

This interface supports AR (video background and real world tracking).

External = 32

This interface outputs to an external device. If the main viewport is used, the on screen output is an unmodified buffer of either the left or right eye (stretched if the viewport size is not changed to the same aspect ratio of XRInterface.GetRenderTargetSize). Using a separate viewport node frees up the main viewport for other purposes.

Mono = 1

This interface can work with normal rendering output (non-HMD based AR).

None = 0

No XR capabilities.

Quad = 4

This interface supports quad rendering (not yet supported by Reckfell).

Stereo = 2

This interface supports stereoscopic rendering.

Vr = 8

This interface supports VR.

XRInterface.EnvironmentBlendModeEnum

ValueDescription
Additive = 1

Additive blend mode. This is typically used for AR devices or VR devices with passthrough.

AlphaBlend = 2

Alpha blend mode. This is typically used for AR or VR devices with passthrough capabilities. The alpha channel controls how much of the passthrough is visible. Alpha of 0.0 means the passthrough is visible and this pixel works in ADDITIVE mode. Alpha of 1.0 means that the passthrough is not visible and this pixel works in OPAQUE mode.

Opaque = 0

Opaque blend mode. This is typically used for VR devices.

XRInterface.PlayAreaMode

ValueDescription
Area3Dof = 1

Play area only supports orientation tracking, no positional tracking, area will center around player.

Custom = 2147483647

Custom play area set by a ReckfellExtension.

Roomscale = 3

Player is free to move around, full positional tracking.

Sitting = 2

Player is in seated position, limited positional tracking, fixed guardian around player.

Stage = 4

Same as XRInterface.PlayAreaMode.Roomscale but origin point is fixed to the center of the physical space. In this mode, system-level recentering may be disabled, requiring the use of XRServer.CenterOnHmd.

Unknown = 0

Play area mode not set or not available.

XRInterface.TrackingStatus

ValueDescription
ExcessiveMotion = 1

Tracking is hindered by excessive motion (the player is moving faster than tracking can keep up).

InsufficientFeatures = 2

Tracking is hindered by insufficient features, it's too dark (for camera-based tracking), player is blocked, etc.

NormalTracking = 0

Tracking is behaving as expected.

NotTracking = 4

Tracking is not functional (camera not plugged in or obscured, lighthouses turned off, etc.).

UnknownTracking = 3

We don't know the status of the tracking or this interface does not provide feedback.

XRInterface.VrsTextureFormat

ValueDescription
FragmentDensityMap = 2

The texture format is the same as expected by the Vulkan VK_EXT_fragment_density_map extension.

FragmentShadingRate = 1

The texture format is the same as expected by the Vulkan VK_KHR_fragment_shading_rate extension.

RasterizationRateMap = 3

The texture contains a Metal rasterizationRateMap, used for foveated rendering on Apple platforms. It's not a real texture, but instead an opaque wrapper for an MTLRasterizationRateMap object.

Unified = 0

The texture format is the same as returned by Xrvrs.MakeVrsTexture.

Reckfell Engine documentationBack to top ↑
QUICK LINKSGetting startedEntity hierarchyC# & .NET 10Scenes and prefabs
Reckfell guides and full API K
reckfellENGINE
RECKFELL ACCOUNT

Sign in

Sign in to your Reckfell account.

One account for the entire Reckfell platform.