@galacean/engine-xr 1.2.0-alpha.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 (46) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +42 -0
  3. package/dist/browser.js +1573 -0
  4. package/dist/browser.min.js +1 -0
  5. package/dist/main.js +1570 -0
  6. package/dist/main.js.map +1 -0
  7. package/dist/miniprogram.js +1570 -0
  8. package/dist/module.js +1555 -0
  9. package/dist/module.js.map +1 -0
  10. package/package.json +35 -0
  11. package/types/XRManagerExtended.d.ts +119 -0
  12. package/types/XRPose.d.ts +15 -0
  13. package/types/feature/XRFeature.d.ts +16 -0
  14. package/types/feature/XRFeatureType.d.ts +6 -0
  15. package/types/feature/camera/XRCameraManager.d.ts +26 -0
  16. package/types/feature/hitTest/TrackableType.d.ts +10 -0
  17. package/types/feature/hitTest/XRHitResult.d.ts +19 -0
  18. package/types/feature/hitTest/XRHitTest.d.ts +40 -0
  19. package/types/feature/trackable/XRRequestTracking.d.ts +1 -0
  20. package/types/feature/trackable/XRRequestTrackingState.d.ts +8 -0
  21. package/types/feature/trackable/XRTrackableFeature.d.ts +36 -0
  22. package/types/feature/trackable/XRTracked.d.ts +14 -0
  23. package/types/feature/trackable/anchor/XRAnchor.d.ts +6 -0
  24. package/types/feature/trackable/anchor/XRAnchorTracking.d.ts +38 -0
  25. package/types/feature/trackable/anchor/XRRequestAnchor.d.ts +16 -0
  26. package/types/feature/trackable/image/XRImageTracking.d.ts +25 -0
  27. package/types/feature/trackable/image/XRReferenceImage.d.ts +16 -0
  28. package/types/feature/trackable/image/XRRequestImage.d.ts +14 -0
  29. package/types/feature/trackable/image/XRTrackedImage.d.ts +12 -0
  30. package/types/feature/trackable/plane/XRPlaneMode.d.ts +13 -0
  31. package/types/feature/trackable/plane/XRPlaneTracking.d.ts +24 -0
  32. package/types/feature/trackable/plane/XRRequestPlane.d.ts +13 -0
  33. package/types/feature/trackable/plane/XRTrackedPlane.d.ts +21 -0
  34. package/types/index.d.ts +28 -0
  35. package/types/input/XRCamera.d.ts +15 -0
  36. package/types/input/XRController.d.ts +38 -0
  37. package/types/input/XRInput.d.ts +8 -0
  38. package/types/input/XRInputButton.d.ts +19 -0
  39. package/types/input/XRInputEventType.d.ts +8 -0
  40. package/types/input/XRInputManager.d.ts +32 -0
  41. package/types/input/XRTargetRayMode.d.ts +5 -0
  42. package/types/input/XRTrackedInputDevice.d.ts +21 -0
  43. package/types/input/XRTrackingState.d.ts +11 -0
  44. package/types/session/XRSessionManager.d.ts +45 -0
  45. package/types/session/XRSessionMode.d.ts +8 -0
  46. package/types/session/XRSessionState.d.ts +13 -0
