@woosh/meep-engine 3.35.0 → 3.37.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 (103) hide show
  1. package/package.json +1 -1
  2. package/src/engine/Engine.d.ts +2 -0
  3. package/src/engine/Engine.d.ts.map +1 -1
  4. package/src/engine/Engine.js +5 -1
  5. package/src/engine/input/devices/XRInputDevice.d.ts +91 -0
  6. package/src/engine/input/devices/XRInputDevice.d.ts.map +1 -0
  7. package/src/engine/input/devices/XRInputDevice.js +479 -0
  8. package/src/engine/input/devices/xr/XRGamepadMapping.d.ts +14 -0
  9. package/src/engine/input/devices/xr/XRGamepadMapping.d.ts.map +1 -0
  10. package/src/engine/input/devices/xr/XRGamepadMapping.js +9 -0
  11. package/src/engine/input/devices/xr/XRHandedness.d.ts +15 -0
  12. package/src/engine/input/devices/xr/XRHandedness.d.ts.map +1 -0
  13. package/src/engine/input/devices/xr/XRHandedness.js +10 -0
  14. package/src/engine/input/devices/xr/XRInputAction.d.ts +50 -0
  15. package/src/engine/input/devices/xr/XRInputAction.d.ts.map +1 -0
  16. package/src/engine/input/devices/xr/XRInputAction.js +116 -0
  17. package/src/engine/input/devices/xr/XRInputButton.d.ts +26 -0
  18. package/src/engine/input/devices/xr/XRInputButton.d.ts.map +1 -0
  19. package/src/engine/input/devices/xr/XRInputButton.js +53 -0
  20. package/src/engine/input/devices/xr/XRInputCoordinates.d.ts +23 -0
  21. package/src/engine/input/devices/xr/XRInputCoordinates.d.ts.map +1 -0
  22. package/src/engine/input/devices/xr/XRInputCoordinates.js +35 -0
  23. package/src/engine/input/devices/xr/XRInputHandle.d.ts +93 -0
  24. package/src/engine/input/devices/xr/XRInputHandle.d.ts.map +1 -0
  25. package/src/engine/input/devices/xr/XRInputHandle.js +268 -0
  26. package/src/engine/input/devices/xr/XRInputPose.d.ts +59 -0
  27. package/src/engine/input/devices/xr/XRInputPose.d.ts.map +1 -0
  28. package/src/engine/input/devices/xr/XRInputPose.js +77 -0
  29. package/src/engine/input/devices/xr/XRInputTypes.d.ts +76 -0
  30. package/src/engine/input/devices/xr/XRInputTypes.d.ts.map +1 -0
  31. package/src/engine/input/devices/xr/XRInputTypes.js +31 -0
  32. package/src/engine/input/devices/xr/XRInputValueSource.d.ts +11 -0
  33. package/src/engine/input/devices/xr/XRInputValueSource.d.ts.map +1 -0
  34. package/src/engine/input/devices/xr/XRInputValueSource.js +11 -0
  35. package/src/engine/input/devices/xr/XRTargetRayMode.d.ts +17 -0
  36. package/src/engine/input/devices/xr/XRTargetRayMode.d.ts.map +1 -0
  37. package/src/engine/input/devices/xr/XRTargetRayMode.js +12 -0
  38. package/src/engine/input/devices/xr/XRVisibilityState.d.ts +15 -0
  39. package/src/engine/input/devices/xr/XRVisibilityState.d.ts.map +1 -0
  40. package/src/engine/input/devices/xr/XRVisibilityState.js +10 -0
  41. package/src/engine/input/ecs/ism/coordinate/InputCoordinateChannel.d.ts +15 -1
  42. package/src/engine/input/ecs/ism/coordinate/InputCoordinateChannel.d.ts.map +1 -1
  43. package/src/engine/input/ecs/ism/coordinate/InputCoordinateChannel.js +9 -0
  44. package/src/engine/input/ecs/ism/coordinate/InputCoordinateDevice.d.ts +17 -4
  45. package/src/engine/input/ecs/ism/coordinate/InputCoordinateDevice.d.ts.map +1 -1
  46. package/src/engine/input/ecs/ism/coordinate/InputCoordinateDevice.js +26 -0
  47. package/src/engine/input/ecs/ism/coordinate/InputCoordinateSwitches.d.ts +17 -2
  48. package/src/engine/input/ecs/ism/coordinate/InputCoordinateSwitches.d.ts.map +1 -1
  49. package/src/engine/input/ecs/ism/device/GamepadInputDeviceAdapter.d.ts +5 -0
  50. package/src/engine/input/ecs/ism/device/GamepadInputDeviceAdapter.d.ts.map +1 -1
  51. package/src/engine/input/ecs/ism/device/InputDeviceAdapter.d.ts +2 -0
  52. package/src/engine/input/ecs/ism/device/InputDeviceAdapter.d.ts.map +1 -1
  53. package/src/engine/input/ecs/ism/device/InputDeviceAdapter.js +2 -0
  54. package/src/engine/input/ecs/ism/device/KeyboardInputDeviceAdapter.d.ts +7 -0
  55. package/src/engine/input/ecs/ism/device/KeyboardInputDeviceAdapter.d.ts.map +1 -1
  56. package/src/engine/input/ecs/ism/device/ManualInputDeviceAdapter.d.ts +5 -0
  57. package/src/engine/input/ecs/ism/device/ManualInputDeviceAdapter.d.ts.map +1 -1
  58. package/src/engine/input/ecs/ism/device/PointerInputDeviceAdapter.d.ts +5 -0
  59. package/src/engine/input/ecs/ism/device/PointerInputDeviceAdapter.d.ts.map +1 -1
  60. package/src/engine/input/ecs/ism/device/XRInputDeviceAdapter.d.ts +30 -0
  61. package/src/engine/input/ecs/ism/device/XRInputDeviceAdapter.d.ts.map +1 -0
  62. package/src/engine/input/ecs/ism/device/XRInputDeviceAdapter.js +87 -0
  63. package/src/engine/input/ecs/ism/device/XR_INPUT_DEVICE_IDS.d.ts +15 -0
  64. package/src/engine/input/ecs/ism/device/XR_INPUT_DEVICE_IDS.d.ts.map +1 -0
  65. package/src/engine/input/ecs/ism/device/XR_INPUT_DEVICE_IDS.js +22 -0
  66. package/src/engine/input/ecs/ism/trigger/InputTrigger.d.ts +11 -1
  67. package/src/engine/input/ecs/ism/trigger/InputTrigger.d.ts.map +1 -1
  68. package/src/engine/input/ecs/ism/trigger/InputTrigger.js +7 -0
  69. package/src/engine/input/ecs/ism/trigger/InputTriggerChord.d.ts +16 -2
  70. package/src/engine/input/ecs/ism/trigger/InputTriggerChord.d.ts.map +1 -1
  71. package/src/engine/input/ecs/ism/trigger/InputTriggerHold.d.ts +22 -2
  72. package/src/engine/input/ecs/ism/trigger/InputTriggerHold.d.ts.map +1 -1
  73. package/src/engine/input/ecs/ism/trigger/InputTriggerRelease.d.ts +16 -2
  74. package/src/engine/input/ecs/ism/trigger/InputTriggerRelease.d.ts.map +1 -1
  75. package/src/engine/input/ecs/ism/trigger/InputTriggerSequence.d.ts +24 -4
  76. package/src/engine/input/ecs/ism/trigger/InputTriggerSequence.d.ts.map +1 -1
  77. package/src/engine/input/ecs/ism/trigger/InputTriggerSwitch.d.ts +6 -8
  78. package/src/engine/input/ecs/ism/trigger/InputTriggerSwitch.d.ts.map +1 -1
  79. package/src/engine/input/ecs/ism/trigger/InputTriggerSwitch.js +5 -0
  80. package/src/engine/input/ecs/ism/trigger/InputTriggerXRButton.d.ts +15 -0
  81. package/src/engine/input/ecs/ism/trigger/InputTriggerXRButton.d.ts.map +1 -0
  82. package/src/engine/input/ecs/ism/trigger/InputTriggerXRButton.js +25 -0
  83. package/src/engine/physics/fluid/ecs/FluidObstacleSystem.d.ts +4 -4
  84. package/src/shade/renderer/animation/chunk_pose_accumulator.js +14 -24
  85. package/src/shade/renderer/animation/skinning/bounds_refresh/shader_meshlet_bounds_reduce.js +16 -15
  86. package/src/shade/renderer/deferred/indirect/chunk_lpv_sample_light.js +1 -1
  87. package/src/shade/renderer/gpu_primitive/bvh/GPU_BVH_BUILD_PLAN.md +1123 -1122
  88. package/src/shade/renderer/gpu_primitive/bvh/PHASE1_HANDOVER.md +202 -201
  89. package/src/shade/renderer/light/environment/chunk_roughness_to_mip_ratio.js +24 -0
  90. package/src/shade/renderer/light/environment/chunk_sphere_probe_roughness_to_lod.js +2 -25
  91. package/src/shade/renderer/light/environment/shader_project_environment_sh.d.ts +2 -2
  92. package/src/shade/renderer/light/environment/shader_project_environment_sh.d.ts.map +1 -1
  93. package/src/shade/renderer/light/environment/shader_project_environment_sh.js +50 -19
  94. package/src/shade/renderer/loader/gltf/tiny-gltf.d.ts +1 -1
  95. package/src/shade/renderer/particles/DESIGN.md +1 -1
  96. package/src/shade/renderer/particles/bounds/chunk_particle_bounds.js +10 -9
  97. package/src/shade/renderer/scene/shader_bvh_extract_instance_leaves.js +10 -8
  98. package/src/shade/renderer/shader/chunk/atomic/chunk_atomic_add_f32_storage.js +25 -0
  99. package/src/shade/renderer/shader/chunk/atomic/chunk_atomic_max_f32_storage.js +28 -0
  100. package/src/shade/renderer/shader/chunk/atomic/chunk_atomic_min_f32_storage.js +28 -0
  101. package/src/shade/renderer/shader/chunk/geometry/plane/{plane_ray_raycast.js → chunk_plane_ray_raycast.js} +1 -1
  102. package/src/shade/renderer/shadow/map/csm/shader/shader_csm_caster_range.js +3 -3
  103. package/src/shade/renderer/animation/skinning/bounds_refresh/chunk_aabb_atomic_f32.js +0 -59
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XRHandedness.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/devices/xr/XRHandedness.js"],"names":[],"mappings":";;;2BAGU,MAAM;AAHhB;;;;GAIG;AACH;;;;GAIG"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Native XRInputSource handedness values.
3
+ * @readonly
4
+ * @enum {string}
5
+ */
6
+ export const XRHandedness = Object.freeze({
7
+ None: 'none',
8
+ Left: 'left',
9
+ Right: 'right'
10
+ });
@@ -0,0 +1,50 @@
1
+ /**
2
+ * Observable amount of a select/squeeze action, in [0, 1]. Read {@link x} and subscribe to
3
+ * {@link onChanged} as with any Vector1. The device owns mutation.
4
+ *
5
+ * {@link valueSource} identifies a native button amount or an event-derived 0/1 value.
6
+ * {@link completed} fires on native action completion; {@link cancelled} fires when an unfinished
7
+ * interaction ends or is interrupted. Each interaction has at most one outcome. Amount changes alone
8
+ * do not complete or cancel an action.
9
+ */
10
+ export class XRInputAction extends Vector1 {
11
+ /**
12
+ * Successful native action completion. Dispatches no arguments.
13
+ * @readonly
14
+ * @type {Signal}
15
+ */
16
+ readonly completed: Signal;
17
+ /**
18
+ * An unfinished interaction ended or was interrupted. Dispatches no arguments.
19
+ * @readonly
20
+ * @type {Signal}
21
+ */
22
+ readonly cancelled: Signal;
23
+ /**
24
+ * Origin of the current amount. Do not modify directly.
25
+ * @type {XRInputValueSource}
26
+ */
27
+ valueSource: XRInputValueSource;
28
+ /**
29
+ * Store the supplied amount and its source.
30
+ * @internal
31
+ * @param {number} [value=0]
32
+ * @param {XRInputValueSource} [source=XRInputValueSource.Unavailable]
33
+ */
34
+ update(value?: number, source?: XRInputValueSource): void;
35
+ /** @internal Called only for a native start, never inferred from the amount. */
36
+ begin(): void;
37
+ /** @internal A completion without an observed start is not replayed after a rebind/interruption. */
38
+ complete(): void;
39
+ /** @internal */
40
+ end(): void;
41
+ /** @internal Stage cancellation so the whole handle can become neutral before its notification. */
42
+ reset(): void;
43
+ /** @internal */
44
+ flushCancellation(): void;
45
+ #private;
46
+ }
47
+ import { Vector1 } from "../../../../core/geom/Vector1.js";
48
+ import Signal from "../../../../core/events/signal/Signal.js";
49
+ import { XRInputValueSource } from "./XRInputValueSource.js";
50
+ //# sourceMappingURL=XRInputAction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XRInputAction.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/devices/xr/XRInputAction.js"],"names":[],"mappings":"AAgBA;;;;;;;;GAQG;AACH;IACI;;;;OAIG;IACH,oBAFU,MAAM,CAES;IAEzB;;;;OAIG;IACH,oBAFU,MAAM,CAES;IAEzB;;;OAGG;IACH,aAFU,kBAAkB,CAEiB;IAM7C;;;;;OAKG;IACH,eAHW,MAAM,WACN,kBAAkB,QAS5B;IAED,gFAAgF;IAChF,cASC;IAED,oGAAoG;IACpG,iBAOC;IAED,gBAAgB;IAChB,YAWC;IAED,mGAAmG;IACnG,cAIC;IAED,gBAAgB;IAChB,0BAKC;;CACJ;wBAjHuB,kCAAkC;mBADvC,0CAA0C;mCAE1B,yBAAyB"}
@@ -0,0 +1,116 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import Signal from "../../../../core/events/signal/Signal.js";
3
+ import { Vector1 } from "../../../../core/geom/Vector1.js";
4
+ import { XRInputValueSource } from "./XRInputValueSource.js";
5
+
6
+ /**
7
+ * Native interaction lifecycle, independent of pressure.
8
+ * @readonly
9
+ * @enum {number}
10
+ */
11
+ const InteractionState = {
12
+ Idle: 0,
13
+ Started: 1,
14
+ Completed: 2
15
+ };
16
+
17
+ /**
18
+ * Observable amount of a select/squeeze action, in [0, 1]. Read {@link x} and subscribe to
19
+ * {@link onChanged} as with any Vector1. The device owns mutation.
20
+ *
21
+ * {@link valueSource} identifies a native button amount or an event-derived 0/1 value.
22
+ * {@link completed} fires on native action completion; {@link cancelled} fires when an unfinished
23
+ * interaction ends or is interrupted. Each interaction has at most one outcome. Amount changes alone
24
+ * do not complete or cancel an action.
25
+ */
26
+ export class XRInputAction extends Vector1 {
27
+ /**
28
+ * Successful native action completion. Dispatches no arguments.
29
+ * @readonly
30
+ * @type {Signal}
31
+ */
32
+ completed = new Signal();
33
+
34
+ /**
35
+ * An unfinished interaction ended or was interrupted. Dispatches no arguments.
36
+ * @readonly
37
+ * @type {Signal}
38
+ */
39
+ cancelled = new Signal();
40
+
41
+ /**
42
+ * Origin of the current amount. Do not modify directly.
43
+ * @type {XRInputValueSource}
44
+ */
45
+ valueSource = XRInputValueSource.Unavailable;
46
+
47
+ #interaction = InteractionState.Idle;
48
+
49
+ #cancelled = false;
50
+
51
+ /**
52
+ * Store the supplied amount and its source.
53
+ * @internal
54
+ * @param {number} [value=0]
55
+ * @param {XRInputValueSource} [source=XRInputValueSource.Unavailable]
56
+ */
57
+ update(value = 0, source = XRInputValueSource.Unavailable) {
58
+ assert.greaterThanOrEqual(value, 0, 'value >= 0');
59
+ assert.lessThanOrEqual(value, 1, 'value <= 1');
60
+ assert.enum(source, XRInputValueSource, 'source');
61
+
62
+ this.valueSource = source;
63
+ this.set(value);
64
+ }
65
+
66
+ /** @internal Called only for a native start, never inferred from the amount. */
67
+ begin() {
68
+ if (this.#interaction !== InteractionState.Idle) {
69
+ return;
70
+ }
71
+
72
+ this.#interaction = InteractionState.Started;
73
+ if (this.valueSource === XRInputValueSource.Action) {
74
+ this.set(1);
75
+ }
76
+ }
77
+
78
+ /** @internal A completion without an observed start is not replayed after a rebind/interruption. */
79
+ complete() {
80
+ if (this.#interaction !== InteractionState.Started) {
81
+ return;
82
+ }
83
+
84
+ this.#interaction = InteractionState.Completed;
85
+ this.completed.send0();
86
+ }
87
+
88
+ /** @internal */
89
+ end() {
90
+ const cancelled = this.#interaction === InteractionState.Started;
91
+ this.#interaction = InteractionState.Idle;
92
+
93
+ if (this.valueSource === XRInputValueSource.Action) {
94
+ this.set(0);
95
+ }
96
+
97
+ if (cancelled) {
98
+ this.cancelled.send0();
99
+ }
100
+ }
101
+
102
+ /** @internal Stage cancellation so the whole handle can become neutral before its notification. */
103
+ reset() {
104
+ this.#cancelled = this.#cancelled || this.#interaction === InteractionState.Started;
105
+ this.#interaction = InteractionState.Idle;
106
+ this.update();
107
+ }
108
+
109
+ /** @internal */
110
+ flushCancellation() {
111
+ if (this.#cancelled) {
112
+ this.#cancelled = false;
113
+ this.cancelled.send0();
114
+ }
115
+ }
116
+ }
@@ -0,0 +1,26 @@
1
+ /**
2
+ * One raw GamepadButton: its amount in [0, 1] and its native pressed/touched switches.
3
+ * {@link pressed} is independent of {@link x}; a partially depressed trigger need not be pressed.
4
+ * The device owns mutation. Switches and {@link onChanged} retain their identity across source replacement.
5
+ */
6
+ export class XRInputButton extends Vector1 {
7
+ /** @readonly */
8
+ readonly pressed: InputDeviceSwitch;
9
+ /** @readonly */
10
+ readonly touched: InputDeviceSwitch;
11
+ /**
12
+ * Stage binary state while updating the scalar. All numeric channels and poses are sampled before
13
+ * the device calls flushSwitches, so an input-map action can read the corresponding amount.
14
+ * @internal
15
+ * @param {number} [value=0]
16
+ * @param {boolean} [pressed=false]
17
+ * @param {boolean} [touched=false]
18
+ */
19
+ update(value?: number, pressed?: boolean, touched?: boolean): void;
20
+ /** @internal */
21
+ flushSwitches(): void;
22
+ #private;
23
+ }
24
+ import { Vector1 } from "../../../../core/geom/Vector1.js";
25
+ import { InputDeviceSwitch } from "../InputDeviceSwitch.js";
26
+ //# sourceMappingURL=XRInputButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XRInputButton.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/devices/xr/XRInputButton.js"],"names":[],"mappings":"AAIA;;;;GAIG;AACH;IACI,gBAAgB;IAChB,oCAAkC;IAElC,gBAAgB;IAChB,oCAAkC;IAKlC;;;;;;;OAOG;IACH,eAJW,MAAM,YACN,OAAO,YACP,OAAO,QAWjB;IAED,gBAAgB;IAChB,sBAYC;;CACJ;wBAnDuB,kCAAkC;kCACxB,yBAAyB"}
@@ -0,0 +1,53 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+ import { Vector1 } from "../../../../core/geom/Vector1.js";
3
+ import { InputDeviceSwitch } from "../InputDeviceSwitch.js";
4
+
5
+ /**
6
+ * One raw GamepadButton: its amount in [0, 1] and its native pressed/touched switches.
7
+ * {@link pressed} is independent of {@link x}; a partially depressed trigger need not be pressed.
8
+ * The device owns mutation. Switches and {@link onChanged} retain their identity across source replacement.
9
+ */
10
+ export class XRInputButton extends Vector1 {
11
+ /** @readonly */
12
+ pressed = new InputDeviceSwitch();
13
+
14
+ /** @readonly */
15
+ touched = new InputDeviceSwitch();
16
+
17
+ #pressed = false;
18
+ #touched = false;
19
+
20
+ /**
21
+ * Stage binary state while updating the scalar. All numeric channels and poses are sampled before
22
+ * the device calls flushSwitches, so an input-map action can read the corresponding amount.
23
+ * @internal
24
+ * @param {number} [value=0]
25
+ * @param {boolean} [pressed=false]
26
+ * @param {boolean} [touched=false]
27
+ */
28
+ update(value = 0, pressed = false, touched = false) {
29
+ assert.greaterThanOrEqual(value, 0, 'value >= 0');
30
+ assert.lessThanOrEqual(value, 1, 'value <= 1');
31
+ assert.isBoolean(pressed, 'pressed');
32
+ assert.isBoolean(touched, 'touched');
33
+
34
+ this.#pressed = pressed;
35
+ this.#touched = touched;
36
+ this.set(value);
37
+ }
38
+
39
+ /** @internal */
40
+ flushSwitches() {
41
+ if (this.#pressed) {
42
+ this.pressed.press();
43
+ } else {
44
+ this.pressed.release();
45
+ }
46
+
47
+ if (this.#touched) {
48
+ this.touched.press();
49
+ } else {
50
+ this.touched.release();
51
+ }
52
+ }
53
+ }
@@ -0,0 +1,23 @@
1
+ /**
2
+ * Code for a raw button's scalar amount. Use InputTriggerXRButton for pressed/touched switches.
3
+ * @param {number} index Native button index.
4
+ * @returns {number}
5
+ */
6
+ export function xr_input_button_coordinate(index: number): number;
7
+ /**
8
+ * Code for a raw axis, without stick calibration.
9
+ * @param {number} index Native axis index.
10
+ * @returns {number}
11
+ */
12
+ export function xr_input_axis_coordinate(index: number): number;
13
+ /**
14
+ * Stable coordinate codes used in serialized input maps.
15
+ */
16
+ export type XRInputCoordinates = number;
17
+ export namespace XRInputCoordinates {
18
+ let select: number;
19
+ let squeeze: number;
20
+ let thumbstick: number;
21
+ let touchpad: number;
22
+ }
23
+ //# sourceMappingURL=XRInputCoordinates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XRInputCoordinates.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/devices/xr/XRInputCoordinates.js"],"names":[],"mappings":"AAcA;;;;GAIG;AACH,kDAHW,MAAM,GACJ,MAAM,CAMlB;AAED;;;;GAIG;AACH,gDAHW,MAAM,GACJ,MAAM,CAMlB;;;;iCA7BS,MAAM"}
@@ -0,0 +1,35 @@
1
+ import { assert } from "../../../../core/assert.js";
2
+
3
+ /**
4
+ * Stable coordinate codes used in serialized input maps.
5
+ * @readonly
6
+ * @enum {number}
7
+ */
8
+ export const XRInputCoordinates = {
9
+ select: 0,
10
+ squeeze: 1,
11
+ thumbstick: 2,
12
+ touchpad: 3
13
+ };
14
+
15
+ /**
16
+ * Code for a raw button's scalar amount. Use InputTriggerXRButton for pressed/touched switches.
17
+ * @param {number} index Native button index.
18
+ * @returns {number}
19
+ */
20
+ export function xr_input_button_coordinate(index) {
21
+ assert.isNonNegativeInteger(index, 'index');
22
+
23
+ return 4 + index * 2;
24
+ }
25
+
26
+ /**
27
+ * Code for a raw axis, without stick calibration.
28
+ * @param {number} index Native axis index.
29
+ * @returns {number}
30
+ */
31
+ export function xr_input_axis_coordinate(index) {
32
+ assert.isNonNegativeInteger(index, 'index');
33
+
34
+ return 5 + index * 2;
35
+ }
@@ -0,0 +1,93 @@
1
+ /**
2
+ * One XR input source, or a persistent handedness slot owned by XRInputDevice.
3
+ * All control objects survive disconnection. Consumers read them; the device owns mutation.
4
+ * With xr-standard, select/squeeze read native button amounts. Other mappings remain available through
5
+ * buttons/axes, while select/squeeze report 0/1 from native events; check their valueSource.
6
+ *
7
+ * Button indices 0/1 are select/squeeze; axes 0/1 are touchpad and 2/3 thumbstick in xr-standard.
8
+ * Placeholder entries are allowed by WebXR: a zero entry does not prove that a control exists.
9
+ */
10
+ export class XRInputHandle {
11
+ /** @readonly */
12
+ readonly select: XRInputAction;
13
+ /** @readonly */
14
+ readonly squeeze: XRInputAction;
15
+ /**
16
+ * Raw native buttons. Use {@link getButton} for an index that may not exist yet.
17
+ * @readonly
18
+ * @type {XRInputButton[]}
19
+ */
20
+ readonly buttons: XRInputButton[];
21
+ /**
22
+ * Raw native axes in [-1, 1]. Use {@link getAxis} for an index that may not exist yet.
23
+ * @readonly
24
+ * @type {Vector1[]}
25
+ */
26
+ readonly axes: Vector1[];
27
+ /**
28
+ * Calibrated xr-standard thumbstick, +x right and +y down.
29
+ * @readonly
30
+ */
31
+ readonly thumbstick: GamepadStick;
32
+ /**
33
+ * Uncalibrated xr-standard touchpad coordinates, +x right and +y down.
34
+ * @readonly
35
+ */
36
+ readonly touchpad: Vector2;
37
+ /** @readonly */
38
+ readonly targetRay: XRInputPose;
39
+ /** @readonly */
40
+ readonly grip: XRInputPose;
41
+ /**
42
+ * Native source, or null while disconnected. Set by the device.
43
+ * @readonly
44
+ * @type {import('./XRInputTypes.js').XRInputSource|null}
45
+ */
46
+ readonly nativeSource: import('./XRInputTypes.js').XRInputSource | null;
47
+ /** Number of native buttons, excluding controls materialised for bindings. Do not modify directly. */
48
+ buttonCount: number;
49
+ /** Number of native axes, excluding controls materialised for bindings. Do not modify directly. */
50
+ axisCount: number;
51
+ get connected(): boolean;
52
+ get handedness(): string;
53
+ get targetRayMode(): string;
54
+ /** @returns {ReadonlyArray<string>} */
55
+ get profiles(): readonly string[];
56
+ /**
57
+ * Return a stable button, creating neutral entries up to this index if needed.
58
+ * @param {number} index
59
+ * @returns {XRInputButton}
60
+ */
61
+ getButton(index: number): XRInputButton;
62
+ /**
63
+ * Return a stable axis, creating neutral entries up to this index if needed.
64
+ * @param {number} index
65
+ * @returns {Vector1}
66
+ */
67
+ getAxis(index: number): Vector1;
68
+ /**
69
+ * @internal
70
+ * @param {import('./XRInputTypes.js').XRInputSource|null} source
71
+ */
72
+ bind(source: import('./XRInputTypes.js').XRInputSource | null): void;
73
+ /**
74
+ * @internal Sample values and poses before publishing raw switch edges.
75
+ * @param {import('./XRInputTypes.js').XRFrame|null} frame
76
+ * @param {EventTarget|null} referenceSpace
77
+ */
78
+ sample(frame: import('./XRInputTypes.js').XRFrame | null, referenceSpace: EventTarget | null): void;
79
+ /** @internal Tracking loss does not imply release or cancellation. */
80
+ invalidatePoses(): void;
81
+ /** @internal Neutralise everything before switch releases and cancellation callbacks. */
82
+ clear(): void;
83
+ /** @internal */
84
+ flush(): void;
85
+ #private;
86
+ }
87
+ import { XRInputAction } from "./XRInputAction.js";
88
+ import { XRInputButton } from "./XRInputButton.js";
89
+ import { Vector1 } from "../../../../core/geom/Vector1.js";
90
+ import { GamepadStick } from "../gamepad/GamepadStick.js";
91
+ import Vector2 from "../../../../core/geom/Vector2.js";
92
+ import { XRInputPose } from "./XRInputPose.js";
93
+ //# sourceMappingURL=XRInputHandle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"XRInputHandle.d.ts","sourceRoot":"","sources":["../../../../../../src/engine/input/devices/xr/XRInputHandle.js"],"names":[],"mappings":"AA2BA;;;;;;;;GAQG;AACH;IACI,gBAAgB;IAChB,+BAA6B;IAE7B,gBAAgB;IAChB,gCAA8B;IAE9B;;;;OAIG;IACH,kBAFU,aAAa,EAAE,CAEZ;IAEb;;;;OAIG;IACH,eAFU,OAAO,EAAE,CAET;IAEV;;;OAGG;IACH,kCAAoC;IAEpC;;;OAGG;IACH,2BAAyB;IAEzB,gBAAgB;IAChB,gCAA8B;IAE9B,gBAAgB;IAChB,2BAAyB;IAEzB;;;;OAIG;IACH,uBAFU,OAAO,mBAAmB,EAAE,aAAa,GAAC,IAAI,CAEpC;IAQpB,sGAAsG;IACtG,oBAAgB;IAEhB,mGAAmG;IACnG,kBAAc;IAOd,yBAEC;IAED,yBAEC;IAED,4BAEC;IAED,uCAAuC;IACvC,kCAEC;IAED;;;;OAIG;IACH,iBAHW,MAAM,GACJ,aAAa,CAUzB;IAED;;;;OAIG;IACH,eAHW,MAAM,GACJ,OAAO,CAUnB;IAED;;;OAGG;IACH,aAFW,OAAO,mBAAmB,EAAE,aAAa,GAAC,IAAI,QAgBxD;IAED;;;;OAIG;IACH,cAHW,OAAO,mBAAmB,EAAE,OAAO,GAAC,IAAI,kBACxC,WAAW,GAAC,IAAI,QA+C1B;IAmBD,sEAAsE;IACtE,wBAGC;IAED,yFAAyF;IACzF,cAeC;IAED,gBAAgB;IAChB,cAMC;;CACJ;8BAvQ6B,oBAAoB;8BACpB,oBAAoB;wBAJ1B,kCAAkC;6BAE7B,4BAA4B;oBADrC,kCAAkC;4BAIN,kBAAkB"}