ReadonlysessionReadonlybindingReadonlylayerReadonlyreferenceReadonlycolorReadonlymodeThe mode this session was created with ('immersive-vr' | 'immersive-ar'
| 'inline').
Fired when the session ends (user exits, headset removed, end()).
True once the underlying session has ended.
True for an 'immersive-ar' session — the caller should render a
transparent background so the camera passthrough shows through.
How the runtime composites this session over the real world. 'opaque'
for VR (and the safe default on UAs that don't expose the field);
'alpha-blend' / 'additive' for AR passthrough.
True when the composited output blends over a real-world view, i.e. the
engine must produce a transparent (alpha < 1) background. Covers both
'alpha-blend' (video passthrough) and 'additive' (optical see-through).
StaticisWhether the browser exposes WebXR and the WebGPU-XR binding for the given
mode. Returns false (never throws) when navigator.xr or XRGPUBinding is
absent, so callers can use it to decide whether to show an "Enter VR" UI.
StaticcreateRequest an immersive session and wire up the WebGPU projection layer.
Must be called from within a user-gesture handler (browser requirement).
The ctx device must have been created with xrCompatible: true.
Schedule the next XR frame. Mirrors window.requestAnimationFrame but is
driven by the headset's compositor and supplies an XRFrame.
Resolve the per-eye views for this frame. Returns an empty array when the pose is unavailable (tracking lost) — the caller should skip rendering that frame. Each returned matrix is already in Taos/WebGPU conventions.
End the session (also fires onEnd). Safe to call more than once.
Detach listeners. Does not end the session — call end for that.
Thin wrapper over a WebGPU-backed immersive WebXR session: owns the
XRSession, theXRGPUBinding, the projection layer and the reference space, and turns eachXRFrameinto a list of XrEyeViews the engine can render. This is the single place that touches the (draft) WebGPU-XR API; everything downstream is plain TaosMat4/GPUTexture.Lifecycle:
await XrSession.isSupported()— gate a UI "Enter VR" button.const xr = await XrSession.create(engine.ctx)— inside a user gesture.engine.enterXR(xr)— the engine swaps its rAF loop to this session.await xr.end()(or the user removes the headset) →onEndfires.