@margoengine/xr 0.0.0-stage → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (52) hide show
  1. package/LICENSE +201 -0
  2. package/NOTICE +4 -0
  3. package/README.md +842 -2
  4. package/dist/ar-extra.d.ts +232 -0
  5. package/dist/ar-extra.js +315 -0
  6. package/dist/ar.d.ts +177 -0
  7. package/dist/ar.js +195 -0
  8. package/dist/body.d.ts +58 -0
  9. package/dist/body.js +134 -0
  10. package/dist/controller.d.ts +32 -0
  11. package/dist/device-check.d.ts +39 -0
  12. package/dist/device-check.js +155 -0
  13. package/dist/errors-XvcwUnU4.js +7 -0
  14. package/dist/eye-target.d.ts +25 -0
  15. package/dist/eyes.d.ts +45 -0
  16. package/dist/gizmo.d.ts +165 -0
  17. package/dist/gizmo.js +198 -0
  18. package/dist/hands.d.ts +48 -0
  19. package/dist/hands.js +198 -0
  20. package/dist/hit-test.d.ts +69 -0
  21. package/dist/index.d.ts +148 -0
  22. package/dist/index.js +1103 -0
  23. package/dist/interaction.d.ts +136 -0
  24. package/dist/interaction.js +205 -0
  25. package/dist/launch.d.ts +65 -0
  26. package/dist/launch.js +54 -0
  27. package/dist/layers-BTUTAawG.js +391 -0
  28. package/dist/layers.d.ts +247 -0
  29. package/dist/layers.js +1 -0
  30. package/dist/locomotion.d.ts +63 -0
  31. package/dist/locomotion.js +184 -0
  32. package/dist/models.d.ts +136 -0
  33. package/dist/models.js +335 -0
  34. package/dist/near.d.ts +465 -0
  35. package/dist/near.js +643 -0
  36. package/dist/occlusion.d.ts +49 -0
  37. package/dist/occlusion.js +218 -0
  38. package/dist/performance.d.ts +67 -0
  39. package/dist/performance.js +78 -0
  40. package/dist/pointer.d.ts +93 -0
  41. package/dist/pointer.js +205 -0
  42. package/dist/reflection.d.ts +70 -0
  43. package/dist/reflection.js +147 -0
  44. package/dist/renderer.d.ts +21 -0
  45. package/dist/scene-owner-BRObO-WJ.js +15 -0
  46. package/dist/scene-owner.d.ts +3 -0
  47. package/dist/scene-scope-DufD_3B6.js +42 -0
  48. package/dist/session.d.ts +60 -0
  49. package/dist/session.js +68 -0
  50. package/dist/shared/xr-run.d.ts +64 -0
  51. package/dist/types.d.ts +221 -0
  52. package/package.json +152 -4
