@galacean/engine-xr-webxr 0.0.0-experimental-1.3-xr.9 → 0.0.0-experimental-1.4-small-language.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/browser.js CHANGED
@@ -75,16 +75,25 @@
75
75
  } else return left instanceof right;
76
76
  }
77
77
 
78
+ function _type_of(obj) {
79
+ "@swc/helpers - typeof";
80
+
81
+ return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
82
+ }
83
+
78
84
  function _is_native_reflect_construct$1() {
79
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
80
- if (Reflect.construct.sham) return false;
81
- if (typeof Proxy === "function") return true;
85
+ // Since Reflect.construct can't be properly polyfilled, some
86
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
87
+ // Those polyfills don't allow us to subclass built-ins, so we need to
88
+ // use our fallback implementation.
82
89
  try {
83
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
84
- return true;
85
- } catch (e) {
86
- return false;
87
- }
90
+ // If the internal slots aren't set, this throws an error similar to
91
+ // TypeError: this is not a Boolean object.
92
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
93
+ } catch (_) {}
94
+ return (_is_native_reflect_construct$1 = function _is_native_reflect_construct() {
95
+ return !!result;
96
+ })();
88
97
  }
89
98
  function _set_prototype_of(o, p) {
90
99
  _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
@@ -143,33 +152,33 @@
143
152
  }
