UNPKG

@threlte/xr

Version:

Tools to more easily create VR and AR experiences with Threlte

47 lines (46 loc) 1.21 kB
import { inputSources } from './inputSources.svelte.js'; class Presenting { current = $state(false); } class IsHandTracking { get current() { return inputSources.current.some((s) => s.type === 'hand'); } } class Session { current = $state.raw(); } class ReferenceSpaceType { current = $state.raw(); } class XR { current = $state.raw(); } class LastSessionRequest { mode = $state.raw(); sessionInit = $state.raw(); } class PointerState { enabled = $state(false); hovering = $state(false); } class IntersectionState { left = $state.raw(); right = $state.raw(); } export const isPresenting = new Presenting(); export const isHandTracking = new IsHandTracking(); export const session = new Session(); export const referenceSpaceType = new ReferenceSpaceType(); export const xr = new XR(); export const lastSessionRequest = new LastSessionRequest(); export const teleportState = { left: new PointerState(), right: new PointerState() }; export const pointerState = { left: new PointerState(), right: new PointerState() }; export const teleportIntersection = new IntersectionState(); export const pointerIntersection = new IntersectionState();