package/dist/module.js ADDED
@@ -0,0 +1,1555 @@
1
+ import { CameraType, Matrix, CameraClearFlags, Vector3, Quaternion, Rect, XRManager, Ray, Plane, Vector2 } from '@galacean/engine';
2
+
3
+ function _is_native_reflect_construct() {
4
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
5
+ if (Reflect.construct.sham) return false;
6
+ if (typeof Proxy === "function") return true;
7
+
8
+ try {
9
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
10
+
11
+ return true;
12
+ } catch (e) {
13
+ return false;
14
+ }
15
+ }
16
+
17
+ function _set_prototype_of(o, p) {
18
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
19
+ o.__proto__ = p;
20
+
21
+ return o;
22
+ };
23
+
24
+ return _set_prototype_of(o, p);
25
+ }
26
+
27
+ function _construct(Parent, args, Class) {
28
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
29
+ else {
30
+ _construct = function construct(Parent, args, Class) {
31
+ var a = [null];
32
+ a.push.apply(a, args);
33
+ var Constructor = Function.bind.apply(Parent, a);
34
+ var instance = new Constructor();
35
+
36
+ if (Class) _set_prototype_of(instance, Class.prototype);
37
+
38
+ return instance;
39
+ };
40
+ }
41
+
42
+ return _construct.apply(null, arguments);
43
+ }
44
+
45
+ function _defineProperties(target, props) {
46
+ for (var i = 0; i < props.length; i++) {
47
+ var descriptor = props[i];
48
+ descriptor.enumerable = descriptor.enumerable || false;
49
+ descriptor.configurable = true;
50
+
51
+ if ("value" in descriptor) descriptor.writable = true;
52
+
53
+ Object.defineProperty(target, descriptor.key, descriptor);
54
+ }
55
+ }
56
+ function _create_class(Constructor, protoProps, staticProps) {
57
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
58
+ if (staticProps) _defineProperties(Constructor, staticProps);
59
+
60
+ return Constructor;
61
+ }
62
+
63
+ function _inherits(subClass, superClass) {
64
+ if (typeof superClass !== "function" && superClass !== null) {
65
+ throw new TypeError("Super expression must either be null or a function");
66
+ }
67
+
68
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
69
+
70
+ if (superClass) _set_prototype_of(subClass, superClass);
71
+ }
72
+
73
+ function _instanceof(left, right) {
74
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
75
+ return !!right[Symbol.hasInstance](left);
76
+ } else return left instanceof right;
77
+ }
78
+
79
+ /**
80
+ * Enumerates some input devices that can be tracked.(including status, posture and other information)
81
+ */ var XRTrackedInputDevice;
82
+ (function(XRTrackedInputDevice) {
83
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Controller */ "Controller"] = 0] = "Controller";
84
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Left controller */ "LeftController"] = 1] = "LeftController";
85
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Right controller */ "RightController"] = 2] = "RightController";
86
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Camera */ "Camera"] = 3] = "Camera";
87
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Left camera */ "LeftCamera"] = 4] = "LeftCamera";
88
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Right camera */ "RightCamera"] = 5] = "RightCamera";
89
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Head */ "LeftHand"] = 6] = "LeftHand";
90
+ XRTrackedInputDevice[XRTrackedInputDevice[/** Right hand */ "RightHand"] = 7] = "RightHand";
91
+ })(XRTrackedInputDevice || (XRTrackedInputDevice = {}));
92
+
93
+ /**
94
+ * The state of an XRSession.
95
+ */ var XRSessionState;
96
+ (function(XRSessionState) {
97
+ XRSessionState[XRSessionState[/** Not initialized. */ "None"] = 0] = "None";
98
+ XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 1] = "Initialized";
99
+ XRSessionState[XRSessionState[/** Running. */ "Running"] = 2] = "Running";
100
+ XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 3] = "Paused";
101
+ })(XRSessionState || (XRSessionState = {}));
102
+
103
+ /**
104
+ * The manager of XR camera.
105
+ */ var XRCameraManager = /*#__PURE__*/ function() {
106
+ function XRCameraManager(_xrManager) {
107
+ this._xrManager = _xrManager;
108
+ }
109
+ var _proto = XRCameraManager.prototype;
110
+ /**
111
+ * Attach the camera to the specified input type(Camera, LeftCamera or RightCamera).
112
+ * The camera entity need to be moved to the XROrigin entity.
113
+ * @param type - The input type
114
+ * @param camera - The camera to be attached
115
+ */ _proto.attachCamera = function attachCamera(type, camera) {
116
+ var xrCamera = this._xrManager.inputManager.getTrackedDevice(type);
117
+ var preCamera = xrCamera._camera;
118
+ if (preCamera !== camera) {
119
+ // @ts-ignore
120
+ preCamera && (preCamera._cameraType = CameraType.Normal);
121
+ switch(type){
122
+ case XRTrackedInputDevice.Camera:
123
+ // @ts-ignore
124
+ camera._cameraType = CameraType.XRCenterCamera;
125
+ break;
126
+ case XRTrackedInputDevice.LeftCamera:
127
+ // @ts-ignore
128
+ camera._cameraType = CameraType.XRLeftCamera;
129
+ break;
130
+ case XRTrackedInputDevice.RightCamera:
131
+ // @ts-ignore
132
+ camera._cameraType = CameraType.XRRightCamera;
133
+ break;
134
+ }
135
+ xrCamera._camera = camera;
136
+ }
137
+ };
138
+ /**
139
+ * Detach the camera from the specified input type.
140
+ * @param type - The input type
141
+ * @returns The camera that was detached
142
+ */ _proto.detachCamera = function detachCamera(type) {
143
+ var xrCamera = this._xrManager.inputManager.getTrackedDevice(type);
144
+ var preCamera = xrCamera._camera;
145
+ // @ts-ignore
146
+ preCamera && (preCamera._cameraType = CameraType.Normal);
147
+ xrCamera._camera = null;
148
+ return preCamera;
149
+ };
150
+ /**
151
+ * @internal
152
+ */ _proto._onSessionStart = function _onSessionStart() {};
153
+ /**
154
+ * @internal
155
+ */ _proto._onUpdate = function _onUpdate() {
156
+ var _this__xrManager_inputManager = this._xrManager.inputManager, cameras = _this__xrManager_inputManager._cameras;
157
+ for(var i = 0, n = cameras.length; i < n; i++){
158
+ var cameraDevice = cameras[i];
159
+ var camera = cameraDevice._camera;
160
+ if (!camera) continue;
161
+ // sync position and rotation
162
+ var transform = camera.entity.transform;
163
+ var pose = cameraDevice.pose;
164
+ transform.position = pose.position;
165
+ transform.rotationQuaternion = pose.rotation;
166
+ // sync viewport
167
+ var viewport = camera.viewport;
168
+ var _cameraDevice_viewport = cameraDevice.viewport, x = _cameraDevice_viewport.x, y = _cameraDevice_viewport.y, width = _cameraDevice_viewport.width, height = _cameraDevice_viewport.height;
169
+ if (!(x === viewport.x && y === viewport.y && width === viewport.z && height === viewport.w)) {
170
+ camera.viewport = viewport.set(x, y, width, height);
171
+ }
172
+ // sync project matrix
173
+ if (!Matrix.equals(camera.projectionMatrix, cameraDevice.projectionMatrix)) {
174
+ camera.projectionMatrix = cameraDevice.projectionMatrix;
175
+ }
176
+ }
177
+ };
178
+ /**
179
+ * @internal
180
+ */ _proto._onSessionExit = function _onSessionExit() {};
181
+ /**
182
+ * @internal
183
+ */ _proto._getCameraClearFlagsMask = function _getCameraClearFlagsMask(cameraType) {
184
+ if (cameraType === CameraType.XRCenterCamera) {
185
+ if (this._xrManager.sessionManager.state === XRSessionState.Running) {
186
+ return CameraClearFlags.Color;
187
+ } else {
188
+ return CameraClearFlags.None;
189
+ }
190
+ } else {
191
+ return CameraClearFlags.None;
192
+ }
193
+ };
194
+ /**
195
+ * @internal
196
+ */ _proto._onDestroy = function _onDestroy() {};
197
+ _create_class(XRCameraManager, [
198
+ {
199
+ key: "fixedFoveation",
200
+ get: /**
201
+ * The fixed foveation of the camera.
202
+ */ function get() {
203
+ var _this__xrManager_sessionManager = this._xrManager.sessionManager, platformSession = _this__xrManager_sessionManager._platformSession;
204
+ if (platformSession) {
205
+ return platformSession.getFixedFoveation();
206
+ } else {
207
+ throw new Error("XR session is not available.");
208
+ }
209
+ },
210
+ set: function set(value) {
211
+ var _this__xrManager_sessionManager = this._xrManager.sessionManager, platformSession = _this__xrManager_sessionManager._platformSession;
212
+ if (platformSession) {
213
+ platformSession.setFixedFoveation(value);
214
+ } else {
215
+ throw new Error("XR session is not available.");
216
+ }
217
+ }
218
+ }
219
+ ]);
220
+ return XRCameraManager;
221
+ }();
222
+
223
+ /**
224
+ * Data for describing pose in the XR space.
225
+ */ var XRPose = function XRPose() {
226
+ /** The position of the pose in XR space. */ this.position = new Vector3();
227
+ /** The rotation of the pose in XR space. */ this.rotation = new Quaternion();
228
+ /** The matrix of the pose in XR space. */ this.matrix = new Matrix();
229
+ /** The inverse matrix of the pose in XR space. */ this.inverseMatrix = new Matrix();
230
+ };
231
+
232
+ /**
233
+ * Enum for XR tracking state.
234
+ */ var XRTrackingState;
235
+ (function(XRTrackingState) {
236
+ XRTrackingState[XRTrackingState[/** Not tracking */ "NotTracking"] = 0] = "NotTracking";
237
+ XRTrackingState[XRTrackingState[/** Tracking */ "Tracking"] = 1] = "Tracking";
238
+ XRTrackingState[XRTrackingState[/** Lost track */ "TrackingLost"] = 2] = "TrackingLost";
239
+ })(XRTrackingState || (XRTrackingState = {}));
240
+
241
+ var XRInput = function XRInput(type) {
242
+ this.type = type;
243
+ this./** The tracking state of xr input. */ trackingState = XRTrackingState.NotTracking;
244
+ };
245
+
246
+ /**
247
+ * The XR camera.
248
+ */ var XRCamera = /*#__PURE__*/ function(XRInput1) {
249
+ _inherits(XRCamera, XRInput1);
250
+ function XRCamera() {
251
+ var _this;
252
+ _this = XRInput1.apply(this, arguments) || this;
253
+ /** The pose of the camera in XR space. */ _this.pose = new XRPose();
254
+ /** The viewport of the camera. */ _this.viewport = new Rect();
255
+ /** The projection matrix of the camera. */ _this.projectionMatrix = new Matrix();
256
+ return _this;
257
+ }
258
+ return XRCamera;
259
+ }(XRInput);
260
+
261
+ /**
262
+ * Enum for XR input button.
263
+ */ var XRInputButton;
264
+ (function(XRInputButton) {
265
+ XRInputButton[XRInputButton[/** None */ "None"] = 0x0] = "None";
266
+ XRInputButton[XRInputButton[/** Select */ "Select"] = 0x1] = "Select";
267
+ XRInputButton[XRInputButton[/** Select */ "Trigger"] = 0x1] = "Trigger";
268
+ XRInputButton[XRInputButton[/** Squeeze */ "Squeeze"] = 0x2] = "Squeeze";
269
+ XRInputButton[XRInputButton[/** TouchPad */ "TouchPad"] = 0x4] = "TouchPad";
270
+ XRInputButton[XRInputButton[/** A */ "AButton"] = 0x8] = "AButton";
271
+ XRInputButton[XRInputButton[/** B */ "BButton"] = 0x10] = "BButton";
272
+ })(XRInputButton || (XRInputButton = {}));
273
+
274
+ /**
275
+ * The XR controller.
276
+ */ var XRController = /*#__PURE__*/ function(XRInput1) {
277
+ _inherits(XRController, XRInput1);
278
+ function XRController() {
279
+ var _this;
280
+ _this = XRInput1.apply(this, arguments) || this;
281
+ /** The grip space pose of the controller in XR space. */ _this.gripPose = new XRPose();
282
+ /** The target ray space pose of the controller in XR space. */ _this.targetRayPose = new XRPose();
283
+ /** The currently pressed buttons of this controller. */ _this.pressedButtons = XRInputButton.None;
284
+ /** Record button lifted. */ _this.down = XRInputButton.None;
285
+ /** Record button pressed. */ _this.up = XRInputButton.None;
286
+ return _this;
287
+ }
288
+ var _proto = XRController.prototype;
289
+ /**
290
+ *
291
+ * Returns whether the button is pressed.
292
+ * @param button - The button to check
293
+ * @returns Whether the button is pressed
294
+ */ _proto.isButtonDown = function isButtonDown(button) {
295
+ return (this.down & button) !== 0;
296
+ };
297
+ /**
298
+ * Returns whether the button is lifted.
299
+ * @param button - The button to check
300
+ * @returns Whether the button is lifted
301
+ */ _proto.isButtonUp = function isButtonUp(button) {
302
+ return (this.up & button) !== 0;
303
+ };
304
+ /**
305
+ * Returns whether the button is held down.
306
+ * @param button - The button to check
307
+ * @returns Whether the button is held down
308
+ */ _proto.isButtonHeldDown = function isButtonHeldDown(button) {
309
+ return (this.pressedButtons & button) !== 0;
310
+ };
311
+ return XRController;
312
+ }(XRInput);
313
+
314
+ var XRInputEventType;
315
+ (function(XRInputEventType) {
316
+ XRInputEventType[XRInputEventType["SelectStart"] = 0] = "SelectStart";
317
+ XRInputEventType[XRInputEventType["Select"] = 1] = "Select";
318
+ XRInputEventType[XRInputEventType["SelectEnd"] = 2] = "SelectEnd";
319
+ XRInputEventType[XRInputEventType["SqueezeStart"] = 3] = "SqueezeStart";
320
+ XRInputEventType[XRInputEventType["Squeeze"] = 4] = "Squeeze";
321
+ XRInputEventType[XRInputEventType["SqueezeEnd"] = 5] = "SqueezeEnd";
322
+ })(XRInputEventType || (XRInputEventType = {}));
323
+
324
+ var XRTargetRayMode;
325
+ (function(XRTargetRayMode) {
326
+ XRTargetRayMode[XRTargetRayMode["Gaze"] = 0] = "Gaze";
327
+ XRTargetRayMode[XRTargetRayMode["TrackedPointer"] = 1] = "TrackedPointer";
328
+ XRTargetRayMode[XRTargetRayMode["Screen"] = 2] = "Screen";
329
+ })(XRTargetRayMode || (XRTargetRayMode = {}));
330
+
331
+ /**
332
+ * The manager of XR input.
333
+ */ var XRInputManager = /*#__PURE__*/ function() {
334
+ function XRInputManager(_xrManager, _engine) {
335
+ this._xrManager = _xrManager;
336
+ this._engine = _engine;
337
+ this./** @internal */ _cameras = [];
338
+ this./** @internal */ _controllers = [];
339
+ this._added = [];
340
+ this._removed = [];
341
+ this._trackedDevices = [];
342
+ this._statusSnapshot = [];
343
+ this._listeners = [];
344
+ var _this = this, trackedDevices = _this._trackedDevices, controllers = _this._controllers, cameras = _this._cameras;
345
+ for(var i = 0; i < 6; i++){
346
+ switch(i){
347
+ case XRTrackedInputDevice.Camera:
348
+ case XRTrackedInputDevice.LeftCamera:
349
+ case XRTrackedInputDevice.RightCamera:
350
+ cameras.push(trackedDevices[i] = new XRCamera(i));
351
+ break;
352
+ case XRTrackedInputDevice.Controller:
353
+ case XRTrackedInputDevice.LeftController:
354
+ case XRTrackedInputDevice.RightController:
355
+ controllers.push(trackedDevices[i] = new XRController(i));
356
+ break;
357
+ }
358
+ }
359
+ this._statusSnapshot.fill(XRTrackingState.NotTracking, 0, trackedDevices.length);
360
+ }
361
+ var _proto = XRInputManager.prototype;
362
+ /**
363
+ * Returns the tracked device instance.
364
+ * @param type - The tracked input device type
365
+ * @returns The input instance
366
+ */ _proto.getTrackedDevice = function getTrackedDevice(type) {
367
+ return this._trackedDevices[type];
368
+ };
369
+ /**
370
+ * Add a listener for tracked device changes.
371
+ * @param listener - The listener to add
372
+ */ _proto.addTrackedDeviceChangedListener = function addTrackedDeviceChangedListener(listener) {
373
+ this._listeners.push(listener);
374
+ };
375
+ /**
376
+ * Remove a listener of tracked device changes.
377
+ * @param listener - The listener to remove
378
+ */ _proto.removeTrackedDeviceChangedListener = function removeTrackedDeviceChangedListener(listener) {
379
+ var _this = this, listeners = _this._listeners;
380
+ var index = listeners.indexOf(listener);
381
+ if (index >= 0) {
382
+ listeners.splice(index, 1);
383
+ }
384
+ };
385
+ /**
386
+ * @internal
387
+ */ _proto._onUpdate = function _onUpdate() {
388
+ var _this = this, added = _this._added, removed = _this._removed, listeners = _this._listeners, statusSnapshot = _this._statusSnapshot;
389
+ var _this1 = this, trackedDevices = _this1._trackedDevices, controllers = _this1._controllers;
390
+ // Reset data
391
+ added.length = removed.length = 0;
392
+ for(var i = 0, n = controllers.length; i < n; i++){
393
+ var controller = controllers[i];
394
+ controller.down = controller.up = 0;
395
+ }
396
+ // Handle events and update tracked devices
397
+ var _this__xrManager_sessionManager = this._xrManager.sessionManager, platformSession = _this__xrManager_sessionManager._platformSession;
398
+ var platformEvents = platformSession.events;
399
+ for(var i1 = 0, n1 = platformEvents.length; i1 < n1; i1++){
400
+ this._handleEvent(platformEvents[i1]);
401
+ }
402
+ platformSession.resetEvents();
403
+ platformSession.frame.updateInputs(trackedDevices);
404
+ for(var i2 = 0, n2 = trackedDevices.length; i2 < n2; i2++){
405
+ var input = trackedDevices[i2];
406
+ if (!input) continue;
407
+ var nowState = input.trackingState;
408
+ if (statusSnapshot[i2] === XRTrackingState.Tracking) {
409
+ if (nowState !== XRTrackingState.Tracking) {
410
+ removed.push(input);
411
+ }
412
+ } else {
413
+ if (nowState === XRTrackingState.Tracking) {
414
+ added.push(input);
415
+ }
416
+ }
417
+ statusSnapshot[i2] = nowState;
418
+ }
419
+ // Dispatch change event
420
+ if (added.length > 0 || removed.length > 0) {
421
+ for(var i3 = 0, n3 = listeners.length; i3 < n3; i3++){
422
+ listeners[i3](added, removed);
423
+ }
424
+ }
425
+ };
426
+ /**
427
+ * @internal
428
+ */ _proto._onDestroy = function _onDestroy() {
429
+ this._listeners.length = 0;
430
+ };
431
+ _proto._handleEvent = function _handleEvent(event) {
432
+ var input = this._trackedDevices[event.input];
433
+ switch(event.targetRayMode){
434
+ case XRTargetRayMode.TrackedPointer:
435
+ switch(event.type){
436
+ case XRInputEventType.SelectStart:
437
+ input.down |= XRInputButton.Select;
438
+ input.pressedButtons |= XRInputButton.Select;
439
+ break;
440
+ case XRInputEventType.SelectEnd:
441
+ input.up |= XRInputButton.Select;
442
+ input.pressedButtons &= ~XRInputButton.Select;
443
+ break;
444
+ case XRInputEventType.SqueezeStart:
445
+ input.down |= XRInputButton.Squeeze;
446
+ input.pressedButtons |= XRInputButton.Squeeze;
447
+ break;
448
+ case XRInputEventType.SqueezeEnd:
449
+ input.up |= XRInputButton.Squeeze;
450
+ input.pressedButtons &= ~XRInputButton.Squeeze;
451
+ break;
452
+ }
453
+ break;
454
+ case XRTargetRayMode.Screen:
455
+ // @ts-ignore
456
+ var canvas = this._engine.canvas._webCanvas;
457
+ var clientWidth = canvas.clientWidth, clientHeight = canvas.clientHeight;
458
+ var clientX = clientWidth * (event.x + 1) * 0.5;
459
+ var clientY = clientHeight * (event.y + 1) * 0.5;
460
+ switch(event.type){
461
+ case XRInputEventType.SelectStart:
462
+ canvas.dispatchEvent(this._makeUpPointerEvent("pointerdown", event.id, clientX, clientY));
463
+ break;
464
+ case XRInputEventType.Select:
465
+ canvas.dispatchEvent(this._makeUpPointerEvent("pointermove", event.id, clientX, clientY));
466
+ break;
467
+ case XRInputEventType.SelectEnd:
468
+ canvas.dispatchEvent(this._makeUpPointerEvent("pointerup", event.id, clientX, clientY));
469
+ canvas.dispatchEvent(this._makeUpPointerEvent("pointerleave", event.id, clientX, clientY));
470
+ break;
471
+ }
472
+ break;
473
+ }
474
+ };
475
+ _proto._makeUpPointerEvent = function _makeUpPointerEvent(type, pointerId, clientX, clientY) {
476
+ var eventInitDict = {
477
+ pointerId: pointerId,
478
+ clientX: clientX,
479
+ clientY: clientY
480
+ };
481
+ switch(type){
482
+ case "pointerdown":
483
+ eventInitDict.button = 0;
484
+ eventInitDict.buttons = 1;
485
+ break;
486
+ case "pointermove":
487
+ eventInitDict.button = -1;
488
+ eventInitDict.buttons = 1;
489
+ break;
490
+ case "pointerup":
491
+ eventInitDict.button = 0;
492
+ eventInitDict.buttons = 0;
493
+ break;
494
+ case "pointerleave":
495
+ eventInitDict.button = 0;
496
+ eventInitDict.buttons = 0;
497
+ break;
498
+ }
499
+ return new PointerEvent(type, eventInitDict);
500
+ };
501
+ return XRInputManager;
502
+ }();
503
+
504
+ /**
505
+ * The type of XR session.
506
+ */ var XRSessionMode;
507
+ (function(XRSessionMode) {
508
+ XRSessionMode[XRSessionMode["None"] = 0] = "None";
509
+ XRSessionMode[XRSessionMode["AR"] = 1] = "AR";
510
+ XRSessionMode[XRSessionMode["VR"] = 2] = "VR";
511
+ })(XRSessionMode || (XRSessionMode = {}));
512
+
513
+ /**
514
+ * XRSessionManager manages the life cycle of XR sessions.
515
+ */ var XRSessionManager = /*#__PURE__*/ function() {
516
+ function XRSessionManager(_xrManager, _engine) {
517
+ this._xrManager = _xrManager;
518
+ this._engine = _engine;
519
+ this._mode = XRSessionMode.None;
520
+ this._state = XRSessionState.None;
521
+ // @ts-ignore
522
+ this._rhi = _engine._hardwareRenderer;
523
+ this._raf = requestAnimationFrame.bind(window);
524
+ this._caf = cancelAnimationFrame.bind(window);
525
+ this._onSessionExit = this._onSessionExit.bind(this);
526
+ }
527
+ var _proto = XRSessionManager.prototype;
528
+ /**
529
+ * Check if the specified mode is supported.
530
+ * @param mode - The mode to check
531
+ * @returns A promise that resolves if the mode is supported, otherwise rejects
532
+ */ _proto.isSupportedMode = function isSupportedMode(mode) {
533
+ return this._xrManager._platformDevice.isSupportedSessionMode(mode);
534
+ };
535
+ /**
536
+ * Run the session.
537
+ */ _proto.run = function run() {
538
+ var _this = this, platformSession = _this._platformSession, engine = _this._engine;
539
+ if (!platformSession) {
540
+ throw new Error("Without session to run.");
541
+ }
542
+ platformSession.start();
543
+ this._state = XRSessionState.Running;
544
+ this._xrManager._onSessionStart();
545
+ if (!engine.isPaused) {
546
+ engine.pause();
547
+ engine.resume();
548
+ }
549
+ };
550
+ /**
551
+ * Stop the session.
552
+ */ _proto.stop = function stop() {
553
+ var _this = this, platformSession = _this._platformSession, engine = _this._engine, rhi = _this._rhi;
554
+ if (!platformSession) {
555
+ throw new Error("Without session to stop.");
556
+ }
557
+ if (this._state !== XRSessionState.Running) {
558
+ throw new Error("Session is not running.");
559
+ }
560
+ rhi._mainFrameBuffer = null;
561
+ rhi._mainFrameWidth = rhi._mainFrameHeight = 0;
562
+ platformSession.stop();
563
+ this._state = XRSessionState.Paused;
564
+ this._xrManager._onSessionStop();
565
+ if (!engine.isPaused) {
566
+ engine.pause();
567
+ engine.resume();
568
+ }
569
+ };
570
+ /**
571
+ * @internal
572
+ */ _proto._initialize = function _initialize(mode, features) {
573
+ var _this = this;
574
+ return new Promise(function(resolve, reject) {
575
+ var xrManager = _this._xrManager;
576
+ // Initialize all features
577
+ var platformFeatures = [];
578
+ for(var i = 0, n = features.length; i < n; i++){
579
+ var _features_i = features[i], platformFeature = _features_i._platformFeature;
580
+ platformFeature && platformFeatures.push(platformFeature);
581
+ }
582
+ xrManager._platformDevice.requestSession(_this._rhi, mode, platformFeatures).then(function(platformSession) {
583
+ _this._mode = mode;
584
+ _this._platformSession = platformSession;
585
+ _this._state = XRSessionState.Initialized;
586
+ platformSession.setSessionExitCallBack(_this._onSessionExit);
587
+ platformSession.addEventListener();
588
+ xrManager._onSessionInit();
589
+ resolve();
590
+ }, reject);
591
+ });
592
+ };
593
+ /**
594
+ * @internal
595
+ */ _proto._onUpdate = function _onUpdate() {
596
+ var _this = this, rhi = _this._rhi, platformSession = _this._platformSession;
597
+ rhi._mainFrameBuffer = platformSession.framebuffer;
598
+ rhi._mainFrameWidth = platformSession.framebufferWidth;
599
+ rhi._mainFrameHeight = platformSession.framebufferHeight;
600
+ };
601
+ /**
602
+ * @internal
603
+ */ _proto._getRequestAnimationFrame = function _getRequestAnimationFrame() {
604
+ if (this._state === XRSessionState.Running) {
605
+ return this._platformSession.requestAnimationFrame;
606
+ } else {
607
+ return this._raf;
608
+ }
609
+ };
610
+ /**
611
+ * @internal
612
+ */ _proto._getCancelAnimationFrame = function _getCancelAnimationFrame() {
613
+ if (this._state === XRSessionState.Running) {
614
+ return this._platformSession.cancelAnimationFrame;
615
+ } else {
616
+ return this._caf;
617
+ }
618
+ };
619
+ /**
620
+ * @internal
621
+ */ _proto._exit = function _exit() {
622
+ var _this = this, platformSession = _this._platformSession;
623
+ if (!platformSession) {
624
+ return Promise.reject("Without session to stop.");
625
+ }
626
+ return platformSession.end();
627
+ };
628
+ _proto._onSessionExit = function _onSessionExit() {
629
+ var _this = this, rhi = _this._rhi, platformSession = _this._platformSession, engine = _this._engine;
630
+ rhi._mainFrameBuffer = null;
631
+ rhi._mainFrameWidth = rhi._mainFrameHeight = 0;
632
+ platformSession.removeEventListener();
633
+ this._platformSession = null;
634
+ this._state = XRSessionState.None;
635
+ this._xrManager._onSessionExit();
636
+ if (!engine.isPaused) {
637
+ engine.pause();
638
+ engine.resume();
639
+ }
640
+ };
641
+ /**
642
+ * @internal
643
+ */ _proto._onDestroy = function _onDestroy() {};
644
+ _create_class(XRSessionManager, [
645
+ {
646
+ key: "mode",
647
+ get: /**
648
+ * The current session mode( AR or VR ).
649
+ */ function get() {
650
+ return this._mode;
651
+ }
652
+ },
653
+ {
654
+ key: "state",
655
+ get: /**
656
+ * Return the current session state.
657
+ */ function get() {
658
+ return this._state;
659
+ }
660
+ },
661
+ {
662
+ key: "supportedFrameRate",
663
+ get: /**
664
+ * Return a list of supported frame rates.(only available in-session)
665
+ */ function get() {
666
+ return this._platformSession.supportedFrameRates;
667
+ }
668
+ },
669
+ {
670
+ key: "frameRate",
671
+ get: /**
672
+ * Return the current frame rate as reported by the device.
673
+ */ function get() {
674
+ return this._platformSession.frameRate;
675
+ }
676
+ }
677
+ ]);
678
+ return XRSessionManager;
679
+ }();
680
+
681
+ /**
682
+ * XRManager is the entry point of the XR system.
683
+ */ var XRManagerExtended = /*#__PURE__*/ function(XRManager1) {
684
+ _inherits(XRManagerExtended, XRManager1);
685
+ function XRManagerExtended() {
686
+ return XRManager1.apply(this, arguments);
687
+ }
688
+ var _proto = XRManagerExtended.prototype;
689
+ /**
690
+ * Check if the specified feature is supported.
691
+ * @param type - The type of the feature
692
+ * @returns If the feature is supported
693
+ */ _proto.isSupportedFeature = function isSupportedFeature(feature) {
694
+ return this._platformDevice.isSupportedFeature(XRManagerExtended._featureMap.get(feature));
695
+ };
696
+ /**
697
+ * Add feature based on the xr feature type.
698
+ * @param type - The type of the feature
699
+ * @param args - The constructor params of the feature
700
+ * @returns The feature which has been added
701
+ */ _proto.addFeature = function addFeature(type) {
702
+ for(var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++){
703
+ args[_key - 1] = arguments[_key];
704
+ }
705
+ if (this.sessionManager._platformSession) {
706
+ throw new Error("Cannot add feature when the session is initialized.");
707
+ }
708
+ var _this = this, features = _this._features;
709
+ for(var i = 0, n = features.length; i < n; i++){
710
+ var feature = features[i];
711
+ if (_instanceof(feature, type)) throw new Error("The feature has been added");
712
+ }
713
+ var feature1 = _construct(type, [].concat(this, args));
714
+ this._features.push(feature1);
715
+ return feature1;
716
+ };
717
+ /**
718
+ * Get feature which match the type.
719
+ * @param type - The type of the feature
720
+ * @returns The feature which match type
721
+ */ _proto.getFeature = function getFeature(type) {
722
+ var _this = this, features = _this._features;
723
+ for(var i = 0, n = features.length; i < n; i++){
724
+ var feature = features[i];
725
+ if (_instanceof(feature, type)) {
726
+ return feature;
727
+ }
728
+ }
729
+ };
730
+ _proto.getFeatures = function getFeatures(type, out) {
731
+ if (out) {
732
+ out.length = 0;
733
+ } else {
734
+ out = [];
735
+ }
736
+ var _this = this, features = _this._features;
737
+ for(var i = 0, n = features.length; i < n; i--){
738
+ var feature = features[i];
739
+ _instanceof(feature, type) && out.push(feature);
740
+ }
741
+ return out;
742
+ };
743
+ /**
744
+ * Enter XR immersive mode, when you call this method, it will initialize and display the XR virtual world.
745
+ * @param sessionMode - The mode of the session
746
+ * @param autoRun - Whether to automatically run the session, when `autoRun` is set to true, xr will start working immediately after initialization. Otherwise, you need to call `sessionManager.run` later to work.
747
+ * @returns A promise that resolves if the XR virtual world is entered, otherwise rejects
748
+ */ _proto.enterXR = function enterXR(sessionMode, autoRun) {
749
+ if (autoRun === void 0) autoRun = true;
750
+ var _this = this;
751
+ var sessionManager = this.sessionManager;
752
+ if (sessionManager._platformSession) {
753
+ throw new Error("Please exit XR immersive mode first.");
754
+ }
755
+ if (!this._origin) {
756
+ throw new Error("Please set origin before enter XR.");
757
+ }
758
+ return new Promise(function(resolve, reject) {
759
+ // 1. Check if this xr mode is supported
760
+ sessionManager.isSupportedMode(sessionMode).then(function() {
761
+ // 2. Initialize session
762
+ sessionManager._initialize(sessionMode, _this._features).then(function() {
763
+ autoRun && sessionManager.run();
764
+ resolve();
765
+ }, reject);
766
+ }, reject);
767
+ });
768
+ };
769
+ /**
770
+ * Exit XR immersive mode, when you call this method, it will destroy the XR virtual world.
771
+ * @returns A promise that resolves if the XR virtual world is destroyed, otherwise rejects
772
+ */ _proto.exitXR = function exitXR() {
773
+ var _this = this;
774
+ return new Promise(function(resolve, reject) {
775
+ _this.sessionManager._exit().then(function() {
776
+ resolve();
777
+ }, reject);
778
+ });
779
+ };
780
+ /**
781
+ * @internal
782
+ */ _proto._initialize = function _initialize(engine, xrDevice) {
783
+ this._features = [];
784
+ this._platformDevice = xrDevice;
785
+ this.sessionManager = new XRSessionManager(this, engine);
786
+ this.inputManager = new XRInputManager(this, engine);
787
+ this.cameraManager = new XRCameraManager(this);
788
+ };
789
+ /**
790
+ * @internal
791
+ */ _proto._update = function _update() {
792
+ var sessionManager = this.sessionManager;
793
+ if (sessionManager.state !== XRSessionState.Running) return;
794
+ sessionManager._onUpdate();
795
+ this.inputManager._onUpdate();
796
+ this.cameraManager._onUpdate();
797
+ var _this = this, features = _this._features;
798
+ for(var i = 0, n = features.length; i < n; i++){
799
+ var feature = features[i];
800
+ feature.enabled && feature._onUpdate();
801
+ }
802
+ };
803
+ /**
804
+ * @internal
805
+ */ _proto._destroy = function _destroy() {
806
+ var _this = this;
807
+ if (this.sessionManager._platformSession) {
808
+ this.exitXR().then(function() {
809
+ _this.sessionManager._onDestroy();
810
+ _this.inputManager._onDestroy();
811
+ _this.cameraManager._onDestroy();
812
+ });
813
+ } else {
814
+ this.sessionManager._onDestroy();
815
+ this.inputManager._onDestroy();
816
+ this.cameraManager._onDestroy();
817
+ }
818
+ };
819
+ /**
820
+ * @internal
821
+ */ _proto._getRequestAnimationFrame = function _getRequestAnimationFrame() {
822
+ return this.sessionManager._getRequestAnimationFrame();
823
+ };
824
+ /**
825
+ * @internal
826
+ */ _proto._getCancelAnimationFrame = function _getCancelAnimationFrame() {
827
+ return this.sessionManager._getCancelAnimationFrame();
828
+ };
829
+ /**
830
+ * @internal
831
+ */ _proto._getCameraClearFlagsMask = function _getCameraClearFlagsMask(type) {
832
+ return this.cameraManager._getCameraClearFlagsMask(type);
833
+ };
834
+ /**
835
+ * @internal
836
+ */ _proto._onSessionStop = function _onSessionStop() {
837
+ var _this = this, features = _this._features;
838
+ for(var i = 0, n = features.length; i < n; i++){
839
+ var feature = features[i];
840
+ feature.enabled && feature._onSessionStop();
841
+ }
842
+ };
843
+ /**
844
+ * @internal
845
+ */ _proto._onSessionInit = function _onSessionInit() {
846
+ var _this = this, features = _this._features;
847
+ for(var i = 0, n = features.length; i < n; i++){
848
+ var feature = features[i];
849
+ feature.enabled && feature._onSessionInit();
850
+ }
851
+ };
852
+ /**
853
+ * @internal
854
+ */ _proto._onSessionStart = function _onSessionStart() {
855
+ this.cameraManager._onSessionStart();
856
+ var _this = this, features = _this._features;
857
+ for(var i = 0, n = features.length; i < n; i++){
858
+ var feature = features[i];
859
+ feature.enabled && feature._onSessionStart();
860
+ }
861
+ };
862
+ /**
863
+ * @internal
864
+ */ _proto._onSessionExit = function _onSessionExit() {
865
+ this.cameraManager._onSessionExit();
866
+ var _this = this, features = _this._features;
867
+ for(var i = 0, n = features.length; i < n; i++){
868
+ var feature = features[i];
869
+ feature.enabled && feature._onSessionExit();
870
+ feature._onDestroy();
871
+ }
872
+ features.length = 0;
873
+ };
874
+ _create_class(XRManagerExtended, [
875
+ {
876
+ key: "origin",
877
+ get: /**
878
+ * The current origin of XR space.
879
+ * @remarks The connection point between the virtual world and the real world ( XR Space )
880
+ */ function get() {
881
+ return this._origin;
882
+ },
883
+ set: function set(value) {
884
+ if (this.sessionManager._platformSession) {
885
+ throw new Error("Cannot set origin when the session is initialized.");
886
+ }
887
+ this._origin = value;
888
+ }
889
+ }
890
+ ]);
891
+ return XRManagerExtended;
892
+ }(XRManager);
893
+ (function() {
894
+ /** @internal */ XRManagerExtended._featureMap = new Map();
895
+ })();
896
+ /**
897
+ * @internal
898
+ */ function registerXRFeature(type) {
899
+ return function(feature) {
900
+ XRManagerExtended._featureMap.set(feature, type);
901
+ };
902
+ }
903
+ // 实现混入的函数
904
+ function ApplyMixins(derivedCtor, baseCtors) {
905
+ baseCtors.forEach(function(baseCtor) {
906
+ Object.getOwnPropertyNames(baseCtor.prototype).forEach(function(name) {
907
+ Object.defineProperty(derivedCtor.prototype, name, Object.getOwnPropertyDescriptor(baseCtor.prototype, name) || Object.create(null));
908
+ });
909
+ });
910
+ }
911
+ ApplyMixins(XRManager, [
912
+ XRManagerExtended
913
+ ]);
914
+
915
+ /**
916
+ * The base class of XR feature manager.
917
+ */ var XRFeature = /*#__PURE__*/ function() {
918
+ function XRFeature(_xrManager, _type) {
919
+ for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
920
+ args[_key - 2] = arguments[_key];
921
+ }
922
+ var _xrManager__platformDevice;
923
+ this._xrManager = _xrManager;
924
+ this._type = _type;
925
+ this._enabled = true;
926
+ this._platformFeature = (_xrManager__platformDevice = _xrManager._platformDevice).createPlatformFeature.apply(_xrManager__platformDevice, [].concat(_type, args));
927
+ this._onEnable();
928
+ }
929
+ var _proto = XRFeature.prototype;
930
+ /**
931
+ * @internal
932
+ */ _proto._onEnable = function _onEnable() {};
933
+ /**
934
+ * @internal
935
+ */ _proto._onDisable = function _onDisable() {};
936
+ /**
937
+ * @internal
938
+ */ _proto._onUpdate = function _onUpdate() {};
939
+ /**
940
+ * @internal
941
+ */ _proto._onSessionInit = function _onSessionInit() {};
942
+ /**
943
+ * @internal
944
+ */ _proto._onSessionStart = function _onSessionStart() {};
945
+ /**
946
+ * @internal
947
+ */ _proto._onSessionStop = function _onSessionStop() {};
948
+ /**
949
+ * @internal
950
+ */ _proto._onSessionExit = function _onSessionExit() {};
951
+ /**
952
+ * @internal
953
+ */ _proto._onDestroy = function _onDestroy() {};
954
+ _create_class(XRFeature, [
955
+ {
956
+ key: "enabled",
957
+ get: /**
958
+ * Returns whether the feature is enabled.
959
+ */ function get() {
960
+ return this._enabled;
961
+ },
962
+ set: function set(value) {
963
+ if (this.enabled !== value) {
964
+ this._enabled = value;
965
+ value ? this._onEnable() : this._onDisable();
966
+ }
967
+ }
968
+ }
969
+ ]);
970
+ return XRFeature;
971
+ }();
972
+
973
+ /**
974
+ * Enum for the types of hit test that can be performed.
975
+ * Note: currently only supports plane.
976
+ */ var TrackableType;
977
+ (function(TrackableType) {
978
+ TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
979
+ TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
980
+ })(TrackableType || (TrackableType = {}));
981
+
982
+ /**
983
+ * XR hit result.
984
+ * It is the detection result returned by using XR HitTest feature.
985
+ */ var XRHitResult = function XRHitResult() {
986
+ /** The position of the hit point. */ this.point = new Vector3();
987
+ /** The normal of the hit point. */ this.normal = new Vector3();
988
+ };
989
+
990
+ /******************************************************************************
991
+ Copyright (c) Microsoft Corporation.
992
+
993
+ Permission to use, copy, modify, and/or distribute this software for any
994
+ purpose with or without fee is hereby granted.
995
+
996
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
997
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
998
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
999
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1000
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1001
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1002
+ PERFORMANCE OF THIS SOFTWARE.
1003
+ ***************************************************************************** */
1004
+
1005
+ function __decorate(decorators, target, key, desc) {
1006
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1007
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1008
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
1009
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1010
+ }
1011
+
1012
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1013
+ var e = new Error(message);
1014
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1015
+ };
1016
+
1017
+ var XRFeatureType;
1018
+ (function(XRFeatureType) {
1019
+ XRFeatureType[XRFeatureType["AnchorTracking"] = 0] = "AnchorTracking";
1020
+ XRFeatureType[XRFeatureType["ImageTracking"] = 1] = "ImageTracking";
1021
+ XRFeatureType[XRFeatureType["PlaneTracking"] = 2] = "PlaneTracking";
1022
+ XRFeatureType[XRFeatureType["HitTest"] = 3] = "HitTest";
1023
+ })(XRFeatureType || (XRFeatureType = {}));
1024
+
1025
+ var XRRequestTrackingState;
1026
+ (function(XRRequestTrackingState) {
1027
+ XRRequestTrackingState[XRRequestTrackingState["None"] = 0] = "None";
1028
+ XRRequestTrackingState[XRRequestTrackingState["Submitted"] = 1] = "Submitted";
1029
+ XRRequestTrackingState[XRRequestTrackingState["Resolved"] = 2] = "Resolved";
1030
+ XRRequestTrackingState[XRRequestTrackingState["Rejected"] = 3] = "Rejected";
1031
+ XRRequestTrackingState[XRRequestTrackingState["Destroyed"] = 4] = "Destroyed";
1032
+ XRRequestTrackingState[XRRequestTrackingState["WaitingDestroy"] = 5] = "WaitingDestroy";
1033
+ })(XRRequestTrackingState || (XRRequestTrackingState = {}));
1034
+
1035
+ /**
1036
+ * The base class of XR trackable manager.
1037
+ */ var XRTrackableFeature = /*#__PURE__*/ function(XRFeature1) {
1038
+ _inherits(XRTrackableFeature, XRFeature1);
1039
+ function XRTrackableFeature() {
1040
+ var _this;
1041
+ _this = XRFeature1.apply(this, arguments) || this;
1042
+ _this._requestTrackings = [];
1043
+ _this._tracked = [];
1044
+ _this._added = [];
1045
+ _this._updated = [];
1046
+ _this._removed = [];
1047
+ _this._statusSnapshot = {};
1048
+ _this._listeners = [];
1049
+ return _this;
1050
+ }
1051
+ var _proto = XRTrackableFeature.prototype;
1052
+ /**
1053
+ * Add a listening function for tracked object changes.
1054
+ * @param listener - The listening function
1055
+ */ _proto.addChangedListener = function addChangedListener(listener) {
1056
+ this._listeners.push(listener);
1057
+ };
1058
+ /**
1059
+ * Remove a listening function of tracked object changes.
1060
+ * @param listener - The listening function
1061
+ */ _proto.removeChangedListener = function removeChangedListener(listener) {
1062
+ var _this = this, listeners = _this._listeners;
1063
+ var index = listeners.indexOf(listener);
1064
+ if (index >= 0) {
1065
+ listeners.splice(index, 1);
1066
+ }
1067
+ };
1068
+ _proto._onUpdate = function _onUpdate() {
1069
+ var _this__xrManager_sessionManager = this._xrManager.sessionManager, platformSession = _this__xrManager_sessionManager._platformSession;
1070
+ var platformFrame = platformSession.frame;
1071
+ var _this = this, platformFeature = _this._platformFeature, listeners = _this._listeners, requestTrackings = _this._requestTrackings, statusSnapshot = _this._statusSnapshot, allTracked = _this._tracked, added = _this._added, updated = _this._updated, removed = _this._removed;
1072
+ if (!platformFrame || !requestTrackings.length) {
1073
+ return;
1074
+ }
1075
+ if (!platformFeature.checkAvailable(platformSession, platformFrame, requestTrackings)) {
1076
+ return;
1077
+ }
1078
+ added.length = updated.length = removed.length = 0;
1079
+ platformFeature.getTrackedResult(platformSession, platformFrame, requestTrackings, this._generateTracked);
1080
+ for(var i = 0, n = requestTrackings.length; i < n; i++){
1081
+ var requestTracking = requestTrackings[i];
1082
+ switch(requestTracking.state){
1083
+ case XRRequestTrackingState.Destroyed:
1084
+ var destroyedTracked = requestTracking.tracked;
1085
+ for(var j = 0, n1 = destroyedTracked.length; j < n1; j++){
1086
+ var tracked = destroyedTracked[j];
1087
+ var trackId = tracked.id;
1088
+ if (statusSnapshot[trackId] === XRTrackingState.Tracking) {
1089
+ removed.push(tracked);
1090
+ allTracked.splice(allTracked.indexOf(tracked), 1);
1091
+ }
1092
+ statusSnapshot[trackId] = XRTrackingState.NotTracking;
1093
+ }
1094
+ break;
1095
+ case XRRequestTrackingState.Resolved:
1096
+ var tracked1 = requestTracking.tracked;
1097
+ for(var j1 = 0, n2 = tracked1.length; j1 < n2; j1++){
1098
+ var trackedObject = tracked1[j1];
1099
+ var trackId1 = trackedObject.id;
1100
+ if (trackedObject.state === XRTrackingState.Tracking) {
1101
+ if (statusSnapshot[trackId1] === XRTrackingState.Tracking) {
1102
+ updated.push(trackedObject);
1103
+ } else {
1104
+ added.push(trackedObject);
1105
+ statusSnapshot[trackId1] = XRTrackingState.Tracking;
1106
+ allTracked.push(trackedObject);
1107
+ }
1108
+ } else {
1109
+ if (statusSnapshot[trackId1] === XRTrackingState.Tracking) {
1110
+ removed.push(trackedObject);
1111
+ allTracked.splice(allTracked.indexOf(trackedObject), 1);
1112
+ }
1113
+ statusSnapshot[trackId1] = trackedObject.state;
1114
+ }
1115
+ }
1116
+ break;
1117
+ }
1118
+ }
1119
+ for(var i1 = requestTrackings.length - 1; i1 >= 0; i1--){
1120
+ requestTrackings[i1].state === XRRequestTrackingState.Destroyed && requestTrackings.splice(i1, 1);
1121
+ }
1122
+ if (added.length > 0 || updated.length > 0 || removed.length > 0) {
1123
+ for(var i2 = 0, n3 = listeners.length; i2 < n3; i2++){
1124
+ listeners[i2](added, updated, removed);
1125
+ }
1126
+ }
1127
+ };
1128
+ _proto._onSessionStop = function _onSessionStop() {
1129
+ this._added.length = this._updated.length = this._removed.length = 0;
1130
+ };
1131
+ _proto._onSessionExit = function _onSessionExit() {
1132
+ // prettier-ignore
1133
+ this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1134
+ };
1135
+ _proto._onDestroy = function _onDestroy() {
1136
+ // prettier-ignore
1137
+ this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1138
+ };
1139
+ _proto._addRequestTracking = function _addRequestTracking(requestTracking) {
1140
+ var _this = this, platformFeature = _this._platformFeature;
1141
+ if (this._xrManager.sessionManager._platformSession && !platformFeature.canModifyRequestTrackingAfterInit) {
1142
+ throw new Error(XRFeatureType[this._type] + " request tracking cannot be modified after initialization.");
1143
+ }
1144
+ this._requestTrackings.push(requestTracking);
1145
+ platformFeature.onAddRequestTracking(requestTracking);
1146
+ };
1147
+ _proto._removeRequestTracking = function _removeRequestTracking(requestTracking) {
1148
+ var _this = this, platformFeature = _this._platformFeature;
1149
+ if (this._xrManager.sessionManager._platformSession && !platformFeature.canModifyRequestTrackingAfterInit) {
1150
+ throw new Error(XRFeatureType[this._type] + " request tracking cannot be modified after initialization.");
1151
+ }
1152
+ platformFeature.onDelRequestTracking(requestTracking);
1153
+ };
1154
+ _proto._removeAllRequestTrackings = function _removeAllRequestTrackings() {
1155
+ var _this = this, platformFeature = _this._platformFeature;
1156
+ if (this._xrManager.sessionManager._platformSession && !platformFeature.canModifyRequestTrackingAfterInit) {
1157
+ throw new Error(XRFeatureType[this._type] + " request tracking cannot be modified after initialization.");
1158
+ }
1159
+ var _this1 = this, requestTrackings = _this1._requestTrackings;
1160
+ for(var i = 0, n = requestTrackings.length; i < n; i++){
1161
+ platformFeature.onDelRequestTracking(requestTrackings[i]);
1162
+ }
1163
+ };
1164
+ return XRTrackableFeature;
1165
+ }(XRFeature);
1166
+ (function() {
1167
+ XRTrackableFeature._uuid = 0;
1168
+ })();
1169
+
1170
+ /**
1171
+ * Enumerates modes of plane in XR.
1172
+ */ var XRPlaneMode;
1173
+ (function(XRPlaneMode) {
1174
+ XRPlaneMode[XRPlaneMode[/** None. */ "None"] = 0] = "None";
1175
+ XRPlaneMode[XRPlaneMode[/** Horizontal */ "Horizontal"] = 1] = "Horizontal";
1176
+ XRPlaneMode[XRPlaneMode[/** Vertical */ "Vertical"] = 2] = "Vertical";
1177
+ XRPlaneMode[XRPlaneMode[/** Includes horizontal and vertical. */ "EveryThing"] = 3] = "EveryThing";
1178
+ })(XRPlaneMode || (XRPlaneMode = {}));
1179
+
1180
+ /**
1181
+ * @internal
1182
+ */ var XRRequestTracking = function XRRequestTracking() {
1183
+ /** The status of the current request tracking. */ this.state = XRRequestTrackingState.None;
1184
+ /** Tracked instances, make up from the tracking data returned by Session. */ this.tracked = [];
1185
+ };
1186
+
1187
+ /**
1188
+ * The request plane in XR space.
1189
+ */ var XRRequestPlane = /*#__PURE__*/ function(XRRequestTracking1) {
1190
+ _inherits(XRRequestPlane, XRRequestTracking1);
1191
+ function XRRequestPlane(detectionMode) {
1192
+ var _this;
1193
+ _this = XRRequestTracking1.call(this) || this;
1194
+ _this.detectionMode = detectionMode;
1195
+ return _this;
1196
+ }
1197
+ return XRRequestPlane;
1198
+ }(XRRequestTracking);
1199
+
1200
+ /**
1201
+ * The base class of XR tracked object.
1202
+ */ var XRTracked = function XRTracked() {
1203
+ /** The pose of the trackable in XR space. */ this.pose = new XRPose();
1204
+ /** The tracking state of the trackable. */ this.state = XRTrackingState.NotTracking;
1205
+ };
1206
+
1207
+ /**
1208
+ * The tracked plane in XR space.
1209
+ */ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked1) {
1210
+ _inherits(XRTrackedPlane, XRTracked1);
1211
+ function XRTrackedPlane() {
1212
+ var _this;
1213
+ _this = XRTracked1.apply(this, arguments) || this;
1214
+ /** The points that make up this plane.
1215
+ * Note: These points are in the plane coordinate system,
1216
+ * and their Y coordinates are all zero.
1217
+ */ _this.polygon = [];
1218
+ /**
1219
+ * Whether this frame changes the attributes of the plane.
1220
+ * Note: Includes `polygon` but no `pose`.
1221
+ */ _this.attributesDirty = false;
1222
+ return _this;
1223
+ }
1224
+ return XRTrackedPlane;
1225
+ }(XRTracked);
1226
+
1227
+ var XRPlaneTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1228
+ _inherits(XRPlaneTracking, XRTrackableFeature1);
1229
+ function XRPlaneTracking(xrManager, detectionMode) {
1230
+ if (detectionMode === void 0) detectionMode = XRPlaneMode.EveryThing;
1231
+ var _this;
1232
+ _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.PlaneTracking, detectionMode) || this;
1233
+ _this._addRequestTracking(new XRRequestPlane(detectionMode));
1234
+ return _this;
1235
+ }
1236
+ var _proto = XRPlaneTracking.prototype;
1237
+ _proto._generateTracked = function _generateTracked() {
1238
+ var plane = new XRTrackedPlane();
1239
+ plane.id = XRTrackableFeature._uuid++;
1240
+ return plane;
1241
+ };
1242
+ _create_class(XRPlaneTracking, [
1243
+ {
1244
+ key: "detectionMode",
1245
+ get: /**
1246
+ * The plane detection mode.
1247
+ */ function get() {
1248
+ return this._requestTrackings[0].detectionMode;
1249
+ }
1250
+ },
1251
+ {
1252
+ key: "trackedPlanes",
1253
+ get: /**
1254
+ * The tracked planes.
1255
+ */ function get() {
1256
+ return this._tracked;
1257
+ }
1258
+ }
1259
+ ]);
1260
+ return XRPlaneTracking;
1261
+ }(XRTrackableFeature);
1262
+ XRPlaneTracking = __decorate([
1263
+ registerXRFeature(XRFeatureType.PlaneTracking)
1264
+ ], XRPlaneTracking);
1265
+
1266
+ var XRHitTest = /*#__PURE__*/ function(XRFeature1) {
1267
+ _inherits(XRHitTest, XRFeature1);
1268
+ function XRHitTest(xrManager) {
1269
+ var _this;
1270
+ _this = XRFeature1.call(this, xrManager, XRFeatureType.HitTest) || this;
1271
+ _this._tempRay = new Ray();
1272
+ _this._tempPlane = new Plane();
1273
+ _this._tempVec2 = new Vector2();
1274
+ _this._tempVec30 = new Vector3();
1275
+ _this._tempVec31 = new Vector3();
1276
+ _this._tempVec32 = new Vector3();
1277
+ _this._tempVec33 = new Vector3();
1278
+ _this._tempVec34 = new Vector3();
1279
+ _this._tempVec35 = new Vector3();
1280
+ return _this;
1281
+ }
1282
+ var _proto = XRHitTest.prototype;
1283
+ /**
1284
+ * Hit test.
1285
+ * @param ray - The ray to test
1286
+ * @param type - The type of hit test
1287
+ * @returns The hit result
1288
+ */ _proto.hitTest = function hitTest(ray, type) {
1289
+ var result = [];
1290
+ if (type & TrackableType.Plane) {
1291
+ this._hitTestPlane(ray, result);
1292
+ }
1293
+ return result;
1294
+ };
1295
+ /**
1296
+ * Screen hit test.
1297
+ * @param x - The x coordinate of the screen point
1298
+ * @param y - The y coordinate of the screen point
1299
+ * @param type - The type of hit test
1300
+ * @returns The hit result
1301
+ */ _proto.screenHitTest = function screenHitTest(x, y, type) {
1302
+ var _this = this, xrManager = _this._xrManager;
1303
+ if (xrManager.sessionManager.mode !== XRSessionMode.AR) {
1304
+ throw new Error("Only AR mode supports using screen ray hit test.");
1305
+ }
1306
+ var _xrManager_inputManager_getTrackedDevice = xrManager.inputManager.getTrackedDevice(XRTrackedInputDevice.Camera), camera = _xrManager_inputManager_getTrackedDevice._camera;
1307
+ if (!camera) {
1308
+ throw new Error("No camera available.");
1309
+ }
1310
+ var ray = camera.screenPointToRay(this._tempVec2.set(x, y), this._tempRay);
1311
+ return this.hitTest(ray, type);
1312
+ };
1313
+ _proto._hitTestPlane = function _hitTestPlane(ray, result) {
1314
+ var planeManager = this._xrManager.getFeature(XRPlaneTracking);
1315
+ if (!planeManager || !planeManager.enabled) {
1316
+ throw new Error("The plane estimation function needs to be turned on for plane hit test.");
1317
+ }
1318
+ var _this = this, plane = _this._tempPlane, normal = _this._tempVec30, hitPoint = _this._tempVec31, hitPointInPlane = _this._tempVec32;
1319
+ var trackedPlanes = planeManager.trackedPlanes;
1320
+ for(var i = 0, n = trackedPlanes.length; i < n; i++){
1321
+ var trackedPlane = trackedPlanes[i];
1322
+ normal.set(0, 1, 0).transformNormal(trackedPlane.pose.matrix);
1323
+ plane.normal.copyFrom(normal);
1324
+ plane.distance = -Vector3.dot(normal, trackedPlane.pose.position);
1325
+ var distance = ray.intersectPlane(plane);
1326
+ if (distance >= 0) {
1327
+ ray.getPoint(distance, hitPoint);
1328
+ Vector3.transformToVec3(hitPoint, trackedPlane.pose.inverseMatrix, hitPointInPlane);
1329
+ // Check if the hit position is within the plane boundary.
1330
+ if (this._checkPointerWithinPlane(hitPointInPlane, trackedPlane)) {
1331
+ var hitResult = new XRHitResult();
1332
+ hitResult.point.copyFrom(hitPoint);
1333
+ hitResult.normal.copyFrom(normal);
1334
+ hitResult.distance = distance;
1335
+ hitResult.trackedObject = trackedPlane;
1336
+ hitResult.trackableType = TrackableType.Plane;
1337
+ result.push(hitResult);
1338
+ }
1339
+ }
1340
+ }
1341
+ };
1342
+ _proto._checkPointerWithinPlane = function _checkPointerWithinPlane(pointer, plane) {
1343
+ var _this = this, preToCur = _this._tempVec33, preToPointer = _this._tempVec34, cross = _this._tempVec35;
1344
+ var polygon = plane.polygon;
1345
+ var length = polygon.length;
1346
+ var prePoint = polygon[length - 1];
1347
+ var side = 0;
1348
+ for(var i = 0; i < length; i++){
1349
+ var curPoint = polygon[i];
1350
+ Vector3.subtract(curPoint, prePoint, preToCur);
1351
+ Vector3.subtract(pointer, prePoint, preToPointer);
1352
+ Vector3.cross(preToCur, preToPointer, cross);
1353
+ var y = cross.y;
1354
+ if (side === 0) {
1355
+ if (y > 0) {
1356
+ side = 1;
1357
+ } else if (y < 0) {
1358
+ side = -1;
1359
+ }
1360
+ } else {
1361
+ if (y > 0 && side < 0 || y < 0 && side > 0) {
1362
+ return false;
1363
+ }
1364
+ }
1365
+ prePoint = curPoint;
1366
+ }
1367
+ return true;
1368
+ };
1369
+ return XRHitTest;
1370
+ }(XRFeature);
1371
+ XRHitTest = __decorate([
1372
+ registerXRFeature(XRFeatureType.HitTest)
1373
+ ], XRHitTest);
1374
+
1375
+ /**
1376
+ * The anchor in XR space.
1377
+ */ var XRAnchor = /*#__PURE__*/ function(XRTracked1) {
1378
+ _inherits(XRAnchor, XRTracked1);
1379
+ function XRAnchor() {
1380
+ return XRTracked1.apply(this, arguments);
1381
+ }
1382
+ return XRAnchor;
1383
+ }(XRTracked);
1384
+
1385
+ /**
1386
+ * The request anchor in XR space.
1387
+ */ var XRRequestAnchor = /*#__PURE__*/ function(XRRequestTracking1) {
1388
+ _inherits(XRRequestAnchor, XRRequestTracking1);
1389
+ function XRRequestAnchor(position, rotation) {
1390
+ var _this;
1391
+ _this = XRRequestTracking1.call(this) || this;
1392
+ _this.position = position;
1393
+ _this.rotation = rotation;
1394
+ return _this;
1395
+ }
1396
+ return XRRequestAnchor;
1397
+ }(XRRequestTracking);
1398
+
1399
+ var XRAnchorTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1400
+ _inherits(XRAnchorTracking, XRTrackableFeature1);
1401
+ function XRAnchorTracking(xrManager) {
1402
+ var _this;
1403
+ _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.AnchorTracking) || this;
1404
+ _this._anchors = [];
1405
+ return _this;
1406
+ }
1407
+ var _proto = XRAnchorTracking.prototype;
1408
+ /**
1409
+ * Add a anchor in XR space.
1410
+ * @param anchor - The anchor to be added
1411
+ */ _proto.addAnchor = function addAnchor(position, rotation) {
1412
+ if (!this._enabled) {
1413
+ throw new Error("Cannot add an anchor from a disabled anchor manager.");
1414
+ }
1415
+ var _this = this, anchors = _this._anchors;
1416
+ var requestAnchor = new XRRequestAnchor(position, rotation);
1417
+ var xrAnchor = this._generateTracked();
1418
+ requestAnchor.tracked[0] = xrAnchor;
1419
+ this._addRequestTracking(requestAnchor);
1420
+ anchors.push(xrAnchor);
1421
+ return xrAnchor;
1422
+ };
1423
+ /**
1424
+ * Remove a anchor in XR space.
1425
+ * @param anchor - The anchor to be removed
1426
+ */ _proto.removeAnchor = function removeAnchor(anchor) {
1427
+ if (!this._enabled) {
1428
+ throw new Error("Cannot remove an anchor from a disabled anchor manager.");
1429
+ }
1430
+ var _this = this, requestTrackings = _this._requestTrackings, anchors = _this._anchors;
1431
+ for(var i = 0, n = requestTrackings.length; i < n; i++){
1432
+ var requestAnchor = requestTrackings[i];
1433
+ if (requestAnchor.tracked[0] === anchor) {
1434
+ this._removeRequestTracking(requestAnchor);
1435
+ break;
1436
+ }
1437
+ }
1438
+ anchors.splice(anchors.indexOf(anchor), 1);
1439
+ };
1440
+ /**
1441
+ * Remove all tracking anchors.
1442
+ */ _proto.clearAnchors = function clearAnchors() {
1443
+ if (!this._enabled) {
1444
+ throw new Error("Cannot remove anchors from a disabled anchor manager.");
1445
+ }
1446
+ this._removeAllRequestTrackings();
1447
+ };
1448
+ _proto._generateTracked = function _generateTracked() {
1449
+ var anchor = new XRAnchor();
1450
+ anchor.id = XRTrackableFeature._uuid++;
1451
+ return anchor;
1452
+ };
1453
+ _create_class(XRAnchorTracking, [
1454
+ {
1455
+ key: "trackingAnchors",
1456
+ get: /**
1457
+ * The anchors to tracking.
1458
+ */ function get() {
1459
+ return this._anchors;
1460
+ }
1461
+ },
1462
+ {
1463
+ key: "trackedAnchors",
1464
+ get: /**
1465
+ * The tracked anchors.
1466
+ */ function get() {
1467
+ return this._tracked;
1468
+ }
1469
+ }
1470
+ ]);
1471
+ return XRAnchorTracking;
1472
+ }(XRTrackableFeature);
1473
+ XRAnchorTracking = __decorate([
1474
+ registerXRFeature(XRFeatureType.AnchorTracking)
1475
+ ], XRAnchorTracking);
1476
+
1477
+ /**
1478
+ * The request image in XR space.
1479
+ */ var XRRequestImage = /*#__PURE__*/ function(XRRequestTracking1) {
1480
+ _inherits(XRRequestImage, XRRequestTracking1);
1481
+ function XRRequestImage(image) {
1482
+ var _this;
1483
+ _this = XRRequestTracking1.call(this) || this;
1484
+ _this.image = image;
1485
+ return _this;
1486
+ }
1487
+ return XRRequestImage;
1488
+ }(XRRequestTracking);
1489
+
1490
+ /**
1491
+ * A tracked image in XR space.
1492
+ */ var XRTrackedImage = /*#__PURE__*/ function(XRTracked1) {
1493
+ _inherits(XRTrackedImage, XRTracked1);
1494
+ function XRTrackedImage() {
1495
+ return XRTracked1.apply(this, arguments);
1496
+ }
1497
+ return XRTrackedImage;
1498
+ }(XRTracked);
1499
+
1500
+ var XRImageTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1501
+ _inherits(XRImageTracking, XRTrackableFeature1);
1502
+ function XRImageTracking(xrManager, trackingImages) {
1503
+ var _this;
1504
+ _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.ImageTracking, trackingImages) || this;
1505
+ _this._trackingImages = trackingImages;
1506
+ var imageLength = trackingImages ? trackingImages.length : 0;
1507
+ if (imageLength > 0) {
1508
+ for(var i = 0, n = trackingImages.length; i < n; i++){
1509
+ _this._addRequestTracking(new XRRequestImage(trackingImages[i]));
1510
+ }
1511
+ } else {
1512
+ console.warn("No image to be tracked.");
1513
+ }
1514
+ return _this;
1515
+ }
1516
+ var _proto = XRImageTracking.prototype;
1517
+ _proto._generateTracked = function _generateTracked() {
1518
+ var image = new XRTrackedImage();
1519
+ image.id = XRTrackableFeature._uuid++;
1520
+ return image;
1521
+ };
1522
+ _create_class(XRImageTracking, [
1523
+ {
1524
+ key: "trackingImages",
1525
+ get: /**
1526
+ * The image to tracking.
1527
+ */ function get() {
1528
+ return this._trackingImages;
1529
+ }
1530
+ },
1531
+ {
1532
+ key: "trackedImages",
1533
+ get: /**
1534
+ * The tracked images.
1535
+ */ function get() {
1536
+ return this._tracked;
1537
+ }
1538
+ }
1539
+ ]);
1540
+ return XRImageTracking;
1541
+ }(XRTrackableFeature);
1542
+ XRImageTracking = __decorate([
1543
+ registerXRFeature(XRFeatureType.ImageTracking)
1544
+ ], XRImageTracking);
1545
+
1546
+ /**
1547
+ * A reference image is an image to look for in the physical environment.
1548
+ */ var XRReferenceImage = function XRReferenceImage(name, imageSource, physicalWidth) {
1549
+ this.name = name;
1550
+ this.imageSource = imageSource;
1551
+ this.physicalWidth = physicalWidth;
1552
+ };
1553
+
1554
+ export { TrackableType, XRAnchor, XRAnchorTracking, XRCamera, XRCameraManager, XRController, XRFeature, XRFeatureType, XRHitResult, XRHitTest, XRImageTracking, XRInputButton, XRInputEventType, XRInputManager, XRPlaneMode, XRPlaneTracking, XRPose, XRReferenceImage, XRRequestTrackingState, XRSessionManager, XRSessionMode, XRSessionState, XRTargetRayMode, XRTrackedImage, XRTrackedInputDevice, XRTrackedPlane, XRTrackingState };
1555
+ //# sourceMappingURL=module.js.map