144
153
  /**
145
154
  * Enumerates some input devices that can be tracked.(including status, posture and other information)
146
- */ var XRTrackedInputDevice;
147
- (function(XRTrackedInputDevice) {
148
- XRTrackedInputDevice[XRTrackedInputDevice[/** Controller */ "Controller"] = 0] = "Controller";
149
- XRTrackedInputDevice[XRTrackedInputDevice[/** Left controller */ "LeftController"] = 1] = "LeftController";
150
- XRTrackedInputDevice[XRTrackedInputDevice[/** Right controller */ "RightController"] = 2] = "RightController";
151
- XRTrackedInputDevice[XRTrackedInputDevice[/** Camera */ "Camera"] = 3] = "Camera";
152
- XRTrackedInputDevice[XRTrackedInputDevice[/** Left camera */ "LeftCamera"] = 4] = "LeftCamera";
153
- XRTrackedInputDevice[XRTrackedInputDevice[/** Right camera */ "RightCamera"] = 5] = "RightCamera";
154
- XRTrackedInputDevice[XRTrackedInputDevice[/** Head */ "LeftHand"] = 6] = "LeftHand";
155
- XRTrackedInputDevice[XRTrackedInputDevice[/** Right hand */ "RightHand"] = 7] = "RightHand";
156
- })(XRTrackedInputDevice || (XRTrackedInputDevice = {}));
155
+ */ var XRTrackedInputDevice = /*#__PURE__*/ function(XRTrackedInputDevice) {
156
+ /** Controller */ XRTrackedInputDevice[XRTrackedInputDevice["Controller"] = 0] = "Controller";
157
+ /** Left controller */ XRTrackedInputDevice[XRTrackedInputDevice["LeftController"] = 1] = "LeftController";
158
+ /** Right controller */ XRTrackedInputDevice[XRTrackedInputDevice["RightController"] = 2] = "RightController";
159
+ /** Camera */ XRTrackedInputDevice[XRTrackedInputDevice["Camera"] = 3] = "Camera";
160
+ /** Left camera */ XRTrackedInputDevice[XRTrackedInputDevice["LeftCamera"] = 4] = "LeftCamera";
161
+ /** Right camera */ XRTrackedInputDevice[XRTrackedInputDevice["RightCamera"] = 5] = "RightCamera";
162
+ /** Head */ XRTrackedInputDevice[XRTrackedInputDevice["LeftHand"] = 6] = "LeftHand";
163
+ /** Right hand */ XRTrackedInputDevice[XRTrackedInputDevice["RightHand"] = 7] = "RightHand";
164
+ return XRTrackedInputDevice;
165
+ }({});
157
166
  /**
158
167
  * The state of an XRSession.
159
- */ var XRSessionState;
160
- (function(XRSessionState) {
161
- XRSessionState[XRSessionState[/** Not initialized. */ "None"] = 0] = "None";
162
- XRSessionState[XRSessionState[/** Initializing session. */ "Initializing"] = 1] = "Initializing";
163
- XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 2] = "Initialized";
164
- XRSessionState[XRSessionState[/** Running. */ "Running"] = 3] = "Running";
165
- XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 4] = "Paused";
166
- })(XRSessionState || (XRSessionState = {}));
168
+ */ var XRSessionState = /*#__PURE__*/ function(XRSessionState) {
169
+ /** Not initialized. */ XRSessionState[XRSessionState["None"] = 0] = "None";
170
+ /** Initializing session. */ XRSessionState[XRSessionState["Initializing"] = 1] = "Initializing";
171
+ /** Initialized but not started. */ XRSessionState[XRSessionState["Initialized"] = 2] = "Initialized";
172
+ /** Running. */ XRSessionState[XRSessionState["Running"] = 3] = "Running";
173
+ /** Paused. */ XRSessionState[XRSessionState["Paused"] = 4] = "Paused";
174
+ return XRSessionState;
175
+ }({});
167
176
  /**
168
177
  * The manager of XR camera.
169
178
  */ var XRCameraManager = /*#__PURE__*/ function() {
170
- var XRCameraManager = function XRCameraManager(_xrManager) {
179
+ function XRCameraManager(_xrManager) {
171
180
  this._xrManager = _xrManager;
172
- };
181
+ }
173
182
  var _proto = XRCameraManager.prototype;
174
183
  /**
175
184
  * Attach the camera to the specified input type(Camera, LeftCamera or RightCamera).
@@ -244,7 +253,7 @@
244
253
  */ _proto._onSessionExit = function _onSessionExit() {};
245
254
  /**
246
255
  * @internal
247
- */ _proto._getCameraClearFlagsMask = function _getCameraClearFlagsMask(cameraType) {
256
+ */ _proto._getIgnoreClearFlags = function _getIgnoreClearFlags(cameraType) {
248
257
  if (cameraType === engine.CameraType.XRCenterCamera) {
249
258
  if (this._xrManager.sessionManager.state === XRSessionState.Running) {
250
259
  return engine.CameraClearFlags.Color;
@@ -293,56 +302,48 @@
293
302
  };
294
303
  /**
295
304
  * Enum for XR tracking state.
296
- */ var XRTrackingState;
297
- (function(XRTrackingState) {
298
- XRTrackingState[XRTrackingState[/** Not tracking */ "NotTracking"] = 0] = "NotTracking";
299
- XRTrackingState[XRTrackingState[/** Tracking */ "Tracking"] = 1] = "Tracking";
300
- XRTrackingState[XRTrackingState[/** Lost track */ "TrackingLost"] = 2] = "TrackingLost";
301
- })(XRTrackingState || (XRTrackingState = {}));
305
+ */ var XRTrackingState = /*#__PURE__*/ function(XRTrackingState) {
306
+ /** Not tracking */ XRTrackingState[XRTrackingState["NotTracking"] = 0] = "NotTracking";
307
+ /** Tracking */ XRTrackingState[XRTrackingState["Tracking"] = 1] = "Tracking";
308
+ /** Lost track */ XRTrackingState[XRTrackingState["TrackingLost"] = 2] = "TrackingLost";
309
+ return XRTrackingState;
310
+ }({});
302
311
  var XRInput = function XRInput(type) {
303
312
  this.type = type;
304
313
  this./** The tracking state of xr input. */ trackingState = XRTrackingState.NotTracking;
305
314
  };
306
315
  /**
307
316
  * The XR camera.
308
- */ var XRCamera = /*#__PURE__*/ function(XRInput1) {
309
- var XRCamera = function XRCamera() {
317
+ */ var XRCamera = /*#__PURE__*/ function(XRInput) {
318
+ _inherits(XRCamera, XRInput);
319
+ function XRCamera() {
310
320
  var _this;
311
- _this = XRInput1.apply(this, arguments) || this;
312
- /** The pose of the camera in XR space. */ _this.pose = new XRPose();
313
- /** The viewport of the camera. */ _this.viewport = new engine.Rect();
314
- /** The projection matrix of the camera. */ _this.projectionMatrix = new engine.Matrix();
321
+ _this = XRInput.apply(this, arguments) || this, /** The pose of the camera in XR space. */ _this.pose = new XRPose(), /** The viewport of the camera. */ _this.viewport = new engine.Rect(), /** The projection matrix of the camera. */ _this.projectionMatrix = new engine.Matrix();
315
322
  return _this;
316
- };
317
- _inherits(XRCamera, XRInput1);
323
+ }
318
324
  return XRCamera;
319
325
  }(XRInput);
320
326
  /**
321
327
  * Enum for XR input button.
322
- */ var XRInputButton;
323
- (function(XRInputButton) {
324
- XRInputButton[XRInputButton[/** None */ "None"] = 0x0] = "None";
325
- XRInputButton[XRInputButton[/** Select */ "Select"] = 0x1] = "Select";
326
- XRInputButton[XRInputButton[/** Select */ "Trigger"] = 0x1] = "Trigger";
327
- XRInputButton[XRInputButton[/** Squeeze */ "Squeeze"] = 0x2] = "Squeeze";
328
- XRInputButton[XRInputButton[/** TouchPad */ "TouchPad"] = 0x4] = "TouchPad";
329
- XRInputButton[XRInputButton[/** A */ "AButton"] = 0x8] = "AButton";
330
- XRInputButton[XRInputButton[/** B */ "BButton"] = 0x10] = "BButton";
331
- })(XRInputButton || (XRInputButton = {}));
328
+ */ var XRInputButton = /*#__PURE__*/ function(XRInputButton) {
329
+ /** None */ XRInputButton[XRInputButton["None"] = 0] = "None";
330
+ /** Select */ XRInputButton[XRInputButton["Select"] = 1] = "Select";
331
+ /** Select */ XRInputButton[XRInputButton["Trigger"] = 1] = "Trigger";
332
+ /** Squeeze */ XRInputButton[XRInputButton["Squeeze"] = 2] = "Squeeze";
333
+ /** TouchPad */ XRInputButton[XRInputButton["TouchPad"] = 4] = "TouchPad";
334
+ /** A */ XRInputButton[XRInputButton["AButton"] = 8] = "AButton";
335
+ /** B */ XRInputButton[XRInputButton["BButton"] = 16] = "BButton";
336
+ return XRInputButton;
337
+ }({});
332
338
  /**
333
339
  * The XR controller.
334
- */ var XRController = /*#__PURE__*/ function(XRInput1) {
335
- var XRController = function XRController() {
340
+ */ var XRController = /*#__PURE__*/ function(XRInput) {
341
+ _inherits(XRController, XRInput);
342
+ function XRController() {
336
343
  var _this;
337
- _this = XRInput1.apply(this, arguments) || this;
338
- /** The grip space pose of the controller in XR space. */ _this.gripPose = new XRPose();
339
- /** The target ray space pose of the controller in XR space. */ _this.targetRayPose = new XRPose();
340
- /** The currently pressed buttons of this controller. */ _this.pressedButtons = XRInputButton.None;
341
- /** Record button lifted. */ _this.down = XRInputButton.None;
342
- /** Record button pressed. */ _this.up = XRInputButton.None;
344
+ _this = XRInput.apply(this, arguments) || this, /** The grip space pose of the controller in XR space. */ _this.gripPose = new XRPose(), /** The target ray space pose of the controller in XR space. */ _this.targetRayPose = new XRPose(), /** The currently pressed buttons of this controller. */ _this.pressedButtons = XRInputButton.None, /** Record button lifted. */ _this.down = XRInputButton.None, /** Record button pressed. */ _this.up = XRInputButton.None;
343
345
  return _this;
344
- };
345
- _inherits(XRController, XRInput1);
346
+ }
346
347
  var _proto = XRController.prototype;
347
348
  /**
348
349
  *
@@ -368,25 +369,25 @@
368
369
  };
369
370
  return XRController;
370
371
  }(XRInput);
371
- var XRInputEventType;
372
- (function(XRInputEventType) {
372
+ var XRInputEventType = /*#__PURE__*/ function(XRInputEventType) {
373
373
  XRInputEventType[XRInputEventType["SelectStart"] = 0] = "SelectStart";
374
374
  XRInputEventType[XRInputEventType["Select"] = 1] = "Select";
375
375
  XRInputEventType[XRInputEventType["SelectEnd"] = 2] = "SelectEnd";
376
376
  XRInputEventType[XRInputEventType["SqueezeStart"] = 3] = "SqueezeStart";
377
377
  XRInputEventType[XRInputEventType["Squeeze"] = 4] = "Squeeze";
378
378
  XRInputEventType[XRInputEventType["SqueezeEnd"] = 5] = "SqueezeEnd";
379
- })(XRInputEventType || (XRInputEventType = {}));
380
- var XRTargetRayMode;
381
- (function(XRTargetRayMode) {
379
+ return XRInputEventType;
380
+ }({});
381
+ var XRTargetRayMode = /*#__PURE__*/ function(XRTargetRayMode) {
382
382
  XRTargetRayMode[XRTargetRayMode["Gaze"] = 0] = "Gaze";
383
383
  XRTargetRayMode[XRTargetRayMode["TrackedPointer"] = 1] = "TrackedPointer";
384
384
  XRTargetRayMode[XRTargetRayMode["Screen"] = 2] = "Screen";
385
- })(XRTargetRayMode || (XRTargetRayMode = {}));
385
+ return XRTargetRayMode;
386
+ }({});
386
387
  /**
387
388
  * The manager of XR input.
388
389
  */ var XRInputManager = /*#__PURE__*/ function() {
389
- var XRInputManager = function XRInputManager(_xrManager, _engine) {
390
+ function XRInputManager(_xrManager, _engine) {
390
391
  this._xrManager = _xrManager;
391
392
  this._engine = _engine;
392
393
  this./** @internal */ _cameras = [];
@@ -395,7 +396,7 @@
395
396
  this._removed = [];
396
397
  this._trackedDevices = [];
397
398
  this._statusSnapshot = [];
398
- this._listeners = [];
399
+ this._listeners = new engine.SafeLoopArray();
399
400
  var _this = this, trackedDevices = _this._trackedDevices, controllers = _this._controllers, cameras = _this._cameras;
400
401
  for(var i = 0; i < 6; i++){
401
402
  switch(i){
@@ -412,7 +413,7 @@
412
413
  }
413
414
  }
414
415
  this._statusSnapshot.fill(XRTrackingState.NotTracking, 0, trackedDevices.length);
415
- };
416
+ }
416
417
  var _proto = XRInputManager.prototype;
417
418
  /**
418
419
  * Returns the tracked device instance.
@@ -425,22 +426,22 @@
425
426
  * Add a listener for tracked device changes.
426
427
  * @param listener - The listener to add
427
428
  */ _proto.addTrackedDeviceChangedListener = function addTrackedDeviceChangedListener(listener) {
428
- this._listeners.push(listener);
429
+ this._listeners.push({
430
+ fn: listener
431
+ });
429
432
  };
430
433
  /**
431
434
  * Remove a listener of tracked device changes.
432
435
  * @param listener - The listener to remove
433
436
  */ _proto.removeTrackedDeviceChangedListener = function removeTrackedDeviceChangedListener(listener) {
434
- var _this = this, listeners = _this._listeners;
435
- var index = listeners.indexOf(listener);
436
- if (index >= 0) {
437
- listeners.splice(index, 1);
438
- }
437
+ this._listeners.findAndRemove(function(value) {
438
+ return value.fn === listener ? value.destroyed = true : false;
439
+ });
439
440
  };
440
441
  /**
441
442
  * @internal
442
443
  */ _proto._onUpdate = function _onUpdate() {
443
- var _this = this, added = _this._added, removed = _this._removed, listeners = _this._listeners, statusSnapshot = _this._statusSnapshot;
444
+ var _this = this, added = _this._added, removed = _this._removed, statusSnapshot = _this._statusSnapshot;
444
445
  var _this1 = this, trackedDevices = _this1._trackedDevices, controllers = _this1._controllers;
445
446
  // Reset data
446
447
  added.length = removed.length = 0;
@@ -473,15 +474,19 @@
473
474
  }
474
475
  // Dispatch change event
475
476
  if (added.length > 0 || removed.length > 0) {
477
+ var listeners = this._listeners.getLoopArray();
476
478
  for(var i3 = 0, n3 = listeners.length; i3 < n3; i3++){
477
- listeners[i3](added, removed);
479
+ var listener = listeners[i3];
480
+ !listener.destroyed && listener.fn(added, removed);
478
481
  }
479
482
  }
480
483
  };
481
484
  /**
482
485
  * @internal
483
486
  */ _proto._onDestroy = function _onDestroy() {
484
- this._listeners.length = 0;
487
+ this._listeners.findAndRemove(function(value) {
488
+ return value.destroyed = true;
489
+ });
485
490
  };
486
491
  _proto._handleEvent = function _handleEvent(event) {
487
492
  var input = this._trackedDevices[event.input];
@@ -561,16 +566,16 @@
561
566
  }();
562
567
  /**
563
568
  * The type of XR session.
564
- */ var XRSessionMode;
565
- (function(XRSessionMode) {
569
+ */ var XRSessionMode = /*#__PURE__*/ function(XRSessionMode) {
566
570
  XRSessionMode[XRSessionMode["None"] = 0] = "None";
567
571
  XRSessionMode[XRSessionMode["AR"] = 1] = "AR";
568
572
  XRSessionMode[XRSessionMode["VR"] = 2] = "VR";
569
- })(XRSessionMode || (XRSessionMode = {}));
573
+ return XRSessionMode;
574
+ }({});
570
575
  /**
571
576
  * XRSessionManager manages the life cycle of XR sessions.
572
577
  */ var XRSessionManager = /*#__PURE__*/ function() {
573
- var XRSessionManager = function XRSessionManager(_xrManager, _engine) {
578
+ function XRSessionManager(_xrManager, _engine) {
574
579
  this._xrManager = _xrManager;
575
580
  this._engine = _engine;
576
581
  this._mode = XRSessionMode.None;
@@ -581,7 +586,7 @@
581
586
  this._raf = requestAnimationFrame.bind(window);
582
587
  this._caf = cancelAnimationFrame.bind(window);
583
588
  this._onSessionExit = this._onSessionExit.bind(this);
584
- };
589
+ }
585
590
  var _proto = XRSessionManager.prototype;
586
591
  /**
587
592
  * Check if the specified mode is supported.
@@ -768,14 +773,11 @@
768
773
  }();
769
774
  /**
770
775
  * @internal
771
- */ var XRManagerExtended = /*#__PURE__*/ function(XRManager1) {
772
- var XRManagerExtended = function XRManagerExtended() {
773
- var _this;
774
- _this = XRManager1.apply(this, arguments) || this;
775
- _this.features = [];
776
- return _this;
777
- };
778
- _inherits(XRManagerExtended, XRManager1);
776
+ */ var XRManagerExtended = /*#__PURE__*/ function(XRManager) {
777
+ _inherits(XRManagerExtended, XRManager);
778
+ function XRManagerExtended() {
779
+ return XRManager.apply(this, arguments) || this;
780
+ }
779
781
  var _proto = XRManagerExtended.prototype;
780
782
  _proto.isSupportedFeature = function isSupportedFeature(feature) {
781
783
  return this._platformDevice.isSupportedFeature(XRManagerExtended._featureMap.get(feature));
@@ -794,7 +796,9 @@
794
796
  for(var i = 0, n = features.length; i < n; i++){
795
797
  if (_instanceof1(features[i], type)) throw new Error("The feature has been added");
796
798
  }
797
- var feature = _construct$1(type, [].concat(this, args));
799
+ var feature = _construct$1(type, [].concat([
800
+ this
801
+ ], args));
798
802
  features.push(feature);
799
803
  return feature;
800
804
  };
@@ -808,8 +812,8 @@
808
812
  }
809
813
  };
810
814
  _proto.enterXR = function enterXR(sessionMode, autoRun) {
811
- if (autoRun === void 0) autoRun = true;
812
815
  var _this = this;
816
+ if (autoRun === void 0) autoRun = true;
813
817
  var sessionManager = this.sessionManager;
814
818
  if (sessionManager._platformSession) {
815
819
  throw new Error("Please exit XR immersive mode first.");
@@ -838,6 +842,7 @@
838
842
  });
839
843
  };
840
844
  _proto._initialize = function _initialize(engine, xrDevice) {
845
+ this._features = [];
841
846
  this._platformDevice = xrDevice;
842
847
  this.sessionManager = new XRSessionManager(this, engine);
843
848
  this.inputManager = new XRInputManager(this, engine);
@@ -875,8 +880,8 @@
875
880
  _proto._getCancelAnimationFrame = function _getCancelAnimationFrame() {
876
881
  return this.sessionManager._getCancelAnimationFrame();
877
882
  };
878
- _proto._getCameraClearFlagsMask = function _getCameraClearFlagsMask(type) {
879
- return this.cameraManager._getCameraClearFlagsMask(type);
883
+ _proto._getCameraIgnoreClearFlags = function _getCameraIgnoreClearFlags(type) {
884
+ return this.cameraManager._getIgnoreClearFlags(type);
880
885
  };
881
886
  /**
882
887
  * @internal
@@ -919,6 +924,12 @@
919
924
  features.length = 0;
920
925
  };
921
926
  _create_class$1(XRManagerExtended, [
927
+ {
928
+ key: "features",
929
+ get: function get() {
930
+ return this._features;
931
+ }
932
+ },
922
933
  {
923
934
  key: "origin",
924
935
  get: function get() {
@@ -934,9 +945,7 @@
934
945
  ]);
935
946
  return XRManagerExtended;
936
947
  }(engine.XRManager);
937
- (function() {
938
- /** @internal */ XRManagerExtended._featureMap = new Map();
939
- })();
948
+ /** @internal */ XRManagerExtended._featureMap = new Map();
940
949
  /**
941
950
  * @internal
942
951
  */ function registerXRFeature(type) {
@@ -958,7 +967,7 @@
958
967
  /**
959
968
  * The base class of XR feature manager.
960
969
  */ var XRFeature = /*#__PURE__*/ function() {
961
- var XRFeature = function XRFeature(_xrManager, _type) {
970
+ function XRFeature(_xrManager, _type) {
962
971
  for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
963
972
  args[_key - 2] = arguments[_key];
964
973
  }
@@ -966,9 +975,11 @@
966
975
  this._xrManager = _xrManager;
967
976
  this._type = _type;
968
977
  this._enabled = true;
969
- this._platformFeature = (_xrManager__platformDevice = _xrManager._platformDevice).createPlatformFeature.apply(_xrManager__platformDevice, [].concat(_type, args));
978
+ this._platformFeature = (_xrManager__platformDevice = _xrManager._platformDevice).createPlatformFeature.apply(_xrManager__platformDevice, [].concat([
979
+ _type
980
+ ], args));
970
981
  this._onEnable();
971
- };
982
+ }
972
983
  var _proto = XRFeature.prototype;
973
984
  /**
974
985
  * @internal
@@ -1012,38 +1023,31 @@
1012
1023
  ]);
1013
1024
  return XRFeature;
1014
1025
  }();
1015
- var XRFeatureType;
1016
- (function(XRFeatureType) {
1026
+ var XRFeatureType = /*#__PURE__*/ function(XRFeatureType) {
1017
1027
  XRFeatureType[XRFeatureType["AnchorTracking"] = 0] = "AnchorTracking";
1018
1028
  XRFeatureType[XRFeatureType["ImageTracking"] = 1] = "ImageTracking";
1019
1029
  XRFeatureType[XRFeatureType["PlaneTracking"] = 2] = "PlaneTracking";
1020
1030
  XRFeatureType[XRFeatureType["HitTest"] = 3] = "HitTest";
1021
- })(XRFeatureType || (XRFeatureType = {}));
1022
- var XRRequestTrackingState;
1023
- (function(XRRequestTrackingState) {
1031
+ return XRFeatureType;
1032
+ }({});
1033
+ var XRRequestTrackingState = /*#__PURE__*/ function(XRRequestTrackingState) {
1024
1034
  XRRequestTrackingState[XRRequestTrackingState["None"] = 0] = "None";
1025
1035
  XRRequestTrackingState[XRRequestTrackingState["Submitted"] = 1] = "Submitted";
1026
1036
  XRRequestTrackingState[XRRequestTrackingState["Resolved"] = 2] = "Resolved";
1027
1037
  XRRequestTrackingState[XRRequestTrackingState["Rejected"] = 3] = "Rejected";
1028
1038
  XRRequestTrackingState[XRRequestTrackingState["Destroyed"] = 4] = "Destroyed";
1029
1039
  XRRequestTrackingState[XRRequestTrackingState["WaitingDestroy"] = 5] = "WaitingDestroy";
1030
- })(XRRequestTrackingState || (XRRequestTrackingState = {}));
1040
+ return XRRequestTrackingState;
1041
+ }({});
1031
1042
  /**
1032
1043
  * The base class of XR trackable manager.
1033
- */ var XRTrackableFeature = /*#__PURE__*/ function(XRFeature1) {
1034
- var XRTrackableFeature = function XRTrackableFeature() {
1044
+ */ var XRTrackableFeature = /*#__PURE__*/ function(XRFeature) {
1045
+ _inherits(XRTrackableFeature, XRFeature);
1046
+ function XRTrackableFeature() {
1035
1047
  var _this;
1036
- _this = XRFeature1.apply(this, arguments) || this;
1037
- _this._requestTrackings = [];
1038
- _this._tracked = [];
1039
- _this._added = [];
1040
- _this._updated = [];
1041
- _this._removed = [];
1042
- _this._statusSnapshot = {};
1043
- _this._listeners = new engine.SafeLoopArray();
1048
+ _this = XRFeature.apply(this, arguments) || this, _this._requestTrackings = [], _this._tracked = [], _this._added = [], _this._updated = [], _this._removed = [], _this._statusSnapshot = {}, _this._listeners = new engine.SafeLoopArray();
1044
1049
  return _this;
1045
- };
1046
- _inherits(XRTrackableFeature, XRFeature1);
1050
+ }
1047
1051
  var _proto = XRTrackableFeature.prototype;
1048
1052
  /**
1049
1053
  * Add a listening function for tracked object changes.
@@ -1160,9 +1164,7 @@
1160
1164
  };
1161
1165
  return XRTrackableFeature;
1162
1166
  }(XRFeature);
1163
- (function() {
1164
- XRTrackableFeature._uuid = 0;
1165
- })();
1167
+ XRTrackableFeature._uuid = 0;
1166
1168
  /**
1167
1169
  * The base class of XR tracked object.
1168
1170
  */ var XRTracked = function XRTracked() {
@@ -1172,11 +1174,11 @@
1172
1174
  /**
1173
1175
  * Enum for the types of hit test that can be performed.
1174
1176
  * Note: currently only supports plane.
1175
- */ var TrackableType;
1176
- (function(TrackableType) {
1177
- TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
1178
- TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
1179
- })(TrackableType || (TrackableType = {}));
1177
+ */ var TrackableType = /*#__PURE__*/ function(TrackableType) {
1178
+ /** Tracked plane. */ TrackableType[TrackableType["Plane"] = 1] = "Plane";
1179
+ /** All tracked objects. */ TrackableType[TrackableType["All"] = 1] = "All";
1180
+ return TrackableType;
1181
+ }({});
1180
1182
  /**
1181
1183
  * XR hit result.
1182
1184
  * It is the detection result returned by using XR HitTest feature.
@@ -1199,7 +1201,7 @@
1199
1201
  PERFORMANCE OF THIS SOFTWARE.
1200
1202
  ***************************************************************************** */ function __decorate(decorators, target, key, desc) {
1201
1203
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1202
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1204
+ if ((typeof Reflect === "undefined" ? "undefined" : _type_of(Reflect)) === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1203
1205
  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;
1204
1206
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1205
1207
  }
@@ -1209,13 +1211,13 @@
1209
1211
  };
1210
1212
  /**
1211
1213
  * Enumerates modes of plane in XR.
1212
- */ var XRPlaneMode;
1213
- (function(XRPlaneMode) {
1214
- XRPlaneMode[XRPlaneMode[/** None. */ "None"] = 0] = "None";
1215
- XRPlaneMode[XRPlaneMode[/** Horizontal */ "Horizontal"] = 1] = "Horizontal";
1216
- XRPlaneMode[XRPlaneMode[/** Vertical */ "Vertical"] = 2] = "Vertical";
1217
- XRPlaneMode[XRPlaneMode[/** Includes horizontal and vertical. */ "EveryThing"] = 3] = "EveryThing";
1218
- })(XRPlaneMode || (XRPlaneMode = {}));
1214
+ */ var XRPlaneMode = /*#__PURE__*/ function(XRPlaneMode) {
1215
+ /** None. */ XRPlaneMode[XRPlaneMode["None"] = 0] = "None";
1216
+ /** Horizontal */ XRPlaneMode[XRPlaneMode["Horizontal"] = 1] = "Horizontal";
1217
+ /** Vertical */ XRPlaneMode[XRPlaneMode["Vertical"] = 2] = "Vertical";
1218
+ /** Includes horizontal and vertical. */ XRPlaneMode[XRPlaneMode["EveryThing"] = 3] = "EveryThing";
1219
+ return XRPlaneMode;
1220
+ }({});
1219
1221
  /**
1220
1222
  * @internal
1221
1223
  */ var XRRequestTracking = function XRRequestTracking() {
@@ -1224,44 +1226,41 @@
1224
1226
  };
1225
1227
  /**
1226
1228
  * The request plane in XR space.
1227
- */ var XRRequestPlane = /*#__PURE__*/ function(XRRequestTracking1) {
1228
- var XRRequestPlane = function XRRequestPlane(detectionMode) {
1229
+ */ var XRRequestPlane = /*#__PURE__*/ function(XRRequestTracking) {
1230
+ _inherits(XRRequestPlane, XRRequestTracking);
1231
+ function XRRequestPlane(detectionMode) {
1229
1232
  var _this;
1230
- _this = XRRequestTracking1.call(this) || this;
1231
- _this.detectionMode = detectionMode;
1233
+ _this = XRRequestTracking.call(this) || this, _this.detectionMode = detectionMode;
1232
1234
  return _this;
1233
- };
1234
- _inherits(XRRequestPlane, XRRequestTracking1);
1235
+ }
1235
1236
  return XRRequestPlane;
1236
1237
  }(XRRequestTracking);
1237
1238
  /**
1238
1239
  * The tracked plane in XR space.
1239
- */ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked1) {
1240
- var XRTrackedPlane = function XRTrackedPlane() {
1240
+ */ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked) {
1241
+ _inherits(XRTrackedPlane, XRTracked);
1242
+ function XRTrackedPlane() {
1241
1243
  var _this;
1242
- _this = XRTracked1.apply(this, arguments) || this;
1243
- /** The points that make up this plane.
1244
+ _this = XRTracked.apply(this, arguments) || this, /** The points that make up this plane.
1244
1245
  * Note: These points are in the plane coordinate system,
1245
1246
  * and their Y coordinates are all zero.
1246
- */ _this.polygon = [];
1247
- /**
1247
+ */ _this.polygon = [], /**
1248
1248
  * Whether this frame changes the attributes of the plane.
1249
1249
  * Note: Includes `polygon` but no `pose`.
1250
1250
  */ _this.attributesDirty = false;
1251
1251
  return _this;
1252
- };
1253
- _inherits(XRTrackedPlane, XRTracked1);
1252
+ }
1254
1253
  return XRTrackedPlane;
1255
1254
  }(XRTracked);
1256
1255
  var XRPlaneTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1257
- var XRPlaneTracking = function XRPlaneTracking(xrManager, detectionMode) {
1256
+ _inherits(XRPlaneTracking, XRTrackableFeature1);
1257
+ function XRPlaneTracking(xrManager, detectionMode) {
1258
1258
  if (detectionMode === void 0) detectionMode = XRPlaneMode.EveryThing;
1259
1259
  var _this;
1260
1260
  _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.PlaneTracking, detectionMode) || this;
1261
1261
  _this._addRequestTracking(new XRRequestPlane(detectionMode));
1262
1262
  return _this;
1263
- };
1264
- _inherits(XRPlaneTracking, XRTrackableFeature1);
1263
+ }
1265
1264
  var _proto = XRPlaneTracking.prototype;
1266
1265
  _proto._generateTracked = function _generateTracked() {
1267
1266
  var plane = new XRTrackedPlane();
@@ -1291,22 +1290,13 @@
1291
1290
  XRPlaneTracking = __decorate([
1292
1291
  registerXRFeature(XRFeatureType.PlaneTracking)
1293
1292
  ], XRPlaneTracking);
1294
- var XRHitTest = /*#__PURE__*/ function(XRFeature1) {
1295
- var XRHitTest = function XRHitTest(xrManager) {
1293
+ var XRHitTest = /*#__PURE__*/ function(XRFeature) {
1294
+ _inherits(XRHitTest, XRFeature);
1295
+ function XRHitTest(xrManager) {
1296
1296
  var _this;
1297
- _this = XRFeature1.call(this, xrManager, XRFeatureType.HitTest) || this;
1298
- _this._tempRay = new engine.Ray();
1299
- _this._tempPlane = new engine.Plane();
1300
- _this._tempVec2 = new engine.Vector2();
1301
- _this._tempVec30 = new engine.Vector3();
1302
- _this._tempVec31 = new engine.Vector3();
1303
- _this._tempVec32 = new engine.Vector3();
1304
- _this._tempVec33 = new engine.Vector3();
1305
- _this._tempVec34 = new engine.Vector3();
1306
- _this._tempVec35 = new engine.Vector3();
1297
+ _this = XRFeature.call(this, xrManager, XRFeatureType.HitTest) || this, _this._tempRay = new engine.Ray(), _this._tempPlane = new engine.Plane(), _this._tempVec2 = new engine.Vector2(), _this._tempVec30 = new engine.Vector3(), _this._tempVec31 = new engine.Vector3(), _this._tempVec32 = new engine.Vector3(), _this._tempVec33 = new engine.Vector3(), _this._tempVec34 = new engine.Vector3(), _this._tempVec35 = new engine.Vector3();
1307
1298
  return _this;
1308
- };
1309
- _inherits(XRHitTest, XRFeature1);
1299
+ }
1310
1300
  var _proto = XRHitTest.prototype;
1311
1301
  /**
1312
1302
  * Hit test.
@@ -1401,34 +1391,31 @@
1401
1391
  ], XRHitTest);
1402
1392
  /**
1403
1393
  * The anchor in XR space.
1404
- */ var XRAnchor$1 = /*#__PURE__*/ function(XRTracked1) {
1405
- var XRAnchor = function XRAnchor() {
1406
- return XRTracked1.apply(this, arguments);
1407
- };
1408
- _inherits(XRAnchor, XRTracked1);
1394
+ */ var XRAnchor$1 = /*#__PURE__*/ function(XRTracked) {
1395
+ _inherits(XRAnchor, XRTracked);
1396
+ function XRAnchor() {
1397
+ return XRTracked.apply(this, arguments) || this;
1398
+ }
1409
1399
  return XRAnchor;
1410
1400
  }(XRTracked);
1411
1401
  /**
1412
1402
  * The request anchor in XR space.
1413
- */ var XRRequestAnchor = /*#__PURE__*/ function(XRRequestTracking1) {
1414
- var XRRequestAnchor = function XRRequestAnchor(position, rotation) {
1403
+ */ var XRRequestAnchor = /*#__PURE__*/ function(XRRequestTracking) {
1404
+ _inherits(XRRequestAnchor, XRRequestTracking);
1405
+ function XRRequestAnchor(position, rotation) {
1415
1406
  var _this;
1416
- _this = XRRequestTracking1.call(this) || this;
1417
- _this.position = position;
1418
- _this.rotation = rotation;
1407
+ _this = XRRequestTracking.call(this) || this, _this.position = position, _this.rotation = rotation;
1419
1408
  return _this;
1420
- };
1421
- _inherits(XRRequestAnchor, XRRequestTracking1);
1409
+ }
1422
1410
  return XRRequestAnchor;
1423
1411
  }(XRRequestTracking);
1424
1412
  var XRAnchorTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1425
- var XRAnchorTracking = function XRAnchorTracking(xrManager) {
1413
+ _inherits(XRAnchorTracking, XRTrackableFeature1);
1414
+ function XRAnchorTracking(xrManager) {
1426
1415
  var _this;
1427
- _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.AnchorTracking) || this;
1428
- _this._anchors = [];
1416
+ _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.AnchorTracking) || this, _this._anchors = [];
1429
1417
  return _this;
1430
- };
1431
- _inherits(XRAnchorTracking, XRTrackableFeature1);
1418
+ }
1432
1419
  var _proto = XRAnchorTracking.prototype;
1433
1420
  /**
1434
1421
  * Add a anchor in XR space.
@@ -1500,27 +1487,27 @@
1500
1487
  ], XRAnchorTracking);
1501
1488
  /**
1502
1489
  * The request image in XR space.
1503
- */ var XRRequestImage = /*#__PURE__*/ function(XRRequestTracking1) {
1504
- var XRRequestImage = function XRRequestImage(image) {
1490
+ */ var XRRequestImage = /*#__PURE__*/ function(XRRequestTracking) {
1491
+ _inherits(XRRequestImage, XRRequestTracking);
1492
+ function XRRequestImage(image) {
1505
1493
  var _this;
1506
- _this = XRRequestTracking1.call(this) || this;
1507
- _this.image = image;
1494
+ _this = XRRequestTracking.call(this) || this, _this.image = image;
1508
1495
  return _this;
1509
- };
1510
- _inherits(XRRequestImage, XRRequestTracking1);
1496
+ }
1511
1497
  return XRRequestImage;
1512
1498
  }(XRRequestTracking);
1513
1499
  /**
1514
1500
  * A tracked image in XR space.
1515
- */ var XRTrackedImage = /*#__PURE__*/ function(XRTracked1) {
1516
- var XRTrackedImage = function XRTrackedImage() {
1517
- return XRTracked1.apply(this, arguments);
1518
- };
1519
- _inherits(XRTrackedImage, XRTracked1);
1501
+ */ var XRTrackedImage = /*#__PURE__*/ function(XRTracked) {
1502
+ _inherits(XRTrackedImage, XRTracked);
1503
+ function XRTrackedImage() {
1504
+ return XRTracked.apply(this, arguments) || this;
1505
+ }
1520
1506
  return XRTrackedImage;
1521
1507
  }(XRTracked);
1522
1508
  var XRImageTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
1523
- var XRImageTracking = function XRImageTracking(xrManager, trackingImages) {
1509
+ _inherits(XRImageTracking, XRTrackableFeature1);
1510
+ function XRImageTracking(xrManager, trackingImages) {
1524
1511
  var _this;
1525
1512
  _this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.ImageTracking, trackingImages) || this;
1526
1513
  _this._trackingImages = trackingImages;
@@ -1533,8 +1520,7 @@
1533
1520
  console.warn("No image to be tracked.");
1534
1521
  }
1535
1522
  return _this;
1536
- };
1537
- _inherits(XRImageTracking, XRTrackableFeature1);
1523
+ }
1538
1524
  var _proto = XRImageTracking.prototype;
1539
1525
  _proto._generateTracked = function _generateTracked() {
1540
1526
  var image = new XRTrackedImage();
@@ -1572,9 +1558,9 @@
1572
1558
  this.physicalWidth = physicalWidth;
1573
1559
  };
1574
1560
  var XRReferenceImageDecoder = /*#__PURE__*/ function() {
1575
- var XRReferenceImageDecoder = function XRReferenceImageDecoder() {};
1576
- XRReferenceImageDecoder.decode = function decode(engine, bufferReader) {
1577
- return new Promise(function(resolve, reject) {
1561
+ function XRReferenceImageDecoder() {}
1562
+ XRReferenceImageDecoder.decode = function decode(engine$1, bufferReader) {
1563
+ return new engine.AssetPromise(function(resolve, reject) {
1578
1564
  var physicalWidth = bufferReader.nextFloat32();
1579
1565
  bufferReader.nextUint8();
1580
1566
  var img = new Image();
@@ -1601,16 +1587,16 @@
1601
1587
  };
1602
1588
  return _extends.apply(this, arguments);
1603
1589
  }
1604
- var XRReferenceImageLoader = /*#__PURE__*/ function(Loader1) {
1605
- var XRReferenceImageLoader = function XRReferenceImageLoader() {
1606
- return Loader1.apply(this, arguments);
1607
- };
1608
- _inherits(XRReferenceImageLoader, Loader1);
1590
+ var XRReferenceImageLoader = /*#__PURE__*/ function(Loader) {
1591
+ _inherits(XRReferenceImageLoader, Loader);
1592
+ function XRReferenceImageLoader() {
1593
+ return Loader.apply(this, arguments) || this;
1594
+ }
1609
1595
  var _proto = XRReferenceImageLoader.prototype;
1610
1596
  _proto.load = function load(item, resourceManager) {
1611
- var _this = this;
1612
1597
  return new engine.AssetPromise(function(resolve, reject) {
1613
- _this.request(item.url, _extends({}, item, {
1598
+ resourceManager // @ts-ignore
1599
+ ._request(item.url, _extends({}, item, {
1614
1600
  type: "arraybuffer"
1615
1601
  })).then(function(data) {
1616
1602
  engine.decode(data, resourceManager.engine).then(function(referenceImage) {
@@ -1626,17 +1612,18 @@
1626
1612
  ], XRReferenceImageLoader);
1627
1613
 
1628
1614
  function _is_native_reflect_construct() {
1629
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
1630
- if (Reflect.construct.sham) return false;
1631
- if (typeof Proxy === "function") return true;
1632
-
1615
+ // Since Reflect.construct can't be properly polyfilled, some
1616
+ // implementations (e.g. core-js@2) don't set the correct internal slots.
1617
+ // Those polyfills don't allow us to subclass built-ins, so we need to
1618
+ // use our fallback implementation.
1633
1619
  try {
1634
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1635
-
1636
- return true;
1637
- } catch (e) {
1638
- return false;
1639
- }
1620
+ // If the internal slots aren't set, this throws an error similar to
1621
+ // TypeError: this is not a Boolean object.
1622
+ var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
1623
+ } catch (_) {}
1624
+ return (_is_native_reflect_construct = function() {
1625
+ return !!result;
1626
+ })();
1640
1627
  }
1641
1628
 
1642
1629
  function _construct(Parent, args, Class) {
@@ -1705,33 +1692,6 @@
1705
1692
  }
1706
1693
  }
1707
1694
 
1708
- /**
1709
- * Defines how the bounding volumes intersects or contain one another.
1710
- */ var ContainmentType;
1711
- (function(ContainmentType) {
1712
- ContainmentType[ContainmentType[/** Indicates that there is no overlap between two bounding volumes. */ "Disjoint"] = 0] = "Disjoint";
1713
- ContainmentType[ContainmentType[/** Indicates that one bounding volume completely contains another volume. */ "Contains"] = 1] = "Contains";
1714
- ContainmentType[ContainmentType[/** Indicates that bounding volumes partially overlap one another. */ "Intersects"] = 2] = "Intersects";
1715
- })(ContainmentType || (ContainmentType = {}));
1716
- /**
1717
- * Defines the intersection between a plane and a bounding volume.
1718
- */ var PlaneIntersectionType;
1719
- (function(PlaneIntersectionType) {
1720
- PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the back of the plane. */ "Back"] = 0] = "Back";
1721
- PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the front of the plane. */ "Front"] = 1] = "Front";
1722
- PlaneIntersectionType[PlaneIntersectionType[/** The plane is intersected. */ "Intersecting"] = 2] = "Intersecting";
1723
- })(PlaneIntersectionType || (PlaneIntersectionType = {}));
1724
- /**
1725
- * Frustum face
1726
- */ var FrustumFace;
1727
- (function(FrustumFace) {
1728
- FrustumFace[FrustumFace[/** Near face */ "Near"] = 0] = "Near";
1729
- FrustumFace[FrustumFace[/** Far face */ "Far"] = 1] = "Far";
1730
- FrustumFace[FrustumFace[/** Left face */ "Left"] = 2] = "Left";
1731
- FrustumFace[FrustumFace[/** Right face */ "Right"] = 3] = "Right";
1732
- FrustumFace[FrustumFace[/** Bottom face */ "Bottom"] = 4] = "Bottom";
1733
- FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
1734
- })(FrustumFace || (FrustumFace = {}));
1735
1695
  function _defineProperties(target, props) {
1736
1696
  for(var i = 0; i < props.length; i++){
1737
1697
  var descriptor = props[i];
@@ -1749,7 +1709,7 @@
1749
1709
  /**
1750
1710
  * Common utility methods for math operations.
1751
1711
  */ var MathUtil = /*#__PURE__*/ function() {
1752
- var MathUtil = function MathUtil() {};
1712
+ function MathUtil() {}
1753
1713
  /**
1754
1714
  * Clamps the specified value.
1755
1715
  * @param v - The specified value
@@ -1800,19 +1760,13 @@
1800
1760
  };
1801
1761
  return MathUtil;
1802
1762
  }();
1803
- (function() {
1804
- /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
1805
- })();
1806
- (function() {
1807
- /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
1808
- })();
1809
- (function() {
1810
- /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
1811
- })();
1763
+ /** The value for which all absolute numbers smaller than are considered equal to zero. */ MathUtil.zeroTolerance = 1e-6;
1764
+ /** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
1765
+ /** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
1812
1766
  /**
1813
1767
  * Describes a 3D-vector.
1814
1768
  */ var Vector3 = /*#__PURE__*/ function() {
1815
- var Vector3 = function Vector3(x, y, z) {
1769
+ function Vector3(x, y, z) {
1816
1770
  if (x === void 0) x = 0;
1817
1771
  if (y === void 0) y = 0;
1818
1772
  if (z === void 0) z = 0;
@@ -1820,7 +1774,7 @@
1820
1774
  this._x = x;
1821
1775
  this._y = y;
1822
1776
  this._z = z;
1823
- };
1777
+ }
1824
1778
  var _proto = Vector3.prototype;
1825
1779
  /**
1826
1780
  * Set the value of this vector.
@@ -1832,7 +1786,7 @@
1832
1786
  this._x = x;
1833
1787
  this._y = y;
1834
1788
  this._z = z;
1835
- this._onValueChanged && this._onValueChanged();
1789
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1836
1790
  return this;
1837
1791
  };
1838
1792
  /**
@@ -1843,7 +1797,7 @@
1843
1797
  this._x += right._x;
1844
1798
  this._y += right._y;
1845
1799
  this._z += right._z;
1846
- this._onValueChanged && this._onValueChanged();
1800
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1847
1801
  return this;
1848
1802
  };
1849
1803
  /**
@@ -1854,7 +1808,7 @@
1854
1808
  this._x -= right._x;
1855
1809
  this._y -= right._y;
1856
1810
  this._z -= right._z;
1857
- this._onValueChanged && this._onValueChanged();
1811
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1858
1812
  return this;
1859
1813
  };
1860
1814
  /**
@@ -1865,7 +1819,7 @@
1865
1819
  this._x *= right._x;
1866
1820
  this._y *= right._y;
1867
1821
  this._z *= right._z;
1868
- this._onValueChanged && this._onValueChanged();
1822
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1869
1823
  return this;
1870
1824
  };
1871
1825
  /**
@@ -1876,7 +1830,7 @@
1876
1830
  this._x /= right._x;
1877
1831
  this._y /= right._y;
1878
1832
  this._z /= right._z;
1879
- this._onValueChanged && this._onValueChanged();
1833
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1880
1834
  return this;
1881
1835
  };
1882
1836
  /**
@@ -1900,7 +1854,7 @@
1900
1854
  this._x = -this._x;
1901
1855
  this._y = -this._y;
1902
1856
  this._z = -this._z;
1903
- this._onValueChanged && this._onValueChanged();
1857
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1904
1858
  return this;
1905
1859
  };
1906
1860
  /**
@@ -1918,7 +1872,7 @@
1918
1872
  this._x *= s;
1919
1873
  this._y *= s;
1920
1874
  this._z *= s;
1921
- this._onValueChanged && this._onValueChanged();
1875
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1922
1876
  return this;
1923
1877
  };
1924
1878
  /**
@@ -1979,10 +1933,20 @@
1979
1933
  this._x = source.x;
1980
1934
  this._y = source.y;
1981
1935
  this._z = source.z;
1982
- this._onValueChanged && this._onValueChanged();
1936
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1983
1937
  return this;
1984
1938
  };
1985
1939
  /**
1940
+ * Copy to vector3 like object.
1941
+ * @param target - Vector3 like object
1942
+ * @returns This Vector3 like object
1943
+ */ _proto.copyTo = function copyTo(target) {
1944
+ target.x = this._x;
1945
+ target.y = this._y;
1946
+ target.z = this._z;
1947
+ return target;
1948
+ };
1949
+ /**
1986
1950
  * Copy the value of this vector from an array.
1987
1951
  * @param array - The array
1988
1952
  * @param offset - The start offset of the array
@@ -1992,7 +1956,7 @@
1992
1956
  this._x = array[offset];
1993
1957
  this._y = array[offset + 1];
1994
1958
  this._z = array[offset + 2];
1995
- this._onValueChanged && this._onValueChanged();
1959
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
1996
1960
  return this;
1997
1961
  };
1998
1962
  /**
@@ -2024,7 +1988,7 @@
2024
1988
  out._x = left._x + right._x;
2025
1989
  out._y = left._y + right._y;
2026
1990
  out._z = left._z + right._z;
2027
- out._onValueChanged && out._onValueChanged();
1991
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2028
1992
  };
2029
1993
  /**
2030
1994
  * Determines the difference between two vectors.
@@ -2035,7 +1999,7 @@
2035
1999
  out._x = left._x - right._x;
2036
2000
  out._y = left._y - right._y;
2037
2001
  out._z = left._z - right._z;
2038
- out._onValueChanged && out._onValueChanged();
2002
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2039
2003
  };
2040
2004
  /**
2041
2005
  * Determines the product of two vectors.
@@ -2046,7 +2010,7 @@
2046
2010
  out._x = left._x * right._x;
2047
2011
  out._y = left._y * right._y;
2048
2012
  out._z = left._z * right._z;
2049
- out._onValueChanged && out._onValueChanged();
2013
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2050
2014
  };
2051
2015
  /**
2052
2016
  * Determines the divisor of two vectors.
@@ -2057,7 +2021,7 @@
2057
2021
  out._x = left._x / right._x;
2058
2022
  out._y = left._y / right._y;
2059
2023
  out._z = left._z / right._z;
2060
- out._onValueChanged && out._onValueChanged();
2024
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2061
2025
  };
2062
2026
  /**
2063
2027
  * Determines the dot product of two vectors.
@@ -2122,7 +2086,7 @@
2122
2086
  out._x = _x + (end._x - _x) * t;
2123
2087
  out._y = _y + (end._y - _y) * t;
2124
2088
  out._z = _z + (end._z - _z) * t;
2125
- out._onValueChanged && out._onValueChanged();
2089
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2126
2090
  };
2127
2091
  /**
2128
2092
  * Calculate a vector containing the largest components of the specified vectors.
@@ -2133,7 +2097,7 @@
2133
2097
  out._x = Math.max(left._x, right._x);
2134
2098
  out._y = Math.max(left._y, right._y);
2135
2099
  out._z = Math.max(left._z, right._z);
2136
- out._onValueChanged && out._onValueChanged();
2100
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2137
2101
  };
2138
2102
  /**
2139
2103
  * Calculate a vector containing the smallest components of the specified vectors.
@@ -2144,7 +2108,7 @@
2144
2108
  out._x = Math.min(left._x, right._x);
2145
2109
  out._y = Math.min(left._y, right._y);
2146
2110
  out._z = Math.min(left._z, right._z);
2147
- out._onValueChanged && out._onValueChanged();
2111
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2148
2112
  };
2149
2113
  /**
2150
2114
  * Reverses the direction of a given vector.
@@ -2154,7 +2118,7 @@
2154
2118
  out._x = -a._x;
2155
2119
  out._y = -a._y;
2156
2120
  out._z = -a._z;
2157
- out._onValueChanged && out._onValueChanged();
2121
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2158
2122
  };
2159
2123
  /**
2160
2124
  * Converts the vector into a unit vector.
@@ -2177,7 +2141,7 @@
2177
2141
  out._x = a._x * s;
2178
2142
  out._y = a._y * s;
2179
2143
  out._z = a._z * s;
2180
- out._onValueChanged && out._onValueChanged();
2144
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2181
2145
  };
2182
2146
  /**
2183
2147
  * Performs a normal transformation using the given 4x4 matrix.
@@ -2196,7 +2160,7 @@
2196
2160
  out._x = _x * e[0] + _y * e[4] + _z * e[8];
2197
2161
  out._y = _x * e[1] + _y * e[5] + _z * e[9];
2198
2162
  out._z = _x * e[2] + _y * e[6] + _z * e[10];
2199
- out._onValueChanged && out._onValueChanged();
2163
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2200
2164
  };
2201
2165
  /**
2202
2166
  * Performs a transformation using the given 4x4 matrix.
@@ -2209,7 +2173,7 @@
2209
2173
  out._x = _x * e[0] + _y * e[4] + _z * e[8] + e[12];
2210
2174
  out._y = _x * e[1] + _y * e[5] + _z * e[9] + e[13];
2211
2175
  out._z = _x * e[2] + _y * e[6] + _z * e[10] + e[14];
2212
- out._onValueChanged && out._onValueChanged();
2176
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2213
2177
  };
2214
2178
  /**
2215
2179
  * Performs a transformation from vector3 to vector4 using the given 4x4 matrix.
@@ -2223,7 +2187,7 @@
2223
2187
  out._y = _x * e[1] + _y * e[5] + _z * e[9] + e[13];
2224
2188
  out._z = _x * e[2] + _y * e[6] + _z * e[10] + e[14];
2225
2189
  out._w = _x * e[3] + _y * e[7] + _z * e[11] + e[15];
2226
- out._onValueChanged && out._onValueChanged();
2190
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2227
2191
  };
2228
2192
  /**
2229
2193
  * Performs a coordinate transformation using the given 4x4 matrix.
@@ -2245,7 +2209,7 @@
2245
2209
  out._x = (_x * e[0] + _y * e[4] + _z * e[8] + e[12]) * w;
2246
2210
  out._y = (_x * e[1] + _y * e[5] + _z * e[9] + e[13]) * w;
2247
2211
  out._z = (_x * e[2] + _y * e[6] + _z * e[10] + e[14]) * w;
2248
- out._onValueChanged && out._onValueChanged();
2212
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2249
2213
  };
2250
2214
  /**
2251
2215
  * Performs a transformation using the given quaternion.
@@ -2264,7 +2228,7 @@
2264
2228
  out._x = ix * qw - iw * qx - iy * qz + iz * qy;
2265
2229
  out._y = iy * qw - iw * qy - iz * qx + ix * qz;
2266
2230
  out._z = iz * qw - iw * qz - ix * qy + iy * qx;
2267
- out._onValueChanged && out._onValueChanged();
2231
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
2268
2232
  };
2269
2233
  _create_class(Vector3, [
2270
2234
  {
@@ -2276,7 +2240,7 @@
2276
2240
  },
2277
2241
  set: function set(value) {
2278
2242
  this._x = value;
2279
- this._onValueChanged && this._onValueChanged();
2243
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
2280
2244
  }
2281
2245
  },
2282
2246
  {
@@ -2288,7 +2252,7 @@
2288
2252
  },
2289
2253
  set: function set(value) {
2290
2254
  this._y = value;
2291
- this._onValueChanged && this._onValueChanged();
2255
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
2292
2256
  }
2293
2257
  },
2294
2258
  {
@@ -2300,661 +2264,24 @@
2300
2264
  },
2301
2265
  set: function set(value) {
2302
2266
  this._z = value;
2303
- this._onValueChanged && this._onValueChanged();
2267
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
2304
2268
  }
2305
2269
  }
2306
2270
  ]);
2307
2271
  return Vector3;
2308
2272
  }();
2309
- (function() {
2310
- /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
2311
- })();
2312
- (function() {
2313
- /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
2314
- })();
2315
- /**
2316
- * A bounding sphere.
2317
- * */ var BoundingSphere = /*#__PURE__*/ function() {
2318
- var BoundingSphere = function BoundingSphere(center, radius) {
2319
- if (center === void 0) center = null;
2320
- if (radius === void 0) radius = 0;
2321
- /** The center point of the sphere. */ this.center = new Vector3();
2322
- /** The radius of the sphere. */ this.radius = 0;
2323
- center && this.center.copyFrom(center);
2324
- this.radius = radius;
2325
- };
2326
- var _proto = BoundingSphere.prototype;
2327
- /**
2328
- * Creates a clone of this sphere.
2329
- * @returns A clone of this sphere
2330
- */ _proto.clone = function clone() {
2331
- return new BoundingSphere(this.center, this.radius);
2332
- };
2333
- /**
2334
- * Copy this sphere from the specified sphere.
2335
- * @param source - The specified sphere
2336
- * @returns This sphere
2337
- */ _proto.copyFrom = function copyFrom(source) {
2338
- this.center.copyFrom(source.center);
2339
- this.radius = source.radius;
2340
- return this;
2341
- };
2342
- /**
2343
- * Calculate a bounding sphere that fully contains the given points.
2344
- * @param points - The given points
2345
- * @param out - The calculated bounding sphere
2346
- */ BoundingSphere.fromPoints = function fromPoints(points, out) {
2347
- if (!points || points.length === 0) {
2348
- throw new Error("points must be array and length must > 0");
2349
- }
2350
- var len = points.length;
2351
- var center = BoundingSphere._tempVec30;
2352
- center.x = center.y = center.z = 0;
2353
- // Calculate the center of the sphere.
2354
- for(var i = 0; i < len; ++i){
2355
- Vector3.add(points[i], center, center);
2356
- }
2357
- // The center of the sphere.
2358
- Vector3.scale(center, 1 / len, out.center);
2359
- // Calculate the radius of the sphere.
2360
- var radius = 0.0;
2361
- for(var i1 = 0; i1 < len; ++i1){
2362
- var distance = Vector3.distanceSquared(center, points[i1]);
2363
- distance > radius && (radius = distance);
2364
- }
2365
- // The radius of the sphere.
2366
- out.radius = Math.sqrt(radius);
2367
- };
2368
- /**
2369
- * Calculate a bounding sphere from a given box.
2370
- * @param box - The given box
2371
- * @param out - The calculated bounding sphere
2372
- */ BoundingSphere.fromBox = function fromBox(box, out) {
2373
- var center = out.center;
2374
- var min = box.min, max = box.max;
2375
- center.x = (min.x + max.x) * 0.5;
2376
- center.y = (min.y + max.y) * 0.5;
2377
- center.z = (min.z + max.z) * 0.5;
2378
- out.radius = Vector3.distance(center, max);
2379
- };
2380
- return BoundingSphere;
2381
- }();
2382
- (function() {
2383
- BoundingSphere._tempVec30 = new Vector3();
2384
- })();
2385
- /**
2386
- * Axis Aligned Bound Box (AABB).
2387
- */ var BoundingBox = /*#__PURE__*/ function() {
2388
- var BoundingBox = function BoundingBox(min, max) {
2389
- if (min === void 0) min = null;
2390
- if (max === void 0) max = null;
2391
- /** The minimum point of the box. */ this.min = new Vector3();
2392
- /** The maximum point of the box. */ this.max = new Vector3();
2393
- min && this.min.copyFrom(min);
2394
- max && this.max.copyFrom(max);
2395
- };
2396
- var _proto = BoundingBox.prototype;
2397
- /**
2398
- * Get the center point of this bounding box.
2399
- * @param out - The center point of this bounding box
2400
- * @returns The center point of this bounding box
2401
- */ _proto.getCenter = function getCenter(out) {
2402
- var _this = this, min = _this.min, max = _this.max;
2403
- var centerX = max._x + min._x;
2404
- var centerY = max._y + min._y;
2405
- var centerZ = max._z + min._z;
2406
- out.set(isNaN(centerX) ? 0 : centerX * 0.5, isNaN(centerY) ? 0 : centerY * 0.5, isNaN(centerZ) ? 0 : centerZ * 0.5);
2407
- return out;
2408
- };
2409
- /**
2410
- * Get the extent of this bounding box.
2411
- * @param out - The extent of this bounding box
2412
- * @returns The extent of this bounding box
2413
- */ _proto.getExtent = function getExtent(out) {
2414
- var _this = this, min = _this.min, max = _this.max;
2415
- var extentX = max._x - min._x;
2416
- var extentY = max._y - min._y;
2417
- var extentZ = max._z - min._z;
2418
- out.set(isNaN(extentX) ? 0 : extentX * 0.5, isNaN(extentY) ? 0 : extentY * 0.5, isNaN(extentZ) ? 0 : extentZ * 0.5);
2419
- return out;
2420
- };
2421
- /**
2422
- * Get the eight corners of this bounding box.
2423
- * @param out - An array of points representing the eight corners of this bounding box
2424
- * @returns An array of points representing the eight corners of this bounding box
2425
- */ _proto.getCorners = function getCorners(out) {
2426
- if (out === void 0) out = [];
2427
- var _this = this, min = _this.min, max = _this.max;
2428
- var minX = min.x;
2429
- var minY = min.y;
2430
- var minZ = min.z;
2431
- var maxX = max.x;
2432
- var maxY = max.y;
2433
- var maxZ = max.z;
2434
- var len = out.length;
2435
- // The array length is less than 8 to make up
2436
- if (len < 8) {
2437
- for(var i = 0, l = 8 - len; i < l; ++i){
2438
- out[len + i] = new Vector3();
2439
- }
2440
- }
2441
- out[0].set(minX, maxY, maxZ);
2442
- out[1].set(maxX, maxY, maxZ);
2443
- out[2].set(maxX, minY, maxZ);
2444
- out[3].set(minX, minY, maxZ);
2445
- out[4].set(minX, maxY, minZ);
2446
- out[5].set(maxX, maxY, minZ);
2447
- out[6].set(maxX, minY, minZ);
2448
- out[7].set(minX, minY, minZ);
2449
- return out;
2450
- };
2451
- /**
2452
- * Transform a bounding box.
2453
- * @param matrix - The transform to apply to the bounding box
2454
- * @returns The transformed bounding box
2455
- */ _proto.transform = function transform(matrix) {
2456
- BoundingBox.transform(this, matrix, this);
2457
- return this;
2458
- };
2459
- /**
2460
- * Creates a clone of this box.
2461
- * @returns A clone of this box
2462
- */ _proto.clone = function clone() {
2463
- return new BoundingBox(this.min, this.max);
2464
- };
2465
- /**
2466
- * Copy this bounding box from the specified box.
2467
- * @param source - The specified box
2468
- * @returns This bounding box
2469
- */ _proto.copyFrom = function copyFrom(source) {
2470
- this.min.copyFrom(source.min);
2471
- this.max.copyFrom(source.max);
2472
- return this;
2473
- };
2474
- /**
2475
- * Calculate a bounding box from the center point and the extent of the bounding box.
2476
- * @param center - The center point
2477
- * @param extent - The extent of the bounding box
2478
- * @param out - The calculated bounding box
2479
- */ BoundingBox.fromCenterAndExtent = function fromCenterAndExtent(center, extent, out) {
2480
- Vector3.subtract(center, extent, out.min);
2481
- Vector3.add(center, extent, out.max);
2482
- };
2483
- /**
2484
- * Calculate a bounding box that fully contains the given points.
2485
- * @param points - The given points
2486
- * @param out - The calculated bounding box
2487
- */ BoundingBox.fromPoints = function fromPoints(points, out) {
2488
- if (!points || points.length === 0) {
2489
- throw new Error("points must be array and length must > 0");
2490
- }
2491
- var min = out.min, max = out.max;
2492
- min.x = min.y = min.z = Number.MAX_VALUE;
2493
- max.x = max.y = max.z = -Number.MAX_VALUE;
2494
- for(var i = 0, l = points.length; i < l; ++i){
2495
- var point = points[i];
2496
- Vector3.min(min, point, min);
2497
- Vector3.max(max, point, max);
2498
- }
2499
- };
2500
- /**
2501
- * Calculate a bounding box from a given sphere.
2502
- * @param sphere - The given sphere
2503
- * @param out - The calculated bounding box
2504
- */ BoundingBox.fromSphere = function fromSphere(sphere, out) {
2505
- var center = sphere.center, radius = sphere.radius;
2506
- var min = out.min, max = out.max;
2507
- min.x = center.x - radius;
2508
- min.y = center.y - radius;
2509
- min.z = center.z - radius;
2510
- max.x = center.x + radius;
2511
- max.y = center.y + radius;
2512
- max.z = center.z + radius;
2513
- };
2514
- /**
2515
- * Transform a bounding box.
2516
- * @param source - The original bounding box
2517
- * @param matrix - The transform to apply to the bounding box
2518
- * @param out - The transformed bounding box
2519
- */ BoundingBox.transform = function transform(source, matrix, out) {
2520
- // https://zeux.io/2010/10/17/aabb-from-obb-with-component-wise-abs/
2521
- var center = BoundingBox._tempVec30;
2522
- var extent = BoundingBox._tempVec31;
2523
- source.getCenter(center);
2524
- source.getExtent(extent);
2525
- Vector3.transformCoordinate(center, matrix, center);
2526
- var x = extent.x, y = extent.y, z = extent.z;
2527
- var e = matrix.elements;
2528
- // prettier-ignore
2529
- var e0 = e[0], e1 = e[1], e2 = e[2], e4 = e[4], e5 = e[5], e6 = e[6], e8 = e[8], e9 = e[9], e10 = e[10];
2530
- extent.set((e0 === 0 ? 0 : Math.abs(x * e0)) + (e4 === 0 ? 0 : Math.abs(y * e4)) + (e8 === 0 ? 0 : Math.abs(z * e8)), (e1 === 0 ? 0 : Math.abs(x * e1)) + (e5 === 0 ? 0 : Math.abs(y * e5)) + (e9 === 0 ? 0 : Math.abs(z * e9)), (e2 === 0 ? 0 : Math.abs(x * e2)) + (e6 === 0 ? 0 : Math.abs(y * e6)) + (e10 === 0 ? 0 : Math.abs(z * e10)));
2531
- // set min、max
2532
- Vector3.subtract(center, extent, out.min);
2533
- Vector3.add(center, extent, out.max);
2534
- };
2535
- /**
2536
- * Calculate a bounding box that is as large as the total combined area of the two specified boxes.
2537
- * @param box1 - The first box to merge
2538
- * @param box2 - The second box to merge
2539
- * @param out - The merged bounding box
2540
- * @returns The merged bounding box
2541
- */ BoundingBox.merge = function merge(box1, box2, out) {
2542
- Vector3.min(box1.min, box2.min, out.min);
2543
- Vector3.max(box1.max, box2.max, out.max);
2544
- return out;
2545
- };
2546
- return BoundingBox;
2547
- }();
2548
- (function() {
2549
- BoundingBox._tempVec30 = new Vector3();
2550
- })();
2551
- (function() {
2552
- BoundingBox._tempVec31 = new Vector3();
2553
- })();
2554
- /**
2555
- * Contains static methods to help in determining intersections, containment, etc.
2556
- */ var CollisionUtil = /*#__PURE__*/ function() {
2557
- var CollisionUtil = function CollisionUtil() {};
2558
- /**
2559
- * Calculate the intersection point of three plane.
2560
- * @param p1 - Plane 1
2561
- * @param p2 - Plane 2
2562
- * @param p3 - Plane 3
2563
- * @param out - intersection point
2564
- */ CollisionUtil.intersectionPointThreePlanes = function intersectionPointThreePlanes(p1, p2, p3, out) {
2565
- var p1Nor = p1.normal;
2566
- var p2Nor = p2.normal;
2567
- var p3Nor = p3.normal;
2568
- Vector3.cross(p2Nor, p3Nor, CollisionUtil._tempVec30);
2569
- Vector3.cross(p3Nor, p1Nor, CollisionUtil._tempVec31);
2570
- Vector3.cross(p1Nor, p2Nor, CollisionUtil._tempVec32);
2571
- var a = -Vector3.dot(p1Nor, CollisionUtil._tempVec30);
2572
- var b = -Vector3.dot(p2Nor, CollisionUtil._tempVec31);
2573
- var c = -Vector3.dot(p3Nor, CollisionUtil._tempVec32);
2574
- Vector3.scale(CollisionUtil._tempVec30, p1.distance / a, CollisionUtil._tempVec30);
2575
- Vector3.scale(CollisionUtil._tempVec31, p2.distance / b, CollisionUtil._tempVec31);
2576
- Vector3.scale(CollisionUtil._tempVec32, p3.distance / c, CollisionUtil._tempVec32);
2577
- Vector3.add(CollisionUtil._tempVec30, CollisionUtil._tempVec31, out);
2578
- Vector3.add(out, CollisionUtil._tempVec32, out);
2579
- };
2580
- /**
2581
- * Calculate the distance from a point to a plane.
2582
- * @param plane - The plane
2583
- * @param point - The point
2584
- * @returns The distance from a point to a plane
2585
- */ CollisionUtil.distancePlaneAndPoint = function distancePlaneAndPoint(plane, point) {
2586
- return Vector3.dot(plane.normal, point) + plane.distance;
2587
- };
2588
- /**
2589
- * Get the intersection type between a plane and a point.
2590
- * @param plane - The plane
2591
- * @param point - The point
2592
- * @returns The intersection type
2593
- */ CollisionUtil.intersectsPlaneAndPoint = function intersectsPlaneAndPoint(plane, point) {
2594
- var distance = CollisionUtil.distancePlaneAndPoint(plane, point);
2595
- if (distance > 0) {
2596
- return PlaneIntersectionType.Front;
2597
- }
2598
- if (distance < 0) {
2599
- return PlaneIntersectionType.Back;
2600
- }
2601
- return PlaneIntersectionType.Intersecting;
2602
- };
2603
- /**
2604
- * Get the intersection type between a plane and a box (AABB).
2605
- * @param plane - The plane
2606
- * @param box - The box
2607
- * @returns The intersection type
2608
- */ CollisionUtil.intersectsPlaneAndBox = function intersectsPlaneAndBox(plane, box) {
2609
- var min = box.min, max = box.max;
2610
- var normal = plane.normal;
2611
- var front = CollisionUtil._tempVec30;
2612
- var back = CollisionUtil._tempVec31;
2613
- if (normal.x >= 0) {
2614
- front.x = max.x;
2615
- back.x = min.x;
2616
- } else {
2617
- front.x = min.x;
2618
- back.x = max.x;
2619
- }
2620
- if (normal.y >= 0) {
2621
- front.y = max.y;
2622
- back.y = min.y;
2623
- } else {
2624
- front.y = min.y;
2625
- back.y = max.y;
2626
- }
2627
- if (normal.z >= 0) {
2628
- front.z = max.z;
2629
- back.z = min.z;
2630
- } else {
2631
- front.z = min.z;
2632
- back.z = max.z;
2633
- }
2634
- if (CollisionUtil.distancePlaneAndPoint(plane, front) < 0) {
2635
- return PlaneIntersectionType.Back;
2636
- }
2637
- if (CollisionUtil.distancePlaneAndPoint(plane, back) > 0) {
2638
- return PlaneIntersectionType.Front;
2639
- }
2640
- return PlaneIntersectionType.Intersecting;
2641
- };
2642
- /**
2643
- * Get the intersection type between a plane and a sphere.
2644
- * @param plane - The plane
2645
- * @param sphere - The sphere
2646
- * @returns The intersection type
2647
- */ CollisionUtil.intersectsPlaneAndSphere = function intersectsPlaneAndSphere(plane, sphere) {
2648
- var center = sphere.center, radius = sphere.radius;
2649
- var distance = CollisionUtil.distancePlaneAndPoint(plane, center);
2650
- if (distance > radius) {
2651
- return PlaneIntersectionType.Front;
2652
- }
2653
- if (distance < -radius) {
2654
- return PlaneIntersectionType.Back;
2655
- }
2656
- return PlaneIntersectionType.Intersecting;
2657
- };
2658
- /**
2659
- * Get the intersection type between a ray and a plane.
2660
- * @param ray - The ray
2661
- * @param plane - The plane
2662
- * @returns The distance from ray to plane if intersecting, -1 otherwise
2663
- */ CollisionUtil.intersectsRayAndPlane = function intersectsRayAndPlane(ray, plane) {
2664
- var normal = plane.normal;
2665
- var zeroTolerance = MathUtil.zeroTolerance;
2666
- var dir = Vector3.dot(normal, ray.direction);
2667
- // Parallel
2668
- if (Math.abs(dir) < zeroTolerance) {
2669
- return -1;
2670
- }
2671
- var position = Vector3.dot(normal, ray.origin);
2672
- var distance = (-plane.distance - position) / dir;
2673
- if (distance < 0) {
2674
- if (distance < -zeroTolerance) {
2675
- return -1;
2676
- }
2677
- distance = 0;
2678
- }
2679
- return distance;
2680
- };
2681
- /**
2682
- * Get the intersection type between a ray and a box (AABB).
2683
- * @param ray - The ray
2684
- * @param box - The box
2685
- * @returns The distance from ray to box if intersecting, -1 otherwise
2686
- */ CollisionUtil.intersectsRayAndBox = function intersectsRayAndBox(ray, box) {
2687
- var zeroTolerance = MathUtil.zeroTolerance;
2688
- var origin = ray.origin, direction = ray.direction;
2689
- var min = box.min, max = box.max;
2690
- var dirX = direction.x;
2691
- var dirY = direction.y;
2692
- var dirZ = direction.z;
2693
- var oriX = origin.x;
2694
- var oriY = origin.y;
2695
- var oriZ = origin.z;
2696
- var distance = 0;
2697
- var tmax = Number.MAX_VALUE;
2698
- if (Math.abs(dirX) < zeroTolerance) {
2699
- if (oriX < min.x || oriX > max.x) {
2700
- return -1;
2701
- }
2702
- } else {
2703
- var inverse = 1.0 / dirX;
2704
- var t1 = (min.x - oriX) * inverse;
2705
- var t2 = (max.x - oriX) * inverse;
2706
- if (t1 > t2) {
2707
- var temp = t1;
2708
- t1 = t2;
2709
- t2 = temp;
2710
- }
2711
- distance = Math.max(t1, distance);
2712
- tmax = Math.min(t2, tmax);
2713
- if (distance > tmax) {
2714
- return -1;
2715
- }
2716
- }
2717
- if (Math.abs(dirY) < zeroTolerance) {
2718
- if (oriY < min.y || oriY > max.y) {
2719
- return -1;
2720
- }
2721
- } else {
2722
- var inverse1 = 1.0 / dirY;
2723
- var t11 = (min.y - oriY) * inverse1;
2724
- var t21 = (max.y - oriY) * inverse1;
2725
- if (t11 > t21) {
2726
- var temp1 = t11;
2727
- t11 = t21;
2728
- t21 = temp1;
2729
- }
2730
- distance = Math.max(t11, distance);
2731
- tmax = Math.min(t21, tmax);
2732
- if (distance > tmax) {
2733
- return -1;
2734
- }
2735
- }
2736
- if (Math.abs(dirZ) < zeroTolerance) {
2737
- if (oriZ < min.z || oriZ > max.z) {
2738
- return -1;
2739
- }
2740
- } else {
2741
- var inverse2 = 1.0 / dirZ;
2742
- var t12 = (min.z - oriZ) * inverse2;
2743
- var t22 = (max.z - oriZ) * inverse2;
2744
- if (t12 > t22) {
2745
- var temp2 = t12;
2746
- t12 = t22;
2747
- t22 = temp2;
2748
- }
2749
- distance = Math.max(t12, distance);
2750
- tmax = Math.min(t22, tmax);
2751
- if (distance > tmax) {
2752
- return -1;
2753
- }
2754
- }
2755
- return distance;
2756
- };
2757
- /**
2758
- * Get the intersection type between a ray and a sphere.
2759
- * @param ray - The ray
2760
- * @param sphere - The sphere
2761
- * @returns The distance from ray to sphere if intersecting, -1 otherwise
2762
- */ CollisionUtil.intersectsRayAndSphere = function intersectsRayAndSphere(ray, sphere) {
2763
- var origin = ray.origin, direction = ray.direction;
2764
- var center = sphere.center, radius = sphere.radius;
2765
- var m = CollisionUtil._tempVec30;
2766
- Vector3.subtract(origin, center, m);
2767
- var b = Vector3.dot(m, direction);
2768
- var c = Vector3.dot(m, m) - radius * radius;
2769
- if (b > 0 && c > 0) {
2770
- return -1;
2771
- }
2772
- var discriminant = b * b - c;
2773
- if (discriminant < 0) {
2774
- return -1;
2775
- }
2776
- var distance = -b - Math.sqrt(discriminant);
2777
- if (distance < 0) {
2778
- distance = 0;
2779
- }
2780
- return distance;
2781
- };
2782
- /**
2783
- * Check whether the boxes intersect.
2784
- * @param boxA - The first box to check
2785
- * @param boxB - The second box to check
2786
- * @returns True if the boxes intersect, false otherwise
2787
- */ CollisionUtil.intersectsBoxAndBox = function intersectsBoxAndBox(boxA, boxB) {
2788
- if (boxA.min.x > boxB.max.x || boxB.min.x > boxA.max.x) {
2789
- return false;
2790
- }
2791
- if (boxA.min.y > boxB.max.y || boxB.min.y > boxA.max.y) {
2792
- return false;
2793
- }
2794
- return !(boxA.min.z > boxB.max.z || boxB.min.z > boxA.max.z);
2795
- };
2796
- /**
2797
- * Check whether the spheres intersect.
2798
- * @param sphereA - The first sphere to check
2799
- * @param sphereB - The second sphere to check
2800
- * @returns True if the spheres intersect, false otherwise
2801
- */ CollisionUtil.intersectsSphereAndSphere = function intersectsSphereAndSphere(sphereA, sphereB) {
2802
- var radiisum = sphereA.radius + sphereB.radius;
2803
- return Vector3.distanceSquared(sphereA.center, sphereB.center) < radiisum * radiisum;
2804
- };
2805
- /**
2806
- * Check whether the sphere and the box intersect.
2807
- * @param sphere - The sphere to check
2808
- * @param box - The box to check
2809
- * @returns True if the sphere and the box intersect, false otherwise
2810
- */ CollisionUtil.intersectsSphereAndBox = function intersectsSphereAndBox(sphere, box) {
2811
- var center = sphere.center;
2812
- var max = box.max;
2813
- var min = box.min;
2814
- var closestPoint = CollisionUtil._tempVec30;
2815
- closestPoint.set(Math.max(min.x, Math.min(center.x, max.x)), Math.max(min.y, Math.min(center.y, max.y)), Math.max(min.z, Math.min(center.z, max.z)));
2816
- var distance = Vector3.distanceSquared(center, closestPoint);
2817
- return distance <= sphere.radius * sphere.radius;
2818
- };
2819
- /**
2820
- * Get whether or not a specified bounding box intersects with this frustum (Contains or Intersects).
2821
- * @param frustum - The frustum
2822
- * @param box - The box
2823
- * @returns True if bounding box intersects with this frustum, false otherwise
2824
- */ CollisionUtil.intersectsFrustumAndBox = function intersectsFrustumAndBox(frustum, box) {
2825
- var min = box.min, max = box.max;
2826
- var p = CollisionUtil._tempVec30;
2827
- for(var i = 0; i < 6; ++i){
2828
- var plane = frustum.getPlane(i);
2829
- var normal = plane.normal;
2830
- p.set(normal.x >= 0 ? max.x : min.x, normal.y >= 0 ? max.y : min.y, normal.z >= 0 ? max.z : min.z);
2831
- if (Vector3.dot(normal, p) < -plane.distance) {
2832
- return false;
2833
- }
2834
- }
2835
- return true;
2836
- };
2837
- /**
2838
- * Get the containment type between a frustum and a point.
2839
- * @param frustum - The frustum
2840
- * @param point - The point
2841
- * @returns The containment type
2842
- */ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
2843
- var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, point);
2844
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2845
- return ContainmentType.Intersects;
2846
- } else if (distance < 0) {
2847
- return ContainmentType.Disjoint;
2848
- }
2849
- distance = CollisionUtil.distancePlaneAndPoint(frustum.far, point);
2850
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2851
- return ContainmentType.Intersects;
2852
- } else if (distance < 0) {
2853
- return ContainmentType.Disjoint;
2854
- }
2855
- distance = CollisionUtil.distancePlaneAndPoint(frustum.left, point);
2856
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2857
- return ContainmentType.Intersects;
2858
- } else if (distance < 0) {
2859
- return ContainmentType.Disjoint;
2860
- }
2861
- distance = CollisionUtil.distancePlaneAndPoint(frustum.right, point);
2862
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2863
- return ContainmentType.Intersects;
2864
- } else if (distance < 0) {
2865
- return ContainmentType.Disjoint;
2866
- }
2867
- distance = CollisionUtil.distancePlaneAndPoint(frustum.top, point);
2868
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2869
- return ContainmentType.Intersects;
2870
- } else if (distance < 0) {
2871
- return ContainmentType.Disjoint;
2872
- }
2873
- distance = CollisionUtil.distancePlaneAndPoint(frustum.bottom, point);
2874
- if (Math.abs(distance) < MathUtil.zeroTolerance) {
2875
- return ContainmentType.Intersects;
2876
- } else if (distance < 0) {
2877
- return ContainmentType.Disjoint;
2878
- }
2879
- return ContainmentType.Contains;
2880
- };
2881
- /**
2882
- * Get the containment type between a frustum and a box (AABB).
2883
- * @param frustum - The frustum
2884
- * @param box - The box
2885
- * @returns The containment type
2886
- */ CollisionUtil.frustumContainsBox = function frustumContainsBox(frustum, box) {
2887
- var min = box.min, max = box.max;
2888
- var p = CollisionUtil._tempVec30;
2889
- var n = CollisionUtil._tempVec31;
2890
- var result = ContainmentType.Contains;
2891
- for(var i = 0; i < 6; ++i){
2892
- var plane = frustum.getPlane(i);
2893
- var normal = plane.normal;
2894
- if (normal.x >= 0) {
2895
- p.x = max.x;
2896
- n.x = min.x;
2897
- } else {
2898
- p.x = min.x;
2899
- n.x = max.x;
2900
- }
2901
- if (normal.y >= 0) {
2902
- p.y = max.y;
2903
- n.y = min.y;
2904
- } else {
2905
- p.y = min.y;
2906
- n.y = max.y;
2907
- }
2908
- if (normal.z >= 0) {
2909
- p.z = max.z;
2910
- n.z = min.z;
2911
- } else {
2912
- p.z = min.z;
2913
- n.z = max.z;
2914
- }
2915
- if (CollisionUtil.intersectsPlaneAndPoint(plane, p) === PlaneIntersectionType.Back) {
2916
- return ContainmentType.Disjoint;
2917
- }
2918
- if (CollisionUtil.intersectsPlaneAndPoint(plane, n) === PlaneIntersectionType.Back) {
2919
- result = ContainmentType.Intersects;
2920
- }
2921
- }
2922
- return result;
2923
- };
2924
- /**
2925
- * Get the containment type between a frustum and a sphere.
2926
- * @param frustum - The frustum
2927
- * @param sphere - The sphere
2928
- * @returns The containment type
2929
- */ CollisionUtil.frustumContainsSphere = function frustumContainsSphere(frustum, sphere) {
2930
- var result = ContainmentType.Contains;
2931
- for(var i = 0; i < 6; ++i){
2932
- var plane = frustum.getPlane(i);
2933
- var intersectionType = CollisionUtil.intersectsPlaneAndSphere(plane, sphere);
2934
- if (intersectionType === PlaneIntersectionType.Back) {
2935
- return ContainmentType.Disjoint;
2936
- } else if (intersectionType === PlaneIntersectionType.Intersecting) {
2937
- result = ContainmentType.Intersects;
2938
- break;
2939
- }
2940
- }
2941
- return result;
2942
- };
2943
- return CollisionUtil;
2944
- }();
2945
- (function() {
2946
- CollisionUtil._tempVec30 = new Vector3();
2947
- })();
2948
- (function() {
2949
- CollisionUtil._tempVec31 = new Vector3();
2950
- })();
2951
- (function() {
2952
- CollisionUtil._tempVec32 = new Vector3();
2953
- })();
2273
+ /** @internal */ Vector3._zero = new Vector3(0.0, 0.0, 0.0);
2274
+ /** @internal */ Vector3._one = new Vector3(1.0, 1.0, 1.0);
2275
+ new Vector3();
2276
+ new Vector3();
2277
+ new Vector3();
2278
+ new Vector3();
2279
+ new Vector3();
2280
+ new Vector3();
2954
2281
  /**
2955
2282
  * Represents a 3x3 mathematical matrix.
2956
2283
  */ var Matrix3x3 = /*#__PURE__*/ function() {
2957
- var Matrix3x3 = function Matrix3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33) {
2284
+ function Matrix3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33) {
2958
2285
  if (m11 === void 0) m11 = 1;
2959
2286
  if (m12 === void 0) m12 = 0;
2960
2287
  if (m13 === void 0) m13 = 0;
@@ -2983,7 +2310,7 @@
2983
2310
  e[6] = m31;
2984
2311
  e[7] = m32;
2985
2312
  e[8] = m33;
2986
- };
2313
+ }
2987
2314
  var _proto = Matrix3x3.prototype;
2988
2315
  /**
2989
2316
  * Set the value of this matrix, and return this matrix.
@@ -3496,7 +2823,7 @@
3496
2823
  /**
3497
2824
  * Represents a four dimensional mathematical quaternion.
3498
2825
  */ var Quaternion = /*#__PURE__*/ function() {
3499
- var Quaternion = function Quaternion(x, y, z, w) {
2826
+ function Quaternion(x, y, z, w) {
3500
2827
  if (x === void 0) x = 0;
3501
2828
  if (y === void 0) y = 0;
3502
2829
  if (z === void 0) z = 0;
@@ -3506,7 +2833,7 @@
3506
2833
  this._y = y;
3507
2834
  this._z = z;
3508
2835
  this._w = w;
3509
- };
2836
+ }
3510
2837
  var _proto = Quaternion.prototype;
3511
2838
  /**
3512
2839
  * Set the value of this quaternion, and return this quaternion.
@@ -3520,7 +2847,7 @@
3520
2847
  this._y = y;
3521
2848
  this._z = z;
3522
2849
  this._w = w;
3523
- this._onValueChanged && this._onValueChanged();
2850
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
3524
2851
  return this;
3525
2852
  };
3526
2853
  /**
@@ -3530,7 +2857,7 @@
3530
2857
  this._x *= -1;
3531
2858
  this._y *= -1;
3532
2859
  this._z *= -1;
3533
- this._onValueChanged && this._onValueChanged();
2860
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
3534
2861
  return this;
3535
2862
  };
3536
2863
  /**
@@ -3561,7 +2888,7 @@
3561
2888
  this._y = 0;
3562
2889
  this._z = 0;
3563
2890
  this._w = 1;
3564
- this._onValueChanged && this._onValueChanged();
2891
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
3565
2892
  return this;
3566
2893
  };
3567
2894
  /**
@@ -3594,7 +2921,7 @@
3594
2921
  var t = out._x;
3595
2922
  out._x = out._y;
3596
2923
  out._y = t;
3597
- out._onValueChanged && out._onValueChanged();
2924
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3598
2925
  return out;
3599
2926
  };
3600
2927
  /**
@@ -3603,7 +2930,7 @@
3603
2930
  * @returns Euler x->yaw y->pitch z->roll
3604
2931
  */ _proto.toYawPitchRoll = function toYawPitchRoll(out) {
3605
2932
  this._toYawPitchRoll(out);
3606
- out._onValueChanged && out._onValueChanged();
2933
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3607
2934
  return out;
3608
2935
  };
3609
2936
  /**
@@ -3695,10 +3022,21 @@
3695
3022
  this._y = source.y;
3696
3023
  this._z = source.z;
3697
3024
  this._w = source.w;
3698
- this._onValueChanged && this._onValueChanged();
3025
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
3699
3026
  return this;
3700
3027
  };
3701
3028
  /**
3029
+ * Copy this quaternion to the specified quaternion.
3030
+ * @param target - The specified quaternion
3031
+ * @returns This specified quaternion
3032
+ */ _proto.copyTo = function copyTo(target) {
3033
+ target.x = this._x;
3034
+ target.y = this._y;
3035
+ target.z = this._z;
3036
+ target.w = this._w;
3037
+ return target;
3038
+ };
3039
+ /**
3702
3040
  * Copy the value of this quaternion from an array.
3703
3041
  * @param array - The array
3704
3042
  * @param offset - The start offset of the array
@@ -3709,7 +3047,7 @@
3709
3047
  this._y = array[offset + 1];
3710
3048
  this._z = array[offset + 2];
3711
3049
  this._w = array[offset + 3];
3712
- this._onValueChanged && this._onValueChanged();
3050
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
3713
3051
  return this;
3714
3052
  };
3715
3053
  /**
@@ -3767,7 +3105,7 @@
3767
3105
  out._y = left._y + right._y;
3768
3106
  out._z = left._z + right._z;
3769
3107
  out._w = left._w + right._w;
3770
- out._onValueChanged && out._onValueChanged();
3108
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3771
3109
  };
3772
3110
  /**
3773
3111
  * Determines the product of two quaternions.
@@ -3781,7 +3119,7 @@
3781
3119
  out._y = ay * bw + aw * by + az * bx - ax * bz;
3782
3120
  out._z = az * bw + aw * bz + ax * by - ay * bx;
3783
3121
  out._w = aw * bw - ax * bx - ay * by - az * bz;
3784
- out._onValueChanged && out._onValueChanged();
3122
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3785
3123
  };
3786
3124
  /**
3787
3125
  * Calculate quaternion that contains conjugated version of the specified quaternion.
@@ -3792,7 +3130,7 @@
3792
3130
  out._y = -a._y;
3793
3131
  out._z = -a._z;
3794
3132
  out._w = a._w;
3795
- out._onValueChanged && out._onValueChanged();
3133
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3796
3134
  };
3797
3135
  /**
3798
3136
  * Determines the dot product of two quaternions.
@@ -3824,7 +3162,7 @@
3824
3162
  out._y = normalAxis._y * s;
3825
3163
  out._z = normalAxis._z * s;
3826
3164
  out._w = Math.cos(rad);
3827
- out._onValueChanged && out._onValueChanged();
3165
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3828
3166
  };
3829
3167
  /**
3830
3168
  * Calculate a quaternion rotates around x, y, z axis (pitch/yaw/roll).
@@ -3857,7 +3195,7 @@
3857
3195
  out._y = sinYaw * cosPitch * cosRoll - cosYaw * sinPitch * sinRoll;
3858
3196
  out._z = cosYawPitch * sinRoll - sinYawPitch * cosRoll;
3859
3197
  out._w = cosYawPitch * cosRoll + sinYawPitch * sinRoll;
3860
- out._onValueChanged && out._onValueChanged();
3198
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3861
3199
  };
3862
3200
  /**
3863
3201
  * Calculate a quaternion from the specified 3x3 matrix.
@@ -3899,7 +3237,7 @@
3899
3237
  out._z = 0.5 * sqrt;
3900
3238
  out._w = (m12 - m21) * half;
3901
3239
  }
3902
- out._onValueChanged && out._onValueChanged();
3240
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3903
3241
  };
3904
3242
  /**
3905
3243
  * Calculate the inverse of the specified quaternion.
@@ -3914,7 +3252,7 @@
3914
3252
  out._y = -y * invDot;
3915
3253
  out._z = -z * invDot;
3916
3254
  out._w = w * invDot;
3917
- out._onValueChanged && out._onValueChanged();
3255
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3918
3256
  }
3919
3257
  };
3920
3258
  /**
@@ -3961,7 +3299,7 @@
3961
3299
  out.y = inverse * start.y + opposite * end.y;
3962
3300
  out.z = inverse * start.z + opposite * end.z;
3963
3301
  out.w = inverse * start.w + opposite * end.w;
3964
- out._onValueChanged && out._onValueChanged();
3302
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3965
3303
  };
3966
3304
  /**
3967
3305
  * Scales the specified quaternion magnitude to unit length.
@@ -3976,7 +3314,7 @@
3976
3314
  out._y = _y * len;
3977
3315
  out._z = _z * len;
3978
3316
  out._w = _w * len;
3979
- out._onValueChanged && out._onValueChanged();
3317
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3980
3318
  }
3981
3319
  };
3982
3320
  /**
@@ -3991,7 +3329,7 @@
3991
3329
  out._y = 0;
3992
3330
  out._z = 0;
3993
3331
  out._w = c;
3994
- out._onValueChanged && out._onValueChanged();
3332
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
3995
3333
  };
3996
3334
  /**
3997
3335
  * Calculate a quaternion rotate around Y axis.
@@ -4005,7 +3343,7 @@
4005
3343
  out._y = s;
4006
3344
  out._z = 0;
4007
3345
  out._w = c;
4008
- out._onValueChanged && out._onValueChanged();
3346
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4009
3347
  };
4010
3348
  /**
4011
3349
  * Calculate a quaternion rotate around Z axis.
@@ -4019,7 +3357,7 @@
4019
3357
  out._y = 0;
4020
3358
  out._z = s;
4021
3359
  out._w = c;
4022
- out._onValueChanged && out._onValueChanged();
3360
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4023
3361
  };
4024
3362
  /**
4025
3363
  * Calculate a quaternion that the specified quaternion rotate around X axis.
@@ -4035,7 +3373,7 @@
4035
3373
  out._y = _y * bw + _z * bx;
4036
3374
  out._z = _z * bw - _y * bx;
4037
3375
  out._w = _w * bw - _x * bx;
4038
- out._onValueChanged && out._onValueChanged();
3376
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4039
3377
  };
4040
3378
  /**
4041
3379
  * Calculate a quaternion that the specified quaternion rotate around Y axis.
@@ -4051,7 +3389,7 @@
4051
3389
  out._y = _y * bw + _w * by;
4052
3390
  out._z = _z * bw + _x * by;
4053
3391
  out._w = _w * bw - _y * by;
4054
- out._onValueChanged && out._onValueChanged();
3392
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4055
3393
  };
4056
3394
  /**
4057
3395
  * Calculate a quaternion that the specified quaternion rotate around Z axis.
@@ -4067,7 +3405,7 @@
4067
3405
  out._y = _y * bw - _x * bz;
4068
3406
  out._z = _z * bw + _w * bz;
4069
3407
  out._w = _w * bw - _z * bz;
4070
- out._onValueChanged && out._onValueChanged();
3408
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4071
3409
  };
4072
3410
  /**
4073
3411
  * Scale a quaternion by a given number.
@@ -4079,7 +3417,7 @@
4079
3417
  out._y = a._y * s;
4080
3418
  out._z = a._z * s;
4081
3419
  out._w = a._w * s;
4082
- out._onValueChanged && out._onValueChanged();
3420
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4083
3421
  };
4084
3422
  _create_class(Quaternion, [
4085
3423
  {
@@ -4091,7 +3429,7 @@
4091
3429
  },
4092
3430
  set: function set(value) {
4093
3431
  this._x = value;
4094
- this._onValueChanged && this._onValueChanged();
3432
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
4095
3433
  }
4096
3434
  },
4097
3435
  {
@@ -4103,7 +3441,7 @@
4103
3441
  },
4104
3442
  set: function set(value) {
4105
3443
  this._y = value;
4106
- this._onValueChanged && this._onValueChanged();
3444
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
4107
3445
  }
4108
3446
  },
4109
3447
  {
@@ -4115,7 +3453,7 @@
4115
3453
  },
4116
3454
  set: function set(value) {
4117
3455
  this._z = value;
4118
- this._onValueChanged && this._onValueChanged();
3456
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
4119
3457
  }
4120
3458
  },
4121
3459
  {
@@ -4135,22 +3473,18 @@
4135
3473
  },
4136
3474
  set: function set(value) {
4137
3475
  this._w = value;
4138
- this._onValueChanged && this._onValueChanged();
3476
+ this._onValueChanged == null ? void 0 : this._onValueChanged.call(this);
4139
3477
  }
4140
3478
  }
4141
3479
  ]);
4142
3480
  return Quaternion;
4143
3481
  }();
4144
- (function() {
4145
- /** @internal */ Quaternion._tempVector3 = new Vector3();
4146
- })();
4147
- (function() {
4148
- /** @internal */ Quaternion._tempQuat1 = new Quaternion();
4149
- })();
3482
+ /** @internal */ Quaternion._tempVector3 = new Vector3();
3483
+ /** @internal */ Quaternion._tempQuat1 = new Quaternion();
4150
3484
  /**
4151
3485
  * Represents a 4x4 mathematical matrix.
4152
3486
  */ var Matrix = /*#__PURE__*/ function() {
4153
- var Matrix = function Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
3487
+ function Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
4154
3488
  if (m11 === void 0) m11 = 1;
4155
3489
  if (m12 === void 0) m12 = 0;
4156
3490
  if (m13 === void 0) m13 = 0;
@@ -4194,7 +3528,7 @@
4194
3528
  e[13] = m42;
4195
3529
  e[14] = m43;
4196
3530
  e[15] = m44;
4197
- };
3531
+ }
4198
3532
  var _proto = Matrix.prototype;
4199
3533
  /**
4200
3534
  * Set the value of this matrix, and return this matrix.
@@ -4344,7 +3678,7 @@
4344
3678
  out._y = (e[6] + e[9]) / s3;
4345
3679
  out._z = 0.25 * s3;
4346
3680
  }
4347
- out._onValueChanged && out._onValueChanged();
3681
+ out._onValueChanged == null ? void 0 : out._onValueChanged.call(out);
4348
3682
  return out;
4349
3683
  };
4350
3684
  /**
@@ -5086,791 +4420,21 @@
5086
4420
  };
5087
4421
  return Matrix;
5088
4422
  }();
5089
- (function() {
5090
- Matrix._tempVec30 = new Vector3();
5091
- })();
5092
- (function() {
5093
- Matrix._tempVec31 = new Vector3();
5094
- })();
5095
- (function() {
5096
- Matrix._tempVec32 = new Vector3();
5097
- })();
5098
- (function() {
5099
- Matrix._tempMat30 = new Matrix3x3();
5100
- })();
5101
- (function() {
5102
- /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
5103
- })();
5104
- /**
5105
- * Describes a 2D-vector.
5106
- */ var Vector2 = /*#__PURE__*/ function() {
5107
- var Vector2 = function Vector2(x, y) {
5108
- if (x === void 0) x = 0;
5109
- if (y === void 0) y = 0;
5110
- /** @internal */ this._onValueChanged = null;
5111
- this._x = x;
5112
- this._y = y;
5113
- };
5114
- var _proto = Vector2.prototype;
5115
- /**
5116
- * Set the value of this vector.
5117
- * @param x - The x component of the vector
5118
- * @param y - The y component of the vector
5119
- * @returns This vector
5120
- */ _proto.set = function set(x, y) {
5121
- this._x = x;
5122
- this._y = y;
5123
- this._onValueChanged && this._onValueChanged();
5124
- return this;
5125
- };
5126
- /**
5127
- * Determines the sum of this vector and the specified vector.
5128
- * @param right - The specified vector
5129
- * @returns This vector
5130
- */ _proto.add = function add(right) {
5131
- this._x += right._x;
5132
- this._y += right._y;
5133
- this._onValueChanged && this._onValueChanged();
5134
- return this;
5135
- };
5136
- /**
5137
- * Determines the difference of this vector and the specified vector.
5138
- * @param right - The specified vector
5139
- * @returns This vector
5140
- */ _proto.subtract = function subtract(right) {
5141
- this._x -= right._x;
5142
- this._y -= right._y;
5143
- this._onValueChanged && this._onValueChanged();
5144
- return this;
5145
- };
5146
- /**
5147
- * Determines the product of this vector and the specified vector.
5148
- * @param right - The specified vector
5149
- * @returns This vector
5150
- */ _proto.multiply = function multiply(right) {
5151
- this._x *= right._x;
5152
- this._y *= right._y;
5153
- this._onValueChanged && this._onValueChanged();
5154
- return this;
5155
- };
5156
- /**
5157
- * Determines the divisor of this vector and the specified vector.
5158
- * @param right - The specified vector
5159
- * @returns This vector
5160
- */ _proto.divide = function divide(right) {
5161
- this._x /= right._x;
5162
- this._y /= right._y;
5163
- this._onValueChanged && this._onValueChanged();
5164
- return this;
5165
- };
5166
- /**
5167
- * Calculate the length of this vector.
5168
- * @returns The length of this vector
5169
- */ _proto.length = function length() {
5170
- var _this = this, _x = _this._x, _y = _this._y;
5171
- return Math.sqrt(_x * _x + _y * _y);
5172
- };
5173
- /**
5174
- * Calculate the squared length of this vector.
5175
- * @returns The squared length of this vector
5176
- */ _proto.lengthSquared = function lengthSquared() {
5177
- var _this = this, _x = _this._x, _y = _this._y;
5178
- return _x * _x + _y * _y;
5179
- };
5180
- /**
5181
- * Reverses the direction of this vector.
5182
- * @returns This vector
5183
- */ _proto.negate = function negate() {
5184
- this._x = -this._x;
5185
- this._y = -this._y;
5186
- this._onValueChanged && this._onValueChanged();
5187
- return this;
5188
- };
5189
- /**
5190
- * Converts this vector into a unit vector.
5191
- * @returns This vector
5192
- */ _proto.normalize = function normalize() {
5193
- Vector2.normalize(this, this);
5194
- return this;
5195
- };
5196
- /**
5197
- * Scale this vector by the given value.
5198
- * @param s - The amount by which to scale the vector
5199
- * @returns This vector
5200
- */ _proto.scale = function scale(s) {
5201
- this._x *= s;
5202
- this._y *= s;
5203
- this._onValueChanged && this._onValueChanged();
5204
- return this;
5205
- };
5206
- /**
5207
- * Creates a clone of this vector.
5208
- * @returns A clone of this vector
5209
- */ _proto.clone = function clone() {
5210
- return new Vector2(this._x, this._y);
5211
- };
5212
- /**
5213
- * Copy from vector2 like object.
5214
- * @param source - Vector2 like object
5215
- * @returns This vector
5216
- */ _proto.copyFrom = function copyFrom(source) {
5217
- this._x = source.x;
5218
- this._y = source.y;
5219
- this._onValueChanged && this._onValueChanged();
5220
- return this;
5221
- };
5222
- /**
5223
- * Copy the value of this vector from an array.
5224
- * @param array - The array
5225
- * @param offset - The start offset of the array
5226
- * @returns This vector
5227
- */ _proto.copyFromArray = function copyFromArray(array, offset) {
5228
- if (offset === void 0) offset = 0;
5229
- this._x = array[offset];
5230
- this._y = array[offset + 1];
5231
- this._onValueChanged && this._onValueChanged();
5232
- return this;
5233
- };
5234
- /**
5235
- * Copy the value of this vector to an array.
5236
- * @param out - The array
5237
- * @param outOffset - The start offset of the array
5238
- */ _proto.copyToArray = function copyToArray(out, outOffset) {
5239
- if (outOffset === void 0) outOffset = 0;
5240
- out[outOffset] = this._x;
5241
- out[outOffset + 1] = this._y;
5242
- };
5243
- /**
5244
- * Serialize this vector to a JSON representation.
5245
- * @returns A JSON representation of this vector
5246
- */ _proto.toJSON = function toJSON() {
5247
- return {
5248
- x: this._x,
5249
- y: this._y
5250
- };
5251
- };
5252
- /**
5253
- * Determines the sum of two vectors.
5254
- * @param left - The first vector to add
5255
- * @param right - The second vector to add
5256
- * @param out - The sum of two vectors
5257
- */ Vector2.add = function add(left, right, out) {
5258
- out._x = left._x + right._x;
5259
- out._y = left._y + right._y;
5260
- out._onValueChanged && out._onValueChanged();
5261
- };
5262
- /**
5263
- * Determines the difference between two vectors.
5264
- * @param left - The first vector to subtract
5265
- * @param right - The second vector to subtract
5266
- * @param out - The difference between two vectors
5267
- */ Vector2.subtract = function subtract(left, right, out) {
5268
- out._x = left._x - right._x;
5269
- out._y = left._y - right._y;
5270
- out._onValueChanged && out._onValueChanged();
5271
- };
5272
- /**
5273
- * Determines the product of two vectors.
5274
- * @param left - The first vector to multiply
5275
- * @param right - The second vector to multiply
5276
- * @param out - The product of two vectors
5277
- */ Vector2.multiply = function multiply(left, right, out) {
5278
- out._x = left._x * right._x;
5279
- out._y = left._y * right._y;
5280
- out._onValueChanged && out._onValueChanged();
5281
- };
5282
- /**
5283
- * Determines the divisor of two vectors.
5284
- * @param left - The first vector to divide
5285
- * @param right - The second vector to divide
5286
- * @param out - The divisor of two vectors
5287
- */ Vector2.divide = function divide(left, right, out) {
5288
- out._x = left._x / right._x;
5289
- out._y = left._y / right._y;
5290
- out._onValueChanged && out._onValueChanged();
5291
- };
5292
- /**
5293
- * Determines the dot product of two vectors.
5294
- * @param left - The first vector to dot
5295
- * @param right - The second vector to dot
5296
- * @returns The dot product of two vectors
5297
- */ Vector2.dot = function dot(left, right) {
5298
- return left._x * right._x + left._y * right._y;
5299
- };
5300
- /**
5301
- * Determines the distance of two vectors.
5302
- * @param left - The first vector
5303
- * @param right - The second vector
5304
- * @returns The distance of two vectors
5305
- */ Vector2.distance = function distance(left, right) {
5306
- var x = right._x - left._x;
5307
- var y = right._y - left._y;
5308
- return Math.sqrt(x * x + y * y);
5309
- };
5310
- /**
5311
- * Determines the squared distance of two vectors.
5312
- * @param left - The first vector
5313
- * @param right - The second vector
5314
- * @returns The squared distance of two vectors
5315
- */ Vector2.distanceSquared = function distanceSquared(left, right) {
5316
- var x = right._x - left._x;
5317
- var y = right._y - left._y;
5318
- return x * x + y * y;
5319
- };
5320
- /**
5321
- * Determines whether the specified vectors are equals.
5322
- * @param left - The first vector to compare
5323
- * @param right - The second vector to compare
5324
- * @returns True if the specified vectors are equals, false otherwise
5325
- */ Vector2.equals = function equals(left, right) {
5326
- return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y);
5327
- };
5328
- /**
5329
- * Performs a linear interpolation between two vectors.
5330
- * @param left - The first vector
5331
- * @param right - The second vector
5332
- * @param t - The blend amount where 0 returns left and 1 right
5333
- * @param out - The result of linear blending between two vectors
5334
- */ Vector2.lerp = function lerp(left, right, t, out) {
5335
- var _x = left._x, _y = left._y;
5336
- out._x = _x + (right._x - _x) * t;
5337
- out._y = _y + (right._y - _y) * t;
5338
- out._onValueChanged && out._onValueChanged();
5339
- };
5340
- /**
5341
- * Calculate a vector containing the largest components of the specified vectors.
5342
- * @param left - The first vector
5343
- * @param right - The second vector
5344
- * @param out - The vector containing the largest components of the specified vectors
5345
- */ Vector2.max = function max(left, right, out) {
5346
- out._x = Math.max(left._x, right._x);
5347
- out._y = Math.max(left._y, right._y);
5348
- out._onValueChanged && out._onValueChanged();
5349
- };
5350
- /**
5351
- * Calculate a vector containing the smallest components of the specified vectors.
5352
- * @param left - The first vector
5353
- * @param right - The second vector
5354
- * @param out - The vector containing the smallest components of the specified vectors
5355
- */ Vector2.min = function min(left, right, out) {
5356
- out._x = Math.min(left._x, right._x);
5357
- out._y = Math.min(left._y, right._y);
5358
- out._onValueChanged && out._onValueChanged();
5359
- };
5360
- /**
5361
- * Reverses the direction of a given vector.
5362
- * @param left - The vector to negate
5363
- * @param out - The vector facing in the opposite direction
5364
- */ Vector2.negate = function negate(left, out) {
5365
- out._x = -left._x;
5366
- out._y = -left._y;
5367
- out._onValueChanged && out._onValueChanged();
5368
- };
5369
- /**
5370
- * Converts the vector into a unit vector.
5371
- * @param left - The vector to normalize
5372
- * @param out - The normalized vector
5373
- */ Vector2.normalize = function normalize(left, out) {
5374
- var _x = left._x, _y = left._y;
5375
- var len = Math.sqrt(_x * _x + _y * _y);
5376
- if (len > MathUtil.zeroTolerance) {
5377
- len = 1 / len;
5378
- out._x = _x * len;
5379
- out._y = _y * len;
5380
- out._onValueChanged && out._onValueChanged();
5381
- }
5382
- };
5383
- /**
5384
- * Scale a vector by the given value.
5385
- * @param left - The vector to scale
5386
- * @param s - The amount by which to scale the vector
5387
- * @param out - The scaled vector
5388
- */ Vector2.scale = function scale(left, s, out) {
5389
- out._x = left._x * s;
5390
- out._y = left._y * s;
5391
- out._onValueChanged && out._onValueChanged();
5392
- };
5393
- _create_class(Vector2, [
5394
- {
5395
- key: "x",
5396
- get: /**
5397
- * The x component of the vector.
5398
- */ function get() {
5399
- return this._x;
5400
- },
5401
- set: function set(value) {
5402
- this._x = value;
5403
- this._onValueChanged && this._onValueChanged();
5404
- }
5405
- },
5406
- {
5407
- key: "y",
5408
- get: /**
5409
- * The y component of the vector.
5410
- */ function get() {
5411
- return this._y;
5412
- },
5413
- set: function set(value) {
5414
- this._y = value;
5415
- this._onValueChanged && this._onValueChanged();
5416
- }
5417
- }
5418
- ]);
5419
- return Vector2;
5420
- }();
5421
- (function() {
5422
- /** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
5423
- })();
5424
- (function() {
5425
- /** @internal */ Vector2._one = new Vector2(1.0, 1.0);
5426
- })();
5427
- /**
5428
- * Describes a 4D-vector.
5429
- */ var Vector4 = /*#__PURE__*/ function() {
5430
- var Vector4 = function Vector4(x, y, z, w) {
5431
- if (x === void 0) x = 0;
5432
- if (y === void 0) y = 0;
5433
- if (z === void 0) z = 0;
5434
- if (w === void 0) w = 0;
5435
- /** @internal */ this._onValueChanged = null;
5436
- this._x = x;
5437
- this._y = y;
5438
- this._z = z;
5439
- this._w = w;
5440
- };
5441
- var _proto = Vector4.prototype;
5442
- /**
5443
- * Set the value of this vector.
5444
- * @param x - The x component of the vector
5445
- * @param y - The y component of the vector
5446
- * @param z - The z component of the vector
5447
- * @param w - The w component of the vector
5448
- * @returns This vector
5449
- */ _proto.set = function set(x, y, z, w) {
5450
- this._x = x;
5451
- this._y = y;
5452
- this._z = z;
5453
- this._w = w;
5454
- this._onValueChanged && this._onValueChanged();
5455
- return this;
5456
- };
5457
- /**
5458
- * Determines the sum of this vector and the specified vector.
5459
- * @param right - The specified vector
5460
- * @returns This vector
5461
- */ _proto.add = function add(right) {
5462
- this._x += right._x;
5463
- this._y += right._y;
5464
- this._z += right._z;
5465
- this._w += right._w;
5466
- this._onValueChanged && this._onValueChanged();
5467
- return this;
5468
- };
5469
- /**
5470
- * Determines the difference of this vector and the specified vector.
5471
- * @param right - the specified vector
5472
- * @returns This vector
5473
- */ _proto.subtract = function subtract(right) {
5474
- this._x -= right._x;
5475
- this._y -= right._y;
5476
- this._z -= right._z;
5477
- this._w -= right._w;
5478
- this._onValueChanged && this._onValueChanged();
5479
- return this;
5480
- };
5481
- /**
5482
- * Determines the product of this vector and the specified vector.
5483
- * @param right - the specified vector
5484
- * @returns This vector
5485
- */ _proto.multiply = function multiply(right) {
5486
- this._x *= right._x;
5487
- this._y *= right._y;
5488
- this._z *= right._z;
5489
- this._w *= right._w;
5490
- this._onValueChanged && this._onValueChanged();
5491
- return this;
5492
- };
5493
- /**
5494
- * Determines the divisor of this vector and the specified vector.
5495
- * @param right - the specified vector
5496
- * @returns This vector
5497
- */ _proto.divide = function divide(right) {
5498
- this._x /= right._x;
5499
- this._y /= right._y;
5500
- this._z /= right._z;
5501
- this._w /= right._w;
5502
- this._onValueChanged && this._onValueChanged();
5503
- return this;
5504
- };
5505
- /**
5506
- * Calculate the length of this vector.
5507
- * @returns The length of this vector
5508
- */ _proto.length = function length() {
5509
- var _this = this, _x = _this._x, _y = _this._y, _z = _this._z, _w = _this._w;
5510
- return Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
5511
- };
5512
- /**
5513
- * Calculate the squared length of this vector.
5514
- * @returns The squared length of this vector
5515
- */ _proto.lengthSquared = function lengthSquared() {
5516
- var _this = this, _x = _this._x, _y = _this._y, _z = _this._z, _w = _this._w;
5517
- return _x * _x + _y * _y + _z * _z + _w * _w;
5518
- };
5519
- /**
5520
- * Reverses the direction of this vector.
5521
- * @returns This vector
5522
- */ _proto.negate = function negate() {
5523
- this._x = -this._x;
5524
- this._y = -this._y;
5525
- this._z = -this._z;
5526
- this._w = -this._w;
5527
- this._onValueChanged && this._onValueChanged();
5528
- return this;
5529
- };
5530
- /**
5531
- * Converts this vector into a unit vector.
5532
- * @returns This vector
5533
- */ _proto.normalize = function normalize() {
5534
- Vector4.normalize(this, this);
5535
- return this;
5536
- };
5537
- /**
5538
- * Scale this vector by the given value.
5539
- * @param s - The amount by which to scale the vector
5540
- * @returns This vector
5541
- */ _proto.scale = function scale(s) {
5542
- this._x *= s;
5543
- this._y *= s;
5544
- this._z *= s;
5545
- this._w *= s;
5546
- this._onValueChanged && this._onValueChanged();
5547
- return this;
5548
- };
5549
- /**
5550
- * Creates a clone of this vector.
5551
- * @returns A clone of this vector
5552
- */ _proto.clone = function clone() {
5553
- var ret = new Vector4(this._x, this._y, this._z, this._w);
5554
- return ret;
5555
- };
5556
- /**
5557
- * Copy from vector3 like object.
5558
- * @param source - Vector3 like object.
5559
- * @returns This vector
5560
- */ _proto.copyFrom = function copyFrom(source) {
5561
- this._x = source.x;
5562
- this._y = source.y;
5563
- this._z = source.z;
5564
- this._w = source.w;
5565
- this._onValueChanged && this._onValueChanged();
5566
- return this;
5567
- };
5568
- /**
5569
- * Copy the value of this vector by an array.
5570
- * @param array - The array
5571
- * @param offset - The start offset of the array
5572
- * @returns This vector
5573
- */ _proto.copyFromArray = function copyFromArray(array, offset) {
5574
- if (offset === void 0) offset = 0;
5575
- this._x = array[offset];
5576
- this._y = array[offset + 1];
5577
- this._z = array[offset + 2];
5578
- this._w = array[offset + 3];
5579
- this._onValueChanged && this._onValueChanged();
5580
- return this;
5581
- };
5582
- /**
5583
- * Copy the value of this vector to an array.
5584
- * @param out - The array
5585
- * @param outOffset - The start offset of the array
5586
- */ _proto.copyToArray = function copyToArray(out, outOffset) {
5587
- if (outOffset === void 0) outOffset = 0;
5588
- out[outOffset] = this._x;
5589
- out[outOffset + 1] = this._y;
5590
- out[outOffset + 2] = this._z;
5591
- out[outOffset + 3] = this._w;
5592
- };
5593
- /**
5594
- * Serialize this vector to a JSON representation.
5595
- * @returns A JSON representation of this vector
5596
- */ _proto.toJSON = function toJSON() {
5597
- return {
5598
- x: this._x,
5599
- y: this._y,
5600
- z: this._z,
5601
- w: this._w
5602
- };
5603
- };
5604
- /**
5605
- * Determines the sum of two vectors.
5606
- * @param left - The first vector to add
5607
- * @param right - The second vector to add
5608
- * @param out - The sum of two vectors
5609
- */ Vector4.add = function add(left, right, out) {
5610
- out._x = left._x + right._x;
5611
- out._y = left._y + right._y;
5612
- out._z = left._z + right._z;
5613
- out._w = left._w + right._w;
5614
- out._onValueChanged && out._onValueChanged();
5615
- };
5616
- /**
5617
- * Determines the difference between two vectors.
5618
- * @param left - The first vector to subtract
5619
- * @param right - The second vector to subtract
5620
- * @param out - The difference between two vectors
5621
- */ Vector4.subtract = function subtract(left, right, out) {
5622
- out._x = left._x - right._x;
5623
- out._y = left._y - right._y;
5624
- out._z = left._z - right._z;
5625
- out._w = left._w - right._w;
5626
- out._onValueChanged && out._onValueChanged();
5627
- };
5628
- /**
5629
- * Determines the product of two vectors.
5630
- * @param left - The first vector to multiply
5631
- * @param right - The second vector to multiply
5632
- * @param out - The product of two vectors
5633
- */ Vector4.multiply = function multiply(left, right, out) {
5634
- out._x = left._x * right._x;
5635
- out._y = left._y * right._y;
5636
- out._z = left._z * right._z;
5637
- out._w = left._w * right._w;
5638
- out._onValueChanged && out._onValueChanged();
5639
- };
5640
- /**
5641
- * Determines the divisor of two vectors.
5642
- * @param left - The first vector to divide
5643
- * @param right - The second vector to divide
5644
- * @param out - The divisor of two vectors
5645
- */ Vector4.divide = function divide(left, right, out) {
5646
- out._x = left._x / right._x;
5647
- out._y = left._y / right._y;
5648
- out._z = left._z / right._z;
5649
- out._w = left._w / right._w;
5650
- out._onValueChanged && out._onValueChanged();
5651
- };
5652
- /**
5653
- * Determines the dot product of two vectors.
5654
- * @param left - The first vector to dot
5655
- * @param right - The second vector to dot
5656
- * @returns The dot product of two vectors
5657
- */ Vector4.dot = function dot(left, right) {
5658
- return left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w;
5659
- };
5660
- /**
5661
- * Determines the distance of two vectors.
5662
- * @param a - The first vector
5663
- * @param b - The second vector
5664
- * @returns The distance of two vectors
5665
- */ Vector4.distance = function distance(a, b) {
5666
- var x = b._x - a._x;
5667
- var y = b._y - a._y;
5668
- var z = b._z - a._z;
5669
- var w = b._w - a._w;
5670
- return Math.sqrt(x * x + y * y + z * z + w * w);
5671
- };
5672
- /**
5673
- * Determines the squared distance of two vectors.
5674
- * @param a - The first vector
5675
- * @param b - The second vector
5676
- * @returns The squared distance of two vectors
5677
- */ Vector4.distanceSquared = function distanceSquared(a, b) {
5678
- var x = b._x - a._x;
5679
- var y = b._y - a._y;
5680
- var z = b._z - a._z;
5681
- var w = b._w - a._w;
5682
- return x * x + y * y + z * z + w * w;
5683
- };
5684
- /**
5685
- * Determines whether the specified vectors are equals.
5686
- * @param left - The first vector to compare
5687
- * @param right - The second vector to compare
5688
- * @returns True if the specified vectors are equals, false otherwise
5689
- */ Vector4.equals = function equals(left, right) {
5690
- return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y) && MathUtil.equals(left._z, right._z) && MathUtil.equals(left._w, right._w);
5691
- };
5692
- /**
5693
- * Performs a linear interpolation between two vectors.
5694
- * @param start - The first vector
5695
- * @param end - The second vector
5696
- * @param t - The blend amount where 0 returns start and 1 end
5697
- * @param out - The result of linear blending between two vectors
5698
- */ Vector4.lerp = function lerp(start, end, t, out) {
5699
- var _x = start._x, _y = start._y, _z = start._z, _w = start._w;
5700
- out._x = _x + (end._x - _x) * t;
5701
- out._y = _y + (end._y - _y) * t;
5702
- out._z = _z + (end._z - _z) * t;
5703
- out._w = _w + (end._w - _w) * t;
5704
- out._onValueChanged && out._onValueChanged();
5705
- };
5706
- /**
5707
- * Calculate a vector containing the largest components of the specified vectors.
5708
- * @param left - The first vector
5709
- * @param right - The second vector
5710
- * @param out - The vector containing the largest components of the specified vectors
5711
- */ Vector4.max = function max(left, right, out) {
5712
- out._x = Math.max(left._x, right._x);
5713
- out._y = Math.max(left._y, right._y);
5714
- out._z = Math.max(left._z, right._z);
5715
- out._w = Math.max(left._w, right._w);
5716
- out._onValueChanged && out._onValueChanged();
5717
- };
5718
- /**
5719
- * Calculate a vector containing the smallest components of the specified vectors.
5720
- * @param left - The first vector
5721
- * @param right - The second vector
5722
- * @param out - The vector containing the smallest components of the specified vectors
5723
- */ Vector4.min = function min(left, right, out) {
5724
- out._x = Math.min(left._x, right._x);
5725
- out._y = Math.min(left._y, right._y);
5726
- out._z = Math.min(left._z, right._z);
5727
- out._w = Math.min(left._w, right._w);
5728
- out._onValueChanged && out._onValueChanged();
5729
- };
5730
- /**
5731
- * Reverses the direction of a given vector.
5732
- * @param a - The vector to negate
5733
- * @param out - The vector facing in the opposite direction
5734
- */ Vector4.negate = function negate(a, out) {
5735
- out._x = -a._x;
5736
- out._y = -a._y;
5737
- out._z = -a._z;
5738
- out._w = -a._w;
5739
- out._onValueChanged && out._onValueChanged();
5740
- };
5741
- /**
5742
- * Converts the vector into a unit vector.
5743
- * @param a - The vector to normalize
5744
- * @param out - The normalized vector
5745
- */ Vector4.normalize = function normalize(a, out) {
5746
- var _x = a._x, _y = a._y, _z = a._z, _w = a._w;
5747
- var len = Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
5748
- if (len > MathUtil.zeroTolerance) {
5749
- len = 1 / len;
5750
- out._x = _x * len;
5751
- out._y = _y * len;
5752
- out._z = _z * len;
5753
- out._w = _w * len;
5754
- out._onValueChanged && out._onValueChanged();
5755
- }
5756
- };
5757
- /**
5758
- * Scale a vector by the given value.
5759
- * @param a - The vector to scale
5760
- * @param s - The amount by which to scale the vector
5761
- * @param out - The scaled vector
5762
- */ Vector4.scale = function scale(a, s, out) {
5763
- out._x = a._x * s;
5764
- out._y = a._y * s;
5765
- out._z = a._z * s;
5766
- out._w = a._w * s;
5767
- out._onValueChanged && out._onValueChanged();
5768
- };
5769
- /**
5770
- * Performs a transformation using the given 4x4 matrix.
5771
- * @param v - The vector to transform
5772
- * @param m - The transform matrix
5773
- * @param out - The transformed vector3
5774
- */ Vector4.transform = function transform(v, m, out) {
5775
- var _x = v._x, _y = v._y, _z = v._z, _w = v._w;
5776
- var e = m.elements;
5777
- out._x = _x * e[0] + _y * e[4] + _z * e[8] + _w * e[12];
5778
- out._y = _x * e[1] + _y * e[5] + _z * e[9] + _w * e[13];
5779
- out._z = _x * e[2] + _y * e[6] + _z * e[10] + _w * e[14];
5780
- out._w = _x * e[3] + _y * e[7] + _z * e[11] + _w * e[15];
5781
- out._onValueChanged && out._onValueChanged();
5782
- };
5783
- /**
5784
- * Performs a transformation using the given quaternion.
5785
- * @param v - The vector to transform
5786
- * @param q - The transform quaternion
5787
- * @param out - The transformed vector
5788
- */ Vector4.transformByQuat = function transformByQuat(v, q, out) {
5789
- var x = v._x, y = v._y, z = v._z, w = v._w;
5790
- var qx = q._x;
5791
- var qy = q._y;
5792
- var qz = q._z;
5793
- var qw = q._w;
5794
- // calculate quat * vec
5795
- var ix = qw * x + qy * z - qz * y;
5796
- var iy = qw * y + qz * x - qx * z;
5797
- var iz = qw * z + qx * y - qy * x;
5798
- var iw = -qx * x - qy * y - qz * z;
5799
- // calculate result * inverse quat
5800
- out._x = ix * qw - iw * qx - iy * qz + iz * qy;
5801
- out._y = iy * qw - iw * qy - iz * qx + ix * qz;
5802
- out._z = iz * qw - iw * qz - ix * qy + iy * qx;
5803
- out._w = w;
5804
- out._onValueChanged && out._onValueChanged();
5805
- };
5806
- _create_class(Vector4, [
5807
- {
5808
- key: "x",
5809
- get: /**
5810
- * The x component of the vector.
5811
- */ function get() {
5812
- return this._x;
5813
- },
5814
- set: function set(value) {
5815
- this._x = value;
5816
- this._onValueChanged && this._onValueChanged();
5817
- }
5818
- },
5819
- {
5820
- key: "y",
5821
- get: /**
5822
- * The y component of the vector.
5823
- */ function get() {
5824
- return this._y;
5825
- },
5826
- set: function set(value) {
5827
- this._y = value;
5828
- this._onValueChanged && this._onValueChanged();
5829
- }
5830
- },
5831
- {
5832
- key: "z",
5833
- get: /**
5834
- * The z component of the vector.
5835
- */ function get() {
5836
- return this._z;
5837
- },
5838
- set: function set(value) {
5839
- this._z = value;
5840
- this._onValueChanged && this._onValueChanged();
5841
- }
5842
- },
5843
- {
5844
- key: "w",
5845
- get: /**
5846
- * The w component of the vector.
5847
- */ function get() {
5848
- return this._w;
5849
- },
5850
- set: function set(value) {
5851
- this._w = value;
5852
- this._onValueChanged && this._onValueChanged();
5853
- }
5854
- }
5855
- ]);
5856
- return Vector4;
5857
- }();
5858
- (function() {
5859
- /** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
5860
- })();
5861
- (function() {
5862
- /** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
5863
- })();
5864
-
5865
- var WebXRFrame = /*#__PURE__*/ function() {
5866
- function WebXRFrame(session) {
5867
- this._session = session;
5868
- }
5869
- var _proto = WebXRFrame.prototype;
5870
- _proto.updateInputs = function updateInputs(inputs) {
5871
- if (!this._platformFrame) return;
5872
- this._updateController(inputs);
5873
- this._updateCamera(inputs);
4423
+ Matrix._tempVec30 = new Vector3();
4424
+ Matrix._tempVec31 = new Vector3();
4425
+ Matrix._tempVec32 = new Vector3();
4426
+ Matrix._tempMat30 = new Matrix3x3();
4427
+ /** @internal Identity matrix. */ Matrix._identity = new Matrix(1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0);
4428
+
4429
+ var WebXRFrame = /*#__PURE__*/ function() {
4430
+ function WebXRFrame(session) {
4431
+ this._session = session;
4432
+ }
4433
+ var _proto = WebXRFrame.prototype;
4434
+ _proto.updateInputs = function updateInputs(inputs) {
4435
+ if (!this._platformFrame) return;
4436
+ this._updateController(inputs);
4437
+ this._updateCamera(inputs);
5874
4438
  };
5875
4439
  _proto._updateController = function _updateController(inputs) {
5876
4440
  var _this = this, frame = _this._platformFrame;
@@ -6246,9 +4810,7 @@
6246
4810
  };
6247
4811
  return WebXRDevice;
6248
4812
  }();
6249
- (function() {
6250
- /** @internal */ WebXRDevice._platformFeatureMap = [];
6251
- })();
4813
+ /** @internal */ WebXRDevice._platformFeatureMap = [];
6252
4814
  function registerXRPlatformFeature(type) {
6253
4815
  return function(platformFeatureConstructor) {
6254
4816
  WebXRDevice._platformFeatureMap[type] = platformFeatureConstructor;
@@ -6262,10 +4824,10 @@
6262
4824
 
6263
4825
  /**
6264
4826
  * @internal
6265
- */ var WebXRTrackableFeature = /*#__PURE__*/ function(WebXRFeature1) {
6266
- _inherits$1(WebXRTrackableFeature, WebXRFeature1);
4827
+ */ var WebXRTrackableFeature = /*#__PURE__*/ function(WebXRFeature) {
4828
+ _inherits$1(WebXRTrackableFeature, WebXRFeature);
6267
4829
  function WebXRTrackableFeature() {
6268
- return WebXRFeature1.apply(this, arguments);
4830
+ return WebXRFeature.apply(this, arguments) || this;
6269
4831
  }
6270
4832
  var _proto = WebXRTrackableFeature.prototype;
6271
4833
  _proto.onAddRequestTracking = function onAddRequestTracking(requestTracking) {};
@@ -6283,10 +4845,10 @@
6283
4845
  return WebXRTrackableFeature;
6284
4846
  }(WebXRFeature);
6285
4847
 
6286
- var WebXRAnchorTracking = /*#__PURE__*/ function(WebXRTrackableFeature1) {
6287
- _inherits$1(WebXRAnchorTracking, WebXRTrackableFeature1);
4848
+ var WebXRAnchorTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
4849
+ _inherits$1(WebXRAnchorTracking, WebXRTrackableFeature);
6288
4850
  function WebXRAnchorTracking() {
6289
- return WebXRTrackableFeature1.apply(this, arguments);
4851
+ return WebXRTrackableFeature.apply(this, arguments) || this;
6290
4852
  }
6291
4853
  var _proto = WebXRAnchorTracking.prototype;
6292
4854
  _proto.checkAvailable = function checkAvailable(session, frame, requestTrackings) {
@@ -6397,14 +4959,11 @@
6397
4959
  registerXRPlatformFeature(XRFeatureType.AnchorTracking)
6398
4960
  ], WebXRAnchorTracking);
6399
4961
 
6400
- var WebXRImageTracking = /*#__PURE__*/ function(WebXRTrackableFeature1) {
6401
- _inherits$1(WebXRImageTracking, WebXRTrackableFeature1);
4962
+ var WebXRImageTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
4963
+ _inherits$1(WebXRImageTracking, WebXRTrackableFeature);
6402
4964
  function WebXRImageTracking(images) {
6403
4965
  var _this;
6404
- _this = WebXRTrackableFeature1.call(this) || this;
6405
- _this._trackingScoreStatus = 0;
6406
- _this._tempIdx = 0;
6407
- _this._tempArr = [];
4966
+ _this = WebXRTrackableFeature.call(this) || this, _this._trackingScoreStatus = 0, _this._tempIdx = 0, _this._tempArr = [];
6408
4967
  _this._images = images;
6409
4968
  return _this;
6410
4969
  }
@@ -6521,17 +5080,12 @@
6521
5080
  WebXRImageTracking = __decorate$1([
6522
5081
  registerXRPlatformFeature(XRFeatureType.ImageTracking)
6523
5082
  ], WebXRImageTracking);
6524
- var ImageTrackingScoreStatus;
6525
- (function(ImageTrackingScoreStatus) {
6526
- ImageTrackingScoreStatus[ImageTrackingScoreStatus["NotReceived"] = 0] = "NotReceived";
6527
- ImageTrackingScoreStatus[ImageTrackingScoreStatus["Waiting"] = 1] = "Waiting";
6528
- ImageTrackingScoreStatus[ImageTrackingScoreStatus["Received"] = 2] = "Received";
6529
- })(ImageTrackingScoreStatus || (ImageTrackingScoreStatus = {}));
6530
5083
 
6531
- var WebXRPlaneTracking = /*#__PURE__*/ function(WebXRTrackableFeature1) {
6532
- _inherits$1(WebXRPlaneTracking, WebXRTrackableFeature1);
5084
+ var WebXRPlaneTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
5085
+ _inherits$1(WebXRPlaneTracking, WebXRTrackableFeature);
6533
5086
  function WebXRPlaneTracking(detectedMode) {
6534
- var _this = WebXRTrackableFeature1.call(this);
5087
+ var _this;
5088
+ _this = WebXRTrackableFeature.call(this) || this;
6535
5089
  if (detectedMode !== XRPlaneMode.EveryThing) {
6536
5090
  console.warn("WebXR only support XRPlaneMode.EveryThing");
6537
5091
  }
@@ -6560,8 +5114,7 @@
6560
5114
  }
6561
5115
  var _this1 = this, lastDetectedPlanes = _this1._lastDetectedPlanes;
6562
5116
  detectedPlanes.forEach(function(xrPlane) {
6563
- var _lastDetectedPlanes;
6564
- if (!((_lastDetectedPlanes = lastDetectedPlanes) == null ? void 0 : _lastDetectedPlanes.has(xrPlane))) {
5117
+ if (!(lastDetectedPlanes == null ? void 0 : lastDetectedPlanes.has(xrPlane))) {
6565
5118
  var plane = generateTracked();
6566
5119
  plane.xrPlane = xrPlane;
6567
5120
  plane.lastChangedTime = -1;