@opsydyn/effect-three-foldkit 0.6.4 → 1.0.0-next.1

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 (121) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/README.md +26 -21
  3. package/dist/boxSelect.d.ts +91 -117
  4. package/dist/boxSelect.d.ts.map +1 -1
  5. package/dist/browser.d.ts +3 -0
  6. package/dist/browser.d.ts.map +1 -0
  7. package/dist/browser.js +32 -0
  8. package/dist/browser.js.map +10 -0
  9. package/dist/element.d.ts +11 -909
  10. package/dist/element.d.ts.map +1 -1
  11. package/dist/index.d.ts +17 -17
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +173 -2565
  14. package/dist/index.js.map +14 -39
  15. package/dist/inspector.d.ts +4 -21
  16. package/dist/inspector.d.ts.map +1 -1
  17. package/dist/measuringTape.d.ts +39 -46
  18. package/dist/measuringTape.d.ts.map +1 -1
  19. package/dist/mount.d.ts +17 -11
  20. package/dist/mount.d.ts.map +1 -1
  21. package/dist/overlayView.d.ts +7 -18
  22. package/dist/overlayView.d.ts.map +1 -1
  23. package/dist/pivotControls.d.ts +64 -76
  24. package/dist/pivotControls.d.ts.map +1 -1
  25. package/dist/transformGizmo.d.ts +113 -125
  26. package/dist/transformGizmo.d.ts.map +1 -1
  27. package/dist/view.d.ts +21 -4
  28. package/dist/view.d.ts.map +1 -1
  29. package/dist/viewportGizmo.d.ts +107 -119
  30. package/dist/viewportGizmo.d.ts.map +1 -1
  31. package/package.json +15 -10
  32. package/src/boxSelect.ts +12 -133
  33. package/src/browser.ts +16 -0
  34. package/src/element.ts +19 -110
  35. package/src/index.ts +32 -16
  36. package/src/inspector.ts +70 -93
  37. package/src/measuringTape.ts +28 -92
  38. package/src/mount.ts +53 -309
  39. package/src/overlayView.ts +36 -57
  40. package/src/pivotControls.ts +8 -94
  41. package/src/transformGizmo.ts +8 -108
  42. package/src/view.ts +73 -54
  43. package/src/viewportGizmo.ts +8 -97
  44. package/dist/assetRegistry.d.ts +0 -49
  45. package/dist/assetRegistry.d.ts.map +0 -1
  46. package/dist/assets.d.ts +0 -66
  47. package/dist/assets.d.ts.map +0 -1
  48. package/dist/dom/animationFrames.d.ts +0 -12
  49. package/dist/dom/animationFrames.d.ts.map +0 -1
  50. package/dist/dom/canvas.d.ts +0 -33
  51. package/dist/dom/canvas.d.ts.map +0 -1
  52. package/dist/dom/latch.d.ts +0 -15
  53. package/dist/dom/latch.d.ts.map +0 -1
  54. package/dist/dom/models.d.ts +0 -10
  55. package/dist/dom/models.d.ts.map +0 -1
  56. package/dist/dom/overlays.d.ts +0 -24
  57. package/dist/dom/overlays.d.ts.map +0 -1
  58. package/dist/dom/pointer.d.ts +0 -49
  59. package/dist/dom/pointer.d.ts.map +0 -1
  60. package/dist/dom/postprocessing.d.ts +0 -22
  61. package/dist/dom/postprocessing.d.ts.map +0 -1
  62. package/dist/dom/property.d.ts +0 -15
  63. package/dist/dom/property.d.ts.map +0 -1
  64. package/dist/dom/reconciled.d.ts +0 -10
  65. package/dist/dom/reconciled.d.ts.map +0 -1
  66. package/dist/dom/renderSettings.d.ts +0 -58
  67. package/dist/dom/renderSettings.d.ts.map +0 -1
  68. package/dist/dom/typedScenes.d.ts +0 -14
  69. package/dist/dom/typedScenes.d.ts.map +0 -1
  70. package/dist/dom/updates.d.ts +0 -8
  71. package/dist/dom/updates.d.ts.map +0 -1
  72. package/dist/dom/viewport.d.ts +0 -40
  73. package/dist/dom/viewport.d.ts.map +0 -1
  74. package/dist/dom/webgl.d.ts +0 -12
  75. package/dist/dom/webgl.d.ts.map +0 -1
  76. package/dist/dom/webgpu.d.ts +0 -24
  77. package/dist/dom/webgpu.d.ts.map +0 -1
  78. package/dist/dom/webgpuPostprocessing.d.ts +0 -4
  79. package/dist/dom/webgpuPostprocessing.d.ts.map +0 -1
  80. package/dist/dom/xr.d.ts +0 -53
  81. package/dist/dom/xr.d.ts.map +0 -1
  82. package/dist/dom/xrGlide.d.ts +0 -49
  83. package/dist/dom/xrGlide.d.ts.map +0 -1
  84. package/dist/dom/xrHub.d.ts +0 -45
  85. package/dist/dom/xrHub.d.ts.map +0 -1
  86. package/dist/dom/xrInputs.d.ts +0 -40
  87. package/dist/dom/xrInputs.d.ts.map +0 -1
  88. package/dist/dom/xrSpaces.d.ts +0 -33
  89. package/dist/dom/xrSpaces.d.ts.map +0 -1
  90. package/dist/dom/xrTarget.d.ts +0 -36
  91. package/dist/dom/xrTarget.d.ts.map +0 -1
  92. package/dist/environment.d.ts +0 -70
  93. package/dist/environment.d.ts.map +0 -1
  94. package/dist/xr.d.ts +0 -34
  95. package/dist/xr.d.ts.map +0 -1
  96. package/src/assetRegistry.ts +0 -218
  97. package/src/assets.ts +0 -208
  98. package/src/dom/animationFrames.ts +0 -32
  99. package/src/dom/canvas.ts +0 -66
  100. package/src/dom/latch.ts +0 -36
  101. package/src/dom/models.ts +0 -37
  102. package/src/dom/overlays.ts +0 -63
  103. package/src/dom/pointer.ts +0 -176
  104. package/src/dom/postprocessing.ts +0 -116
  105. package/src/dom/property.ts +0 -43
  106. package/src/dom/reconciled.ts +0 -51
  107. package/src/dom/renderSettings.ts +0 -117
  108. package/src/dom/typedScenes.ts +0 -21
  109. package/src/dom/updates.ts +0 -14
  110. package/src/dom/viewport.ts +0 -97
  111. package/src/dom/webgl.ts +0 -231
  112. package/src/dom/webgpu.ts +0 -220
  113. package/src/dom/webgpuPostprocessing.ts +0 -102
  114. package/src/dom/xr.ts +0 -211
  115. package/src/dom/xrGlide.ts +0 -114
  116. package/src/dom/xrHub.ts +0 -118
  117. package/src/dom/xrInputs.ts +0 -309
  118. package/src/dom/xrSpaces.ts +0 -287
  119. package/src/dom/xrTarget.ts +0 -71
  120. package/src/environment.ts +0 -83
  121. package/src/xr.ts +0 -36