@@ -0,0 +1,70 @@
1
+ import { ARLight, type ARHost } from './ar.js';
2
+ import type { XREyeTarget } from './eye-target.js';
3
+ /** What {@link ARReflection.create} needs of an `XR`. */
4
+ export interface ARReflectionHost extends ARHost {
5
+ onEye(callback: (target: XREyeTarget) => void): () => void;
6
+ }
7
+ /** The part of an `Environment` that {@link ARReflection.attach} drives. */
8
+ export interface ReflectionEnvironment {
9
+ refresh(): Promise<void>;
10
+ }
11
+ /** Options for {@link ARReflection.create}. */
12
+ export interface ARReflectionOptions {
13
+ /** The engine's device (`engine.gpu`). */
14
+ device: GPUDevice;
15
+ /** An ARLight whose probe and estimate to use; one is made, and stopped with this, when left out. */
16
+ light?: ARLight;
17
+ /** Edge of the cube made from spherical harmonics, a power of two from 8 to 256. Default 32. */
18
+ size?: number;
19
+ /** Format asked of the browser's cube map. Default 'rgba16f'. */
20
+ reflectionFormat?: 'srgb8' | 'rgba16f';
21
+ /** Fewest milliseconds between two repaints from spherical harmonics. Default 500. */
22
+ interval?: number;
23
+ /** Paint from spherical harmonics even where the binding gives the browser's cube map. Default false. */
24
+ forceSH?: boolean;
25
+ }
26
+ /** Where the cube's pixels come from. */
27
+ export type ReflectionSource = 'binding' | 'sh';
28
+ /**
29
+ * Paints the cube of the room's radiance from the nine RGB spherical harmonics `sh` (`k * 3 + channel`, the order of
30
+ * `@margoengine/math` SH3) into `rgba16float` words: 6 faces of `size * size` texels, 4 words each, row 0 at the top.
31
+ */
32
+ export declare function paintCubeFromSH(sh: ArrayLike<number>, size: number): Uint16Array;
33
+ /**
34
+ * The AR room's light as a cube texture for the scene's specular reflections, in a session started with the
35
+ * 'light-estimation' feature. Read `texture` after `await reflection.ready`, make an Environment from it and
36
+ * `attach` the Environment so it is filtered again each time the room's light changes.
37
+ * @throws RangeError for a bad `size` or `interval`; MargoError 'state' and 'unsupported' as {@link ARLight.create}.
38
+ */
39
+ export declare class ARReflection {
40
+ private readonly host;
41
+ private readonly light;
42
+ private readonly ownsLight;
43
+ private readonly options;
44
+ /** Resolves with the cube texture once the first estimate arrived. */
45
+ readonly ready: Promise<GPUTexture>;
46
+ /** Where the last paint came from; null before the first. */
47
+ source: ReflectionSource | null;
48
+ /** Count of repaints. */
49
+ updates: number;
50
+ private cube;
51
+ private environment;
52
+ private binding;
53
+ private dirty;
54
+ private last;
55
+ private painted;
56
+ private resolve;
57
+ private disposed;
58
+ private readonly stops;
59
+ private constructor();
60
+ static create(xr: ARReflectionHost, options: ARReflectionOptions): Promise<ARReflection>;
61
+ /** The cube texture (rgba16float, 6 layers, COPY_SRC), or null before the first estimate. */
62
+ get texture(): GPUTexture | null;
63
+ /** Gives the Environment made from `texture`; it is refreshed after each repaint. */
64
+ attach(environment: ReflectionEnvironment): void;
65
+ private update;
66
+ private ensure;
67
+ /** Stops following the room and frees the cube texture; the light it made is stopped too. */
68
+ dispose(): void;
69
+ [Symbol.dispose](): void;
70
+ }
@@ -0,0 +1,147 @@
1
+ import { n as e } from "./errors-XvcwUnU4.js";
2
+ import { ARLight as t } from "./ar.js";
3
+ import { shBasis as n } from "@margoengine/math/sh";
4
+ //#region src/reflection.ts
5
+ var r = [
6
+ (e, t) => [
7
+ 1,
8
+ -t,
9
+ -e
10
+ ],
11
+ (e, t) => [
12
+ -1,
13
+ -t,
14
+ e
15
+ ],
16
+ (e, t) => [
17
+ e,
18
+ 1,
19
+ t
20
+ ],
21
+ (e, t) => [
22
+ e,
23
+ -1,
24
+ -t
25
+ ],
26
+ (e, t) => [
27
+ e,
28
+ -t,
29
+ 1
30
+ ],
31
+ (e, t) => [
32
+ -e,
33
+ -t,
34
+ -1
35
+ ]
36
+ ], i = /* @__PURE__ */ new Float32Array(1), a = new Uint32Array(i.buffer);
37
+ function o(e) {
38
+ if (!(e > 0)) return 0;
39
+ if (e >= 65504) return 31743;
40
+ i[0] = e;
41
+ let t = a[0], n = (t >>> 23 & 255) - 112;
42
+ return n <= 0 ? n < -10 ? 0 : (t & 8388607 | 8388608) >>> 14 - n : n << 10 | (t & 8388607) >>> 13;
43
+ }
44
+ function s(e, t) {
45
+ let i = new Uint16Array(6 * t * t * 4), a = /* @__PURE__ */ new Float64Array(9), s = 0;
46
+ for (let c of r) for (let r = 0; r < t; r++) for (let l = 0; l < t; l++) {
47
+ let [u, d, f] = c((l + .5) * 2 / t - 1, (r + .5) * 2 / t - 1);
48
+ n({
49
+ x: u,
50
+ y: d,
51
+ z: f
52
+ }, a);
53
+ for (let t = 0; t < 3; t++) {
54
+ let n = 0;
55
+ for (let r = 0; r < 9; r++) n += e[r * 3 + t] * a[r];
56
+ i[s++] = o(n);
57
+ }
58
+ i[s++] = 15360;
59
+ }
60
+ return i;
61
+ }
62
+ function c(e) {
63
+ return !!e && e.format === "rgba16float" && e.width === e.height && !(e.width & e.width - 1) && e.depthOrArrayLayers === 6;
64
+ }
65
+ var l = class n {
66
+ constructor(e, t, n, r) {
67
+ this.host = e, this.light = t, this.ownsLight = n, this.options = r, this.source = null, this.updates = 0, this.cube = null, this.environment = null, this.dirty = !0, this.last = -Infinity, this.painted = null, this.disposed = !1, this.stops = [], this.ready = new Promise((e) => {
68
+ this.resolve = e;
69
+ });
70
+ let i = t.probe, a = () => {
71
+ this.dirty = !0;
72
+ };
73
+ i.addEventListener?.("reflectionchange", a), this.stops.push(() => i.removeEventListener?.("reflectionchange", a), e.onEye((e) => {
74
+ this.binding = e.binding;
75
+ }), e.onFrame((e) => this.update(e.time)));
76
+ }
77
+ static async create(r, i) {
78
+ let { size: a = 32, interval: o = 500, reflectionFormat: s = "rgba16f", forceSH: c = !1, device: l } = i;
79
+ if (!l) throw e("state", "ARReflection needs the engine device; pass device: engine.gpu");
80
+ if (!(Number.isInteger(a) && a >= 8 && a <= 256 && !(a & a - 1))) throw RangeError("ARReflection size is a power of two from 8 to 256; pass 32");
81
+ if (!(Number.isFinite(o) && o >= 0)) throw RangeError("ARReflection interval is milliseconds, 0 or more; pass 500");
82
+ let u = i.light ?? await t.withReflection(r, { reflectionFormat: s });
83
+ return new n(r, u, !i.light, {
84
+ device: l,
85
+ size: a,
86
+ interval: o,
87
+ reflectionFormat: s,
88
+ forceSH: c
89
+ });
90
+ }
91
+ get texture() {
92
+ return this.cube;
93
+ }
94
+ attach(e) {
95
+ this.environment = e;
96
+ }
97
+ update(e) {
98
+ if (this.disposed) return;
99
+ let { device: t, size: n, interval: r, forceSH: i } = this.options, a = this.light.probe, o = i ? null : this.binding?.getReflectionCubeMap?.(a), l = null;
100
+ if (c(o)) {
101
+ if (!this.dirty && this.cube) return;
102
+ this.dirty = !1, this.ensure(o.width);
103
+ let e = t.createCommandEncoder();
104
+ e.copyTextureToTexture({ texture: o }, { texture: this.cube }, [
105
+ o.width,
106
+ o.width,
107
+ 6
108
+ ]), t.queue.submit([e.finish()]), this.source = "binding";
109
+ } else {
110
+ let i = this.light.estimate;
111
+ if (!i || e - this.last < r || this.painted && i.sh.every((e, t) => Math.abs(e - this.painted[t]) < .001 * (1 + Math.abs(e)))) return;
112
+ this.painted = Float32Array.from(i.sh), this.last = e, this.ensure(n), l = s(i.sh, n), t.queue.writeTexture({ texture: this.cube }, l, {
113
+ bytesPerRow: n * 8,
114
+ rowsPerImage: n
115
+ }, [
116
+ n,
117
+ n,
118
+ 6
119
+ ]), this.source = "sh";
120
+ }
121
+ this.updates++, this.environment && this.environment.refresh().catch(() => {});
122
+ }
123
+ ensure(e) {
124
+ this.cube?.width !== e && (this.cube?.destroy(), this.cube = this.options.device.createTexture({
125
+ size: [
126
+ e,
127
+ e,
128
+ 6
129
+ ],
130
+ format: "rgba16float",
131
+ usage: GPUTextureUsage.TEXTURE_BINDING | GPUTextureUsage.COPY_DST | GPUTextureUsage.COPY_SRC,
132
+ label: "AR reflection cube"
133
+ }), this.resolve(this.cube));
134
+ }
135
+ dispose() {
136
+ if (!this.disposed) {
137
+ this.disposed = !0;
138
+ for (let e of this.stops) e();
139
+ this.ownsLight && this.light.dispose(), this.cube?.destroy(), this.cube = null, this.environment = null;
140
+ }
141
+ }
142
+ [Symbol.dispose]() {
143
+ this.dispose();
144
+ }
145
+ };
146
+ //#endregion
147
+ export { l as ARReflection, s as paintCubeFromSH };
@@ -0,0 +1,21 @@
1
+ import type { XREyeTarget } from './eye-target.js';
2
+ import type { Engine, PassContext } from '@margoengine/core/extension';
3
+ import type { XRBinding, XRProjectionLayer, XRViewerPose } from './types.js';
4
+ export declare class StereoRenderer {
5
+ private readonly device;
6
+ private pipeline?;
7
+ private depthPipeline?;
8
+ private readonly resources;
9
+ private readonly eyes;
10
+ private readonly used;
11
+ private readonly pbr;
12
+ private context?;
13
+ constructor(device: GPUDevice);
14
+ configure(context: Extract<PassContext, {
15
+ backend: 'webgpu';
16
+ }>, format: GPUTextureFormat): void;
17
+ render(engine: Engine, binding: XRBinding, layer: XRProjectionLayer, viewer: XRViewerPose, transparent: boolean, onEye?: (target: XREyeTarget) => boolean | void, layers?: number): void;
18
+ /** True when a drawn gltf\/pbr model has a material drawn as native glass. */
19
+ private glass;
20
+ dispose(): void;
21
+ }
@@ -0,0 +1,15 @@
1
+ // @margo/core-built 1.0.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+
4
+ //#region src/scene-owner.ts
5
+ var e = 0;
6
+ function t(t, n) {
7
+ let r = `xr-subscription-${e++}`;
8
+ return t.use({coreRequirement:/*@__PURE__*/__margoCoreRequirement("1.0.0",import.meta.url),
9
+ name: r,
10
+ setup() {},
11
+ dispose: n
12
+ }), () => t.removePlugin(r);
13
+ }
14
+ //#endregion
15
+ export { t };
@@ -0,0 +1,3 @@
1
+ import type { Scene } from '@margoengine/core';
2
+ /** Bind an XR subscription to an explicitly selected scene without changing the ambient scene. */
3
+ export declare function ownScene(scene: Scene, close: () => void): () => void;
@@ -0,0 +1,42 @@
1
+ // @margo/core-built 1.0.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+
4
+ //#region ../shared/scene-scope.js
5
+ var e = 0, t = (t, n) => {
6
+ let r = n + e++;
7
+ for (; t.plugins?.has(r);) r += ":";
8
+ return r;
9
+ };
10
+ function n(e) {
11
+ let n;
12
+ if (typeof e?.sceneOf == "function") {
13
+ for (let t of e.plugins?.values() ?? []) if (n = e.sceneOf(t)) break;
14
+ if (!n) {
15
+ let r = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("1.0.0",import.meta.url),
16
+ name: t(e, "scene-scope:"),
17
+ setup() {
18
+ n = e.sceneOf(r);
19
+ }
20
+ };
21
+ e.use(r), e.removePlugin(r.name);
22
+ }
23
+ }
24
+ return r(e, n);
25
+ }
26
+ function r(e, n) {
27
+ return {
28
+ scene: n,
29
+ run(r) {
30
+ if (!n) return r();
31
+ let i, a = {coreRequirement:/*@__PURE__*/__margoCoreRequirement("1.0.0",import.meta.url),
32
+ name: t(e, "scene-scope:"),
33
+ setup() {
34
+ i = r();
35
+ }
36
+ };
37
+ return n.use(a), n.removePlugin(a.name), i;
38
+ }
39
+ };
40
+ }
41
+ //#endregion
42
+ export { r as n, n as t };
@@ -0,0 +1,60 @@
1
+ import type { XRNativeSession, XRSpace } from './types.js';
2
+ /** What {@link XRSessionState.attach} needs of an `XR`. */
3
+ export interface XRSessionStateHost {
4
+ readonly session: XRNativeSession | null;
5
+ readonly referenceSpace: XRSpace | undefined;
6
+ }
7
+ /** The session's visibility (WebXR Device API, XRVisibilityState). */
8
+ export type XRVisibility = 'visible' | 'visible-blurred' | 'hidden';
9
+ /** Options for {@link XRSessionState.attach}. */
10
+ export interface XRSessionStateOptions {
11
+ /** Stops following the session when aborted. */
12
+ signal?: AbortSignal;
13
+ }
14
+ /**
15
+ * Reads and follows an XR session's display and tracking facts: `environmentBlendMode`, `visibility` (a `hidden`
16
+ * session should stop drawing), `frameRate` with `setFrameRate`, and the play-area `bounds` of a 'bounded-floor'
17
+ * reference space.
18
+ * @throws MargoError 'state' without a session.
19
+ */
20
+ export declare class XRSessionState {
21
+ private readonly host;
22
+ private readonly session;
23
+ private readonly visible;
24
+ private readonly resets;
25
+ private readonly stops;
26
+ private disposed;
27
+ private constructor();
28
+ static attach(xr: XRSessionStateHost, options?: XRSessionStateOptions): XRSessionState;
29
+ /** How the display mixes the real world with the scene; undefined where the browser does not say. */
30
+ get environmentBlendMode(): 'opaque' | 'additive' | 'alpha-blend' | undefined;
31
+ /** Whether the session's input is a screen or the world; undefined where the browser does not say. */
32
+ get interactionMode(): 'screen-space' | 'world-space' | undefined;
33
+ /** 'visible', 'visible-blurred' (a system menu is up) or 'hidden'. Default 'visible' where the browser does not say. */
34
+ get visibility(): XRVisibility;
35
+ /** The frame rate the device runs at now, or null where it does not say. */
36
+ get frameRate(): number | null;
37
+ /** The frame rates the device accepts; empty where it offers a choice of none. */
38
+ get supportedFrameRates(): readonly number[];
39
+ /**
40
+ * Asks the device for `rate` frames per second (WebXR `updateTargetFrameRate`).
41
+ * @throws RangeError when `rate` is not one of `supportedFrameRates`; MargoError 'unsupported' where the browser has no
42
+ * frame rate control.
43
+ */
44
+ setFrameRate(rate: number): Promise<void>;
45
+ /**
46
+ * The play area of a 'bounded-floor' space as x and z metres per corner in the space's own frame (a polygon, wound as
47
+ * the browser gives it), or null where the space has no bounds (ask for `referenceSpace: 'bounded-floor'`).
48
+ */
49
+ get bounds(): Float32Array | null;
50
+ /** Runs `callback` when the visibility changes; returns a function that stops it. */
51
+ onVisibilityChange(callback: (visibility: XRVisibility) => void): () => void;
52
+ /**
53
+ * Runs `callback` when the reference space resets (the user recentred, or the play area changed), with the event's
54
+ * `transform` (an XRRigidTransform) or null; read `bounds` again here.
55
+ */
56
+ onReset(callback: (transform: unknown) => void): () => void;
57
+ /** Stops following the session. */
58
+ dispose(): void;
59
+ [Symbol.dispose](): void;
60
+ }
@@ -0,0 +1,68 @@
1
+ // @margo/core-built 1.0.0
2
+ import {coreRequirement as __margoCoreRequirement,assertCore as __margoAssertCore} from '@margoengine/core/extension';
3
+
4
+ import { n as e } from "./errors-XvcwUnU4.js";
5
+ //#region src/session.ts
6
+ var t = class t {
7
+ constructor(e, t) {
8
+ this.host = e, this.session = t, this.visible = /* @__PURE__ */ new Set(), this.resets = /* @__PURE__ */ new Set(), this.stops = [], this.disposed = !1;
9
+ }
10
+ static attach(n, r = {}) {__margoAssertCore(n,__margoCoreRequirement("1.0.0",import.meta.url));
11
+ let i = n?.session;
12
+ if (!i) throw e("state", "XRSessionState needs an active XR session; await xr.requestSession first");
13
+ let a = new t(n, i), o = () => {
14
+ for (let e of a.visible) e(a.visibility);
15
+ };
16
+ i.addEventListener?.("visibilitychange", o), a.stops.push(() => i.removeEventListener?.("visibilitychange", o));
17
+ let s = n.referenceSpace, c = (e) => {
18
+ for (let t of a.resets) t(e.transform ?? null);
19
+ };
20
+ return s?.addEventListener?.("reset", c), a.stops.push(() => s?.removeEventListener?.("reset", c)), r.signal?.addEventListener("abort", () => a.dispose(), { once: !0 }), a;
21
+ }
22
+ get environmentBlendMode() {
23
+ return this.session.environmentBlendMode;
24
+ }
25
+ get interactionMode() {
26
+ return this.session.interactionMode;
27
+ }
28
+ get visibility() {
29
+ return this.session.visibilityState ?? "visible";
30
+ }
31
+ get frameRate() {
32
+ return this.session.frameRate ?? null;
33
+ }
34
+ get supportedFrameRates() {
35
+ return Array.from(this.session.supportedFrameRates ?? []).sort((e, t) => e - t);
36
+ }
37
+ async setFrameRate(t) {
38
+ if (!this.session.updateTargetFrameRate) throw e("unsupported", "This browser has no XR frame rate control (updateTargetFrameRate); check supportedFrameRates.length before calling setFrameRate");
39
+ let n = this.supportedFrameRates;
40
+ if (!n.includes(t)) throw RangeError(`XR frame rate ${String(t)} is not supported; pass one of ${n.join(", ") || "(the device lists none)"}`);
41
+ await this.session.updateTargetFrameRate(t);
42
+ }
43
+ get bounds() {
44
+ let e = this.host.referenceSpace?.boundsGeometry;
45
+ if (!e || e.length === 0) return null;
46
+ let t = new Float32Array(e.length * 2);
47
+ for (let n = 0; n < e.length; n++) t[n * 2] = e[n].x, t[n * 2 + 1] = e[n].z;
48
+ return t;
49
+ }
50
+ onVisibilityChange(e) {
51
+ return this.visible.add(e), () => this.visible.delete(e);
52
+ }
53
+ onReset(e) {
54
+ return this.resets.add(e), () => this.resets.delete(e);
55
+ }
56
+ dispose() {
57
+ if (!this.disposed) {
58
+ this.disposed = !0;
59
+ for (let e of this.stops) e();
60
+ this.visible.clear(), this.resets.clear();
61
+ }
62
+ }
63
+ [Symbol.dispose]() {
64
+ this.dispose();
65
+ }
66
+ };
67
+ //#endregion
68
+ export { t as XRSessionState };
@@ -0,0 +1,64 @@
1
+ /** One browser and device route a real run must cover before XR counts as run on hardware. */
2
+ export interface XRRunTarget {
3
+ /** Stable name of the route. */
4
+ readonly id: string;
5
+ readonly mode: 'immersive-vr' | 'immersive-ar';
6
+ readonly route: 'webgpu' | 'webgl2';
7
+ /** What the run needs, in words. */
8
+ readonly needs: string;
9
+ }
10
+ /** What the tester saw, answered by a person after the session. */
11
+ export interface XRRunObserved {
12
+ /** The scene stood still in the room while the head moved, in the right place for each eye. */
13
+ scene: boolean;
14
+ /** Moving the head moved the view at once, with no jumps. */
15
+ tracking: boolean;
16
+ /** A controller, hand or tap was seen and reacted. */
17
+ input: boolean;
18
+ /** Leaving the session gave the page back. */
19
+ exit: boolean;
20
+ }
21
+ /** What `runDeviceCheck` writes: one session on one device. */
22
+ export interface XRRun {
23
+ schema: 1;
24
+ /** ISO date of the run. */
25
+ date: string;
26
+ userAgent: string;
27
+ /** True when `navigator.xr.requestSession` is the browser's own code. A stand-in written in JavaScript cannot set it. */
28
+ native: boolean;
29
+ mode: 'inline' | 'immersive-vr' | 'immersive-ar';
30
+ route: 'webgpu' | 'webgl2' | 'none';
31
+ /** The session's `enabledFeatures`, or empty where the browser does not list them. */
32
+ features: string[];
33
+ /** Largest number of views in one frame: 2 on a headset, 1 on a phone. */
34
+ views: number;
35
+ frames: number;
36
+ /** Frames with a viewer pose. */
37
+ tracked: number;
38
+ /** Frames whose viewer pose was estimated, as on a headset with no position tracking. */
39
+ emulated: number;
40
+ /** Time between frames in milliseconds: the median, the 95th percentile and the longest. */
41
+ frameMs: { median: number; p95: number; max: number };
42
+ /** Every input source seen in the session. */
43
+ inputs: {
44
+ handedness: string;
45
+ targetRayMode: string;
46
+ profiles: string[];
47
+ hand: boolean;
48
+ buttons: number;
49
+ axes: number;
50
+ }[];
51
+ /** True when the session ended before the check's time was up: the headset came off, or the browser stopped it. */
52
+ endedEarly: boolean;
53
+ /** Messages of everything that went wrong. */
54
+ errors: string[];
55
+ observed?: XRRunObserved;
56
+ }
57
+ /** The routes a real run must cover. */
58
+ export const XR_RUN_TARGETS: readonly XRRunTarget[];
59
+ /** Shortest run that counts: frames of a session with a viewer pose. */
60
+ export const XR_RUN_MIN_FRAMES: number;
61
+ /** What is wrong with `run`'s shape: an empty list for a well-formed run. */
62
+ export function checkXRRun(run: unknown): string[];
63
+ /** Why `run` does not prove `target`: an empty list when it does. */
64
+ export function xrRunGaps(run: XRRun, target: XRRunTarget): string[];