@threlte/xr
Version:
Tools to more easily create VR and AR experiences with Threlte
52 lines (51 loc) • 2.21 kB
TypeScript
import { type Snippet } from 'svelte';
import type { XRSessionEvent } from '../types';
/**
* `<XR />` is a WebXR manager that configures your scene for XR rendering and interaction.
*
* This should be placed within a Threlte `<Canvas />`.
*
* ```svelte
* <XR
* foveation={1}
* frameRate={90}
* referenceSpace='local-floor'
* onsessionstart={(event: XREvent<XRManagerEvent>) => {}}
* onsessionend={(event: XREvent<XRManagerEvent>) => {}}
* onvisibilitychange={(event: XREvent<XRSessionEvent>) => {}}
* oninputsourceschange={(event: XREvent<XRSessionEvent>) => {}}
* />
* ```
*/
declare const Xr: import("svelte").Component<{
/**
* Enables foveated rendering. Default is `1`, the three.js default.
*
* 0 = no foveation, full resolution
*
* 1 = maximum foveation, the edges render at lower resolution
*/
foveation?: number;
/**
* The target framerate for the XRSystem. Smaller rates give more CPU headroom at the cost of responsiveness.
* Recommended range is `72`-`120`. Default is unset and left to the device.
* @note If your experience cannot effectively reach the target framerate, it will be subject to frame reprojection
* which will halve the effective framerate. Choose a conservative estimate that balances responsiveness and
* headroom based on your experience.
* @see https://developer.mozilla.org/en-US/docs/Web/API/WebXR_Device_API/Rendering#refresh_rate_and_frame_rate
*/
frameRate?: number | undefined;
/** Type of WebXR reference space to use. Default is `local-floor` */
referenceSpace?: XRReferenceSpaceType;
fallback?: Snippet;
children?: Snippet;
/** Called as an XRSession is requested */
onsessionstart?: (event: XRSessionEvent<"sessionstart">) => void;
/** Called after an XRSession is terminated */
onsessionend?: (event: XRSessionEvent<"sessionend">) => void;
/** Called when an XRSession is hidden or unfocused. */
onvisibilitychange?: (event: globalThis.XRSessionEvent) => void;
/** Called when available inputsources change */
oninputsourceschange?: (event: globalThis.XRSessionEvent) => void;
}, {}, "">;
export default Xr;