XRInterface
Base class for an XR interface implementation.
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
public bool ArIsAnchorDetectionEnabled { get; set; }On an AR interface, true if anchor detection is enabled.
EnvironmentBlendModeProperty
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
public bool InterfaceIsPrimary { get; set; }true if this is the primary interface.
XRPlayAreaModeProperty
public XRInterface.PlayAreaMode XRPlayAreaMode { get; set; }The play area mode for this interface.
Methods30
GetAnchorDetectionIsEnabledbool
public bool GetAnchorDetectionIsEnabled();boolGetCameraFeedIdint
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.
intGetCameraOffsetsReckfell.Collections.Array<Transform3D>
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.
| Name | Type | Default |
|---|---|---|
trackerName | StringName | — |
Reckfell.Collections.Array<Transform3D>GetCameraProjectionsReckfell.Collections.Array<Projection>
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.
| Name | Type | Default |
|---|---|---|
trackerName | StringName | — |
aspect | double | — |
near | double | — |
far | double | — |
Reckfell.Collections.Array<Projection>GetCapabilitiesuint
public uint GetCapabilities();Returns a combination of XRInterface.Capabilities flags providing information about the capabilities of this interface.
uintGetEnvironmentBlendModeXRInterface.EnvironmentBlendModeEnum
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.
XRInterface.EnvironmentBlendModeEnumInterface-reported mode, not a guarantee of video delivery.
GetNameStringName
public StringName GetName();Returns the name of this interface ("OpenXR", "OpenVR", "OpenHMD", "ARKit", etc.).
StringNameGetPlayAreaVector3[]
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.
Vector3[]GetPlayAreaModeXRInterface.PlayAreaMode
public XRInterface.PlayAreaMode GetPlayAreaMode();XRInterface.PlayAreaModeGetProjectionForViewProjection · Deprecated
public Projection GetProjectionForView(uint view, double aspect, double near, double far);Returns the projection matrix for a view/eye.
| Name | Type | Default |
|---|---|---|
view | uint | — |
aspect | double | — |
near | double | — |
far | double | — |
ProjectionGetRenderTargetSizeVector2
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.
Vector2GetSupportedEnvironmentBlendModesReckfell.Collections.Array
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.
Reckfell.Collections.ArrayNew Array of enum values, possibly empty. Check membership of the requested mode.
GetSystemInfoReckfell.Collections.Dictionary
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.
Reckfell.Collections.DictionaryGetTrackingStatusXRInterface.TrackingStatus
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.
XRInterface.TrackingStatusGetTransformForViewTransform3D · Deprecated
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.
| Name | Type | Default |
|---|---|---|
view | uint | — |
camTransform | Transform3D | — |
Transform3DGetViewCountuint
public uint GetViewCount();Returns the number of views that need to be rendered for this device. 1 for Monoscopic, 2 for Stereoscopic.
uintInitializebool
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.
boolIsInitializedbool
public bool IsInitialized();Returns true if this interface has been initialized.
boolIsPassthroughEnabledbool · Deprecated
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.
boolLegacy comparison with AlphaBlend, not a hardware video check.
IsPassthroughSupportedbool · Deprecated
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.
boolUnreliable legacy bool in current OpenXR; an empty list incorrectly yields true.
IsPrimarybool
public bool IsPrimary();boolSetAnchorDetectionIsEnabledvoid
public void SetAnchorDetectionIsEnabled(bool enable);| Name | Type | Default |
|---|---|---|
enable | bool | — |
SetEnvironmentBlendModebool
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.
| Name | Type | Default |
|---|---|---|
mode | XRInterface.EnvironmentBlendModeEnum | — |
modeRequested Opaque, Additive or AlphaBlend from supported modes, not a list index.
boolWhether the implementation accepted the request; not a check of Viewport transparency or passthrough quality.
SetPlayAreaModebool
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.
| Name | Type | Default |
|---|---|---|
mode | XRInterface.PlayAreaMode | — |
boolSetPrimaryvoid
public void SetPrimary(bool primary);| Name | Type | Default |
|---|---|---|
primary | bool | — |
StartPassthroughbool · Deprecated
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.
boolLegacy AlphaBlend request result, not scene-configuration success.
StopPassthroughvoid · Deprecated
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
public bool SupportsPlayAreaMode(XRInterface.PlayAreaMode mode);Call this to find out if a given play area mode is supported by this interface.
| Name | Type | Default |
|---|---|---|
mode | XRInterface.PlayAreaMode | — |
boolTriggerHapticPulsevoid
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.
| Name | Type | Default |
|---|---|---|
actionName | string | — |
trackerName | StringName | — |
frequency | double | — |
amplitude | double | — |
durationSec | double | — |
delaySec | double | — |
Uninitializevoid
public void Uninitialize();Turns the interface off.
Signals and events1
PlayAreaChangedEvent
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.
| Name | Type | Default |
|---|---|---|
mode | long | — |
XRInterface.Capabilities
| Value | Description |
|---|---|
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 |
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
| Value | Description |
|---|---|
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
| Value | Description |
|---|---|
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 |
Unknown = 0 | Play area mode not set or not available. |
XRInterface.TrackingStatus
| Value | Description |
|---|---|
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
| Value | Description |
|---|---|
FragmentDensityMap = 2 | The texture format is the same as expected by the Vulkan |
FragmentShadingRate = 1 | The texture format is the same as expected by the Vulkan |
RasterizationRateMap = 3 | The texture contains a Metal |
Unified = 0 | The texture format is the same as returned by |