@@ -1,24 +0,0 @@
1
- /**
2
- * Moves the application's overlay HTML to where the scene placed each overlay, as Drei's
3
- * `Html` does every frame (`src/web/Html.tsx` at `bf6f4ad`): a translate to the point,
4
- * the distance scale, centring, the depth's z-index, and hiding when not visible.
5
- *
6
- * @module
7
- */
8
- import type { OverlayPlacement } from '@opsydyn/effect-three';
9
- /** The data attribute naming the overlay an element's HTML belongs to. */
10
- export declare const overlayData: {
11
- readonly key: 'effect-three-overlay';
12
- readonly attribute: 'data-effect-three-overlay';
13
- };
14
- export type OverlayWriter = {
15
- /** Takes the latest placements and writes them. */
16
- readonly place: (placements: ReadonlyArray<OverlayPlacement>) => void;
17
- /** Writes the latest placements again, for overlay elements the view has just made. */
18
- readonly rewrite: () => void;
19
- };
20
- /** Creates the writer for overlays rendered inside `host`. */
21
- export declare const createOverlayWriter: (host: Element) => OverlayWriter;
22
- /** Makes the scene element the overlays' containing block, unless it already is one. */
23
- export declare const containOverlays: (host: Element) => () => void;
24
- //# sourceMappingURL=overlays.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"overlays.d.ts","sourceRoot":"","sources":["../../src/dom/overlays.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,0EAA0E;AAC1E,eAAO,MAAM,WAAW;aACtB,GAAG,EAAE,sBAAsB;aAC3B,SAAS,EAAE,2BAA2B;CAC9B,CAAC;AAkBX,MAAM,MAAM,aAAa,GAAG;IAC1B,mDAAmD;IACnD,QAAQ,CAAC,KAAK,EAAE,CAAC,UAAU,EAAE,aAAa,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;IACtE,uFAAuF;IACvF,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,mBAAmB,SAAU,OAAO,KAAG,aAiBnD,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,eAAe,SAAU,OAAO,WAAS,IAGrD,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * DOM pointer events to the kernel's normalised device coordinates.
3
- *
4
- * @module
5
- */
6
- import type { Gestures, PointerInput, SceneEvent } from '@opsydyn/effect-three';
7
- /** The part of `DOMRect` the conversion needs. */
8
- export type Rect = {
9
- readonly left: number;
10
- readonly top: number;
11
- readonly width: number;
12
- readonly height: number;
13
- };
14
- /** Client coordinates to NDC: x and y in [-1, 1], y up. A zero-sized rect maps to the centre. */
15
- export declare const toNdc: (rect: Rect, clientX: number, clientY: number) => {
16
- readonly x: number;
17
- readonly y: number;
18
- };
19
- /**
20
- * Converts a DOM pointer, mouse or wheel event into kernel input, or `undefined` for
21
- * other event types. Pointer cancel is treated as leaving the surface.
22
- */
23
- export declare const toPointerInput: (event: MouseEvent, rect: Rect) => PointerInput | undefined;
24
- /** True when a press landed on an interactive mesh, which then captures the pointer. */
25
- export declare const capturesPointer: (events: ReadonlyArray<SceneEvent>) => boolean;
26
- /** True when the scene handled a context-menu input, so the browser menu should not open. */
27
- export declare const claimsContextMenu: (events: ReadonlyArray<SceneEvent>) => boolean;
28
- /**
29
- * Forwards pointer, mouse and wheel input from `element`. `onInput` returns the scene
30
- * events it produced. By default the page keeps its gestures: wheel and touch scroll it,
31
- * and the browser's menu opens except over an interactive mesh that handles it. A press
32
- * on a mesh captures the pointer.
33
- *
34
- * While `claimsGestures()` is true the scene owns them, as three.js's `OrbitControls` does
35
- * when connected: every press captures the pointer, the wheel does not scroll the page,
36
- * and the context menu stays shut (the right button pans). Returns a function that
37
- * removes every listener.
38
- */
39
- export declare const listenForPointer: (element: HTMLElement, onInput: (input: PointerInput) => ReadonlyArray<SceneEvent>, claimsGestures?: () => boolean) => (() => void);
40
- /** Whatever reports the scene's claim on gestures: its graph. */
41
- type GestureOwner = {
42
- readonly gestures: () => Gestures;
43
- };
44
- /** Whether the scene currently claims the pointer's gestures. */
45
- export declare const claimsGestures: (owner: GestureOwner) => () => boolean;
46
- /** Lets the browser pan and zoom on touch, or not while the scene claims gestures. */
47
- export declare const touchActionSync: (element: HTMLElement, owner: GestureOwner) => () => void;
48
- export {};
49
- //# sourceMappingURL=pointer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pointer.d.ts","sourceRoot":"","sources":["../../src/dom/pointer.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EACV,QAAQ,EAGR,YAAY,EACZ,UAAU,EACX,MAAM,uBAAuB,CAAC;AAE/B,kDAAkD;AAClD,MAAM,MAAM,IAAI,GAAG;IACjB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,iGAAiG;AACjG,eAAO,MAAM,KAAK,SACV,IAAI,WACD,MAAM,WACN,MAAM,KACd;IAAE,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAA;CAM1C,CAAC;AAyBF;;;GAGG;AACH,eAAO,MAAM,cAAc,UAAW,UAAU,QAAQ,IAAI,KAAG,YAAY,GAAG,SAuC7E,CAAC;AAEF,wFAAwF;AACxF,eAAO,MAAM,eAAe,WAAY,aAAa,CAAC,UAAU,CAAC,KAAG,OACd,CAAC;AAEvD,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,WAAY,aAAa,CAAC,UAAU,CAAC,KAAG,OAChB,CAAC;AAavD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,YAClB,WAAW,WACX,CAAC,KAAK,EAAE,YAAY,KAAK,aAAa,CAAC,UAAU,CAAC,mBAC3C,MAAM,OAAO,KAC5B,CAAC,MAAM,IAAI,CA2Bb,CAAC;AAEF,iEAAiE;AACjE,KAAK,YAAY,GAAG;IAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,QAAQ,CAAA;CAAE,CAAC;AAE1D,iEAAiE;AACjE,eAAO,MAAM,cAAc,UAAW,YAAY,WAAS,OAAuC,CAAC;AAEnG,sFAAsF;AACtF,eAAO,MAAM,eAAe,YAAa,WAAW,SAAS,YAAY,WAAS,IAGjF,CAAC"}
@@ -1,22 +0,0 @@
1
- /**
2
- * Post-processing for the WebGL renderer: three.js's `EffectComposer`, built from the
3
- * scene's `render.effects` and rebuilt only when they change. With no effects the scene
4
- * renders straight to the screen and no composer exists.
5
- *
6
- * The composer renders into a multisampled target, so antialiasing survives, and ends
7
- * with three's `OutputPass`, which applies tone mapping and the output colour space.
8
- *
9
- * @module
10
- */
11
- import { type PostEffect } from '@opsydyn/effect-three';
12
- import { type Camera, type Scene, type WebGLRenderer } from 'three';
13
- export type PostProcessing = {
14
- /** Rebuilds the passes when `effects` differ from the current ones. */
15
- readonly configure: (effects: ReadonlyArray<PostEffect>) => void;
16
- readonly setSize: (width: number, height: number, pixelRatio: number) => void;
17
- /** Renders through the effects; returns false when there are none to apply. */
18
- readonly render: (scene: Scene, camera: Camera) => boolean;
19
- readonly dispose: () => void;
20
- };
21
- export declare const createPostProcessing: (renderer: WebGLRenderer) => PostProcessing;
22
- //# sourceMappingURL=postprocessing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postprocessing.d.ts","sourceRoot":"","sources":["../../src/dom/postprocessing.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAgB,KAAK,UAAU,EAAE,MAAM,uBAAuB,CAAC;AACtE,OAAO,EACL,KAAK,MAAM,EAGX,KAAK,KAAK,EAGV,KAAK,aAAa,EAEnB,MAAM,OAAO,CAAC;AAgCf,MAAM,MAAM,cAAc,GAAG;IAC3B,uEAAuE;IACvE,QAAQ,CAAC,SAAS,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,UAAU,CAAC,KAAK,IAAI,CAAC;IACjE,QAAQ,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9E,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,KAAK,OAAO,CAAC;IAC3D,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,eAAO,MAAM,oBAAoB,aAAc,aAAa,KAAG,cAsD9D,CAAC"}
@@ -1,15 +0,0 @@
1
- /**
2
- * Intercepts the property Foldkit's CustomElement factory sets on every render, so a
3
- * Mount can see new values without an update hook (ADR-002).
4
- *
5
- * @module
6
- */
7
- export type PropertyInterception = {
8
- /** The value present when interception began (set by the first render). */
9
- readonly initial: unknown;
10
- /** Restores a plain data property holding the latest value. */
11
- readonly restore: () => void;
12
- };
13
- /** Calls `onSet` for every assignment to `element[key]`. */
14
- export declare const interceptProperty: (element: object, key: string, onSet: (value: unknown) => void) => PropertyInterception;
15
- //# sourceMappingURL=property.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"property.d.ts","sourceRoot":"","sources":["../../src/dom/property.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,oBAAoB,GAAG;IACjC,2EAA2E;IAC3E,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,+DAA+D;IAC/D,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;CAC9B,CAAC;AAEF,4DAA4D;AAC5D,eAAO,MAAM,iBAAiB,YACnB,MAAM,OACV,MAAM,SACJ,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,KAC9B,oBAuBF,CAAC"}
@@ -1,10 +0,0 @@
1
- /**
2
- * Summaries of scene updates, for the `scene-reconciled` event.
3
- *
4
- * @module
5
- */
6
- import type { Op, ResourceStats } from '@opsydyn/effect-three';
7
- import type { ReconciledDetail } from '../element.ts';
8
- /** Counts operations by kind and snapshots resource counters. */
9
- export declare const summarise: (ops: ReadonlyArray<Op>, stats: ResourceStats) => ReconciledDetail;
10
- //# sourceMappingURL=reconciled.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"reconciled.d.ts","sourceRoot":"","sources":["../../src/dom/reconciled.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAE/D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD,iEAAiE;AACjE,eAAO,MAAM,SAAS,QAAS,aAAa,CAAC,EAAE,CAAC,SAAS,aAAa,KAAG,gBAwCxE,CAAC"}
@@ -1,58 +0,0 @@
1
- import { type Object3D, type WebGLRenderer } from 'three';
2
- import type { WebGPURenderer } from 'three/webgpu';
3
- /**
4
- * Shadow map types by React Three Fiber's names (`core/configuration.ts` at `d74622e`).
5
- * three 0.186 folded PCF soft into PCF (softness is per light), so `soft` maps to PCF
6
- * here; R3F's PCFSoftShadowMap would only log a removal warning on this version.
7
- */
8
- export declare const shadowTypes: {
9
- basic: 0;
10
- percentage: 1;
11
- soft: 1;
12
- variance: 3;
13
- };
14
- export declare const toneMappings: {
15
- none: 0;
16
- linear: 1;
17
- reinhard: 2;
18
- cineon: 3;
19
- aces: 4;
20
- agx: 6;
21
- neutral: 7;
22
- };
23
- export declare const colorSpaces: {
24
- srgb: "srgb";
25
- linear: "srgb-linear";
26
- };
27
- /**
28
- * Flags every material in the scene for recompilation. three.js keeps a shader built
29
- * with shadows sampling its last shadow map after `shadowMap.enabled` turns off (and
30
- * without shadows after it turns on) until its material is updated.
31
- */
32
- export declare const recompileMaterials: (scene: Object3D) => void;
33
- /** What presenting a renderer in WebXR uses; three's WebGL and WebGPU renderers both have it. */
34
- export type PresentableRenderer = {
35
- readonly xr: {
36
- enabled: boolean;
37
- readonly isPresenting: boolean;
38
- setReferenceSpaceType: (type: XRReferenceSpaceType) => void;
39
- setFramebufferScaleFactor: (scale: number) => void;
40
- setSession: (session: XRSession) => Promise<void>;
41
- getReferenceSpace: () => XRReferenceSpace | null;
42
- setReferenceSpace: (space: XRReferenceSpace) => void;
43
- getEnvironmentBlendMode: () => XREnvironmentBlendMode | undefined;
44
- };
45
- /**
46
- * Hands the session's frames to `callback` (`null` stops), set before the session starts:
47
- * WebGL's `xr.setAnimationLoop`, or WebGPU's `setAnimationLoop`, which its XR manager
48
- * captures when the session starts. It may also be called outside the session.
49
- */
50
- readonly setXrLoop: (callback: ((time: number, frame?: XRFrame) => void) | null) => void;
51
- };
52
- export declare const registerPresentable: (canvas: HTMLCanvasElement, renderer: WebGLRenderer | WebGPURenderer, presenting: PresentableRenderer) => void;
53
- export declare const forgetPresentable: (canvas: HTMLCanvasElement) => void;
54
- /** The three.js renderer drawing into `canvas` (WebGL or WebGPU), if one does. */
55
- export declare const threeRendererOf: (canvas: HTMLCanvasElement) => WebGLRenderer | WebGPURenderer | undefined;
56
- /** The three.js renderer drawing into `canvas`, if one does. */
57
- export declare const presentableRendererOf: (canvas: HTMLCanvasElement) => PresentableRenderer | undefined;
58
- //# sourceMappingURL=renderSettings.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"renderSettings.d.ts","sourceRoot":"","sources":["../../src/dom/renderSettings.ts"],"names":[],"mappings":"AAQA,OAAO,EAWL,KAAK,QAAQ,EAOb,KAAK,aAAa,EACnB,MAAM,OAAO,CAAC;AACf,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,WAAW;;;;;CAKoD,CAAC;AAE7E,eAAO,MAAM,YAAY;;;;;;;;CAQqC,CAAC;AAE/D,eAAO,MAAM,WAAW;;;CAGoC,CAAC;AAE7D;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,UAAW,QAAQ,KAAG,IAMpD,CAAC;AAEF,iGAAiG;AACjG,MAAM,MAAM,mBAAmB,GAAG;IAChC,QAAQ,CAAC,EAAE,EAAE;QACX,OAAO,EAAE,OAAO,CAAC;QACjB,QAAQ,CAAC,YAAY,EAAE,OAAO,CAAC;QAC/B,qBAAqB,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;QAC5D,yBAAyB,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;QACnD,UAAU,EAAE,CAAC,OAAO,EAAE,SAAS,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;QAClD,iBAAiB,EAAE,MAAM,gBAAgB,GAAG,IAAI,CAAC;QACjD,iBAAiB,EAAE,CAAC,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;QACrD,uBAAuB,EAAE,MAAM,sBAAsB,GAAG,SAAS,CAAC;KACnE,CAAC;IACF;;;;OAIG;IACH,QAAQ,CAAC,SAAS,EAAE,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,IAAI,KAAK,IAAI,CAAC;CAC1F,CAAC;AAOF,eAAO,MAAM,mBAAmB,WACtB,iBAAiB,YACf,aAAa,GAAG,cAAc,cAC5B,mBAAmB,KAC9B,IAGF,CAAC;AAEF,eAAO,MAAM,iBAAiB,WAAY,iBAAiB,KAAG,IAG7D,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,eAAe,WAClB,iBAAiB,KACxB,aAAa,GAAG,cAAc,GAAG,SAAgC,CAAC;AAErE,gEAAgE;AAChE,eAAO,MAAM,qBAAqB,WAAY,iBAAiB,KAAG,mBAAmB,GAAG,SAC/D,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Scenes that reached the element through the typed `view` helper. TypeScript already
3
- * checked them against `SceneDescription`, so the Mount can skip the Schema decode (about
4
- * 0.6 ms per render for 1,000 meshes). Any other value assigned to the element's `scene`
5
- * property is still decoded.
6
- *
7
- * @module
8
- */
9
- import type { SceneDescription } from '@opsydyn/effect-three';
10
- /** Records a compile-time-checked scene and returns it unchanged. */
11
- export declare const markTyped: (scene: SceneDescription) => SceneDescription;
12
- /** The scene, if this exact value came through `markTyped`. */
13
- export declare const typedScene: (value: unknown) => SceneDescription | undefined;
14
- //# sourceMappingURL=typedScenes.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"typedScenes.d.ts","sourceRoot":"","sources":["../../src/dom/typedScenes.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAI9D,qEAAqE;AACrE,eAAO,MAAM,SAAS,UAAW,gBAAgB,KAAG,gBAGnD,CAAC;AAEF,+DAA+D;AAC/D,eAAO,MAAM,UAAU,UAAW,OAAO,KAAG,gBAAgB,GAAG,SACa,CAAC"}
@@ -1,8 +0,0 @@
1
- /**
2
- * What follows a scene update in the DOM.
3
- *
4
- * @module
5
- */
6
- /** After an update: report it, then run each follow-up step in order. */
7
- export declare const afterUpdate: <A>(report: (value: A) => () => void, steps: ReadonlyArray<() => void>) => (value: A) => () => void;
8
- //# sourceMappingURL=updates.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"updates.d.ts","sourceRoot":"","sources":["../../src/dom/updates.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,yEAAyE;AACzE,eAAO,MAAM,WAAW,GACrB,CAAC,UAAU,CAAC,KAAK,EAAE,CAAC,KAAK,MAAM,IAAI,SAAS,aAAa,CAAC,MAAM,IAAI,CAAC,aAC9D,CAAC,WACL,IAGH,CAAC"}
@@ -1,40 +0,0 @@
1
- /**
2
- * Element size, visibility and motion preference.
3
- *
4
- * @module
5
- */
6
- import type { Viewport } from '@opsydyn/effect-three';
7
- /**
8
- * The drawing buffer's pixel ratio: a fixed number, or `[min, max]` to follow the device
9
- * within bounds. React Three Fiber's `dpr`, with its `[1, 2]` default (`calculateDpr` in
10
- * `core/utils.tsx` at `d74622e`): ratios above 2 cost GPU time for little visible gain.
11
- */
12
- export type PixelRatio = number | readonly [min: number, max: number];
13
- export declare const defaultPixelRatio: PixelRatio;
14
- /** Resolves a pixel ratio setting against the device's ratio. */
15
- export declare const resolvePixelRatio: (devicePixelRatio: number, setting: PixelRatio) => number;
16
- /** The element's current viewport, with the pixel ratio resolved. */
17
- export declare const measureViewport: (element: Element, devicePixelRatio: number, pixelRatio?: PixelRatio) => Viewport;
18
- /** Calls `onResize` whenever the element's size changes. Returns a disconnect function. */
19
- export declare const observeSize: (element: Element, onResize: () => void) => (() => void);
20
- /** Calls `onVisible` with whether any part of the element is on screen. */
21
- export declare const observeVisibility: (element: Element, onVisible: (visible: boolean) => void) => (() => void);
22
- /** Calls `onChange` with the current reduced-motion preference, then on every change. */
23
- export declare const observeReducedMotion: (view: Pick<Window, 'matchMedia'>, onChange: (reduced: boolean) => void) => (() => void);
24
- /** The media query calls the pixel-ratio watch needs; `window` provides them. */
25
- type ChangeTarget = {
26
- addEventListener(type: 'change', listener: () => void): void;
27
- removeEventListener(type: 'change', listener: () => void): void;
28
- };
29
- export type PixelRatioHost = {
30
- readonly devicePixelRatio: number;
31
- readonly matchMedia: (query: string) => ChangeTarget;
32
- };
33
- /**
34
- * Calls `onChange` whenever the device pixel ratio changes (moving to another display, or
35
- * zooming), which resizes nothing. As React Three Fiber's `watchDpr`: a media query for
36
- * the current resolution, re-armed for the new ratio after each change.
37
- */
38
- export declare const observePixelRatio: (view: PixelRatioHost, onChange: () => void) => (() => void);
39
- export {};
40
- //# sourceMappingURL=viewport.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"viewport.d.ts","sourceRoot":"","sources":["../../src/dom/viewport.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAEtD;;;;GAIG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,CAAC,CAAC;AAEtE,eAAO,MAAM,iBAAiB,EAAE,UAAmB,CAAC;AAEpD,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,qBAAsB,MAAM,WAAW,UAAU,KAAG,MAGhB,CAAC;AAEnE,qEAAqE;AACrE,eAAO,MAAM,eAAe,YACjB,OAAO,oBACE,MAAM,eACZ,UAAU,KACrB,QAOF,CAAC;AAEF,2FAA2F;AAC3F,eAAO,MAAM,WAAW,YAAa,OAAO,YAAY,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAI/E,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,iBAAiB,YACnB,OAAO,aACL,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KACpC,CAAC,MAAM,IAAI,CAMb,CAAC;AAEF,yFAAyF;AACzF,eAAO,MAAM,oBAAoB,SACzB,IAAI,CAAC,MAAM,EAAE,YAAY,CAAC,YACtB,CAAC,OAAO,EAAE,OAAO,KAAK,IAAI,KACnC,CAAC,MAAM,IAAI,CAMb,CAAC;AAEF,iFAAiF;AACjF,KAAK,YAAY,GAAG;IAClB,gBAAgB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;IAC7D,mBAAmB,CAAC,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,IAAI,GAAG,IAAI,CAAC;CACjE,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,YAAY,CAAC;CACtD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,SAAU,cAAc,YAAY,MAAM,IAAI,KAAG,CAAC,MAAM,IAAI,CAazF,CAAC"}
@@ -1,12 +0,0 @@
1
- /**
2
- * The WebGL2 renderer behind the core's backend-neutral renderer contract.
3
- *
4
- * @module
5
- */
6
- import type { RendererFactory } from '@opsydyn/effect-three';
7
- import { type WebGLRendererParameters } from 'three';
8
- /** Options passed through to three's `WebGLRenderer`. The canvas is always the scene's own. */
9
- export type WebGLOptions = Omit<WebGLRendererParameters, 'canvas'>;
10
- /** A factory for a WebGL2 renderer drawing into `canvas`. `create` throws if WebGL2 is unavailable. */
11
- export declare const webglRendererFactory: (canvas: HTMLCanvasElement, options?: WebGLOptions) => RendererFactory;
12
- //# sourceMappingURL=webgl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webgl.d.ts","sourceRoot":"","sources":["../../src/dom/webgl.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,uBAAuB,CAAC;AAE3F,OAAO,EASL,KAAK,uBAAuB,EAE7B,MAAM,OAAO,CAAC;AAaf,+FAA+F;AAC/F,MAAM,MAAM,YAAY,GAAG,IAAI,CAAC,uBAAuB,EAAE,QAAQ,CAAC,CAAC;AAyEnE,uGAAuG;AACvG,eAAO,MAAM,oBAAoB,WACvB,iBAAiB,YAChB,YAAY,KACpB,eAyHD,CAAC"}
@@ -1,24 +0,0 @@
1
- /**
2
- * three.js's `WebGPURenderer` behind the core's renderer contract: WebGPU where the browser
3
- * has it, otherwise its WebGL 2 backend (or always, with `forceWebGL`), drawing the same
4
- * node materials either way. It carries the WebGPU render kit (the sky, shader grid and
5
- * contact shadows in TSL), post-processes with `RenderPipeline`, and presents in WebXR.
6
- * It starts asynchronously (`init()`), which the runtime waits for.
7
- *
8
- * Its kit shades with TSL, so labels come from a label engine's `createTsl` (troika's is
9
- * `troikaLabels` from `@opsydyn/effect-three-troika/webgpu`); an engine without one draws
10
- * no labels here.
11
- *
12
- * @module
13
- */
14
- import type { RendererFactory } from '@opsydyn/effect-three';
15
- /** Options for three's `WebGPURenderer`. The canvas is always the scene's own. */
16
- export type WebGPUOptions = {
17
- /** Use the WebGL 2 backend even where WebGPU is available. */
18
- readonly forceWebGL?: boolean;
19
- readonly alpha?: boolean;
20
- readonly antialias?: boolean;
21
- };
22
- /** A factory for three's `WebGPURenderer` drawing into `canvas`. */
23
- export declare const webgpuRendererFactory: (canvas: HTMLCanvasElement, options?: WebGPUOptions) => RendererFactory;
24
- //# sourceMappingURL=webgpu.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webgpu.d.ts","sourceRoot":"","sources":["../../src/dom/webgpu.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,eAAe,EAAgC,MAAM,uBAAuB,CAAC;AAwB3F,kFAAkF;AAClF,MAAM,MAAM,aAAa,GAAG;IAC1B,8DAA8D;IAC9D,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,OAAO,CAAC;IACzB,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;CAC9B,CAAC;AA+DF,oEAAoE;AACpE,eAAO,MAAM,qBAAqB,WACxB,iBAAiB,YAChB,aAAa,KACrB,eA6GD,CAAC"}
@@ -1,4 +0,0 @@
1
- import { type WebGPURenderer } from 'three/webgpu';
2
- import type { PostProcessing } from './postprocessing.ts';
3
- export declare const createWebGPUPostProcessing: (renderer: WebGPURenderer) => PostProcessing;
4
- //# sourceMappingURL=webgpuPostprocessing.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"webgpuPostprocessing.d.ts","sourceRoot":"","sources":["../../src/dom/webgpuPostprocessing.ts"],"names":[],"mappings":"AA6BA,OAAO,EAA6B,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AA8B1D,eAAO,MAAM,0BAA0B,aAAc,cAAc,KAAG,cAwCrE,CAAC"}
package/dist/dom/xr.d.ts DELETED
@@ -1,53 +0,0 @@
1
- /**
2
- * Presenting a scene in a WebXR session through three.js's `WebXRManager`.
3
- *
4
- * Behavioural references: React Three Fiber `core/configuration.ts` at `d74622e` (on
5
- * `sessionstart` enable XR and hand frames to `xr.setAnimationLoop`; on `sessionend` take
6
- * them back and draw again), and pmndrs/xr at `0e1acd8` (`store.ts` `setupXRManager`:
7
- * reference space type and framebuffer scale before `setSession`; `init.ts`
8
- * `buildXRSessionInit`: the reference space required, other features optional). The
9
- * player's origin is an offset reference space, as three.js's teleport example moves
10
- * the viewer. Controller selects become rays, as `@react-three/xr`'s pointers hit-test
11
- * along each controller's target ray.
12
- *
13
- * @module
14
- */
15
- import type { Xr, XrInput } from '@opsydyn/effect-three';
16
- import { type Object3D } from 'three';
17
- import type { PresentableRenderer } from './renderSettings.ts';
18
- import { type Follow, type LendGeometry } from './xrSpaces.ts';
19
- /** Where an immersive session can come from: `navigator.xr`, or an emulator's. */
20
- export type XrSystem = Pick<XRSystem, 'requestSession' | 'isSessionSupported'>;
21
- /** The immersive session modes. */
22
- export type XrMode = 'immersive-vr' | 'immersive-ar';
23
- /**
24
- * The session request for a scene's settings: its reference space required, other
25
- * floors, hand tracking and anchors optional, and plane detection, a DOM overlay (on
26
- * `overlay`, the scene's element) and in AR hit testing when the scene asks for them
27
- * (pmndrs/xr's `buildXRSessionInit` asks for every feature it may use, optionally, and
28
- * roots the overlay on the element it is given). Anchors are asked for whether or not
29
- * the scene has any yet: it may place them mid-session.
30
- */
31
- export declare const sessionInit: (settings: Xr, mode?: XrMode, overlay?: Element) => XRSessionInit;
32
- export type Presentation = {
33
- /** Applies new settings mid-session: a new origin or heading moves the player. */
34
- readonly update: (settings: Xr) => void;
35
- readonly session: XRSession;
36
- };
37
- /** What a session presents: the scene, and how it is drawn, followed and told of input. */
38
- export type Presented = {
39
- readonly scene: Object3D;
40
- readonly draw: () => void;
41
- /** Places the groups that follow tracked spaces (`group({ follow })`). */
42
- readonly follow: Follow;
43
- /** Lends detected meshes' geometry to the scene (`xrMesh(id)`). */
44
- readonly lend: LendGeometry;
45
- readonly input: (input: XrInput) => void;
46
- };
47
- /**
48
- * Presents into `session`: frames come from the session (each read for input and the
49
- * spaces groups follow, then drawn) until it ends, when `ended` is called and the page's
50
- * own frames take over again. Input sources are drawn into the scene while it presents.
51
- */
52
- export declare const present: (renderer: PresentableRenderer, session: XRSession, settings: Xr, presented: Presented, ended: () => void) => Promise<Presentation>;
53
- //# sourceMappingURL=xr.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xr.d.ts","sourceRoot":"","sources":["../../src/dom/xr.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE7C,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAG/D,OAAO,EAAE,KAAK,MAAM,EAAE,KAAK,YAAY,EAAe,MAAM,eAAe,CAAC;AAE5E,kFAAkF;AAClF,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,gBAAgB,GAAG,oBAAoB,CAAC,CAAC;AAE/E,mCAAmC;AACnC,MAAM,MAAM,MAAM,GAAG,cAAc,GAAG,cAAc,CAAC;AAErD;;;;;;;GAOG;AACH,eAAO,MAAM,WAAW,aACZ,EAAE,SACN,MAAM,YACF,OAAO,KAChB,aAYD,CAAC;AAkDH,MAAM,MAAM,YAAY,GAAG;IACzB,kFAAkF;IAClF,QAAQ,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE,EAAE,KAAK,IAAI,CAAC;IACxC,QAAQ,CAAC,OAAO,EAAE,SAAS,CAAC;CAC7B,CAAC;AAEF,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B,0EAA0E;IAC1E,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,mEAAmE;IACnE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,OAAO,aACR,mBAAmB,WACpB,SAAS,YACR,EAAE,aACD,SAAS,SACb,MAAM,IAAI,KAChB,OAAO,CAAC,YAAY,CAgFtB,CAAC"}
@@ -1,49 +0,0 @@
1
- /**
2
- * Gliding with the thumbsticks while presenting (`xr({ glide })`), one frame at a time.
3
- *
4
- * Behavioural reference: pmndrs/xr at `0e1acd8`, `packages/xr/src/controller-locomotion.ts`:
5
- * the left stick moves the player along the head's facing, flattened onto the floor, at
6
- * `speed` metres per second at full stick (forward is the stick pushed away, negative y);
7
- * the right stick turns, smoothly at `turnSpeed`, or by `snapDegrees` once per push past
8
- * halfway, ready again once back under it. Unlike there, a still stick is a still player
9
- * (a small dead zone keeps resting thumbsticks from drifting), and the frame that stops
10
- * says where the player ended, for the Model.
11
- *
12
- * @module
13
- */
14
- import type { Vec3, XrGlide } from '@opsydyn/effect-three';
15
- /** Where the player stands: the reference space's origin in the scene, and its heading. */
16
- export type GlidePose = {
17
- readonly origin: Vec3;
18
- readonly heading: number;
19
- };
20
- /** A thumbstick, `[x, y]`, each −1 to 1 (`y` negative pushed away). */
21
- export type Stick = readonly [x: number, y: number];
22
- /** Gliding's state between frames. */
23
- export type Glider = {
24
- readonly pose: GlidePose;
25
- /** Whether a snap turn is ready (the turning stick has been back under halfway). */
26
- readonly snapReady: boolean;
27
- /** Whether the pose moved since the last report. */
28
- readonly moved: boolean;
29
- };
30
- export declare const startGlider: (pose: GlidePose) => Glider;
31
- /** The head's facing on the floor, from its orientation quaternion: −z turned, flattened. */
32
- export declare const floorFacing: (q: {
33
- readonly x: number;
34
- readonly y: number;
35
- readonly z: number;
36
- readonly w: number;
37
- }) => readonly [x: number, z: number];
38
- /**
39
- * One frame of gliding. Returns the next state, and the pose to report when the sticks
40
- * have just come to rest after moving it.
41
- */
42
- export declare const glideFrame: (glider: Glider, glide: XrGlide, sticks: {
43
- readonly move: Stick;
44
- readonly turn: Stick;
45
- }, facing: readonly [number, number], seconds: number) => {
46
- readonly glider: Glider;
47
- readonly stopped: GlidePose | undefined;
48
- };
49
- //# sourceMappingURL=xrGlide.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xrGlide.d.ts","sourceRoot":"","sources":["../../src/dom/xrGlide.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAE3D,2FAA2F;AAC3F,MAAM,MAAM,SAAS,GAAG;IAAE,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAE5E,uEAAuE;AACvE,MAAM,MAAM,KAAK,GAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAAC,CAAC;AAEpD,sCAAsC;AACtC,MAAM,MAAM,MAAM,GAAG;IACnB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC;IACzB,oFAAoF;IACpF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,oDAAoD;IACpD,QAAQ,CAAC,KAAK,EAAE,OAAO,CAAC;CACzB,CAAC;AAOF,eAAO,MAAM,WAAW,SAAU,SAAS,KAAG,MAAmD,CAAC;AAElG,6FAA6F;AAC7F,eAAO,MAAM,WAAW,MAAO;IAC7B,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;IACnB,QAAQ,CAAC,CAAC,EAAE,MAAM,CAAC;CACpB,KAAG,SAAS,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,CAKjC,CAAC;AA2CF;;;GAGG;AACH,eAAO,MAAM,UAAU,WACb,MAAM,SACP,OAAO,UACN;IAAE,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC;IAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAA;CAAE,UAC9C,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,WACxB,MAAM,KACd;IAAE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,OAAO,EAAE,SAAS,GAAG,SAAS,CAAA;CAYpE,CAAC"}
@@ -1,45 +0,0 @@
1
- /**
2
- * The page's immersive sessions: which mounted scenes can be presented, and the one
3
- * session (WebXR allows one at a time) presenting a scene.
4
- *
5
- * @module
6
- */
7
- import type { Xr, XrInput } from '@opsydyn/effect-three';
8
- import type { Object3D } from 'three';
9
- import { type XrMode, type XrSystem } from './xr.ts';
10
- import type { Follow, LendGeometry } from './xrSpaces.ts';
11
- export type { XrMode } from './xr.ts';
12
- /** A mounted scene that can be presented. */
13
- export type XrTarget = {
14
- readonly canvas: HTMLCanvasElement;
15
- /** The scene's current `xr` description; `null` while it does not ask to be presented. */
16
- readonly settings: () => Xr | null;
17
- /** Draws one frame now (the session calls it for each of its frames). */
18
- readonly draw: () => void;
19
- /** The scene's three.js root, where input sources are drawn while it presents. */
20
- readonly scene: Object3D;
21
- /** The scene's element: the DOM overlay's root, when the scene asks for one. */
22
- readonly element: Element;
23
- /** Places the groups that follow tracked spaces. */
24
- readonly follow: Follow;
25
- /** Lends a geometry to the scene's store, for detected meshes. */
26
- readonly lend: LendGeometry;
27
- /** Input from the session: aims, selects, sticks, buttons and surfaces. */
28
- readonly input: (input: XrInput) => void;
29
- /** The session began presenting this scene in `mode`, or (with `null`) ended. */
30
- readonly presenting: (mode: XrMode | null) => void;
31
- };
32
- export type XrHub = {
33
- /** Makes a scene presentable; returns a function that withdraws it (ending its session). */
34
- readonly register: (target: XrTarget) => () => void;
35
- readonly supported: (mode: XrMode) => Promise<boolean>;
36
- /**
37
- * Requests a session and presents the first registered scene that describes `xr`.
38
- * Call from a user gesture's handling: browsers require one to start a session.
39
- */
40
- readonly enter: (mode: XrMode) => Promise<void>;
41
- readonly exit: () => Promise<void>;
42
- };
43
- /** Creates the hub for a page; `system` is `navigator.xr` when the browser has WebXR. */
44
- export declare const createXrHub: (system: () => XrSystem | undefined) => XrHub;
45
- //# sourceMappingURL=xrHub.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xrHub.d.ts","sourceRoot":"","sources":["../../src/dom/xrHub.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,EAAE,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AACzD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAA2C,KAAK,MAAM,EAAE,KAAK,QAAQ,EAAE,MAAM,SAAS,CAAC;AAC9F,OAAO,KAAK,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAE1D,YAAY,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAEtC,6CAA6C;AAC7C,MAAM,MAAM,QAAQ,GAAG;IACrB,QAAQ,CAAC,MAAM,EAAE,iBAAiB,CAAC;IACnC,0FAA0F;IAC1F,QAAQ,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IACnC,yEAAyE;IACzE,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B,kFAAkF;IAClF,QAAQ,CAAC,KAAK,EAAE,QAAQ,CAAC;IACzB,gFAAgF;IAChF,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,oDAAoD;IACpD,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,EAAE,YAAY,CAAC;IAC5B,2EAA2E;IAC3E,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,CAAC;IACzC,iFAAiF;IACjF,QAAQ,CAAC,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CACpD,CAAC;AAEF,MAAM,MAAM,KAAK,GAAG;IAClB,4FAA4F;IAC5F,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,QAAQ,KAAK,MAAM,IAAI,CAAC;IACpD,QAAQ,CAAC,SAAS,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,OAAO,CAAC,CAAC;IACvD;;;OAGG;IACH,QAAQ,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;CACpC,CAAC;AAIF,yFAAyF;AACzF,eAAO,MAAM,WAAW,WAAY,MAAM,QAAQ,GAAG,SAAS,KAAG,KAkEhE,CAAC"}
@@ -1,40 +0,0 @@
1
- /**
2
- * A session's input sources, each frame: where each points (`Aim`), its gamepad's sticks
3
- * and buttons, in AR where its ray meets a real surface, and drawing its ray and a hand's
4
- * joints into the presented scene.
5
- *
6
- * Behavioural references: pmndrs/xr at `0e1acd8` (`packages/xr/src/pointer` ray-casts
7
- * along every source's target ray each frame; `controller-locomotion.ts` reads the
8
- * `xr-standard` thumbstick, axes 2 and 3, forward negative; `hit-test.ts` requests a hit
9
- * test source per space and reads `getHitTestResults` each frame), and three.js's
10
- * `XRHandPrimitiveModel` at 0.186.1 (a sphere per hand joint, sized by its radius).
11
- *
12
- * @module
13
- */
14
- import type { Ray, Xr, XrInput, XrStickDirection } from '@opsydyn/effect-three';
15
- import { Group } from 'three';
16
- /** A target ray pose as a ray in the reference space: from its position along its −z. */
17
- export declare const rayOf: (pose: XRPose) => Ray;
18
- /** Where a stick at `(x, y)` points, keeping `previous` until it clearly changes. */
19
- export declare const stickDirection: (x: number, y: number, previous: XrStickDirection) => XrStickDirection;
20
- export type XrInputs = {
21
- /** Reads every input source in this frame, in `space` (the scene's). */
22
- readonly frame: (frame: XRFrame, space: XRReferenceSpace) => void;
23
- /** A source's id, the same for its selects as for its aims. */
24
- readonly idOf: (source: XRInputSource) => number;
25
- /** A select ended: in AR with hit tests, report where its ray met a surface. */
26
- readonly selected: (source: XRInputSource) => void;
27
- /** Ends tracking: every source is lost, and the visuals go. */
28
- readonly stop: () => void;
29
- /** Each hand's thumbstick this frame (`[0, 0]` without one). */
30
- readonly sticks: () => {
31
- readonly left: readonly [number, number];
32
- readonly right: readonly [number, number];
33
- };
34
- };
35
- /**
36
- * Tracks `session`'s input sources, sending what they do to `input` and drawing them into
37
- * `group` (added to the presented scene) while `settings().showInputs`.
38
- */
39
- export declare const trackInputs: (session: XRSession, group: Group, settings: () => Xr | null, input: (input: XrInput) => void) => XrInputs;
40
- //# sourceMappingURL=xrInputs.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xrInputs.d.ts","sourceRoot":"","sources":["../../src/dom/xrInputs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AACH,OAAO,KAAK,EACV,GAAG,EAEH,EAAE,EAGF,OAAO,EACP,gBAAgB,EACjB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAGL,KAAK,EASN,MAAM,OAAO,CAAC;AAEf,yFAAyF;AACzF,eAAO,MAAM,KAAK,SAAU,MAAM,KAAG,GAQpC,CAAC;AAeF,qFAAqF;AACrF,eAAO,MAAM,cAAc,MACtB,MAAM,KACN,MAAM,YACC,gBAAgB,KACzB,gBAKF,CAAC;AA8FF,MAAM,MAAM,QAAQ,GAAG;IACrB,wEAAwE;IACxE,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClE,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,MAAM,CAAC;IACjD,gFAAgF;IAChF,QAAQ,CAAC,QAAQ,EAAE,CAAC,MAAM,EAAE,aAAa,KAAK,IAAI,CAAC;IACnD,+DAA+D;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;IAC1B,gEAAgE;IAChE,QAAQ,CAAC,MAAM,EAAE,MAAM;QACrB,QAAQ,CAAC,IAAI,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QACzC,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KAC3C,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YACb,SAAS,SACX,KAAK,YACF,MAAM,EAAE,GAAG,IAAI,SAClB,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,KAC9B,QAuHF,CAAC"}
@@ -1,33 +0,0 @@
1
- /**
2
- * What a session tracks for the scene's description, each frame: where every space a
3
- * group follows is (`group({ follow })`), the anchors the scene placed
4
- * (`xr({ anchors })`), and the planes the session detected (`xr({ planes: true })`).
5
- *
6
- * Behavioural reference: pmndrs/xr at `0e1acd8`: `space.ts` `createGetXRSpaceMatrix` (an
7
- * object on a space takes the space's pose in the reference space each frame, and none
8
- * while the frame has no pose for it), `anchor.ts` `requestXRAnchor` (`frame.createAnchor`
9
- * with a rigid transform in the origin's reference space), `store.ts` `updateSession` (the
10
- * frame's `detectedPlanes` and `detectedMeshes` read each frame, passed on when the set
11
- * changes), `plane.ts` (a plane is made again once it changes) and `mesh.ts` (a detected
12
- * mesh's geometry built from its `vertices` and `indices`, again when they change).
13
- *
14
- * @module
15
- */
16
- import { type BodyPose, type Xr, type XrInput, type XrSpace } from '@opsydyn/effect-three';
17
- import { BufferGeometry } from 'three';
18
- /** Places the scene's following groups where `locate` finds their spaces. */
19
- export type Follow = (locate: (space: XrSpace) => BodyPose | undefined) => void;
20
- /** Lends a geometry to the scene's store under `id`; returns a function that withdraws it. */
21
- export type LendGeometry = (id: string, geometry: BufferGeometry) => () => void;
22
- export type XrSpaces = {
23
- /** Brings anchors and planes up to date in this frame, then places the following groups. */
24
- readonly frame: (frame: XRFrame, space: XRReferenceSpace) => void;
25
- /** Ends tracking: anchors are deleted, and every following group is hidden. */
26
- readonly stop: () => void;
27
- };
28
- /**
29
- * Tracks the spaces `session` can locate for the description `settings()`, placing its
30
- * following groups with `follow` and reporting detected planes to `input`.
31
- */
32
- export declare const trackSpaces: (session: XRSession, settings: () => Xr | null, follow: Follow, input: (input: XrInput) => void, lend: LendGeometry) => XrSpaces;
33
- //# sourceMappingURL=xrSpaces.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"xrSpaces.d.ts","sourceRoot":"","sources":["../../src/dom/xrSpaces.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AACH,OAAO,EACL,KAAK,QAAQ,EAEb,KAAK,EAAE,EAEP,KAAK,OAAO,EAIZ,KAAK,OAAO,EACb,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EAAmB,cAAc,EAAqB,MAAM,OAAO,CAAC;AAE3E,6EAA6E;AAC7E,MAAM,MAAM,MAAM,GAAG,CAAC,MAAM,EAAE,CAAC,KAAK,EAAE,OAAO,KAAK,QAAQ,GAAG,SAAS,KAAK,IAAI,CAAC;AAEhF,8FAA8F;AAC9F,MAAM,MAAM,YAAY,GAAG,CAAC,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,KAAK,MAAM,IAAI,CAAC;AAEhF,MAAM,MAAM,QAAQ,GAAG;IACrB,4FAA4F;IAC5F,QAAQ,CAAC,KAAK,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAClE,+EAA+E;IAC/E,QAAQ,CAAC,IAAI,EAAE,MAAM,IAAI,CAAC;CAC3B,CAAC;AAqEF;;;GAGG;AACH,eAAO,MAAM,WAAW,YACb,SAAS,YACR,MAAM,EAAE,GAAG,IAAI,UACjB,MAAM,SACP,CAAC,KAAK,EAAE,OAAO,KAAK,IAAI,QACzB,YAAY,KACjB,QAwKF,CAAC"}