@iwsdk/core 0.3.1 → 0.4.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.
- package/dist/camera/camera-system.d.ts +2 -1
- package/dist/camera/camera-system.d.ts.map +1 -1
- package/dist/camera/camera-system.js +6 -6
- package/dist/camera/camera-system.js.map +1 -1
- package/dist/depth/depth-sensing-system.d.ts +2 -0
- package/dist/depth/depth-sensing-system.d.ts.map +1 -1
- package/dist/depth/depth-sensing-system.js +18 -16
- package/dist/depth/depth-sensing-system.js.map +1 -1
- package/dist/ecs/system.d.ts +5 -2
- package/dist/ecs/system.d.ts.map +1 -1
- package/dist/ecs/system.js +2 -0
- package/dist/ecs/system.js.map +1 -1
- package/dist/ecs/world.d.ts +26 -4
- package/dist/ecs/world.d.ts.map +1 -1
- package/dist/ecs/world.js +2 -2
- package/dist/ecs/world.js.map +1 -1
- package/dist/environment-raycast/environment-raycast.js +2 -2
- package/dist/environment-raycast/environment-raycast.js.map +1 -1
- package/dist/grab/grab-system.d.ts.map +1 -1
- package/dist/grab/grab-system.js +20 -7
- package/dist/grab/grab-system.js.map +1 -1
- package/dist/grab/grabbed.d.ts +21 -0
- package/dist/grab/grabbed.d.ts.map +1 -0
- package/dist/grab/grabbed.js +29 -0
- package/dist/grab/grabbed.js.map +1 -0
- package/dist/grab/index.d.ts +1 -0
- package/dist/grab/index.d.ts.map +1 -1
- package/dist/grab/index.js +1 -0
- package/dist/grab/index.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/init/player-camera.d.ts +9 -0
- package/dist/init/player-camera.d.ts.map +1 -0
- package/dist/init/player-camera.js +14 -0
- package/dist/init/player-camera.js.map +1 -0
- package/dist/init/world-initializer.d.ts +30 -4
- package/dist/init/world-initializer.d.ts.map +1 -1
- package/dist/init/world-initializer.js +114 -24
- package/dist/init/world-initializer.js.map +1 -1
- package/dist/init/xr.d.ts.map +1 -1
- package/dist/init/xr.js +1 -0
- package/dist/init/xr.js.map +1 -1
- package/dist/input/canvas-pointer-system.d.ts +38 -0
- package/dist/input/canvas-pointer-system.d.ts.map +1 -0
- package/dist/input/canvas-pointer-system.js +47 -0
- package/dist/input/canvas-pointer-system.js.map +1 -0
- package/dist/input/index.d.ts +5 -0
- package/dist/input/index.d.ts.map +1 -1
- package/dist/input/input-actions.d.ts +139 -0
- package/dist/input/input-actions.d.ts.map +1 -0
- package/dist/input/input-actions.js +357 -0
- package/dist/input/input-actions.js.map +1 -0
- package/dist/input/input-manager.d.ts +56 -0
- package/dist/input/input-manager.d.ts.map +1 -0
- package/dist/input/input-manager.js +89 -0
- package/dist/input/input-manager.js.map +1 -0
- package/dist/input/input-system.d.ts +149 -137
- package/dist/input/input-system.d.ts.map +1 -1
- package/dist/input/input-system.js +30 -66
- package/dist/input/input-system.js.map +1 -1
- package/dist/input/stateful-browser-gamepad.d.ts +40 -0
- package/dist/input/stateful-browser-gamepad.d.ts.map +1 -0
- package/dist/input/stateful-browser-gamepad.js +139 -0
- package/dist/input/stateful-browser-gamepad.js.map +1 -0
- package/dist/input/stateful-keyboard.d.ts +23 -0
- package/dist/input/stateful-keyboard.d.ts.map +1 -0
- package/dist/input/stateful-keyboard.js +63 -0
- package/dist/input/stateful-keyboard.js.map +1 -0
- package/dist/layers/index.d.ts +10 -0
- package/dist/layers/index.d.ts.map +1 -0
- package/dist/layers/xr-cylinder-layer.d.ts +62 -0
- package/dist/layers/xr-cylinder-layer.d.ts.map +1 -0
- package/dist/layers/xr-cylinder-layer.js +48 -0
- package/dist/layers/xr-cylinder-layer.js.map +1 -0
- package/dist/layers/xr-layer-system.d.ts +296 -0
- package/dist/layers/xr-layer-system.d.ts.map +1 -0
- package/dist/layers/xr-layer-system.js +378 -0
- package/dist/layers/xr-layer-system.js.map +1 -0
- package/dist/layers/xr-quad-layer.d.ts +57 -0
- package/dist/layers/xr-quad-layer.d.ts.map +1 -0
- package/dist/layers/xr-quad-layer.js +46 -0
- package/dist/layers/xr-quad-layer.js.map +1 -0
- package/dist/locomotion/index.d.ts +1 -0
- package/dist/locomotion/index.d.ts.map +1 -1
- package/dist/locomotion/locomotion-input-provider.d.ts +39 -0
- package/dist/locomotion/locomotion-input-provider.d.ts.map +1 -0
- package/dist/locomotion/locomotion-input-provider.js +109 -0
- package/dist/locomotion/locomotion-input-provider.js.map +1 -0
- package/dist/locomotion/locomotion.d.ts +11 -11
- package/dist/locomotion/locomotion.d.ts.map +1 -1
- package/dist/locomotion/locomotion.js +10 -10
- package/dist/locomotion/locomotion.js.map +1 -1
- package/dist/locomotion/slide.d.ts +12 -12
- package/dist/locomotion/slide.d.ts.map +1 -1
- package/dist/locomotion/slide.js +11 -15
- package/dist/locomotion/slide.js.map +1 -1
- package/dist/locomotion/teleport.d.ts +11 -1
- package/dist/locomotion/teleport.d.ts.map +1 -1
- package/dist/locomotion/teleport.js +10 -30
- package/dist/locomotion/teleport.js.map +1 -1
- package/dist/locomotion/turn.d.ts +11 -0
- package/dist/locomotion/turn.d.ts.map +1 -1
- package/dist/locomotion/turn.js +14 -25
- package/dist/locomotion/turn.js.map +1 -1
- package/dist/mcp/ecs-debug-tools.d.ts.map +1 -1
- package/dist/mcp/ecs-debug-tools.js +20 -13
- package/dist/mcp/ecs-debug-tools.js.map +1 -1
- package/dist/physics/physics-system.d.ts.map +1 -1
- package/dist/physics/physics-system.js +2 -2
- package/dist/ui/ui.d.ts +5 -18
- package/dist/ui/ui.d.ts.map +1 -1
- package/dist/ui/ui.js +6 -25
- package/dist/ui/ui.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -5
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createSystem } from '../ecs/system.js';
|
|
2
2
|
import { VisibilityState } from '../ecs/world.js';
|
|
3
|
-
import 'elics';
|
|
3
|
+
import { Types } from 'elics';
|
|
4
4
|
import '../ecs/entity.js';
|
|
5
5
|
import '../ecs/component-registry.js';
|
|
6
6
|
import { DistanceGrabbable } from '../grab/distance-grabbable.js';
|
|
@@ -51,7 +51,10 @@ class InputSystem extends createSystem({
|
|
|
51
51
|
twoHandsGrabbables: { required: [TwoHandsGrabbable, Transform] },
|
|
52
52
|
/** Distance grabbable entities */
|
|
53
53
|
distanceGrabbables: { required: [DistanceGrabbable, Transform] },
|
|
54
|
-
}, {
|
|
54
|
+
}, {
|
|
55
|
+
/** Keep pointer target lists available outside immersive XR for browser canvas input. */
|
|
56
|
+
maintainScenePointers: { type: Types.Boolean, default: false },
|
|
57
|
+
}) {
|
|
55
58
|
constructor() {
|
|
56
59
|
super(...arguments);
|
|
57
60
|
/** Descendants for ray pointer intersection */
|
|
@@ -61,78 +64,54 @@ class InputSystem extends createSystem({
|
|
|
61
64
|
/** Descendants for grab pointer intersection */
|
|
62
65
|
this.grabDescendants = [];
|
|
63
66
|
this.shouldSetIntersectables = false;
|
|
64
|
-
this.dirty = true;
|
|
65
67
|
this.listeners = new WeakMap();
|
|
66
68
|
this.lastBVHUpdate = new WeakMap();
|
|
67
69
|
}
|
|
68
70
|
init() {
|
|
71
|
+
this.shouldSetIntersectables =
|
|
72
|
+
this.visibilityState.value === VisibilityState.Visible ||
|
|
73
|
+
this.config.maintainScenePointers.value;
|
|
69
74
|
// React to XR visibility for enabling scoped intersections
|
|
70
75
|
this.cleanupFuncs.push(this.visibilityState.subscribe((value) => {
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
this.dirty = true;
|
|
75
|
-
}
|
|
76
|
+
this.shouldSetIntersectables =
|
|
77
|
+
value === VisibilityState.Visible ||
|
|
78
|
+
this.config.maintainScenePointers.value;
|
|
76
79
|
}));
|
|
77
|
-
//
|
|
80
|
+
// Wire pointer event listeners on qualify; tear them down on disqualify.
|
|
81
|
+
// Descendant arrays are rebuilt every frame, so no dirty bookkeeping here.
|
|
78
82
|
this.queries.rayInteractables.subscribe('qualify', (entity) => {
|
|
79
83
|
this.setupEventListeners(entity);
|
|
80
|
-
this.dirty = true;
|
|
81
84
|
});
|
|
82
85
|
this.queries.rayInteractables.subscribe('disqualify', (entity) => {
|
|
83
86
|
this.cleanupEventListeners(entity);
|
|
84
|
-
this.dirty = true;
|
|
85
87
|
});
|
|
86
|
-
// Handle additions/removals for poke interactables
|
|
87
88
|
this.queries.pokeInteractables.subscribe('qualify', (entity) => {
|
|
88
89
|
this.setupEventListeners(entity);
|
|
89
|
-
this.dirty = true;
|
|
90
90
|
// Enable touch pointers when first poke interactable appears
|
|
91
|
-
this.input.multiPointers.left.toggleSubPointer('touch', true);
|
|
92
|
-
this.input.multiPointers.right.toggleSubPointer('touch', true);
|
|
91
|
+
this.input.xr.multiPointers.left.toggleSubPointer('touch', true);
|
|
92
|
+
this.input.xr.multiPointers.right.toggleSubPointer('touch', true);
|
|
93
93
|
});
|
|
94
94
|
this.queries.pokeInteractables.subscribe('disqualify', (entity) => {
|
|
95
95
|
this.cleanupEventListeners(entity);
|
|
96
|
-
this.dirty = true;
|
|
97
96
|
// Disable touch pointers when no poke interactables remain
|
|
98
97
|
if (this.queries.pokeInteractables.entities.size === 0) {
|
|
99
|
-
this.input.multiPointers.left.toggleSubPointer('touch', false);
|
|
100
|
-
this.input.multiPointers.right.toggleSubPointer('touch', false);
|
|
98
|
+
this.input.xr.multiPointers.left.toggleSubPointer('touch', false);
|
|
99
|
+
this.input.xr.multiPointers.right.toggleSubPointer('touch', false);
|
|
101
100
|
}
|
|
102
101
|
});
|
|
103
|
-
// Handle additions/removals for grabbables (all types)
|
|
104
|
-
this.queries.oneHandGrabbables.subscribe('qualify', () => {
|
|
105
|
-
this.dirty = true;
|
|
106
|
-
});
|
|
107
|
-
this.queries.oneHandGrabbables.subscribe('disqualify', () => {
|
|
108
|
-
this.dirty = true;
|
|
109
|
-
});
|
|
110
|
-
this.queries.twoHandsGrabbables.subscribe('qualify', () => {
|
|
111
|
-
this.dirty = true;
|
|
112
|
-
});
|
|
113
|
-
this.queries.twoHandsGrabbables.subscribe('disqualify', () => {
|
|
114
|
-
this.dirty = true;
|
|
115
|
-
});
|
|
116
|
-
this.queries.distanceGrabbables.subscribe('qualify', () => {
|
|
117
|
-
this.dirty = true;
|
|
118
|
-
});
|
|
119
|
-
this.queries.distanceGrabbables.subscribe('disqualify', () => {
|
|
120
|
-
this.dirty = true;
|
|
121
|
-
});
|
|
122
102
|
// Enable touch pointer if there are already poke interactables
|
|
123
103
|
if (this.queries.pokeInteractables.entities.size > 0) {
|
|
124
|
-
this.input.multiPointers.left.toggleSubPointer('touch', true);
|
|
125
|
-
this.input.multiPointers.right.toggleSubPointer('touch', true);
|
|
104
|
+
this.input.xr.multiPointers.left.toggleSubPointer('touch', true);
|
|
105
|
+
this.input.xr.multiPointers.right.toggleSubPointer('touch', true);
|
|
126
106
|
}
|
|
127
107
|
}
|
|
128
108
|
update(delta, time) {
|
|
129
109
|
// Update input sampling first
|
|
130
110
|
this.input.update(this.xrManager, delta, time);
|
|
131
|
-
//
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
}
|
|
111
|
+
// Rebuild interactable descendant arrays every frame so newly parented
|
|
112
|
+
// entities (TransformSystem runs at priority 0, after this system at -4)
|
|
113
|
+
// become hit-testable on the same frame they're created.
|
|
114
|
+
this.updateDescendantArrays();
|
|
136
115
|
}
|
|
137
116
|
/**
|
|
138
117
|
* Update per-type descendant arrays for optimized pointer intersection
|
|
@@ -153,40 +132,34 @@ class InputSystem extends createSystem({
|
|
|
153
132
|
// Collect ray interactables + distance grabbables (both use ray)
|
|
154
133
|
for (const entity of this.queries.rayInteractables.entities) {
|
|
155
134
|
const obj = entity.object3D;
|
|
156
|
-
if (
|
|
135
|
+
if (obj) {
|
|
157
136
|
this.rayDescendants.push(obj);
|
|
158
137
|
}
|
|
159
138
|
}
|
|
160
139
|
for (const entity of this.queries.distanceGrabbables.entities) {
|
|
161
140
|
const obj = entity.object3D;
|
|
162
|
-
if (
|
|
163
|
-
|
|
164
|
-
if (!this.rayDescendants.includes(obj)) {
|
|
165
|
-
this.rayDescendants.push(obj);
|
|
166
|
-
}
|
|
141
|
+
if (obj && !this.rayDescendants.includes(obj)) {
|
|
142
|
+
this.rayDescendants.push(obj);
|
|
167
143
|
}
|
|
168
144
|
}
|
|
169
145
|
// Collect poke/touch interactables
|
|
170
146
|
for (const entity of this.queries.pokeInteractables.entities) {
|
|
171
147
|
const obj = entity.object3D;
|
|
172
|
-
if (
|
|
148
|
+
if (obj) {
|
|
173
149
|
this.touchDescendants.push(obj);
|
|
174
150
|
}
|
|
175
151
|
}
|
|
176
152
|
// Collect grab interactables (oneHand + twoHands)
|
|
177
153
|
for (const entity of this.queries.oneHandGrabbables.entities) {
|
|
178
154
|
const obj = entity.object3D;
|
|
179
|
-
if (
|
|
155
|
+
if (obj) {
|
|
180
156
|
this.grabDescendants.push(obj);
|
|
181
157
|
}
|
|
182
158
|
}
|
|
183
159
|
for (const entity of this.queries.twoHandsGrabbables.entities) {
|
|
184
160
|
const obj = entity.object3D;
|
|
185
|
-
if (
|
|
186
|
-
|
|
187
|
-
if (!this.grabDescendants.includes(obj)) {
|
|
188
|
-
this.grabDescendants.push(obj);
|
|
189
|
-
}
|
|
161
|
+
if (obj && !this.grabDescendants.includes(obj)) {
|
|
162
|
+
this.grabDescendants.push(obj);
|
|
190
163
|
}
|
|
191
164
|
}
|
|
192
165
|
// Set type-specific arrays on scene
|
|
@@ -285,15 +258,6 @@ class InputSystem extends createSystem({
|
|
|
285
258
|
entity.removeComponent(Hovered).removeComponent(Pressed);
|
|
286
259
|
}
|
|
287
260
|
}
|
|
288
|
-
function isDescendantOf(object, parent) {
|
|
289
|
-
while (object) {
|
|
290
|
-
if (object === parent) {
|
|
291
|
-
return true;
|
|
292
|
-
}
|
|
293
|
-
object = object.parent;
|
|
294
|
-
}
|
|
295
|
-
return false;
|
|
296
|
-
}
|
|
297
261
|
|
|
298
262
|
export { InputSystem };
|
|
299
263
|
//# sourceMappingURL=input-system.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-system.js","sources":["../../src/input/input-system.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AAgBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,MAAO,WAAY,SAAQ,YAAY,CAC3C;;IAEE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE;;IAE5D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;;IAEhE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;
|
|
1
|
+
{"version":3,"file":"input-system.js","sources":["../../src/input/input-system.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AAgBH;;;;;;;;;;;;;;;;;;;;;;AAsBG;AACG,MAAO,WAAY,SAAQ,YAAY,CAC3C;;IAEE,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,eAAe,EAAE,SAAS,CAAC,EAAE;;IAE5D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,iBAAiB,EAAE,EAAE,QAAQ,EAAE,CAAC,gBAAgB,EAAE,SAAS,CAAC,EAAE;;IAE9D,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;;IAEhE,kBAAkB,EAAE,EAAE,QAAQ,EAAE,CAAC,iBAAiB,EAAE,SAAS,CAAC,EAAE;CACjE,EACD;;IAEE,qBAAqB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EAAE;YACb;QACF;QACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC;QACxC,IAAI,GAAG,EAAE;YACP,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,cAAc,EAAE,GAAG,CAAC,KAAK,CAAC;YACvD,QAAQ,CAAC,mBAAmB,CAAC,aAAa,EAAE,GAAG,CAAC,IAAI,CAAC;YACrD,QAAQ,CAAC,mBAAmB,CAAC,WAAW,EAAE,GAAG,CAAC,EAAE,CAAC;AACjD,YAAA,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,QAAQ,CAAC;QACjC;QACA,MAAM,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC,eAAe,CAAC,OAAO,CAAC;IAC1D;AACD;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { StatefulButtonAxesDevice } from '@iwsdk/xr-input';
|
|
8
|
+
export declare enum BrowserGamepadButton {
|
|
9
|
+
South = "standard-south",
|
|
10
|
+
East = "standard-east",
|
|
11
|
+
West = "standard-west",
|
|
12
|
+
North = "standard-north",
|
|
13
|
+
LeftBumper = "standard-left-bumper",
|
|
14
|
+
RightBumper = "standard-right-bumper",
|
|
15
|
+
LeftTrigger = "standard-left-trigger",
|
|
16
|
+
RightTrigger = "standard-right-trigger",
|
|
17
|
+
Select = "standard-select",
|
|
18
|
+
Start = "standard-start",
|
|
19
|
+
LeftStick = "standard-left-stick",
|
|
20
|
+
RightStick = "standard-right-stick",
|
|
21
|
+
DPadUp = "standard-dpad-up",
|
|
22
|
+
DPadDown = "standard-dpad-down",
|
|
23
|
+
DPadLeft = "standard-dpad-left",
|
|
24
|
+
DPadRight = "standard-dpad-right",
|
|
25
|
+
Home = "standard-home"
|
|
26
|
+
}
|
|
27
|
+
export declare enum BrowserGamepadAxis {
|
|
28
|
+
LeftStick = "standard-left-stick-axes",
|
|
29
|
+
RightStick = "standard-right-stick-axes"
|
|
30
|
+
}
|
|
31
|
+
export declare class StatefulBrowserGamepad extends StatefulButtonAxesDevice {
|
|
32
|
+
gamepad: Gamepad;
|
|
33
|
+
constructor(gamepad: Gamepad);
|
|
34
|
+
get index(): number;
|
|
35
|
+
get id(): string;
|
|
36
|
+
get connected(): boolean;
|
|
37
|
+
get mapping(): GamepadMappingType;
|
|
38
|
+
refresh(gamepad?: Gamepad): void;
|
|
39
|
+
}
|
|
40
|
+
//# sourceMappingURL=stateful-browser-gamepad.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateful-browser-gamepad.d.ts","sourceRoot":"","sources":["../../src/input/stateful-browser-gamepad.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAoB,wBAAwB,EAAE,MAAM,iBAAiB,CAAC;AAE7E,oBAAY,oBAAoB;IAC9B,KAAK,mBAAmB;IACxB,IAAI,kBAAkB;IACtB,IAAI,kBAAkB;IACtB,KAAK,mBAAmB;IACxB,UAAU,yBAAyB;IACnC,WAAW,0BAA0B;IACrC,WAAW,0BAA0B;IACrC,YAAY,2BAA2B;IACvC,MAAM,oBAAoB;IAC1B,KAAK,mBAAmB;IACxB,SAAS,wBAAwB;IACjC,UAAU,yBAAyB;IACnC,MAAM,qBAAqB;IAC3B,QAAQ,uBAAuB;IAC/B,QAAQ,uBAAuB;IAC/B,SAAS,wBAAwB;IACjC,IAAI,kBAAkB;CACvB;AAED,oBAAY,kBAAkB;IAC5B,SAAS,6BAA6B;IACtC,UAAU,8BAA8B;CACzC;AAoFD,qBAAa,sBAAuB,SAAQ,wBAAwB;IAC3D,OAAO,EAAE,OAAO,CAAC;gBAEZ,OAAO,EAAE,OAAO;IAK5B,IAAI,KAAK,IAAI,MAAM,CAElB;IAED,IAAI,EAAE,IAAI,MAAM,CAEf;IAED,IAAI,SAAS,IAAI,OAAO,CAEvB;IAED,IAAI,OAAO,IAAI,kBAAkB,CAEhC;IAED,OAAO,CAAC,OAAO,GAAE,OAAsB,GAAG,IAAI;CAI/C"}
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { StatefulButtonAxesDevice } from '@iwsdk/xr-input';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
|
+
*
|
|
6
|
+
* This source code is licensed under the MIT license found in the
|
|
7
|
+
* LICENSE file in the root directory of this source tree.
|
|
8
|
+
*/
|
|
9
|
+
var BrowserGamepadButton;
|
|
10
|
+
(function (BrowserGamepadButton) {
|
|
11
|
+
BrowserGamepadButton["South"] = "standard-south";
|
|
12
|
+
BrowserGamepadButton["East"] = "standard-east";
|
|
13
|
+
BrowserGamepadButton["West"] = "standard-west";
|
|
14
|
+
BrowserGamepadButton["North"] = "standard-north";
|
|
15
|
+
BrowserGamepadButton["LeftBumper"] = "standard-left-bumper";
|
|
16
|
+
BrowserGamepadButton["RightBumper"] = "standard-right-bumper";
|
|
17
|
+
BrowserGamepadButton["LeftTrigger"] = "standard-left-trigger";
|
|
18
|
+
BrowserGamepadButton["RightTrigger"] = "standard-right-trigger";
|
|
19
|
+
BrowserGamepadButton["Select"] = "standard-select";
|
|
20
|
+
BrowserGamepadButton["Start"] = "standard-start";
|
|
21
|
+
BrowserGamepadButton["LeftStick"] = "standard-left-stick";
|
|
22
|
+
BrowserGamepadButton["RightStick"] = "standard-right-stick";
|
|
23
|
+
BrowserGamepadButton["DPadUp"] = "standard-dpad-up";
|
|
24
|
+
BrowserGamepadButton["DPadDown"] = "standard-dpad-down";
|
|
25
|
+
BrowserGamepadButton["DPadLeft"] = "standard-dpad-left";
|
|
26
|
+
BrowserGamepadButton["DPadRight"] = "standard-dpad-right";
|
|
27
|
+
BrowserGamepadButton["Home"] = "standard-home";
|
|
28
|
+
})(BrowserGamepadButton || (BrowserGamepadButton = {}));
|
|
29
|
+
var BrowserGamepadAxis;
|
|
30
|
+
(function (BrowserGamepadAxis) {
|
|
31
|
+
BrowserGamepadAxis["LeftStick"] = "standard-left-stick-axes";
|
|
32
|
+
BrowserGamepadAxis["RightStick"] = "standard-right-stick-axes";
|
|
33
|
+
})(BrowserGamepadAxis || (BrowserGamepadAxis = {}));
|
|
34
|
+
const STANDARD_GAMEPAD_LAYOUT = {
|
|
35
|
+
selectComponentId: BrowserGamepadButton.South,
|
|
36
|
+
components: {
|
|
37
|
+
[BrowserGamepadButton.South]: {
|
|
38
|
+
type: 'button',
|
|
39
|
+
gamepadIndices: { button: 0 },
|
|
40
|
+
},
|
|
41
|
+
[BrowserGamepadButton.East]: {
|
|
42
|
+
type: 'button',
|
|
43
|
+
gamepadIndices: { button: 1 },
|
|
44
|
+
},
|
|
45
|
+
[BrowserGamepadButton.West]: {
|
|
46
|
+
type: 'button',
|
|
47
|
+
gamepadIndices: { button: 2 },
|
|
48
|
+
},
|
|
49
|
+
[BrowserGamepadButton.North]: {
|
|
50
|
+
type: 'button',
|
|
51
|
+
gamepadIndices: { button: 3 },
|
|
52
|
+
},
|
|
53
|
+
[BrowserGamepadButton.LeftBumper]: {
|
|
54
|
+
type: 'button',
|
|
55
|
+
gamepadIndices: { button: 4 },
|
|
56
|
+
},
|
|
57
|
+
[BrowserGamepadButton.RightBumper]: {
|
|
58
|
+
type: 'button',
|
|
59
|
+
gamepadIndices: { button: 5 },
|
|
60
|
+
},
|
|
61
|
+
[BrowserGamepadButton.LeftTrigger]: {
|
|
62
|
+
type: 'trigger',
|
|
63
|
+
gamepadIndices: { button: 6 },
|
|
64
|
+
},
|
|
65
|
+
[BrowserGamepadButton.RightTrigger]: {
|
|
66
|
+
type: 'trigger',
|
|
67
|
+
gamepadIndices: { button: 7 },
|
|
68
|
+
},
|
|
69
|
+
[BrowserGamepadButton.Select]: {
|
|
70
|
+
type: 'button',
|
|
71
|
+
gamepadIndices: { button: 8 },
|
|
72
|
+
},
|
|
73
|
+
[BrowserGamepadButton.Start]: {
|
|
74
|
+
type: 'button',
|
|
75
|
+
gamepadIndices: { button: 9 },
|
|
76
|
+
},
|
|
77
|
+
[BrowserGamepadButton.LeftStick]: {
|
|
78
|
+
type: 'button',
|
|
79
|
+
gamepadIndices: { button: 10 },
|
|
80
|
+
},
|
|
81
|
+
[BrowserGamepadButton.RightStick]: {
|
|
82
|
+
type: 'button',
|
|
83
|
+
gamepadIndices: { button: 11 },
|
|
84
|
+
},
|
|
85
|
+
[BrowserGamepadButton.DPadUp]: {
|
|
86
|
+
type: 'button',
|
|
87
|
+
gamepadIndices: { button: 12 },
|
|
88
|
+
},
|
|
89
|
+
[BrowserGamepadButton.DPadDown]: {
|
|
90
|
+
type: 'button',
|
|
91
|
+
gamepadIndices: { button: 13 },
|
|
92
|
+
},
|
|
93
|
+
[BrowserGamepadButton.DPadLeft]: {
|
|
94
|
+
type: 'button',
|
|
95
|
+
gamepadIndices: { button: 14 },
|
|
96
|
+
},
|
|
97
|
+
[BrowserGamepadButton.DPadRight]: {
|
|
98
|
+
type: 'button',
|
|
99
|
+
gamepadIndices: { button: 15 },
|
|
100
|
+
},
|
|
101
|
+
[BrowserGamepadButton.Home]: {
|
|
102
|
+
type: 'button',
|
|
103
|
+
gamepadIndices: { button: 16 },
|
|
104
|
+
},
|
|
105
|
+
[BrowserGamepadAxis.LeftStick]: {
|
|
106
|
+
type: 'thumbstick',
|
|
107
|
+
gamepadIndices: { xAxis: 0, yAxis: 1 },
|
|
108
|
+
},
|
|
109
|
+
[BrowserGamepadAxis.RightStick]: {
|
|
110
|
+
type: 'thumbstick',
|
|
111
|
+
gamepadIndices: { xAxis: 2, yAxis: 3 },
|
|
112
|
+
},
|
|
113
|
+
},
|
|
114
|
+
};
|
|
115
|
+
class StatefulBrowserGamepad extends StatefulButtonAxesDevice {
|
|
116
|
+
constructor(gamepad) {
|
|
117
|
+
super(STANDARD_GAMEPAD_LAYOUT, gamepad.buttons.length);
|
|
118
|
+
this.gamepad = gamepad;
|
|
119
|
+
}
|
|
120
|
+
get index() {
|
|
121
|
+
return this.gamepad.index;
|
|
122
|
+
}
|
|
123
|
+
get id() {
|
|
124
|
+
return this.gamepad.id;
|
|
125
|
+
}
|
|
126
|
+
get connected() {
|
|
127
|
+
return this.gamepad.connected;
|
|
128
|
+
}
|
|
129
|
+
get mapping() {
|
|
130
|
+
return this.gamepad.mapping;
|
|
131
|
+
}
|
|
132
|
+
refresh(gamepad = this.gamepad) {
|
|
133
|
+
this.gamepad = gamepad;
|
|
134
|
+
super.update(gamepad.buttons, gamepad.axes);
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export { BrowserGamepadAxis, BrowserGamepadButton, StatefulBrowserGamepad };
|
|
139
|
+
//# sourceMappingURL=stateful-browser-gamepad.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateful-browser-gamepad.js","sources":["../../src/input/stateful-browser-gamepad.ts"],"sourcesContent":[null],"names":[],"mappings":";;AAAA;;;;;AAKG;IAIS;AAAZ,CAAA,UAAY,oBAAoB,EAAA;AAC9B,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,gBAAwB;AACxB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,eAAsB;AACtB,IAAA,oBAAA,CAAA,MAAA,CAAA,GAAA,eAAsB;AACtB,IAAA,oBAAA,CAAA,OAAA,CAAA,GAAA,gBAAwB;AACxB,IAAA,oBAAA,CAAA,YAAA,CAAA,GAAA,sBAAmC;AACnC,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC;AACrC,IAAA,oBAAA,CAAA,aAAA,CAAA,GAAA,uBAAqC;AACrC,IAAA,oBAAA,CAAA,cAAA,CAAA,GAAA,wBAAuC;AACvC,IAAA,oBAAA,CAAA,QAA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M,CAAC;AACtD,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;IACxB;AAEA,IAAA,IAAI,KAAK,GAAA;AACP,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK;IAC3B;AAEA,IAAA,IAAI,EAAE,GAAA;AACJ,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,EAAE;IACxB;AAEA,IAAA,IAAI,SAAS,GAAA;AACX,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,SAAS;IAC/B;AAEA,IAAA,IAAI,OAAO,GAAA;AACT,QAAA,OAAO,IAAI,CAAC,OAAO,CAAC,OAAO;IAC7B;AAEA,IAAA,OAAO,CAAC,OAAA,GAAmB,IAAI,CAAC,OAAO,EAAA;AACrC,QAAA,IAAI,CAAC,OAAO,GAAG,OAAO;QACtB,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC;IAC7C;AACD;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export declare class StatefulKeyboard {
|
|
8
|
+
private readonly pressedKeys;
|
|
9
|
+
private readonly currentDownKeys;
|
|
10
|
+
private readonly currentUpKeys;
|
|
11
|
+
private readonly pendingDownKeys;
|
|
12
|
+
private readonly pendingUpKeys;
|
|
13
|
+
private readonly target;
|
|
14
|
+
private readonly handleKeyDown;
|
|
15
|
+
private readonly handleKeyUp;
|
|
16
|
+
constructor(target?: Window);
|
|
17
|
+
update(): void;
|
|
18
|
+
getKeyPressed(code: string): boolean;
|
|
19
|
+
getKeyDown(code: string): boolean;
|
|
20
|
+
getKeyUp(code: string): boolean;
|
|
21
|
+
destroy(): void;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=stateful-keyboard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stateful-keyboard.d.ts","sourceRoot":"","sources":["../../src/input/stateful-keyboard.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,qBAAa,gBAAgB;IAC3B,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAqB;IACjD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,eAAe,CAAqB;IACrD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAqB;IACnD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAS;IAEhC,OAAO,CAAC,QAAQ,CAAC,aAAa,CAK5B;IAEF,OAAO,CAAC,QAAQ,CAAC,WAAW,CAK1B;gBAEU,MAAM,GAAE,MAAe;IAMnC,MAAM,IAAI,IAAI;IAad,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIpC,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAIjC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAI/B,OAAO,IAAI,IAAI;CAShB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
class StatefulKeyboard {
|
|
8
|
+
constructor(target = window) {
|
|
9
|
+
this.pressedKeys = new Set();
|
|
10
|
+
this.currentDownKeys = new Set();
|
|
11
|
+
this.currentUpKeys = new Set();
|
|
12
|
+
this.pendingDownKeys = new Set();
|
|
13
|
+
this.pendingUpKeys = new Set();
|
|
14
|
+
this.handleKeyDown = (event) => {
|
|
15
|
+
if (!this.pressedKeys.has(event.code)) {
|
|
16
|
+
this.pendingDownKeys.add(event.code);
|
|
17
|
+
}
|
|
18
|
+
this.pressedKeys.add(event.code);
|
|
19
|
+
};
|
|
20
|
+
this.handleKeyUp = (event) => {
|
|
21
|
+
if (this.pressedKeys.has(event.code)) {
|
|
22
|
+
this.pendingUpKeys.add(event.code);
|
|
23
|
+
}
|
|
24
|
+
this.pressedKeys.delete(event.code);
|
|
25
|
+
};
|
|
26
|
+
this.target = target;
|
|
27
|
+
this.target.addEventListener('keydown', this.handleKeyDown);
|
|
28
|
+
this.target.addEventListener('keyup', this.handleKeyUp);
|
|
29
|
+
}
|
|
30
|
+
update() {
|
|
31
|
+
this.currentDownKeys.clear();
|
|
32
|
+
this.currentUpKeys.clear();
|
|
33
|
+
for (const code of this.pendingDownKeys) {
|
|
34
|
+
this.currentDownKeys.add(code);
|
|
35
|
+
}
|
|
36
|
+
for (const code of this.pendingUpKeys) {
|
|
37
|
+
this.currentUpKeys.add(code);
|
|
38
|
+
}
|
|
39
|
+
this.pendingDownKeys.clear();
|
|
40
|
+
this.pendingUpKeys.clear();
|
|
41
|
+
}
|
|
42
|
+
getKeyPressed(code) {
|
|
43
|
+
return this.pressedKeys.has(code);
|
|
44
|
+
}
|
|
45
|
+
getKeyDown(code) {
|
|
46
|
+
return this.currentDownKeys.has(code);
|
|
47
|
+
}
|
|
48
|
+
getKeyUp(code) {
|
|
49
|
+
return this.currentUpKeys.has(code);
|
|
50
|
+
}
|
|
51
|
+
destroy() {
|
|
52
|
+
this.target.removeEventListener('keydown', this.handleKeyDown);
|
|
53
|
+
this.target.removeEventListener('keyup', this.handleKeyUp);
|
|
54
|
+
this.pressedKeys.clear();
|
|
55
|
+
this.currentDownKeys.clear();
|
|
56
|
+
this.currentUpKeys.clear();
|
|
57
|
+
this.pendingDownKeys.clear();
|
|
58
|
+
this.pendingUpKeys.clear();
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { StatefulKeyboard };
|
|
63
|
+
//# sourceMappingURL=stateful-keyboard.js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Aa,CAAC,KAAK,EAAE;IAC5B;AACD;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
export * from './xr-quad-layer.js';
|
|
8
|
+
export * from './xr-cylinder-layer.js';
|
|
9
|
+
export * from './xr-layer-system.js';
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/layers/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC;AACvC,cAAc,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { Types } from '../ecs/index.js';
|
|
8
|
+
/**
|
|
9
|
+
* XRCylinderLayer - Component for WebXR cylinder composition layers.
|
|
10
|
+
*
|
|
11
|
+
* A cylinder layer renders content onto a curved rectangular surface. The
|
|
12
|
+
* viewer sees the inside of the cylinder. The entity's transform controls
|
|
13
|
+
* the layer's world position and orientation. In XR, the content is
|
|
14
|
+
* composited by the device's native compositor.
|
|
15
|
+
*
|
|
16
|
+
* Outside XR, the layer content is displayed on a textured cylinder mesh
|
|
17
|
+
* as a fallback.
|
|
18
|
+
*
|
|
19
|
+
* @category Layers
|
|
20
|
+
*/
|
|
21
|
+
export declare const XRCylinderLayer: import("elics").Component<{
|
|
22
|
+
/** Radius of the cylinder in meters. */
|
|
23
|
+
radius: {
|
|
24
|
+
type: Types.Float32;
|
|
25
|
+
default: number;
|
|
26
|
+
};
|
|
27
|
+
/** Central angle of the visible arc in radians. */
|
|
28
|
+
centralAngle: {
|
|
29
|
+
type: Types.Float32;
|
|
30
|
+
default: number;
|
|
31
|
+
};
|
|
32
|
+
/** Width-to-height aspect ratio of the visible section. */
|
|
33
|
+
aspectRatio: {
|
|
34
|
+
type: Types.Float32;
|
|
35
|
+
default: number;
|
|
36
|
+
};
|
|
37
|
+
/** Width of the layer's render target in pixels. */
|
|
38
|
+
pixelWidth: {
|
|
39
|
+
type: Types.Int16;
|
|
40
|
+
default: number;
|
|
41
|
+
};
|
|
42
|
+
/** Height of the layer's render target in pixels. */
|
|
43
|
+
pixelHeight: {
|
|
44
|
+
type: Types.Int16;
|
|
45
|
+
default: number;
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Callback invoked each frame to render layer content.
|
|
49
|
+
* The renderer's render target is already set; call
|
|
50
|
+
* `renderer.render(scene, camera)` to draw into the layer.
|
|
51
|
+
*/
|
|
52
|
+
renderCallback: {
|
|
53
|
+
type: Types.Object;
|
|
54
|
+
default: null;
|
|
55
|
+
};
|
|
56
|
+
/** Enable stencil buffer on the layer's render target. */
|
|
57
|
+
stencil: {
|
|
58
|
+
type: Types.Boolean;
|
|
59
|
+
default: false;
|
|
60
|
+
};
|
|
61
|
+
}>;
|
|
62
|
+
//# sourceMappingURL=xr-cylinder-layer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xr-cylinder-layer.d.ts","sourceRoot":"","sources":["../../src/layers/xr-cylinder-layer.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,KAAK,EAAmB,MAAM,iBAAiB,CAAC;AAEzD;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,eAAe;IAGxB,wCAAwC;;;;;IAExC,mDAAmD;;;;;IAEnD,2DAA2D;;;;;IAE3D,oDAAoD;;;;;IAEpD,qDAAqD;;;;;IAErD;;;;OAIG;;;;;IAEH,0DAA0D;;;;;EAI7D,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import '@preact/signals-core';
|
|
2
|
+
import '../ecs/world.js';
|
|
3
|
+
import { createComponent, Types } from 'elics';
|
|
4
|
+
import '../ecs/entity.js';
|
|
5
|
+
import '../ecs/component-registry.js';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
9
|
+
*
|
|
10
|
+
* This source code is licensed under the MIT license found in the
|
|
11
|
+
* LICENSE file in the root directory of this source tree.
|
|
12
|
+
*/
|
|
13
|
+
/**
|
|
14
|
+
* XRCylinderLayer - Component for WebXR cylinder composition layers.
|
|
15
|
+
*
|
|
16
|
+
* A cylinder layer renders content onto a curved rectangular surface. The
|
|
17
|
+
* viewer sees the inside of the cylinder. The entity's transform controls
|
|
18
|
+
* the layer's world position and orientation. In XR, the content is
|
|
19
|
+
* composited by the device's native compositor.
|
|
20
|
+
*
|
|
21
|
+
* Outside XR, the layer content is displayed on a textured cylinder mesh
|
|
22
|
+
* as a fallback.
|
|
23
|
+
*
|
|
24
|
+
* @category Layers
|
|
25
|
+
*/
|
|
26
|
+
const XRCylinderLayer = createComponent('XRCylinderLayer', {
|
|
27
|
+
/** Radius of the cylinder in meters. */
|
|
28
|
+
radius: { type: Types.Float32, default: 2.0 },
|
|
29
|
+
/** Central angle of the visible arc in radians. */
|
|
30
|
+
centralAngle: { type: Types.Float32, default: Math.PI / 4 },
|
|
31
|
+
/** Width-to-height aspect ratio of the visible section. */
|
|
32
|
+
aspectRatio: { type: Types.Float32, default: 2.0 },
|
|
33
|
+
/** Width of the layer's render target in pixels. */
|
|
34
|
+
pixelWidth: { type: Types.Int16, default: 1024 },
|
|
35
|
+
/** Height of the layer's render target in pixels. */
|
|
36
|
+
pixelHeight: { type: Types.Int16, default: 1024 },
|
|
37
|
+
/**
|
|
38
|
+
* Callback invoked each frame to render layer content.
|
|
39
|
+
* The renderer's render target is already set; call
|
|
40
|
+
* `renderer.render(scene, camera)` to draw into the layer.
|
|
41
|
+
*/
|
|
42
|
+
renderCallback: { type: Types.Object, default: null },
|
|
43
|
+
/** Enable stencil buffer on the layer's render target. */
|
|
44
|
+
stencil: { type: Types.Boolean, default: false },
|
|
45
|
+
}, 'Cylinder composition layer for WebXR');
|
|
46
|
+
|
|
47
|
+
export { XRCylinderLayer };
|
|
48
|
+
//# sourceMappingURL=xr-cylinder-layer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"xr-cylinder-layer.js","sources":["../../src/layers/xr-cylinder-layer.ts"],"sourcesContent":[null],"names":[],"mappings":";;;;;;AAAA;;;;;AAKG;AAIH;;;;;;;;;;;;AAYG;AACI,MAAM,eAAe,GAAG,eAAe,CAC5C,iBAAiB,EACjB;;IAEE,MAAM,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;AAE7C,IAAA,YAAY,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,CAAC,EAAE,GAAG,CAAC,EAAE;;IAE3D,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,EAAE;;IAElD,UAAU,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;;IAEhD,WAAW,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE;AACjD;;;;AAIG;IACH,cAAc,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;;IAErD,OAAO,EAAE,EAAE,IAAI,EAAE,KAAK,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE;CACjD,EACD,sCAAsC;;;;"}
|