@galacean/engine-xr-webxr 1.3.24 → 1.4.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +267 -1763
- package/dist/browser.js.map +1 -1
- package/dist/browser.min.js +1 -1
- package/dist/browser.min.js.map +1 -1
- package/dist/main.js +147 -1621
- package/dist/main.js.map +1 -1
- package/dist/module.js +147 -1621
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/Util.d.ts +0 -1
- package/types/WebXRSession.d.ts +0 -1
- package/types/feature/WebXRAnchorTracking.d.ts +0 -1
- package/types/feature/WebXRPlaneTracking.d.ts +0 -1
- package/dist/miniprogram.js +0 -5977
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
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
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
XRTrackedInputDevice
|
|
156
|
-
}
|
|
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
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
XRSessionState
|
|
166
|
-
}
|
|
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
|
-
|
|
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).
|
|
@@ -293,56 +302,48 @@
|
|
|
293
302
|
};
|
|
294
303
|
/**
|
|
295
304
|
* Enum for XR tracking state.
|
|
296
|
-
*/ var XRTrackingState
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
XRTrackingState
|
|
301
|
-
}
|
|
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(
|
|
309
|
-
|
|
317
|
+
*/ var XRCamera = /*#__PURE__*/ function(XRInput) {
|
|
318
|
+
_inherits(XRCamera, XRInput);
|
|
319
|
+
function XRCamera() {
|
|
310
320
|
var _this;
|
|
311
|
-
_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
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
XRInputButton
|
|
331
|
-
}
|
|
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(
|
|
335
|
-
|
|
340
|
+
*/ var XRController = /*#__PURE__*/ function(XRInput) {
|
|
341
|
+
_inherits(XRController, XRInput);
|
|
342
|
+
function XRController() {
|
|
336
343
|
var _this;
|
|
337
|
-
_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
|
-
|
|
380
|
-
|
|
381
|
-
|
|
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
|
-
|
|
385
|
+
return XRTargetRayMode;
|
|
386
|
+
}({});
|
|
386
387
|
/**
|
|
387
388
|
* The manager of XR input.
|
|
388
389
|
*/ var XRInputManager = /*#__PURE__*/ function() {
|
|
389
|
-
|
|
390
|
+
function XRInputManager(_xrManager, _engine) {
|
|
390
391
|
this._xrManager = _xrManager;
|
|
391
392
|
this._engine = _engine;
|
|
392
393
|
this./** @internal */ _cameras = [];
|
|
@@ -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.
|
|
@@ -565,16 +566,16 @@
|
|
|
565
566
|
}();
|
|
566
567
|
/**
|
|
567
568
|
* The type of XR session.
|
|
568
|
-
*/ var XRSessionMode
|
|
569
|
-
(function(XRSessionMode) {
|
|
569
|
+
*/ var XRSessionMode = /*#__PURE__*/ function(XRSessionMode) {
|
|
570
570
|
XRSessionMode[XRSessionMode["None"] = 0] = "None";
|
|
571
571
|
XRSessionMode[XRSessionMode["AR"] = 1] = "AR";
|
|
572
572
|
XRSessionMode[XRSessionMode["VR"] = 2] = "VR";
|
|
573
|
-
|
|
573
|
+
return XRSessionMode;
|
|
574
|
+
}({});
|
|
574
575
|
/**
|
|
575
576
|
* XRSessionManager manages the life cycle of XR sessions.
|
|
576
577
|
*/ var XRSessionManager = /*#__PURE__*/ function() {
|
|
577
|
-
|
|
578
|
+
function XRSessionManager(_xrManager, _engine) {
|
|
578
579
|
this._xrManager = _xrManager;
|
|
579
580
|
this._engine = _engine;
|
|
580
581
|
this._mode = XRSessionMode.None;
|
|
@@ -585,7 +586,7 @@
|
|
|
585
586
|
this._raf = requestAnimationFrame.bind(window);
|
|
586
587
|
this._caf = cancelAnimationFrame.bind(window);
|
|
587
588
|
this._onSessionExit = this._onSessionExit.bind(this);
|
|
588
|
-
}
|
|
589
|
+
}
|
|
589
590
|
var _proto = XRSessionManager.prototype;
|
|
590
591
|
/**
|
|
591
592
|
* Check if the specified mode is supported.
|
|
@@ -772,11 +773,11 @@
|
|
|
772
773
|
}();
|
|
773
774
|
/**
|
|
774
775
|
* @internal
|
|
775
|
-
*/ var XRManagerExtended = /*#__PURE__*/ function(
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
776
|
+
*/ var XRManagerExtended = /*#__PURE__*/ function(XRManager) {
|
|
777
|
+
_inherits(XRManagerExtended, XRManager);
|
|
778
|
+
function XRManagerExtended() {
|
|
779
|
+
return XRManager.apply(this, arguments) || this;
|
|
780
|
+
}
|
|
780
781
|
var _proto = XRManagerExtended.prototype;
|
|
781
782
|
_proto.isSupportedFeature = function isSupportedFeature(feature) {
|
|
782
783
|
return this._platformDevice.isSupportedFeature(XRManagerExtended._featureMap.get(feature));
|
|
@@ -795,7 +796,9 @@
|
|
|
795
796
|
for(var i = 0, n = features.length; i < n; i++){
|
|
796
797
|
if (_instanceof1(features[i], type)) throw new Error("The feature has been added");
|
|
797
798
|
}
|
|
798
|
-
var feature = _construct$1(type, [].concat(
|
|
799
|
+
var feature = _construct$1(type, [].concat([
|
|
800
|
+
this
|
|
801
|
+
], args));
|
|
799
802
|
features.push(feature);
|
|
800
803
|
return feature;
|
|
801
804
|
};
|
|
@@ -809,8 +812,8 @@
|
|
|
809
812
|
}
|
|
810
813
|
};
|
|
811
814
|
_proto.enterXR = function enterXR(sessionMode, autoRun) {
|
|
812
|
-
if (autoRun === void 0) autoRun = true;
|
|
813
815
|
var _this = this;
|
|
816
|
+
if (autoRun === void 0) autoRun = true;
|
|
814
817
|
var sessionManager = this.sessionManager;
|
|
815
818
|
if (sessionManager._platformSession) {
|
|
816
819
|
throw new Error("Please exit XR immersive mode first.");
|
|
@@ -942,9 +945,7 @@
|
|
|
942
945
|
]);
|
|
943
946
|
return XRManagerExtended;
|
|
944
947
|
}(engine.XRManager);
|
|
945
|
-
(
|
|
946
|
-
/** @internal */ XRManagerExtended._featureMap = new Map();
|
|
947
|
-
})();
|
|
948
|
+
/** @internal */ XRManagerExtended._featureMap = new Map();
|
|
948
949
|
/**
|
|
949
950
|
* @internal
|
|
950
951
|
*/ function registerXRFeature(type) {
|
|
@@ -966,7 +967,7 @@
|
|
|
966
967
|
/**
|
|
967
968
|
* The base class of XR feature manager.
|
|
968
969
|
*/ var XRFeature = /*#__PURE__*/ function() {
|
|
969
|
-
|
|
970
|
+
function XRFeature(_xrManager, _type) {
|
|
970
971
|
for(var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++){
|
|
971
972
|
args[_key - 2] = arguments[_key];
|
|
972
973
|
}
|
|
@@ -974,9 +975,11 @@
|
|
|
974
975
|
this._xrManager = _xrManager;
|
|
975
976
|
this._type = _type;
|
|
976
977
|
this._enabled = true;
|
|
977
|
-
this._platformFeature = (_xrManager__platformDevice = _xrManager._platformDevice).createPlatformFeature.apply(_xrManager__platformDevice, [].concat(
|
|
978
|
+
this._platformFeature = (_xrManager__platformDevice = _xrManager._platformDevice).createPlatformFeature.apply(_xrManager__platformDevice, [].concat([
|
|
979
|
+
_type
|
|
980
|
+
], args));
|
|
978
981
|
this._onEnable();
|
|
979
|
-
}
|
|
982
|
+
}
|
|
980
983
|
var _proto = XRFeature.prototype;
|
|
981
984
|
/**
|
|
982
985
|
* @internal
|
|
@@ -1020,38 +1023,31 @@
|
|
|
1020
1023
|
]);
|
|
1021
1024
|
return XRFeature;
|
|
1022
1025
|
}();
|
|
1023
|
-
var XRFeatureType
|
|
1024
|
-
(function(XRFeatureType) {
|
|
1026
|
+
var XRFeatureType = /*#__PURE__*/ function(XRFeatureType) {
|
|
1025
1027
|
XRFeatureType[XRFeatureType["AnchorTracking"] = 0] = "AnchorTracking";
|
|
1026
1028
|
XRFeatureType[XRFeatureType["ImageTracking"] = 1] = "ImageTracking";
|
|
1027
1029
|
XRFeatureType[XRFeatureType["PlaneTracking"] = 2] = "PlaneTracking";
|
|
1028
1030
|
XRFeatureType[XRFeatureType["HitTest"] = 3] = "HitTest";
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1031
|
+
return XRFeatureType;
|
|
1032
|
+
}({});
|
|
1033
|
+
var XRRequestTrackingState = /*#__PURE__*/ function(XRRequestTrackingState) {
|
|
1032
1034
|
XRRequestTrackingState[XRRequestTrackingState["None"] = 0] = "None";
|
|
1033
1035
|
XRRequestTrackingState[XRRequestTrackingState["Submitted"] = 1] = "Submitted";
|
|
1034
1036
|
XRRequestTrackingState[XRRequestTrackingState["Resolved"] = 2] = "Resolved";
|
|
1035
1037
|
XRRequestTrackingState[XRRequestTrackingState["Rejected"] = 3] = "Rejected";
|
|
1036
1038
|
XRRequestTrackingState[XRRequestTrackingState["Destroyed"] = 4] = "Destroyed";
|
|
1037
1039
|
XRRequestTrackingState[XRRequestTrackingState["WaitingDestroy"] = 5] = "WaitingDestroy";
|
|
1038
|
-
|
|
1040
|
+
return XRRequestTrackingState;
|
|
1041
|
+
}({});
|
|
1039
1042
|
/**
|
|
1040
1043
|
* The base class of XR trackable manager.
|
|
1041
|
-
*/ var XRTrackableFeature = /*#__PURE__*/ function(
|
|
1042
|
-
|
|
1044
|
+
*/ var XRTrackableFeature = /*#__PURE__*/ function(XRFeature) {
|
|
1045
|
+
_inherits(XRTrackableFeature, XRFeature);
|
|
1046
|
+
function XRTrackableFeature() {
|
|
1043
1047
|
var _this;
|
|
1044
|
-
_this =
|
|
1045
|
-
_this._requestTrackings = [];
|
|
1046
|
-
_this._tracked = [];
|
|
1047
|
-
_this._added = [];
|
|
1048
|
-
_this._updated = [];
|
|
1049
|
-
_this._removed = [];
|
|
1050
|
-
_this._statusSnapshot = {};
|
|
1051
|
-
_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();
|
|
1052
1049
|
return _this;
|
|
1053
|
-
}
|
|
1054
|
-
_inherits(XRTrackableFeature, XRFeature1);
|
|
1050
|
+
}
|
|
1055
1051
|
var _proto = XRTrackableFeature.prototype;
|
|
1056
1052
|
/**
|
|
1057
1053
|
* Add a listening function for tracked object changes.
|
|
@@ -1168,9 +1164,7 @@
|
|
|
1168
1164
|
};
|
|
1169
1165
|
return XRTrackableFeature;
|
|
1170
1166
|
}(XRFeature);
|
|
1171
|
-
|
|
1172
|
-
XRTrackableFeature._uuid = 0;
|
|
1173
|
-
})();
|
|
1167
|
+
XRTrackableFeature._uuid = 0;
|
|
1174
1168
|
/**
|
|
1175
1169
|
* The base class of XR tracked object.
|
|
1176
1170
|
*/ var XRTracked = function XRTracked() {
|
|
@@ -1180,11 +1174,11 @@
|
|
|
1180
1174
|
/**
|
|
1181
1175
|
* Enum for the types of hit test that can be performed.
|
|
1182
1176
|
* Note: currently only supports plane.
|
|
1183
|
-
*/ var TrackableType
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
TrackableType
|
|
1187
|
-
}
|
|
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
|
+
}({});
|
|
1188
1182
|
/**
|
|
1189
1183
|
* XR hit result.
|
|
1190
1184
|
* It is the detection result returned by using XR HitTest feature.
|
|
@@ -1207,7 +1201,7 @@
|
|
|
1207
1201
|
PERFORMANCE OF THIS SOFTWARE.
|
|
1208
1202
|
***************************************************************************** */ function __decorate(decorators, target, key, desc) {
|
|
1209
1203
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1210
|
-
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);
|
|
1211
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;
|
|
1212
1206
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1213
1207
|
}
|
|
@@ -1217,13 +1211,13 @@
|
|
|
1217
1211
|
};
|
|
1218
1212
|
/**
|
|
1219
1213
|
* Enumerates modes of plane in XR.
|
|
1220
|
-
*/ var XRPlaneMode
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
XRPlaneMode
|
|
1226
|
-
}
|
|
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
|
+
}({});
|
|
1227
1221
|
/**
|
|
1228
1222
|
* @internal
|
|
1229
1223
|
*/ var XRRequestTracking = function XRRequestTracking() {
|
|
@@ -1232,44 +1226,41 @@
|
|
|
1232
1226
|
};
|
|
1233
1227
|
/**
|
|
1234
1228
|
* The request plane in XR space.
|
|
1235
|
-
*/ var XRRequestPlane = /*#__PURE__*/ function(
|
|
1236
|
-
|
|
1229
|
+
*/ var XRRequestPlane = /*#__PURE__*/ function(XRRequestTracking) {
|
|
1230
|
+
_inherits(XRRequestPlane, XRRequestTracking);
|
|
1231
|
+
function XRRequestPlane(detectionMode) {
|
|
1237
1232
|
var _this;
|
|
1238
|
-
_this =
|
|
1239
|
-
_this.detectionMode = detectionMode;
|
|
1233
|
+
_this = XRRequestTracking.call(this) || this, _this.detectionMode = detectionMode;
|
|
1240
1234
|
return _this;
|
|
1241
|
-
}
|
|
1242
|
-
_inherits(XRRequestPlane, XRRequestTracking1);
|
|
1235
|
+
}
|
|
1243
1236
|
return XRRequestPlane;
|
|
1244
1237
|
}(XRRequestTracking);
|
|
1245
1238
|
/**
|
|
1246
1239
|
* The tracked plane in XR space.
|
|
1247
|
-
*/ var XRTrackedPlane = /*#__PURE__*/ function(
|
|
1248
|
-
|
|
1240
|
+
*/ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked) {
|
|
1241
|
+
_inherits(XRTrackedPlane, XRTracked);
|
|
1242
|
+
function XRTrackedPlane() {
|
|
1249
1243
|
var _this;
|
|
1250
|
-
_this =
|
|
1251
|
-
/** The points that make up this plane.
|
|
1244
|
+
_this = XRTracked.apply(this, arguments) || this, /** The points that make up this plane.
|
|
1252
1245
|
* Note: These points are in the plane coordinate system,
|
|
1253
1246
|
* and their Y coordinates are all zero.
|
|
1254
|
-
*/ _this.polygon = []
|
|
1255
|
-
/**
|
|
1247
|
+
*/ _this.polygon = [], /**
|
|
1256
1248
|
* Whether this frame changes the attributes of the plane.
|
|
1257
1249
|
* Note: Includes `polygon` but no `pose`.
|
|
1258
1250
|
*/ _this.attributesDirty = false;
|
|
1259
1251
|
return _this;
|
|
1260
|
-
}
|
|
1261
|
-
_inherits(XRTrackedPlane, XRTracked1);
|
|
1252
|
+
}
|
|
1262
1253
|
return XRTrackedPlane;
|
|
1263
1254
|
}(XRTracked);
|
|
1264
1255
|
var XRPlaneTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
|
|
1265
|
-
|
|
1256
|
+
_inherits(XRPlaneTracking, XRTrackableFeature1);
|
|
1257
|
+
function XRPlaneTracking(xrManager, detectionMode) {
|
|
1266
1258
|
if (detectionMode === void 0) detectionMode = XRPlaneMode.EveryThing;
|
|
1267
1259
|
var _this;
|
|
1268
1260
|
_this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.PlaneTracking, detectionMode) || this;
|
|
1269
1261
|
_this._addRequestTracking(new XRRequestPlane(detectionMode));
|
|
1270
1262
|
return _this;
|
|
1271
|
-
}
|
|
1272
|
-
_inherits(XRPlaneTracking, XRTrackableFeature1);
|
|
1263
|
+
}
|
|
1273
1264
|
var _proto = XRPlaneTracking.prototype;
|
|
1274
1265
|
_proto._generateTracked = function _generateTracked() {
|
|
1275
1266
|
var plane = new XRTrackedPlane();
|
|
@@ -1299,22 +1290,13 @@
|
|
|
1299
1290
|
XRPlaneTracking = __decorate([
|
|
1300
1291
|
registerXRFeature(XRFeatureType.PlaneTracking)
|
|
1301
1292
|
], XRPlaneTracking);
|
|
1302
|
-
var XRHitTest = /*#__PURE__*/ function(
|
|
1303
|
-
|
|
1293
|
+
var XRHitTest = /*#__PURE__*/ function(XRFeature) {
|
|
1294
|
+
_inherits(XRHitTest, XRFeature);
|
|
1295
|
+
function XRHitTest(xrManager) {
|
|
1304
1296
|
var _this;
|
|
1305
|
-
_this =
|
|
1306
|
-
_this._tempRay = new engine.Ray();
|
|
1307
|
-
_this._tempPlane = new engine.Plane();
|
|
1308
|
-
_this._tempVec2 = new engine.Vector2();
|
|
1309
|
-
_this._tempVec30 = new engine.Vector3();
|
|
1310
|
-
_this._tempVec31 = new engine.Vector3();
|
|
1311
|
-
_this._tempVec32 = new engine.Vector3();
|
|
1312
|
-
_this._tempVec33 = new engine.Vector3();
|
|
1313
|
-
_this._tempVec34 = new engine.Vector3();
|
|
1314
|
-
_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();
|
|
1315
1298
|
return _this;
|
|
1316
|
-
}
|
|
1317
|
-
_inherits(XRHitTest, XRFeature1);
|
|
1299
|
+
}
|
|
1318
1300
|
var _proto = XRHitTest.prototype;
|
|
1319
1301
|
/**
|
|
1320
1302
|
* Hit test.
|
|
@@ -1409,34 +1391,31 @@
|
|
|
1409
1391
|
], XRHitTest);
|
|
1410
1392
|
/**
|
|
1411
1393
|
* The anchor in XR space.
|
|
1412
|
-
*/ var XRAnchor$1 = /*#__PURE__*/ function(
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1394
|
+
*/ var XRAnchor$1 = /*#__PURE__*/ function(XRTracked) {
|
|
1395
|
+
_inherits(XRAnchor, XRTracked);
|
|
1396
|
+
function XRAnchor() {
|
|
1397
|
+
return XRTracked.apply(this, arguments) || this;
|
|
1398
|
+
}
|
|
1417
1399
|
return XRAnchor;
|
|
1418
1400
|
}(XRTracked);
|
|
1419
1401
|
/**
|
|
1420
1402
|
* The request anchor in XR space.
|
|
1421
|
-
*/ var XRRequestAnchor = /*#__PURE__*/ function(
|
|
1422
|
-
|
|
1403
|
+
*/ var XRRequestAnchor = /*#__PURE__*/ function(XRRequestTracking) {
|
|
1404
|
+
_inherits(XRRequestAnchor, XRRequestTracking);
|
|
1405
|
+
function XRRequestAnchor(position, rotation) {
|
|
1423
1406
|
var _this;
|
|
1424
|
-
_this =
|
|
1425
|
-
_this.position = position;
|
|
1426
|
-
_this.rotation = rotation;
|
|
1407
|
+
_this = XRRequestTracking.call(this) || this, _this.position = position, _this.rotation = rotation;
|
|
1427
1408
|
return _this;
|
|
1428
|
-
}
|
|
1429
|
-
_inherits(XRRequestAnchor, XRRequestTracking1);
|
|
1409
|
+
}
|
|
1430
1410
|
return XRRequestAnchor;
|
|
1431
1411
|
}(XRRequestTracking);
|
|
1432
1412
|
var XRAnchorTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
|
|
1433
|
-
|
|
1413
|
+
_inherits(XRAnchorTracking, XRTrackableFeature1);
|
|
1414
|
+
function XRAnchorTracking(xrManager) {
|
|
1434
1415
|
var _this;
|
|
1435
|
-
_this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.AnchorTracking) || this;
|
|
1436
|
-
_this._anchors = [];
|
|
1416
|
+
_this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.AnchorTracking) || this, _this._anchors = [];
|
|
1437
1417
|
return _this;
|
|
1438
|
-
}
|
|
1439
|
-
_inherits(XRAnchorTracking, XRTrackableFeature1);
|
|
1418
|
+
}
|
|
1440
1419
|
var _proto = XRAnchorTracking.prototype;
|
|
1441
1420
|
/**
|
|
1442
1421
|
* Add a anchor in XR space.
|
|
@@ -1508,27 +1487,27 @@
|
|
|
1508
1487
|
], XRAnchorTracking);
|
|
1509
1488
|
/**
|
|
1510
1489
|
* The request image in XR space.
|
|
1511
|
-
*/ var XRRequestImage = /*#__PURE__*/ function(
|
|
1512
|
-
|
|
1490
|
+
*/ var XRRequestImage = /*#__PURE__*/ function(XRRequestTracking) {
|
|
1491
|
+
_inherits(XRRequestImage, XRRequestTracking);
|
|
1492
|
+
function XRRequestImage(image) {
|
|
1513
1493
|
var _this;
|
|
1514
|
-
_this =
|
|
1515
|
-
_this.image = image;
|
|
1494
|
+
_this = XRRequestTracking.call(this) || this, _this.image = image;
|
|
1516
1495
|
return _this;
|
|
1517
|
-
}
|
|
1518
|
-
_inherits(XRRequestImage, XRRequestTracking1);
|
|
1496
|
+
}
|
|
1519
1497
|
return XRRequestImage;
|
|
1520
1498
|
}(XRRequestTracking);
|
|
1521
1499
|
/**
|
|
1522
1500
|
* A tracked image in XR space.
|
|
1523
|
-
*/ var XRTrackedImage = /*#__PURE__*/ function(
|
|
1524
|
-
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1501
|
+
*/ var XRTrackedImage = /*#__PURE__*/ function(XRTracked) {
|
|
1502
|
+
_inherits(XRTrackedImage, XRTracked);
|
|
1503
|
+
function XRTrackedImage() {
|
|
1504
|
+
return XRTracked.apply(this, arguments) || this;
|
|
1505
|
+
}
|
|
1528
1506
|
return XRTrackedImage;
|
|
1529
1507
|
}(XRTracked);
|
|
1530
1508
|
var XRImageTracking = /*#__PURE__*/ function(XRTrackableFeature1) {
|
|
1531
|
-
|
|
1509
|
+
_inherits(XRImageTracking, XRTrackableFeature1);
|
|
1510
|
+
function XRImageTracking(xrManager, trackingImages) {
|
|
1532
1511
|
var _this;
|
|
1533
1512
|
_this = XRTrackableFeature1.call(this, xrManager, XRFeatureType.ImageTracking, trackingImages) || this;
|
|
1534
1513
|
_this._trackingImages = trackingImages;
|
|
@@ -1541,8 +1520,7 @@
|
|
|
1541
1520
|
console.warn("No image to be tracked.");
|
|
1542
1521
|
}
|
|
1543
1522
|
return _this;
|
|
1544
|
-
}
|
|
1545
|
-
_inherits(XRImageTracking, XRTrackableFeature1);
|
|
1523
|
+
}
|
|
1546
1524
|
var _proto = XRImageTracking.prototype;
|
|
1547
1525
|
_proto._generateTracked = function _generateTracked() {
|
|
1548
1526
|
var image = new XRTrackedImage();
|
|
@@ -1580,7 +1558,7 @@
|
|
|
1580
1558
|
this.physicalWidth = physicalWidth;
|
|
1581
1559
|
};
|
|
1582
1560
|
var XRReferenceImageDecoder = /*#__PURE__*/ function() {
|
|
1583
|
-
|
|
1561
|
+
function XRReferenceImageDecoder() {}
|
|
1584
1562
|
XRReferenceImageDecoder.decode = function decode(engine, bufferReader) {
|
|
1585
1563
|
return new Promise(function(resolve, reject) {
|
|
1586
1564
|
var physicalWidth = bufferReader.nextFloat32();
|
|
@@ -1609,11 +1587,11 @@
|
|
|
1609
1587
|
};
|
|
1610
1588
|
return _extends.apply(this, arguments);
|
|
1611
1589
|
}
|
|
1612
|
-
var XRReferenceImageLoader = /*#__PURE__*/ function(
|
|
1613
|
-
|
|
1614
|
-
|
|
1615
|
-
|
|
1616
|
-
|
|
1590
|
+
var XRReferenceImageLoader = /*#__PURE__*/ function(Loader) {
|
|
1591
|
+
_inherits(XRReferenceImageLoader, Loader);
|
|
1592
|
+
function XRReferenceImageLoader() {
|
|
1593
|
+
return Loader.apply(this, arguments) || this;
|
|
1594
|
+
}
|
|
1617
1595
|
var _proto = XRReferenceImageLoader.prototype;
|
|
1618
1596
|
_proto.load = function load(item, resourceManager) {
|
|
1619
1597
|
return new engine.AssetPromise(function(resolve, reject) {
|
|
@@ -1634,17 +1612,18 @@
|
|
|
1634
1612
|
], XRReferenceImageLoader);
|
|
1635
1613
|
|
|
1636
1614
|
function _is_native_reflect_construct() {
|
|
1637
|
-
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
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.
|
|
1641
1619
|
try {
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
} catch (
|
|
1646
|
-
|
|
1647
|
-
|
|
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
|
+
})();
|
|
1648
1627
|
}
|
|
1649
1628
|
|
|
1650
1629
|
function _construct(Parent, args, Class) {
|
|
@@ -1713,33 +1692,6 @@
|
|
|
1713
1692
|
}
|
|
1714
1693
|
}
|
|
1715
1694
|
|
|
1716
|
-
/**
|
|
1717
|
-
* Defines how the bounding volumes intersects or contain one another.
|
|
1718
|
-
*/ var ContainmentType;
|
|
1719
|
-
(function(ContainmentType) {
|
|
1720
|
-
ContainmentType[ContainmentType[/** Indicates that there is no overlap between two bounding volumes. */ "Disjoint"] = 0] = "Disjoint";
|
|
1721
|
-
ContainmentType[ContainmentType[/** Indicates that one bounding volume completely contains another volume. */ "Contains"] = 1] = "Contains";
|
|
1722
|
-
ContainmentType[ContainmentType[/** Indicates that bounding volumes partially overlap one another. */ "Intersects"] = 2] = "Intersects";
|
|
1723
|
-
})(ContainmentType || (ContainmentType = {}));
|
|
1724
|
-
/**
|
|
1725
|
-
* Defines the intersection between a plane and a bounding volume.
|
|
1726
|
-
*/ var PlaneIntersectionType;
|
|
1727
|
-
(function(PlaneIntersectionType) {
|
|
1728
|
-
PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the back of the plane. */ "Back"] = 0] = "Back";
|
|
1729
|
-
PlaneIntersectionType[PlaneIntersectionType[/** There is no intersection, the bounding volume is in the front of the plane. */ "Front"] = 1] = "Front";
|
|
1730
|
-
PlaneIntersectionType[PlaneIntersectionType[/** The plane is intersected. */ "Intersecting"] = 2] = "Intersecting";
|
|
1731
|
-
})(PlaneIntersectionType || (PlaneIntersectionType = {}));
|
|
1732
|
-
/**
|
|
1733
|
-
* Frustum face
|
|
1734
|
-
*/ var FrustumFace;
|
|
1735
|
-
(function(FrustumFace) {
|
|
1736
|
-
FrustumFace[FrustumFace[/** Near face */ "Near"] = 0] = "Near";
|
|
1737
|
-
FrustumFace[FrustumFace[/** Far face */ "Far"] = 1] = "Far";
|
|
1738
|
-
FrustumFace[FrustumFace[/** Left face */ "Left"] = 2] = "Left";
|
|
1739
|
-
FrustumFace[FrustumFace[/** Right face */ "Right"] = 3] = "Right";
|
|
1740
|
-
FrustumFace[FrustumFace[/** Bottom face */ "Bottom"] = 4] = "Bottom";
|
|
1741
|
-
FrustumFace[FrustumFace[/** Top face */ "Top"] = 5] = "Top";
|
|
1742
|
-
})(FrustumFace || (FrustumFace = {}));
|
|
1743
1695
|
function _defineProperties(target, props) {
|
|
1744
1696
|
for(var i = 0; i < props.length; i++){
|
|
1745
1697
|
var descriptor = props[i];
|
|
@@ -1757,7 +1709,7 @@
|
|
|
1757
1709
|
/**
|
|
1758
1710
|
* Common utility methods for math operations.
|
|
1759
1711
|
*/ var MathUtil = /*#__PURE__*/ function() {
|
|
1760
|
-
|
|
1712
|
+
function MathUtil() {}
|
|
1761
1713
|
/**
|
|
1762
1714
|
* Clamps the specified value.
|
|
1763
1715
|
* @param v - The specified value
|
|
@@ -1808,19 +1760,13 @@
|
|
|
1808
1760
|
};
|
|
1809
1761
|
return MathUtil;
|
|
1810
1762
|
}();
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
(function() {
|
|
1815
|
-
/** The conversion factor that radian to degree. */ MathUtil.radToDegreeFactor = 180 / Math.PI;
|
|
1816
|
-
})();
|
|
1817
|
-
(function() {
|
|
1818
|
-
/** The conversion factor that degree to radian. */ MathUtil.degreeToRadFactor = Math.PI / 180;
|
|
1819
|
-
})();
|
|
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;
|
|
1820
1766
|
/**
|
|
1821
1767
|
* Describes a 3D-vector.
|
|
1822
1768
|
*/ var Vector3 = /*#__PURE__*/ function() {
|
|
1823
|
-
|
|
1769
|
+
function Vector3(x, y, z) {
|
|
1824
1770
|
if (x === void 0) x = 0;
|
|
1825
1771
|
if (y === void 0) y = 0;
|
|
1826
1772
|
if (z === void 0) z = 0;
|
|
@@ -1828,7 +1774,7 @@
|
|
|
1828
1774
|
this._x = x;
|
|
1829
1775
|
this._y = y;
|
|
1830
1776
|
this._z = z;
|
|
1831
|
-
}
|
|
1777
|
+
}
|
|
1832
1778
|
var _proto = Vector3.prototype;
|
|
1833
1779
|
/**
|
|
1834
1780
|
* Set the value of this vector.
|
|
@@ -2324,655 +2270,18 @@
|
|
|
2324
2270
|
]);
|
|
2325
2271
|
return Vector3;
|
|
2326
2272
|
}();
|
|
2327
|
-
(
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
(
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
|
|
2335
|
-
* */ var BoundingSphere = /*#__PURE__*/ function() {
|
|
2336
|
-
var BoundingSphere = function BoundingSphere(center, radius) {
|
|
2337
|
-
if (center === void 0) center = null;
|
|
2338
|
-
if (radius === void 0) radius = 0;
|
|
2339
|
-
/** The center point of the sphere. */ this.center = new Vector3();
|
|
2340
|
-
/** The radius of the sphere. */ this.radius = 0;
|
|
2341
|
-
center && this.center.copyFrom(center);
|
|
2342
|
-
this.radius = radius;
|
|
2343
|
-
};
|
|
2344
|
-
var _proto = BoundingSphere.prototype;
|
|
2345
|
-
/**
|
|
2346
|
-
* Creates a clone of this sphere.
|
|
2347
|
-
* @returns A clone of this sphere
|
|
2348
|
-
*/ _proto.clone = function clone() {
|
|
2349
|
-
return new BoundingSphere(this.center, this.radius);
|
|
2350
|
-
};
|
|
2351
|
-
/**
|
|
2352
|
-
* Copy this sphere from the specified sphere.
|
|
2353
|
-
* @param source - The specified sphere
|
|
2354
|
-
* @returns This sphere
|
|
2355
|
-
*/ _proto.copyFrom = function copyFrom(source) {
|
|
2356
|
-
this.center.copyFrom(source.center);
|
|
2357
|
-
this.radius = source.radius;
|
|
2358
|
-
return this;
|
|
2359
|
-
};
|
|
2360
|
-
/**
|
|
2361
|
-
* Calculate a bounding sphere that fully contains the given points.
|
|
2362
|
-
* @param points - The given points
|
|
2363
|
-
* @param out - The calculated bounding sphere
|
|
2364
|
-
*/ BoundingSphere.fromPoints = function fromPoints(points, out) {
|
|
2365
|
-
if (!points || points.length === 0) {
|
|
2366
|
-
throw new Error("points must be array and length must > 0");
|
|
2367
|
-
}
|
|
2368
|
-
var len = points.length;
|
|
2369
|
-
var center = BoundingSphere._tempVec30;
|
|
2370
|
-
center.x = center.y = center.z = 0;
|
|
2371
|
-
// Calculate the center of the sphere.
|
|
2372
|
-
for(var i = 0; i < len; ++i){
|
|
2373
|
-
Vector3.add(points[i], center, center);
|
|
2374
|
-
}
|
|
2375
|
-
// The center of the sphere.
|
|
2376
|
-
Vector3.scale(center, 1 / len, out.center);
|
|
2377
|
-
// Calculate the radius of the sphere.
|
|
2378
|
-
var radius = 0.0;
|
|
2379
|
-
for(var i1 = 0; i1 < len; ++i1){
|
|
2380
|
-
var distance = Vector3.distanceSquared(center, points[i1]);
|
|
2381
|
-
distance > radius && (radius = distance);
|
|
2382
|
-
}
|
|
2383
|
-
// The radius of the sphere.
|
|
2384
|
-
out.radius = Math.sqrt(radius);
|
|
2385
|
-
};
|
|
2386
|
-
/**
|
|
2387
|
-
* Calculate a bounding sphere from a given box.
|
|
2388
|
-
* @param box - The given box
|
|
2389
|
-
* @param out - The calculated bounding sphere
|
|
2390
|
-
*/ BoundingSphere.fromBox = function fromBox(box, out) {
|
|
2391
|
-
var center = out.center;
|
|
2392
|
-
var min = box.min, max = box.max;
|
|
2393
|
-
center.x = (min.x + max.x) * 0.5;
|
|
2394
|
-
center.y = (min.y + max.y) * 0.5;
|
|
2395
|
-
center.z = (min.z + max.z) * 0.5;
|
|
2396
|
-
out.radius = Vector3.distance(center, max);
|
|
2397
|
-
};
|
|
2398
|
-
return BoundingSphere;
|
|
2399
|
-
}();
|
|
2400
|
-
(function() {
|
|
2401
|
-
BoundingSphere._tempVec30 = new Vector3();
|
|
2402
|
-
})();
|
|
2403
|
-
/**
|
|
2404
|
-
* Axis Aligned Bound Box (AABB).
|
|
2405
|
-
*/ var BoundingBox = /*#__PURE__*/ function() {
|
|
2406
|
-
var BoundingBox = function BoundingBox(min, max) {
|
|
2407
|
-
if (min === void 0) min = null;
|
|
2408
|
-
if (max === void 0) max = null;
|
|
2409
|
-
/** The minimum point of the box. */ this.min = new Vector3();
|
|
2410
|
-
/** The maximum point of the box. */ this.max = new Vector3();
|
|
2411
|
-
min && this.min.copyFrom(min);
|
|
2412
|
-
max && this.max.copyFrom(max);
|
|
2413
|
-
};
|
|
2414
|
-
var _proto = BoundingBox.prototype;
|
|
2415
|
-
/**
|
|
2416
|
-
* Get the center point of this bounding box.
|
|
2417
|
-
* @param out - The center point of this bounding box
|
|
2418
|
-
* @returns The center point of this bounding box
|
|
2419
|
-
*/ _proto.getCenter = function getCenter(out) {
|
|
2420
|
-
var _this = this, min = _this.min, max = _this.max;
|
|
2421
|
-
var centerX = max._x + min._x;
|
|
2422
|
-
var centerY = max._y + min._y;
|
|
2423
|
-
var centerZ = max._z + min._z;
|
|
2424
|
-
out.set(isNaN(centerX) ? 0 : centerX * 0.5, isNaN(centerY) ? 0 : centerY * 0.5, isNaN(centerZ) ? 0 : centerZ * 0.5);
|
|
2425
|
-
return out;
|
|
2426
|
-
};
|
|
2427
|
-
/**
|
|
2428
|
-
* Get the extent of this bounding box.
|
|
2429
|
-
* @param out - The extent of this bounding box
|
|
2430
|
-
* @returns The extent of this bounding box
|
|
2431
|
-
*/ _proto.getExtent = function getExtent(out) {
|
|
2432
|
-
var _this = this, min = _this.min, max = _this.max;
|
|
2433
|
-
var extentX = max._x - min._x;
|
|
2434
|
-
var extentY = max._y - min._y;
|
|
2435
|
-
var extentZ = max._z - min._z;
|
|
2436
|
-
out.set(isNaN(extentX) ? 0 : extentX * 0.5, isNaN(extentY) ? 0 : extentY * 0.5, isNaN(extentZ) ? 0 : extentZ * 0.5);
|
|
2437
|
-
return out;
|
|
2438
|
-
};
|
|
2439
|
-
/**
|
|
2440
|
-
* Get the eight corners of this bounding box.
|
|
2441
|
-
* @param out - An array of points representing the eight corners of this bounding box
|
|
2442
|
-
* @returns An array of points representing the eight corners of this bounding box
|
|
2443
|
-
*/ _proto.getCorners = function getCorners(out) {
|
|
2444
|
-
if (out === void 0) out = [];
|
|
2445
|
-
var _this = this, min = _this.min, max = _this.max;
|
|
2446
|
-
var minX = min.x;
|
|
2447
|
-
var minY = min.y;
|
|
2448
|
-
var minZ = min.z;
|
|
2449
|
-
var maxX = max.x;
|
|
2450
|
-
var maxY = max.y;
|
|
2451
|
-
var maxZ = max.z;
|
|
2452
|
-
var len = out.length;
|
|
2453
|
-
// The array length is less than 8 to make up
|
|
2454
|
-
if (len < 8) {
|
|
2455
|
-
for(var i = 0, l = 8 - len; i < l; ++i){
|
|
2456
|
-
out[len + i] = new Vector3();
|
|
2457
|
-
}
|
|
2458
|
-
}
|
|
2459
|
-
out[0].set(minX, maxY, maxZ);
|
|
2460
|
-
out[1].set(maxX, maxY, maxZ);
|
|
2461
|
-
out[2].set(maxX, minY, maxZ);
|
|
2462
|
-
out[3].set(minX, minY, maxZ);
|
|
2463
|
-
out[4].set(minX, maxY, minZ);
|
|
2464
|
-
out[5].set(maxX, maxY, minZ);
|
|
2465
|
-
out[6].set(maxX, minY, minZ);
|
|
2466
|
-
out[7].set(minX, minY, minZ);
|
|
2467
|
-
return out;
|
|
2468
|
-
};
|
|
2469
|
-
/**
|
|
2470
|
-
* Transform a bounding box.
|
|
2471
|
-
* @param matrix - The transform to apply to the bounding box
|
|
2472
|
-
* @returns The transformed bounding box
|
|
2473
|
-
*/ _proto.transform = function transform(matrix) {
|
|
2474
|
-
BoundingBox.transform(this, matrix, this);
|
|
2475
|
-
return this;
|
|
2476
|
-
};
|
|
2477
|
-
/**
|
|
2478
|
-
* Creates a clone of this box.
|
|
2479
|
-
* @returns A clone of this box
|
|
2480
|
-
*/ _proto.clone = function clone() {
|
|
2481
|
-
return new BoundingBox(this.min, this.max);
|
|
2482
|
-
};
|
|
2483
|
-
/**
|
|
2484
|
-
* Copy this bounding box from the specified box.
|
|
2485
|
-
* @param source - The specified box
|
|
2486
|
-
* @returns This bounding box
|
|
2487
|
-
*/ _proto.copyFrom = function copyFrom(source) {
|
|
2488
|
-
this.min.copyFrom(source.min);
|
|
2489
|
-
this.max.copyFrom(source.max);
|
|
2490
|
-
return this;
|
|
2491
|
-
};
|
|
2492
|
-
/**
|
|
2493
|
-
* Calculate a bounding box from the center point and the extent of the bounding box.
|
|
2494
|
-
* @param center - The center point
|
|
2495
|
-
* @param extent - The extent of the bounding box
|
|
2496
|
-
* @param out - The calculated bounding box
|
|
2497
|
-
*/ BoundingBox.fromCenterAndExtent = function fromCenterAndExtent(center, extent, out) {
|
|
2498
|
-
Vector3.subtract(center, extent, out.min);
|
|
2499
|
-
Vector3.add(center, extent, out.max);
|
|
2500
|
-
};
|
|
2501
|
-
/**
|
|
2502
|
-
* Calculate a bounding box that fully contains the given points.
|
|
2503
|
-
* @param points - The given points
|
|
2504
|
-
* @param out - The calculated bounding box
|
|
2505
|
-
*/ BoundingBox.fromPoints = function fromPoints(points, out) {
|
|
2506
|
-
if (!points || points.length === 0) {
|
|
2507
|
-
throw new Error("points must be array and length must > 0");
|
|
2508
|
-
}
|
|
2509
|
-
var min = out.min, max = out.max;
|
|
2510
|
-
min.x = min.y = min.z = Number.MAX_VALUE;
|
|
2511
|
-
max.x = max.y = max.z = -Number.MAX_VALUE;
|
|
2512
|
-
for(var i = 0, l = points.length; i < l; ++i){
|
|
2513
|
-
var point = points[i];
|
|
2514
|
-
Vector3.min(min, point, min);
|
|
2515
|
-
Vector3.max(max, point, max);
|
|
2516
|
-
}
|
|
2517
|
-
};
|
|
2518
|
-
/**
|
|
2519
|
-
* Calculate a bounding box from a given sphere.
|
|
2520
|
-
* @param sphere - The given sphere
|
|
2521
|
-
* @param out - The calculated bounding box
|
|
2522
|
-
*/ BoundingBox.fromSphere = function fromSphere(sphere, out) {
|
|
2523
|
-
var center = sphere.center, radius = sphere.radius;
|
|
2524
|
-
var min = out.min, max = out.max;
|
|
2525
|
-
min.x = center.x - radius;
|
|
2526
|
-
min.y = center.y - radius;
|
|
2527
|
-
min.z = center.z - radius;
|
|
2528
|
-
max.x = center.x + radius;
|
|
2529
|
-
max.y = center.y + radius;
|
|
2530
|
-
max.z = center.z + radius;
|
|
2531
|
-
};
|
|
2532
|
-
/**
|
|
2533
|
-
* Transform a bounding box.
|
|
2534
|
-
* @param source - The original bounding box
|
|
2535
|
-
* @param matrix - The transform to apply to the bounding box
|
|
2536
|
-
* @param out - The transformed bounding box
|
|
2537
|
-
*/ BoundingBox.transform = function transform(source, matrix, out) {
|
|
2538
|
-
// https://zeux.io/2010/10/17/aabb-from-obb-with-component-wise-abs/
|
|
2539
|
-
var center = BoundingBox._tempVec30;
|
|
2540
|
-
var extent = BoundingBox._tempVec31;
|
|
2541
|
-
source.getCenter(center);
|
|
2542
|
-
source.getExtent(extent);
|
|
2543
|
-
Vector3.transformCoordinate(center, matrix, center);
|
|
2544
|
-
var x = extent.x, y = extent.y, z = extent.z;
|
|
2545
|
-
var e = matrix.elements;
|
|
2546
|
-
// prettier-ignore
|
|
2547
|
-
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];
|
|
2548
|
-
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)));
|
|
2549
|
-
// set min、max
|
|
2550
|
-
Vector3.subtract(center, extent, out.min);
|
|
2551
|
-
Vector3.add(center, extent, out.max);
|
|
2552
|
-
};
|
|
2553
|
-
/**
|
|
2554
|
-
* Calculate a bounding box that is as large as the total combined area of the two specified boxes.
|
|
2555
|
-
* @param box1 - The first box to merge
|
|
2556
|
-
* @param box2 - The second box to merge
|
|
2557
|
-
* @param out - The merged bounding box
|
|
2558
|
-
* @returns The merged bounding box
|
|
2559
|
-
*/ BoundingBox.merge = function merge(box1, box2, out) {
|
|
2560
|
-
Vector3.min(box1.min, box2.min, out.min);
|
|
2561
|
-
Vector3.max(box1.max, box2.max, out.max);
|
|
2562
|
-
return out;
|
|
2563
|
-
};
|
|
2564
|
-
return BoundingBox;
|
|
2565
|
-
}();
|
|
2566
|
-
(function() {
|
|
2567
|
-
BoundingBox._tempVec30 = new Vector3();
|
|
2568
|
-
})();
|
|
2569
|
-
(function() {
|
|
2570
|
-
BoundingBox._tempVec31 = new Vector3();
|
|
2571
|
-
})();
|
|
2572
|
-
/**
|
|
2573
|
-
* Contains static methods to help in determining intersections, containment, etc.
|
|
2574
|
-
*/ var CollisionUtil = /*#__PURE__*/ function() {
|
|
2575
|
-
var CollisionUtil = function CollisionUtil() {};
|
|
2576
|
-
/**
|
|
2577
|
-
* Calculate the intersection point of three plane.
|
|
2578
|
-
* @param p1 - Plane 1
|
|
2579
|
-
* @param p2 - Plane 2
|
|
2580
|
-
* @param p3 - Plane 3
|
|
2581
|
-
* @param out - intersection point
|
|
2582
|
-
*/ CollisionUtil.intersectionPointThreePlanes = function intersectionPointThreePlanes(p1, p2, p3, out) {
|
|
2583
|
-
var p1Nor = p1.normal;
|
|
2584
|
-
var p2Nor = p2.normal;
|
|
2585
|
-
var p3Nor = p3.normal;
|
|
2586
|
-
Vector3.cross(p2Nor, p3Nor, CollisionUtil._tempVec30);
|
|
2587
|
-
Vector3.cross(p3Nor, p1Nor, CollisionUtil._tempVec31);
|
|
2588
|
-
Vector3.cross(p1Nor, p2Nor, CollisionUtil._tempVec32);
|
|
2589
|
-
var a = -Vector3.dot(p1Nor, CollisionUtil._tempVec30);
|
|
2590
|
-
var b = -Vector3.dot(p2Nor, CollisionUtil._tempVec31);
|
|
2591
|
-
var c = -Vector3.dot(p3Nor, CollisionUtil._tempVec32);
|
|
2592
|
-
Vector3.scale(CollisionUtil._tempVec30, p1.distance / a, CollisionUtil._tempVec30);
|
|
2593
|
-
Vector3.scale(CollisionUtil._tempVec31, p2.distance / b, CollisionUtil._tempVec31);
|
|
2594
|
-
Vector3.scale(CollisionUtil._tempVec32, p3.distance / c, CollisionUtil._tempVec32);
|
|
2595
|
-
Vector3.add(CollisionUtil._tempVec30, CollisionUtil._tempVec31, out);
|
|
2596
|
-
Vector3.add(out, CollisionUtil._tempVec32, out);
|
|
2597
|
-
};
|
|
2598
|
-
/**
|
|
2599
|
-
* Calculate the distance from a point to a plane.
|
|
2600
|
-
* @param plane - The plane
|
|
2601
|
-
* @param point - The point
|
|
2602
|
-
* @returns The distance from a point to a plane
|
|
2603
|
-
*/ CollisionUtil.distancePlaneAndPoint = function distancePlaneAndPoint(plane, point) {
|
|
2604
|
-
return Vector3.dot(plane.normal, point) + plane.distance;
|
|
2605
|
-
};
|
|
2606
|
-
/**
|
|
2607
|
-
* Get the intersection type between a plane and a point.
|
|
2608
|
-
* @param plane - The plane
|
|
2609
|
-
* @param point - The point
|
|
2610
|
-
* @returns The intersection type
|
|
2611
|
-
*/ CollisionUtil.intersectsPlaneAndPoint = function intersectsPlaneAndPoint(plane, point) {
|
|
2612
|
-
var distance = CollisionUtil.distancePlaneAndPoint(plane, point);
|
|
2613
|
-
if (distance > 0) {
|
|
2614
|
-
return PlaneIntersectionType.Front;
|
|
2615
|
-
}
|
|
2616
|
-
if (distance < 0) {
|
|
2617
|
-
return PlaneIntersectionType.Back;
|
|
2618
|
-
}
|
|
2619
|
-
return PlaneIntersectionType.Intersecting;
|
|
2620
|
-
};
|
|
2621
|
-
/**
|
|
2622
|
-
* Get the intersection type between a plane and a box (AABB).
|
|
2623
|
-
* @param plane - The plane
|
|
2624
|
-
* @param box - The box
|
|
2625
|
-
* @returns The intersection type
|
|
2626
|
-
*/ CollisionUtil.intersectsPlaneAndBox = function intersectsPlaneAndBox(plane, box) {
|
|
2627
|
-
var min = box.min, max = box.max;
|
|
2628
|
-
var normal = plane.normal;
|
|
2629
|
-
var front = CollisionUtil._tempVec30;
|
|
2630
|
-
var back = CollisionUtil._tempVec31;
|
|
2631
|
-
if (normal.x >= 0) {
|
|
2632
|
-
front.x = max.x;
|
|
2633
|
-
back.x = min.x;
|
|
2634
|
-
} else {
|
|
2635
|
-
front.x = min.x;
|
|
2636
|
-
back.x = max.x;
|
|
2637
|
-
}
|
|
2638
|
-
if (normal.y >= 0) {
|
|
2639
|
-
front.y = max.y;
|
|
2640
|
-
back.y = min.y;
|
|
2641
|
-
} else {
|
|
2642
|
-
front.y = min.y;
|
|
2643
|
-
back.y = max.y;
|
|
2644
|
-
}
|
|
2645
|
-
if (normal.z >= 0) {
|
|
2646
|
-
front.z = max.z;
|
|
2647
|
-
back.z = min.z;
|
|
2648
|
-
} else {
|
|
2649
|
-
front.z = min.z;
|
|
2650
|
-
back.z = max.z;
|
|
2651
|
-
}
|
|
2652
|
-
if (CollisionUtil.distancePlaneAndPoint(plane, front) < 0) {
|
|
2653
|
-
return PlaneIntersectionType.Back;
|
|
2654
|
-
}
|
|
2655
|
-
if (CollisionUtil.distancePlaneAndPoint(plane, back) > 0) {
|
|
2656
|
-
return PlaneIntersectionType.Front;
|
|
2657
|
-
}
|
|
2658
|
-
return PlaneIntersectionType.Intersecting;
|
|
2659
|
-
};
|
|
2660
|
-
/**
|
|
2661
|
-
* Get the intersection type between a plane and a sphere.
|
|
2662
|
-
* @param plane - The plane
|
|
2663
|
-
* @param sphere - The sphere
|
|
2664
|
-
* @returns The intersection type
|
|
2665
|
-
*/ CollisionUtil.intersectsPlaneAndSphere = function intersectsPlaneAndSphere(plane, sphere) {
|
|
2666
|
-
var center = sphere.center, radius = sphere.radius;
|
|
2667
|
-
var distance = CollisionUtil.distancePlaneAndPoint(plane, center);
|
|
2668
|
-
if (distance > radius) {
|
|
2669
|
-
return PlaneIntersectionType.Front;
|
|
2670
|
-
}
|
|
2671
|
-
if (distance < -radius) {
|
|
2672
|
-
return PlaneIntersectionType.Back;
|
|
2673
|
-
}
|
|
2674
|
-
return PlaneIntersectionType.Intersecting;
|
|
2675
|
-
};
|
|
2676
|
-
/**
|
|
2677
|
-
* Get the intersection type between a ray and a plane.
|
|
2678
|
-
* @param ray - The ray
|
|
2679
|
-
* @param plane - The plane
|
|
2680
|
-
* @returns The distance from ray to plane if intersecting, -1 otherwise
|
|
2681
|
-
*/ CollisionUtil.intersectsRayAndPlane = function intersectsRayAndPlane(ray, plane) {
|
|
2682
|
-
var normal = plane.normal;
|
|
2683
|
-
var zeroTolerance = MathUtil.zeroTolerance;
|
|
2684
|
-
var dir = Vector3.dot(normal, ray.direction);
|
|
2685
|
-
// Parallel
|
|
2686
|
-
if (Math.abs(dir) < zeroTolerance) {
|
|
2687
|
-
return -1;
|
|
2688
|
-
}
|
|
2689
|
-
var position = Vector3.dot(normal, ray.origin);
|
|
2690
|
-
var distance = (-plane.distance - position) / dir;
|
|
2691
|
-
if (distance < 0) {
|
|
2692
|
-
if (distance < -zeroTolerance) {
|
|
2693
|
-
return -1;
|
|
2694
|
-
}
|
|
2695
|
-
distance = 0;
|
|
2696
|
-
}
|
|
2697
|
-
return distance;
|
|
2698
|
-
};
|
|
2699
|
-
/**
|
|
2700
|
-
* Get the intersection type between a ray and a box (AABB).
|
|
2701
|
-
* @param ray - The ray
|
|
2702
|
-
* @param box - The box
|
|
2703
|
-
* @returns The distance from ray to box if intersecting, -1 otherwise
|
|
2704
|
-
*/ CollisionUtil.intersectsRayAndBox = function intersectsRayAndBox(ray, box) {
|
|
2705
|
-
var zeroTolerance = MathUtil.zeroTolerance;
|
|
2706
|
-
var origin = ray.origin, direction = ray.direction;
|
|
2707
|
-
var min = box.min, max = box.max;
|
|
2708
|
-
var dirX = direction.x;
|
|
2709
|
-
var dirY = direction.y;
|
|
2710
|
-
var dirZ = direction.z;
|
|
2711
|
-
var oriX = origin.x;
|
|
2712
|
-
var oriY = origin.y;
|
|
2713
|
-
var oriZ = origin.z;
|
|
2714
|
-
var distance = 0;
|
|
2715
|
-
var tmax = Number.MAX_VALUE;
|
|
2716
|
-
if (Math.abs(dirX) < zeroTolerance) {
|
|
2717
|
-
if (oriX < min.x || oriX > max.x) {
|
|
2718
|
-
return -1;
|
|
2719
|
-
}
|
|
2720
|
-
} else {
|
|
2721
|
-
var inverse = 1.0 / dirX;
|
|
2722
|
-
var t1 = (min.x - oriX) * inverse;
|
|
2723
|
-
var t2 = (max.x - oriX) * inverse;
|
|
2724
|
-
if (t1 > t2) {
|
|
2725
|
-
var temp = t1;
|
|
2726
|
-
t1 = t2;
|
|
2727
|
-
t2 = temp;
|
|
2728
|
-
}
|
|
2729
|
-
distance = Math.max(t1, distance);
|
|
2730
|
-
tmax = Math.min(t2, tmax);
|
|
2731
|
-
if (distance > tmax) {
|
|
2732
|
-
return -1;
|
|
2733
|
-
}
|
|
2734
|
-
}
|
|
2735
|
-
if (Math.abs(dirY) < zeroTolerance) {
|
|
2736
|
-
if (oriY < min.y || oriY > max.y) {
|
|
2737
|
-
return -1;
|
|
2738
|
-
}
|
|
2739
|
-
} else {
|
|
2740
|
-
var inverse1 = 1.0 / dirY;
|
|
2741
|
-
var t11 = (min.y - oriY) * inverse1;
|
|
2742
|
-
var t21 = (max.y - oriY) * inverse1;
|
|
2743
|
-
if (t11 > t21) {
|
|
2744
|
-
var temp1 = t11;
|
|
2745
|
-
t11 = t21;
|
|
2746
|
-
t21 = temp1;
|
|
2747
|
-
}
|
|
2748
|
-
distance = Math.max(t11, distance);
|
|
2749
|
-
tmax = Math.min(t21, tmax);
|
|
2750
|
-
if (distance > tmax) {
|
|
2751
|
-
return -1;
|
|
2752
|
-
}
|
|
2753
|
-
}
|
|
2754
|
-
if (Math.abs(dirZ) < zeroTolerance) {
|
|
2755
|
-
if (oriZ < min.z || oriZ > max.z) {
|
|
2756
|
-
return -1;
|
|
2757
|
-
}
|
|
2758
|
-
} else {
|
|
2759
|
-
var inverse2 = 1.0 / dirZ;
|
|
2760
|
-
var t12 = (min.z - oriZ) * inverse2;
|
|
2761
|
-
var t22 = (max.z - oriZ) * inverse2;
|
|
2762
|
-
if (t12 > t22) {
|
|
2763
|
-
var temp2 = t12;
|
|
2764
|
-
t12 = t22;
|
|
2765
|
-
t22 = temp2;
|
|
2766
|
-
}
|
|
2767
|
-
distance = Math.max(t12, distance);
|
|
2768
|
-
tmax = Math.min(t22, tmax);
|
|
2769
|
-
if (distance > tmax) {
|
|
2770
|
-
return -1;
|
|
2771
|
-
}
|
|
2772
|
-
}
|
|
2773
|
-
return distance;
|
|
2774
|
-
};
|
|
2775
|
-
/**
|
|
2776
|
-
* Get the intersection type between a ray and a sphere.
|
|
2777
|
-
* @param ray - The ray
|
|
2778
|
-
* @param sphere - The sphere
|
|
2779
|
-
* @returns The distance from ray to sphere if intersecting, -1 otherwise
|
|
2780
|
-
*/ CollisionUtil.intersectsRayAndSphere = function intersectsRayAndSphere(ray, sphere) {
|
|
2781
|
-
var origin = ray.origin, direction = ray.direction;
|
|
2782
|
-
var center = sphere.center, radius = sphere.radius;
|
|
2783
|
-
var m = CollisionUtil._tempVec30;
|
|
2784
|
-
Vector3.subtract(origin, center, m);
|
|
2785
|
-
var b = Vector3.dot(m, direction);
|
|
2786
|
-
var c = Vector3.dot(m, m) - radius * radius;
|
|
2787
|
-
if (b > 0 && c > 0) {
|
|
2788
|
-
return -1;
|
|
2789
|
-
}
|
|
2790
|
-
var discriminant = b * b - c;
|
|
2791
|
-
if (discriminant < 0) {
|
|
2792
|
-
return -1;
|
|
2793
|
-
}
|
|
2794
|
-
var distance = -b - Math.sqrt(discriminant);
|
|
2795
|
-
if (distance < 0) {
|
|
2796
|
-
distance = 0;
|
|
2797
|
-
}
|
|
2798
|
-
return distance;
|
|
2799
|
-
};
|
|
2800
|
-
/**
|
|
2801
|
-
* Check whether the boxes intersect.
|
|
2802
|
-
* @param boxA - The first box to check
|
|
2803
|
-
* @param boxB - The second box to check
|
|
2804
|
-
* @returns True if the boxes intersect, false otherwise
|
|
2805
|
-
*/ CollisionUtil.intersectsBoxAndBox = function intersectsBoxAndBox(boxA, boxB) {
|
|
2806
|
-
if (boxA.min.x > boxB.max.x || boxB.min.x > boxA.max.x) {
|
|
2807
|
-
return false;
|
|
2808
|
-
}
|
|
2809
|
-
if (boxA.min.y > boxB.max.y || boxB.min.y > boxA.max.y) {
|
|
2810
|
-
return false;
|
|
2811
|
-
}
|
|
2812
|
-
return !(boxA.min.z > boxB.max.z || boxB.min.z > boxA.max.z);
|
|
2813
|
-
};
|
|
2814
|
-
/**
|
|
2815
|
-
* Check whether the spheres intersect.
|
|
2816
|
-
* @param sphereA - The first sphere to check
|
|
2817
|
-
* @param sphereB - The second sphere to check
|
|
2818
|
-
* @returns True if the spheres intersect, false otherwise
|
|
2819
|
-
*/ CollisionUtil.intersectsSphereAndSphere = function intersectsSphereAndSphere(sphereA, sphereB) {
|
|
2820
|
-
var radiisum = sphereA.radius + sphereB.radius;
|
|
2821
|
-
return Vector3.distanceSquared(sphereA.center, sphereB.center) < radiisum * radiisum;
|
|
2822
|
-
};
|
|
2823
|
-
/**
|
|
2824
|
-
* Check whether the sphere and the box intersect.
|
|
2825
|
-
* @param sphere - The sphere to check
|
|
2826
|
-
* @param box - The box to check
|
|
2827
|
-
* @returns True if the sphere and the box intersect, false otherwise
|
|
2828
|
-
*/ CollisionUtil.intersectsSphereAndBox = function intersectsSphereAndBox(sphere, box) {
|
|
2829
|
-
var center = sphere.center;
|
|
2830
|
-
var max = box.max;
|
|
2831
|
-
var min = box.min;
|
|
2832
|
-
var closestPoint = CollisionUtil._tempVec30;
|
|
2833
|
-
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)));
|
|
2834
|
-
var distance = Vector3.distanceSquared(center, closestPoint);
|
|
2835
|
-
return distance <= sphere.radius * sphere.radius;
|
|
2836
|
-
};
|
|
2837
|
-
/**
|
|
2838
|
-
* Get whether or not a specified bounding box intersects with this frustum (Contains or Intersects).
|
|
2839
|
-
* @param frustum - The frustum
|
|
2840
|
-
* @param box - The box
|
|
2841
|
-
* @returns True if bounding box intersects with this frustum, false otherwise
|
|
2842
|
-
*/ CollisionUtil.intersectsFrustumAndBox = function intersectsFrustumAndBox(frustum, box) {
|
|
2843
|
-
var min = box.min, max = box.max;
|
|
2844
|
-
var p = CollisionUtil._tempVec30;
|
|
2845
|
-
for(var i = 0; i < 6; ++i){
|
|
2846
|
-
var plane = frustum.getPlane(i);
|
|
2847
|
-
var normal = plane.normal;
|
|
2848
|
-
p.set(normal.x >= 0 ? max.x : min.x, normal.y >= 0 ? max.y : min.y, normal.z >= 0 ? max.z : min.z);
|
|
2849
|
-
if (Vector3.dot(normal, p) < -plane.distance) {
|
|
2850
|
-
return false;
|
|
2851
|
-
}
|
|
2852
|
-
}
|
|
2853
|
-
return true;
|
|
2854
|
-
};
|
|
2855
|
-
/**
|
|
2856
|
-
* Get the containment type between a frustum and a point.
|
|
2857
|
-
* @param frustum - The frustum
|
|
2858
|
-
* @param point - The point
|
|
2859
|
-
* @returns The containment type
|
|
2860
|
-
*/ CollisionUtil.frustumContainsPoint = function frustumContainsPoint(frustum, point) {
|
|
2861
|
-
var distance = CollisionUtil.distancePlaneAndPoint(frustum.near, 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.far, 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.left, point);
|
|
2874
|
-
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
2875
|
-
return ContainmentType.Intersects;
|
|
2876
|
-
} else if (distance < 0) {
|
|
2877
|
-
return ContainmentType.Disjoint;
|
|
2878
|
-
}
|
|
2879
|
-
distance = CollisionUtil.distancePlaneAndPoint(frustum.right, point);
|
|
2880
|
-
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
2881
|
-
return ContainmentType.Intersects;
|
|
2882
|
-
} else if (distance < 0) {
|
|
2883
|
-
return ContainmentType.Disjoint;
|
|
2884
|
-
}
|
|
2885
|
-
distance = CollisionUtil.distancePlaneAndPoint(frustum.top, point);
|
|
2886
|
-
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
2887
|
-
return ContainmentType.Intersects;
|
|
2888
|
-
} else if (distance < 0) {
|
|
2889
|
-
return ContainmentType.Disjoint;
|
|
2890
|
-
}
|
|
2891
|
-
distance = CollisionUtil.distancePlaneAndPoint(frustum.bottom, point);
|
|
2892
|
-
if (Math.abs(distance) < MathUtil.zeroTolerance) {
|
|
2893
|
-
return ContainmentType.Intersects;
|
|
2894
|
-
} else if (distance < 0) {
|
|
2895
|
-
return ContainmentType.Disjoint;
|
|
2896
|
-
}
|
|
2897
|
-
return ContainmentType.Contains;
|
|
2898
|
-
};
|
|
2899
|
-
/**
|
|
2900
|
-
* Get the containment type between a frustum and a box (AABB).
|
|
2901
|
-
* @param frustum - The frustum
|
|
2902
|
-
* @param box - The box
|
|
2903
|
-
* @returns The containment type
|
|
2904
|
-
*/ CollisionUtil.frustumContainsBox = function frustumContainsBox(frustum, box) {
|
|
2905
|
-
var min = box.min, max = box.max;
|
|
2906
|
-
var p = CollisionUtil._tempVec30;
|
|
2907
|
-
var n = CollisionUtil._tempVec31;
|
|
2908
|
-
var result = ContainmentType.Contains;
|
|
2909
|
-
for(var i = 0; i < 6; ++i){
|
|
2910
|
-
var plane = frustum.getPlane(i);
|
|
2911
|
-
var normal = plane.normal;
|
|
2912
|
-
if (normal.x >= 0) {
|
|
2913
|
-
p.x = max.x;
|
|
2914
|
-
n.x = min.x;
|
|
2915
|
-
} else {
|
|
2916
|
-
p.x = min.x;
|
|
2917
|
-
n.x = max.x;
|
|
2918
|
-
}
|
|
2919
|
-
if (normal.y >= 0) {
|
|
2920
|
-
p.y = max.y;
|
|
2921
|
-
n.y = min.y;
|
|
2922
|
-
} else {
|
|
2923
|
-
p.y = min.y;
|
|
2924
|
-
n.y = max.y;
|
|
2925
|
-
}
|
|
2926
|
-
if (normal.z >= 0) {
|
|
2927
|
-
p.z = max.z;
|
|
2928
|
-
n.z = min.z;
|
|
2929
|
-
} else {
|
|
2930
|
-
p.z = min.z;
|
|
2931
|
-
n.z = max.z;
|
|
2932
|
-
}
|
|
2933
|
-
if (CollisionUtil.intersectsPlaneAndPoint(plane, p) === PlaneIntersectionType.Back) {
|
|
2934
|
-
return ContainmentType.Disjoint;
|
|
2935
|
-
}
|
|
2936
|
-
if (CollisionUtil.intersectsPlaneAndPoint(plane, n) === PlaneIntersectionType.Back) {
|
|
2937
|
-
result = ContainmentType.Intersects;
|
|
2938
|
-
}
|
|
2939
|
-
}
|
|
2940
|
-
return result;
|
|
2941
|
-
};
|
|
2942
|
-
/**
|
|
2943
|
-
* Get the containment type between a frustum and a sphere.
|
|
2944
|
-
* @param frustum - The frustum
|
|
2945
|
-
* @param sphere - The sphere
|
|
2946
|
-
* @returns The containment type
|
|
2947
|
-
*/ CollisionUtil.frustumContainsSphere = function frustumContainsSphere(frustum, sphere) {
|
|
2948
|
-
var result = ContainmentType.Contains;
|
|
2949
|
-
for(var i = 0; i < 6; ++i){
|
|
2950
|
-
var plane = frustum.getPlane(i);
|
|
2951
|
-
var intersectionType = CollisionUtil.intersectsPlaneAndSphere(plane, sphere);
|
|
2952
|
-
if (intersectionType === PlaneIntersectionType.Back) {
|
|
2953
|
-
return ContainmentType.Disjoint;
|
|
2954
|
-
} else if (intersectionType === PlaneIntersectionType.Intersecting) {
|
|
2955
|
-
result = ContainmentType.Intersects;
|
|
2956
|
-
break;
|
|
2957
|
-
}
|
|
2958
|
-
}
|
|
2959
|
-
return result;
|
|
2960
|
-
};
|
|
2961
|
-
return CollisionUtil;
|
|
2962
|
-
}();
|
|
2963
|
-
(function() {
|
|
2964
|
-
CollisionUtil._tempVec30 = new Vector3();
|
|
2965
|
-
})();
|
|
2966
|
-
(function() {
|
|
2967
|
-
CollisionUtil._tempVec31 = new Vector3();
|
|
2968
|
-
})();
|
|
2969
|
-
(function() {
|
|
2970
|
-
CollisionUtil._tempVec32 = new Vector3();
|
|
2971
|
-
})();
|
|
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();
|
|
2972
2281
|
/**
|
|
2973
2282
|
* Represents a 3x3 mathematical matrix.
|
|
2974
2283
|
*/ var Matrix3x3 = /*#__PURE__*/ function() {
|
|
2975
|
-
|
|
2284
|
+
function Matrix3x3(m11, m12, m13, m21, m22, m23, m31, m32, m33) {
|
|
2976
2285
|
if (m11 === void 0) m11 = 1;
|
|
2977
2286
|
if (m12 === void 0) m12 = 0;
|
|
2978
2287
|
if (m13 === void 0) m13 = 0;
|
|
@@ -3001,7 +2310,7 @@
|
|
|
3001
2310
|
e[6] = m31;
|
|
3002
2311
|
e[7] = m32;
|
|
3003
2312
|
e[8] = m33;
|
|
3004
|
-
}
|
|
2313
|
+
}
|
|
3005
2314
|
var _proto = Matrix3x3.prototype;
|
|
3006
2315
|
/**
|
|
3007
2316
|
* Set the value of this matrix, and return this matrix.
|
|
@@ -3514,7 +2823,7 @@
|
|
|
3514
2823
|
/**
|
|
3515
2824
|
* Represents a four dimensional mathematical quaternion.
|
|
3516
2825
|
*/ var Quaternion = /*#__PURE__*/ function() {
|
|
3517
|
-
|
|
2826
|
+
function Quaternion(x, y, z, w) {
|
|
3518
2827
|
if (x === void 0) x = 0;
|
|
3519
2828
|
if (y === void 0) y = 0;
|
|
3520
2829
|
if (z === void 0) z = 0;
|
|
@@ -3524,7 +2833,7 @@
|
|
|
3524
2833
|
this._y = y;
|
|
3525
2834
|
this._z = z;
|
|
3526
2835
|
this._w = w;
|
|
3527
|
-
}
|
|
2836
|
+
}
|
|
3528
2837
|
var _proto = Quaternion.prototype;
|
|
3529
2838
|
/**
|
|
3530
2839
|
* Set the value of this quaternion, and return this quaternion.
|
|
@@ -4170,16 +3479,12 @@
|
|
|
4170
3479
|
]);
|
|
4171
3480
|
return Quaternion;
|
|
4172
3481
|
}();
|
|
4173
|
-
(
|
|
4174
|
-
|
|
4175
|
-
})();
|
|
4176
|
-
(function() {
|
|
4177
|
-
/** @internal */ Quaternion._tempQuat1 = new Quaternion();
|
|
4178
|
-
})();
|
|
3482
|
+
/** @internal */ Quaternion._tempVector3 = new Vector3();
|
|
3483
|
+
/** @internal */ Quaternion._tempQuat1 = new Quaternion();
|
|
4179
3484
|
/**
|
|
4180
3485
|
* Represents a 4x4 mathematical matrix.
|
|
4181
3486
|
*/ var Matrix = /*#__PURE__*/ function() {
|
|
4182
|
-
|
|
3487
|
+
function Matrix(m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44) {
|
|
4183
3488
|
if (m11 === void 0) m11 = 1;
|
|
4184
3489
|
if (m12 === void 0) m12 = 0;
|
|
4185
3490
|
if (m13 === void 0) m13 = 0;
|
|
@@ -4223,7 +3528,7 @@
|
|
|
4223
3528
|
e[13] = m42;
|
|
4224
3529
|
e[14] = m43;
|
|
4225
3530
|
e[15] = m44;
|
|
4226
|
-
}
|
|
3531
|
+
}
|
|
4227
3532
|
var _proto = Matrix.prototype;
|
|
4228
3533
|
/**
|
|
4229
3534
|
* Set the value of this matrix, and return this matrix.
|
|
@@ -5115,847 +4420,57 @@
|
|
|
5115
4420
|
};
|
|
5116
4421
|
return Matrix;
|
|
5117
4422
|
}();
|
|
5118
|
-
(
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
(
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
|
|
5126
|
-
|
|
5127
|
-
|
|
5128
|
-
|
|
5129
|
-
|
|
5130
|
-
|
|
5131
|
-
|
|
5132
|
-
|
|
5133
|
-
/**
|
|
5134
|
-
* Describes a 2D-vector.
|
|
5135
|
-
*/ var Vector2 = /*#__PURE__*/ function() {
|
|
5136
|
-
var Vector2 = function Vector2(x, y) {
|
|
5137
|
-
if (x === void 0) x = 0;
|
|
5138
|
-
if (y === void 0) y = 0;
|
|
5139
|
-
/** @internal */ this._onValueChanged = null;
|
|
5140
|
-
this._x = x;
|
|
5141
|
-
this._y = y;
|
|
5142
|
-
};
|
|
5143
|
-
var _proto = Vector2.prototype;
|
|
5144
|
-
/**
|
|
5145
|
-
* Set the value of this vector.
|
|
5146
|
-
* @param x - The x component of the vector
|
|
5147
|
-
* @param y - The y component of the vector
|
|
5148
|
-
* @returns This vector
|
|
5149
|
-
*/ _proto.set = function set(x, y) {
|
|
5150
|
-
this._x = x;
|
|
5151
|
-
this._y = y;
|
|
5152
|
-
this._onValueChanged && this._onValueChanged();
|
|
5153
|
-
return this;
|
|
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);
|
|
5154
4438
|
};
|
|
5155
|
-
|
|
5156
|
-
|
|
5157
|
-
|
|
5158
|
-
|
|
5159
|
-
|
|
5160
|
-
|
|
5161
|
-
|
|
5162
|
-
|
|
5163
|
-
|
|
5164
|
-
|
|
5165
|
-
|
|
5166
|
-
|
|
5167
|
-
|
|
5168
|
-
|
|
5169
|
-
|
|
5170
|
-
|
|
5171
|
-
|
|
5172
|
-
|
|
5173
|
-
|
|
5174
|
-
|
|
5175
|
-
|
|
5176
|
-
|
|
5177
|
-
|
|
5178
|
-
|
|
5179
|
-
|
|
5180
|
-
|
|
5181
|
-
|
|
5182
|
-
|
|
5183
|
-
|
|
5184
|
-
|
|
5185
|
-
|
|
5186
|
-
|
|
5187
|
-
|
|
5188
|
-
|
|
5189
|
-
|
|
5190
|
-
this._x /= right._x;
|
|
5191
|
-
this._y /= right._y;
|
|
5192
|
-
this._onValueChanged && this._onValueChanged();
|
|
5193
|
-
return this;
|
|
5194
|
-
};
|
|
5195
|
-
/**
|
|
5196
|
-
* Calculate the length of this vector.
|
|
5197
|
-
* @returns The length of this vector
|
|
5198
|
-
*/ _proto.length = function length() {
|
|
5199
|
-
var _this = this, _x = _this._x, _y = _this._y;
|
|
5200
|
-
return Math.sqrt(_x * _x + _y * _y);
|
|
5201
|
-
};
|
|
5202
|
-
/**
|
|
5203
|
-
* Calculate the squared length of this vector.
|
|
5204
|
-
* @returns The squared length of this vector
|
|
5205
|
-
*/ _proto.lengthSquared = function lengthSquared() {
|
|
5206
|
-
var _this = this, _x = _this._x, _y = _this._y;
|
|
5207
|
-
return _x * _x + _y * _y;
|
|
5208
|
-
};
|
|
5209
|
-
/**
|
|
5210
|
-
* Reverses the direction of this vector.
|
|
5211
|
-
* @returns This vector
|
|
5212
|
-
*/ _proto.negate = function negate() {
|
|
5213
|
-
this._x = -this._x;
|
|
5214
|
-
this._y = -this._y;
|
|
5215
|
-
this._onValueChanged && this._onValueChanged();
|
|
5216
|
-
return this;
|
|
5217
|
-
};
|
|
5218
|
-
/**
|
|
5219
|
-
* Converts this vector into a unit vector.
|
|
5220
|
-
* @returns This vector
|
|
5221
|
-
*/ _proto.normalize = function normalize() {
|
|
5222
|
-
Vector2.normalize(this, this);
|
|
5223
|
-
return this;
|
|
5224
|
-
};
|
|
5225
|
-
/**
|
|
5226
|
-
* Scale this vector by the given value.
|
|
5227
|
-
* @param s - The amount by which to scale the vector
|
|
5228
|
-
* @returns This vector
|
|
5229
|
-
*/ _proto.scale = function scale(s) {
|
|
5230
|
-
this._x *= s;
|
|
5231
|
-
this._y *= s;
|
|
5232
|
-
this._onValueChanged && this._onValueChanged();
|
|
5233
|
-
return this;
|
|
5234
|
-
};
|
|
5235
|
-
/**
|
|
5236
|
-
* Creates a clone of this vector.
|
|
5237
|
-
* @returns A clone of this vector
|
|
5238
|
-
*/ _proto.clone = function clone() {
|
|
5239
|
-
return new Vector2(this._x, this._y);
|
|
5240
|
-
};
|
|
5241
|
-
/**
|
|
5242
|
-
* Copy from vector2 like object.
|
|
5243
|
-
* @param source - Vector2 like object
|
|
5244
|
-
* @returns This vector
|
|
5245
|
-
*/ _proto.copyFrom = function copyFrom(source) {
|
|
5246
|
-
this._x = source.x;
|
|
5247
|
-
this._y = source.y;
|
|
5248
|
-
this._onValueChanged && this._onValueChanged();
|
|
5249
|
-
return this;
|
|
5250
|
-
};
|
|
5251
|
-
/**
|
|
5252
|
-
* Copy to vector2 like object.
|
|
5253
|
-
* @param target - Vector2 like object
|
|
5254
|
-
* @returns This Vector2 like object
|
|
5255
|
-
*/ _proto.copyTo = function copyTo(target) {
|
|
5256
|
-
target.x = this._x;
|
|
5257
|
-
target.y = this._y;
|
|
5258
|
-
return target;
|
|
5259
|
-
};
|
|
5260
|
-
/**
|
|
5261
|
-
* Copy the value of this vector from an array.
|
|
5262
|
-
* @param array - The array
|
|
5263
|
-
* @param offset - The start offset of the array
|
|
5264
|
-
* @returns This vector
|
|
5265
|
-
*/ _proto.copyFromArray = function copyFromArray(array, offset) {
|
|
5266
|
-
if (offset === void 0) offset = 0;
|
|
5267
|
-
this._x = array[offset];
|
|
5268
|
-
this._y = array[offset + 1];
|
|
5269
|
-
this._onValueChanged && this._onValueChanged();
|
|
5270
|
-
return this;
|
|
5271
|
-
};
|
|
5272
|
-
/**
|
|
5273
|
-
* Copy the value of this vector to an array.
|
|
5274
|
-
* @param out - The array
|
|
5275
|
-
* @param outOffset - The start offset of the array
|
|
5276
|
-
*/ _proto.copyToArray = function copyToArray(out, outOffset) {
|
|
5277
|
-
if (outOffset === void 0) outOffset = 0;
|
|
5278
|
-
out[outOffset] = this._x;
|
|
5279
|
-
out[outOffset + 1] = this._y;
|
|
5280
|
-
};
|
|
5281
|
-
/**
|
|
5282
|
-
* Serialize this vector to a JSON representation.
|
|
5283
|
-
* @returns A JSON representation of this vector
|
|
5284
|
-
*/ _proto.toJSON = function toJSON() {
|
|
5285
|
-
return {
|
|
5286
|
-
x: this._x,
|
|
5287
|
-
y: this._y
|
|
5288
|
-
};
|
|
5289
|
-
};
|
|
5290
|
-
/**
|
|
5291
|
-
* Determines the sum of two vectors.
|
|
5292
|
-
* @param left - The first vector to add
|
|
5293
|
-
* @param right - The second vector to add
|
|
5294
|
-
* @param out - The sum of two vectors
|
|
5295
|
-
*/ Vector2.add = function add(left, right, out) {
|
|
5296
|
-
out._x = left._x + right._x;
|
|
5297
|
-
out._y = left._y + right._y;
|
|
5298
|
-
out._onValueChanged && out._onValueChanged();
|
|
5299
|
-
};
|
|
5300
|
-
/**
|
|
5301
|
-
* Determines the difference between two vectors.
|
|
5302
|
-
* @param left - The first vector to subtract
|
|
5303
|
-
* @param right - The second vector to subtract
|
|
5304
|
-
* @param out - The difference between two vectors
|
|
5305
|
-
*/ Vector2.subtract = function subtract(left, right, out) {
|
|
5306
|
-
out._x = left._x - right._x;
|
|
5307
|
-
out._y = left._y - right._y;
|
|
5308
|
-
out._onValueChanged && out._onValueChanged();
|
|
5309
|
-
};
|
|
5310
|
-
/**
|
|
5311
|
-
* Determines the product of two vectors.
|
|
5312
|
-
* @param left - The first vector to multiply
|
|
5313
|
-
* @param right - The second vector to multiply
|
|
5314
|
-
* @param out - The product of two vectors
|
|
5315
|
-
*/ Vector2.multiply = function multiply(left, right, out) {
|
|
5316
|
-
out._x = left._x * right._x;
|
|
5317
|
-
out._y = left._y * right._y;
|
|
5318
|
-
out._onValueChanged && out._onValueChanged();
|
|
5319
|
-
};
|
|
5320
|
-
/**
|
|
5321
|
-
* Determines the divisor of two vectors.
|
|
5322
|
-
* @param left - The first vector to divide
|
|
5323
|
-
* @param right - The second vector to divide
|
|
5324
|
-
* @param out - The divisor of two vectors
|
|
5325
|
-
*/ Vector2.divide = function divide(left, right, out) {
|
|
5326
|
-
out._x = left._x / right._x;
|
|
5327
|
-
out._y = left._y / right._y;
|
|
5328
|
-
out._onValueChanged && out._onValueChanged();
|
|
5329
|
-
};
|
|
5330
|
-
/**
|
|
5331
|
-
* Determines the dot product of two vectors.
|
|
5332
|
-
* @param left - The first vector to dot
|
|
5333
|
-
* @param right - The second vector to dot
|
|
5334
|
-
* @returns The dot product of two vectors
|
|
5335
|
-
*/ Vector2.dot = function dot(left, right) {
|
|
5336
|
-
return left._x * right._x + left._y * right._y;
|
|
5337
|
-
};
|
|
5338
|
-
/**
|
|
5339
|
-
* Determines the distance of two vectors.
|
|
5340
|
-
* @param left - The first vector
|
|
5341
|
-
* @param right - The second vector
|
|
5342
|
-
* @returns The distance of two vectors
|
|
5343
|
-
*/ Vector2.distance = function distance(left, right) {
|
|
5344
|
-
var x = right._x - left._x;
|
|
5345
|
-
var y = right._y - left._y;
|
|
5346
|
-
return Math.sqrt(x * x + y * y);
|
|
5347
|
-
};
|
|
5348
|
-
/**
|
|
5349
|
-
* Determines the squared distance of two vectors.
|
|
5350
|
-
* @param left - The first vector
|
|
5351
|
-
* @param right - The second vector
|
|
5352
|
-
* @returns The squared distance of two vectors
|
|
5353
|
-
*/ Vector2.distanceSquared = function distanceSquared(left, right) {
|
|
5354
|
-
var x = right._x - left._x;
|
|
5355
|
-
var y = right._y - left._y;
|
|
5356
|
-
return x * x + y * y;
|
|
5357
|
-
};
|
|
5358
|
-
/**
|
|
5359
|
-
* Determines whether the specified vectors are equals.
|
|
5360
|
-
* @param left - The first vector to compare
|
|
5361
|
-
* @param right - The second vector to compare
|
|
5362
|
-
* @returns True if the specified vectors are equals, false otherwise
|
|
5363
|
-
*/ Vector2.equals = function equals(left, right) {
|
|
5364
|
-
return MathUtil.equals(left._x, right._x) && MathUtil.equals(left._y, right._y);
|
|
5365
|
-
};
|
|
5366
|
-
/**
|
|
5367
|
-
* Performs a linear interpolation between two vectors.
|
|
5368
|
-
* @param left - The first vector
|
|
5369
|
-
* @param right - The second vector
|
|
5370
|
-
* @param t - The blend amount where 0 returns left and 1 right
|
|
5371
|
-
* @param out - The result of linear blending between two vectors
|
|
5372
|
-
*/ Vector2.lerp = function lerp(left, right, t, out) {
|
|
5373
|
-
var _x = left._x, _y = left._y;
|
|
5374
|
-
out._x = _x + (right._x - _x) * t;
|
|
5375
|
-
out._y = _y + (right._y - _y) * t;
|
|
5376
|
-
out._onValueChanged && out._onValueChanged();
|
|
5377
|
-
};
|
|
5378
|
-
/**
|
|
5379
|
-
* Calculate a vector containing the largest components of the specified vectors.
|
|
5380
|
-
* @param left - The first vector
|
|
5381
|
-
* @param right - The second vector
|
|
5382
|
-
* @param out - The vector containing the largest components of the specified vectors
|
|
5383
|
-
*/ Vector2.max = function max(left, right, out) {
|
|
5384
|
-
out._x = Math.max(left._x, right._x);
|
|
5385
|
-
out._y = Math.max(left._y, right._y);
|
|
5386
|
-
out._onValueChanged && out._onValueChanged();
|
|
5387
|
-
};
|
|
5388
|
-
/**
|
|
5389
|
-
* Calculate a vector containing the smallest components of the specified vectors.
|
|
5390
|
-
* @param left - The first vector
|
|
5391
|
-
* @param right - The second vector
|
|
5392
|
-
* @param out - The vector containing the smallest components of the specified vectors
|
|
5393
|
-
*/ Vector2.min = function min(left, right, out) {
|
|
5394
|
-
out._x = Math.min(left._x, right._x);
|
|
5395
|
-
out._y = Math.min(left._y, right._y);
|
|
5396
|
-
out._onValueChanged && out._onValueChanged();
|
|
5397
|
-
};
|
|
5398
|
-
/**
|
|
5399
|
-
* Reverses the direction of a given vector.
|
|
5400
|
-
* @param left - The vector to negate
|
|
5401
|
-
* @param out - The vector facing in the opposite direction
|
|
5402
|
-
*/ Vector2.negate = function negate(left, out) {
|
|
5403
|
-
out._x = -left._x;
|
|
5404
|
-
out._y = -left._y;
|
|
5405
|
-
out._onValueChanged && out._onValueChanged();
|
|
5406
|
-
};
|
|
5407
|
-
/**
|
|
5408
|
-
* Converts the vector into a unit vector.
|
|
5409
|
-
* @param left - The vector to normalize
|
|
5410
|
-
* @param out - The normalized vector
|
|
5411
|
-
*/ Vector2.normalize = function normalize(left, out) {
|
|
5412
|
-
var _x = left._x, _y = left._y;
|
|
5413
|
-
var len = Math.sqrt(_x * _x + _y * _y);
|
|
5414
|
-
if (len > MathUtil.zeroTolerance) {
|
|
5415
|
-
len = 1 / len;
|
|
5416
|
-
out._x = _x * len;
|
|
5417
|
-
out._y = _y * len;
|
|
5418
|
-
out._onValueChanged && out._onValueChanged();
|
|
5419
|
-
}
|
|
5420
|
-
};
|
|
5421
|
-
/**
|
|
5422
|
-
* Scale a vector by the given value.
|
|
5423
|
-
* @param left - The vector to scale
|
|
5424
|
-
* @param s - The amount by which to scale the vector
|
|
5425
|
-
* @param out - The scaled vector
|
|
5426
|
-
*/ Vector2.scale = function scale(left, s, out) {
|
|
5427
|
-
out._x = left._x * s;
|
|
5428
|
-
out._y = left._y * s;
|
|
5429
|
-
out._onValueChanged && out._onValueChanged();
|
|
5430
|
-
};
|
|
5431
|
-
_create_class(Vector2, [
|
|
5432
|
-
{
|
|
5433
|
-
key: "x",
|
|
5434
|
-
get: /**
|
|
5435
|
-
* The x component of the vector.
|
|
5436
|
-
*/ function get() {
|
|
5437
|
-
return this._x;
|
|
5438
|
-
},
|
|
5439
|
-
set: function set(value) {
|
|
5440
|
-
this._x = value;
|
|
5441
|
-
this._onValueChanged && this._onValueChanged();
|
|
5442
|
-
}
|
|
5443
|
-
},
|
|
5444
|
-
{
|
|
5445
|
-
key: "y",
|
|
5446
|
-
get: /**
|
|
5447
|
-
* The y component of the vector.
|
|
5448
|
-
*/ function get() {
|
|
5449
|
-
return this._y;
|
|
5450
|
-
},
|
|
5451
|
-
set: function set(value) {
|
|
5452
|
-
this._y = value;
|
|
5453
|
-
this._onValueChanged && this._onValueChanged();
|
|
5454
|
-
}
|
|
5455
|
-
}
|
|
5456
|
-
]);
|
|
5457
|
-
return Vector2;
|
|
5458
|
-
}();
|
|
5459
|
-
(function() {
|
|
5460
|
-
/** @internal */ Vector2._zero = new Vector2(0.0, 0.0);
|
|
5461
|
-
})();
|
|
5462
|
-
(function() {
|
|
5463
|
-
/** @internal */ Vector2._one = new Vector2(1.0, 1.0);
|
|
5464
|
-
})();
|
|
5465
|
-
/**
|
|
5466
|
-
* Describes a 4D-vector.
|
|
5467
|
-
*/ var Vector4 = /*#__PURE__*/ function() {
|
|
5468
|
-
var Vector4 = function Vector4(x, y, z, w) {
|
|
5469
|
-
if (x === void 0) x = 0;
|
|
5470
|
-
if (y === void 0) y = 0;
|
|
5471
|
-
if (z === void 0) z = 0;
|
|
5472
|
-
if (w === void 0) w = 0;
|
|
5473
|
-
/** @internal */ this._onValueChanged = null;
|
|
5474
|
-
this._x = x;
|
|
5475
|
-
this._y = y;
|
|
5476
|
-
this._z = z;
|
|
5477
|
-
this._w = w;
|
|
5478
|
-
};
|
|
5479
|
-
var _proto = Vector4.prototype;
|
|
5480
|
-
/**
|
|
5481
|
-
* Set the value of this vector.
|
|
5482
|
-
* @param x - The x component of the vector
|
|
5483
|
-
* @param y - The y component of the vector
|
|
5484
|
-
* @param z - The z component of the vector
|
|
5485
|
-
* @param w - The w component of the vector
|
|
5486
|
-
* @returns This vector
|
|
5487
|
-
*/ _proto.set = function set(x, y, z, w) {
|
|
5488
|
-
this._x = x;
|
|
5489
|
-
this._y = y;
|
|
5490
|
-
this._z = z;
|
|
5491
|
-
this._w = w;
|
|
5492
|
-
this._onValueChanged && this._onValueChanged();
|
|
5493
|
-
return this;
|
|
5494
|
-
};
|
|
5495
|
-
/**
|
|
5496
|
-
* Determines the sum of this vector and the specified vector.
|
|
5497
|
-
* @param right - The specified vector
|
|
5498
|
-
* @returns This vector
|
|
5499
|
-
*/ _proto.add = function add(right) {
|
|
5500
|
-
this._x += right._x;
|
|
5501
|
-
this._y += right._y;
|
|
5502
|
-
this._z += right._z;
|
|
5503
|
-
this._w += right._w;
|
|
5504
|
-
this._onValueChanged && this._onValueChanged();
|
|
5505
|
-
return this;
|
|
5506
|
-
};
|
|
5507
|
-
/**
|
|
5508
|
-
* Determines the difference of this vector and the specified vector.
|
|
5509
|
-
* @param right - the specified vector
|
|
5510
|
-
* @returns This vector
|
|
5511
|
-
*/ _proto.subtract = function subtract(right) {
|
|
5512
|
-
this._x -= right._x;
|
|
5513
|
-
this._y -= right._y;
|
|
5514
|
-
this._z -= right._z;
|
|
5515
|
-
this._w -= right._w;
|
|
5516
|
-
this._onValueChanged && this._onValueChanged();
|
|
5517
|
-
return this;
|
|
5518
|
-
};
|
|
5519
|
-
/**
|
|
5520
|
-
* Determines the product of this vector and the specified vector.
|
|
5521
|
-
* @param right - the specified vector
|
|
5522
|
-
* @returns This vector
|
|
5523
|
-
*/ _proto.multiply = function multiply(right) {
|
|
5524
|
-
this._x *= right._x;
|
|
5525
|
-
this._y *= right._y;
|
|
5526
|
-
this._z *= right._z;
|
|
5527
|
-
this._w *= right._w;
|
|
5528
|
-
this._onValueChanged && this._onValueChanged();
|
|
5529
|
-
return this;
|
|
5530
|
-
};
|
|
5531
|
-
/**
|
|
5532
|
-
* Determines the divisor of this vector and the specified vector.
|
|
5533
|
-
* @param right - the specified vector
|
|
5534
|
-
* @returns This vector
|
|
5535
|
-
*/ _proto.divide = function divide(right) {
|
|
5536
|
-
this._x /= right._x;
|
|
5537
|
-
this._y /= right._y;
|
|
5538
|
-
this._z /= right._z;
|
|
5539
|
-
this._w /= right._w;
|
|
5540
|
-
this._onValueChanged && this._onValueChanged();
|
|
5541
|
-
return this;
|
|
5542
|
-
};
|
|
5543
|
-
/**
|
|
5544
|
-
* Calculate the length of this vector.
|
|
5545
|
-
* @returns The length of this vector
|
|
5546
|
-
*/ _proto.length = function length() {
|
|
5547
|
-
var _this = this, _x = _this._x, _y = _this._y, _z = _this._z, _w = _this._w;
|
|
5548
|
-
return Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
|
|
5549
|
-
};
|
|
5550
|
-
/**
|
|
5551
|
-
* Calculate the squared length of this vector.
|
|
5552
|
-
* @returns The squared length of this vector
|
|
5553
|
-
*/ _proto.lengthSquared = function lengthSquared() {
|
|
5554
|
-
var _this = this, _x = _this._x, _y = _this._y, _z = _this._z, _w = _this._w;
|
|
5555
|
-
return _x * _x + _y * _y + _z * _z + _w * _w;
|
|
5556
|
-
};
|
|
5557
|
-
/**
|
|
5558
|
-
* Reverses the direction of this vector.
|
|
5559
|
-
* @returns This vector
|
|
5560
|
-
*/ _proto.negate = function negate() {
|
|
5561
|
-
this._x = -this._x;
|
|
5562
|
-
this._y = -this._y;
|
|
5563
|
-
this._z = -this._z;
|
|
5564
|
-
this._w = -this._w;
|
|
5565
|
-
this._onValueChanged && this._onValueChanged();
|
|
5566
|
-
return this;
|
|
5567
|
-
};
|
|
5568
|
-
/**
|
|
5569
|
-
* Converts this vector into a unit vector.
|
|
5570
|
-
* @returns This vector
|
|
5571
|
-
*/ _proto.normalize = function normalize() {
|
|
5572
|
-
Vector4.normalize(this, this);
|
|
5573
|
-
return this;
|
|
5574
|
-
};
|
|
5575
|
-
/**
|
|
5576
|
-
* Scale this vector by the given value.
|
|
5577
|
-
* @param s - The amount by which to scale the vector
|
|
5578
|
-
* @returns This vector
|
|
5579
|
-
*/ _proto.scale = function scale(s) {
|
|
5580
|
-
this._x *= s;
|
|
5581
|
-
this._y *= s;
|
|
5582
|
-
this._z *= s;
|
|
5583
|
-
this._w *= s;
|
|
5584
|
-
this._onValueChanged && this._onValueChanged();
|
|
5585
|
-
return this;
|
|
5586
|
-
};
|
|
5587
|
-
/**
|
|
5588
|
-
* Creates a clone of this vector.
|
|
5589
|
-
* @returns A clone of this vector
|
|
5590
|
-
*/ _proto.clone = function clone() {
|
|
5591
|
-
var ret = new Vector4(this._x, this._y, this._z, this._w);
|
|
5592
|
-
return ret;
|
|
5593
|
-
};
|
|
5594
|
-
/**
|
|
5595
|
-
* Copy from vector3 like object.
|
|
5596
|
-
* @param source - Vector3 like object.
|
|
5597
|
-
* @returns This vector
|
|
5598
|
-
*/ _proto.copyFrom = function copyFrom(source) {
|
|
5599
|
-
this._x = source.x;
|
|
5600
|
-
this._y = source.y;
|
|
5601
|
-
this._z = source.z;
|
|
5602
|
-
this._w = source.w;
|
|
5603
|
-
this._onValueChanged && this._onValueChanged();
|
|
5604
|
-
return this;
|
|
5605
|
-
};
|
|
5606
|
-
/**
|
|
5607
|
-
* Copy to vector4 like object.
|
|
5608
|
-
* @param target - Vector4 like object
|
|
5609
|
-
* @returns This Vector4 like object
|
|
5610
|
-
*/ _proto.copyTo = function copyTo(target) {
|
|
5611
|
-
target.x = this._x;
|
|
5612
|
-
target.y = this._y;
|
|
5613
|
-
target.z = this._z;
|
|
5614
|
-
target.w = this._w;
|
|
5615
|
-
return target;
|
|
5616
|
-
};
|
|
5617
|
-
/**
|
|
5618
|
-
* Copy the value of this vector by an array.
|
|
5619
|
-
* @param array - The array
|
|
5620
|
-
* @param offset - The start offset of the array
|
|
5621
|
-
* @returns This vector
|
|
5622
|
-
*/ _proto.copyFromArray = function copyFromArray(array, offset) {
|
|
5623
|
-
if (offset === void 0) offset = 0;
|
|
5624
|
-
this._x = array[offset];
|
|
5625
|
-
this._y = array[offset + 1];
|
|
5626
|
-
this._z = array[offset + 2];
|
|
5627
|
-
this._w = array[offset + 3];
|
|
5628
|
-
this._onValueChanged && this._onValueChanged();
|
|
5629
|
-
return this;
|
|
5630
|
-
};
|
|
5631
|
-
/**
|
|
5632
|
-
* Copy the value of this vector to an array.
|
|
5633
|
-
* @param out - The array
|
|
5634
|
-
* @param outOffset - The start offset of the array
|
|
5635
|
-
*/ _proto.copyToArray = function copyToArray(out, outOffset) {
|
|
5636
|
-
if (outOffset === void 0) outOffset = 0;
|
|
5637
|
-
out[outOffset] = this._x;
|
|
5638
|
-
out[outOffset + 1] = this._y;
|
|
5639
|
-
out[outOffset + 2] = this._z;
|
|
5640
|
-
out[outOffset + 3] = this._w;
|
|
5641
|
-
};
|
|
5642
|
-
/**
|
|
5643
|
-
* Serialize this vector to a JSON representation.
|
|
5644
|
-
* @returns A JSON representation of this vector
|
|
5645
|
-
*/ _proto.toJSON = function toJSON() {
|
|
5646
|
-
return {
|
|
5647
|
-
x: this._x,
|
|
5648
|
-
y: this._y,
|
|
5649
|
-
z: this._z,
|
|
5650
|
-
w: this._w
|
|
5651
|
-
};
|
|
5652
|
-
};
|
|
5653
|
-
/**
|
|
5654
|
-
* Determines the sum of two vectors.
|
|
5655
|
-
* @param left - The first vector to add
|
|
5656
|
-
* @param right - The second vector to add
|
|
5657
|
-
* @param out - The sum of two vectors
|
|
5658
|
-
*/ Vector4.add = function add(left, right, out) {
|
|
5659
|
-
out._x = left._x + right._x;
|
|
5660
|
-
out._y = left._y + right._y;
|
|
5661
|
-
out._z = left._z + right._z;
|
|
5662
|
-
out._w = left._w + right._w;
|
|
5663
|
-
out._onValueChanged && out._onValueChanged();
|
|
5664
|
-
};
|
|
5665
|
-
/**
|
|
5666
|
-
* Determines the difference between two vectors.
|
|
5667
|
-
* @param left - The first vector to subtract
|
|
5668
|
-
* @param right - The second vector to subtract
|
|
5669
|
-
* @param out - The difference between two vectors
|
|
5670
|
-
*/ Vector4.subtract = function subtract(left, right, out) {
|
|
5671
|
-
out._x = left._x - right._x;
|
|
5672
|
-
out._y = left._y - right._y;
|
|
5673
|
-
out._z = left._z - right._z;
|
|
5674
|
-
out._w = left._w - right._w;
|
|
5675
|
-
out._onValueChanged && out._onValueChanged();
|
|
5676
|
-
};
|
|
5677
|
-
/**
|
|
5678
|
-
* Determines the product of two vectors.
|
|
5679
|
-
* @param left - The first vector to multiply
|
|
5680
|
-
* @param right - The second vector to multiply
|
|
5681
|
-
* @param out - The product of two vectors
|
|
5682
|
-
*/ Vector4.multiply = function multiply(left, right, out) {
|
|
5683
|
-
out._x = left._x * right._x;
|
|
5684
|
-
out._y = left._y * right._y;
|
|
5685
|
-
out._z = left._z * right._z;
|
|
5686
|
-
out._w = left._w * right._w;
|
|
5687
|
-
out._onValueChanged && out._onValueChanged();
|
|
5688
|
-
};
|
|
5689
|
-
/**
|
|
5690
|
-
* Determines the divisor of two vectors.
|
|
5691
|
-
* @param left - The first vector to divide
|
|
5692
|
-
* @param right - The second vector to divide
|
|
5693
|
-
* @param out - The divisor of two vectors
|
|
5694
|
-
*/ Vector4.divide = function divide(left, right, out) {
|
|
5695
|
-
out._x = left._x / right._x;
|
|
5696
|
-
out._y = left._y / right._y;
|
|
5697
|
-
out._z = left._z / right._z;
|
|
5698
|
-
out._w = left._w / right._w;
|
|
5699
|
-
out._onValueChanged && out._onValueChanged();
|
|
5700
|
-
};
|
|
5701
|
-
/**
|
|
5702
|
-
* Determines the dot product of two vectors.
|
|
5703
|
-
* @param left - The first vector to dot
|
|
5704
|
-
* @param right - The second vector to dot
|
|
5705
|
-
* @returns The dot product of two vectors
|
|
5706
|
-
*/ Vector4.dot = function dot(left, right) {
|
|
5707
|
-
return left._x * right._x + left._y * right._y + left._z * right._z + left._w * right._w;
|
|
5708
|
-
};
|
|
5709
|
-
/**
|
|
5710
|
-
* Determines the distance of two vectors.
|
|
5711
|
-
* @param a - The first vector
|
|
5712
|
-
* @param b - The second vector
|
|
5713
|
-
* @returns The distance of two vectors
|
|
5714
|
-
*/ Vector4.distance = function distance(a, b) {
|
|
5715
|
-
var x = b._x - a._x;
|
|
5716
|
-
var y = b._y - a._y;
|
|
5717
|
-
var z = b._z - a._z;
|
|
5718
|
-
var w = b._w - a._w;
|
|
5719
|
-
return Math.sqrt(x * x + y * y + z * z + w * w);
|
|
5720
|
-
};
|
|
5721
|
-
/**
|
|
5722
|
-
* Determines the squared distance of two vectors.
|
|
5723
|
-
* @param a - The first vector
|
|
5724
|
-
* @param b - The second vector
|
|
5725
|
-
* @returns The squared distance of two vectors
|
|
5726
|
-
*/ Vector4.distanceSquared = function distanceSquared(a, b) {
|
|
5727
|
-
var x = b._x - a._x;
|
|
5728
|
-
var y = b._y - a._y;
|
|
5729
|
-
var z = b._z - a._z;
|
|
5730
|
-
var w = b._w - a._w;
|
|
5731
|
-
return x * x + y * y + z * z + w * w;
|
|
5732
|
-
};
|
|
5733
|
-
/**
|
|
5734
|
-
* Determines whether the specified vectors are equals.
|
|
5735
|
-
* @param left - The first vector to compare
|
|
5736
|
-
* @param right - The second vector to compare
|
|
5737
|
-
* @returns True if the specified vectors are equals, false otherwise
|
|
5738
|
-
*/ Vector4.equals = function equals(left, right) {
|
|
5739
|
-
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);
|
|
5740
|
-
};
|
|
5741
|
-
/**
|
|
5742
|
-
* Performs a linear interpolation between two vectors.
|
|
5743
|
-
* @param start - The first vector
|
|
5744
|
-
* @param end - The second vector
|
|
5745
|
-
* @param t - The blend amount where 0 returns start and 1 end
|
|
5746
|
-
* @param out - The result of linear blending between two vectors
|
|
5747
|
-
*/ Vector4.lerp = function lerp(start, end, t, out) {
|
|
5748
|
-
var _x = start._x, _y = start._y, _z = start._z, _w = start._w;
|
|
5749
|
-
out._x = _x + (end._x - _x) * t;
|
|
5750
|
-
out._y = _y + (end._y - _y) * t;
|
|
5751
|
-
out._z = _z + (end._z - _z) * t;
|
|
5752
|
-
out._w = _w + (end._w - _w) * t;
|
|
5753
|
-
out._onValueChanged && out._onValueChanged();
|
|
5754
|
-
};
|
|
5755
|
-
/**
|
|
5756
|
-
* Calculate a vector containing the largest components of the specified vectors.
|
|
5757
|
-
* @param left - The first vector
|
|
5758
|
-
* @param right - The second vector
|
|
5759
|
-
* @param out - The vector containing the largest components of the specified vectors
|
|
5760
|
-
*/ Vector4.max = function max(left, right, out) {
|
|
5761
|
-
out._x = Math.max(left._x, right._x);
|
|
5762
|
-
out._y = Math.max(left._y, right._y);
|
|
5763
|
-
out._z = Math.max(left._z, right._z);
|
|
5764
|
-
out._w = Math.max(left._w, right._w);
|
|
5765
|
-
out._onValueChanged && out._onValueChanged();
|
|
5766
|
-
};
|
|
5767
|
-
/**
|
|
5768
|
-
* Calculate a vector containing the smallest components of the specified vectors.
|
|
5769
|
-
* @param left - The first vector
|
|
5770
|
-
* @param right - The second vector
|
|
5771
|
-
* @param out - The vector containing the smallest components of the specified vectors
|
|
5772
|
-
*/ Vector4.min = function min(left, right, out) {
|
|
5773
|
-
out._x = Math.min(left._x, right._x);
|
|
5774
|
-
out._y = Math.min(left._y, right._y);
|
|
5775
|
-
out._z = Math.min(left._z, right._z);
|
|
5776
|
-
out._w = Math.min(left._w, right._w);
|
|
5777
|
-
out._onValueChanged && out._onValueChanged();
|
|
5778
|
-
};
|
|
5779
|
-
/**
|
|
5780
|
-
* Reverses the direction of a given vector.
|
|
5781
|
-
* @param a - The vector to negate
|
|
5782
|
-
* @param out - The vector facing in the opposite direction
|
|
5783
|
-
*/ Vector4.negate = function negate(a, out) {
|
|
5784
|
-
out._x = -a._x;
|
|
5785
|
-
out._y = -a._y;
|
|
5786
|
-
out._z = -a._z;
|
|
5787
|
-
out._w = -a._w;
|
|
5788
|
-
out._onValueChanged && out._onValueChanged();
|
|
5789
|
-
};
|
|
5790
|
-
/**
|
|
5791
|
-
* Converts the vector into a unit vector.
|
|
5792
|
-
* @param a - The vector to normalize
|
|
5793
|
-
* @param out - The normalized vector
|
|
5794
|
-
*/ Vector4.normalize = function normalize(a, out) {
|
|
5795
|
-
var _x = a._x, _y = a._y, _z = a._z, _w = a._w;
|
|
5796
|
-
var len = Math.sqrt(_x * _x + _y * _y + _z * _z + _w * _w);
|
|
5797
|
-
if (len > MathUtil.zeroTolerance) {
|
|
5798
|
-
len = 1 / len;
|
|
5799
|
-
out._x = _x * len;
|
|
5800
|
-
out._y = _y * len;
|
|
5801
|
-
out._z = _z * len;
|
|
5802
|
-
out._w = _w * len;
|
|
5803
|
-
out._onValueChanged && out._onValueChanged();
|
|
5804
|
-
}
|
|
5805
|
-
};
|
|
5806
|
-
/**
|
|
5807
|
-
* Scale a vector by the given value.
|
|
5808
|
-
* @param a - The vector to scale
|
|
5809
|
-
* @param s - The amount by which to scale the vector
|
|
5810
|
-
* @param out - The scaled vector
|
|
5811
|
-
*/ Vector4.scale = function scale(a, s, out) {
|
|
5812
|
-
out._x = a._x * s;
|
|
5813
|
-
out._y = a._y * s;
|
|
5814
|
-
out._z = a._z * s;
|
|
5815
|
-
out._w = a._w * s;
|
|
5816
|
-
out._onValueChanged && out._onValueChanged();
|
|
5817
|
-
};
|
|
5818
|
-
/**
|
|
5819
|
-
* Performs a transformation using the given 4x4 matrix.
|
|
5820
|
-
* @param v - The vector to transform
|
|
5821
|
-
* @param m - The transform matrix
|
|
5822
|
-
* @param out - The transformed vector3
|
|
5823
|
-
*/ Vector4.transform = function transform(v, m, out) {
|
|
5824
|
-
var _x = v._x, _y = v._y, _z = v._z, _w = v._w;
|
|
5825
|
-
var e = m.elements;
|
|
5826
|
-
out._x = _x * e[0] + _y * e[4] + _z * e[8] + _w * e[12];
|
|
5827
|
-
out._y = _x * e[1] + _y * e[5] + _z * e[9] + _w * e[13];
|
|
5828
|
-
out._z = _x * e[2] + _y * e[6] + _z * e[10] + _w * e[14];
|
|
5829
|
-
out._w = _x * e[3] + _y * e[7] + _z * e[11] + _w * e[15];
|
|
5830
|
-
out._onValueChanged && out._onValueChanged();
|
|
5831
|
-
};
|
|
5832
|
-
/**
|
|
5833
|
-
* Performs a transformation using the given quaternion.
|
|
5834
|
-
* @param v - The vector to transform
|
|
5835
|
-
* @param q - The transform quaternion
|
|
5836
|
-
* @param out - The transformed vector
|
|
5837
|
-
*/ Vector4.transformByQuat = function transformByQuat(v, q, out) {
|
|
5838
|
-
var x = v._x, y = v._y, z = v._z, w = v._w;
|
|
5839
|
-
var qx = q._x;
|
|
5840
|
-
var qy = q._y;
|
|
5841
|
-
var qz = q._z;
|
|
5842
|
-
var qw = q._w;
|
|
5843
|
-
// calculate quat * vec
|
|
5844
|
-
var ix = qw * x + qy * z - qz * y;
|
|
5845
|
-
var iy = qw * y + qz * x - qx * z;
|
|
5846
|
-
var iz = qw * z + qx * y - qy * x;
|
|
5847
|
-
var iw = -qx * x - qy * y - qz * z;
|
|
5848
|
-
// calculate result * inverse quat
|
|
5849
|
-
out._x = ix * qw - iw * qx - iy * qz + iz * qy;
|
|
5850
|
-
out._y = iy * qw - iw * qy - iz * qx + ix * qz;
|
|
5851
|
-
out._z = iz * qw - iw * qz - ix * qy + iy * qx;
|
|
5852
|
-
out._w = w;
|
|
5853
|
-
out._onValueChanged && out._onValueChanged();
|
|
5854
|
-
};
|
|
5855
|
-
_create_class(Vector4, [
|
|
5856
|
-
{
|
|
5857
|
-
key: "x",
|
|
5858
|
-
get: /**
|
|
5859
|
-
* The x component of the vector.
|
|
5860
|
-
*/ function get() {
|
|
5861
|
-
return this._x;
|
|
5862
|
-
},
|
|
5863
|
-
set: function set(value) {
|
|
5864
|
-
this._x = value;
|
|
5865
|
-
this._onValueChanged && this._onValueChanged();
|
|
5866
|
-
}
|
|
5867
|
-
},
|
|
5868
|
-
{
|
|
5869
|
-
key: "y",
|
|
5870
|
-
get: /**
|
|
5871
|
-
* The y component of the vector.
|
|
5872
|
-
*/ function get() {
|
|
5873
|
-
return this._y;
|
|
5874
|
-
},
|
|
5875
|
-
set: function set(value) {
|
|
5876
|
-
this._y = value;
|
|
5877
|
-
this._onValueChanged && this._onValueChanged();
|
|
5878
|
-
}
|
|
5879
|
-
},
|
|
5880
|
-
{
|
|
5881
|
-
key: "z",
|
|
5882
|
-
get: /**
|
|
5883
|
-
* The z component of the vector.
|
|
5884
|
-
*/ function get() {
|
|
5885
|
-
return this._z;
|
|
5886
|
-
},
|
|
5887
|
-
set: function set(value) {
|
|
5888
|
-
this._z = value;
|
|
5889
|
-
this._onValueChanged && this._onValueChanged();
|
|
5890
|
-
}
|
|
5891
|
-
},
|
|
5892
|
-
{
|
|
5893
|
-
key: "w",
|
|
5894
|
-
get: /**
|
|
5895
|
-
* The w component of the vector.
|
|
5896
|
-
*/ function get() {
|
|
5897
|
-
return this._w;
|
|
5898
|
-
},
|
|
5899
|
-
set: function set(value) {
|
|
5900
|
-
this._w = value;
|
|
5901
|
-
this._onValueChanged && this._onValueChanged();
|
|
5902
|
-
}
|
|
5903
|
-
}
|
|
5904
|
-
]);
|
|
5905
|
-
return Vector4;
|
|
5906
|
-
}();
|
|
5907
|
-
(function() {
|
|
5908
|
-
/** @internal */ Vector4._zero = new Vector4(0.0, 0.0, 0.0, 0.0);
|
|
5909
|
-
})();
|
|
5910
|
-
(function() {
|
|
5911
|
-
/** @internal */ Vector4._one = new Vector4(1.0, 1.0, 1.0, 1.0);
|
|
5912
|
-
})();
|
|
5913
|
-
|
|
5914
|
-
var WebXRFrame = /*#__PURE__*/ function() {
|
|
5915
|
-
function WebXRFrame(session) {
|
|
5916
|
-
this._session = session;
|
|
5917
|
-
}
|
|
5918
|
-
var _proto = WebXRFrame.prototype;
|
|
5919
|
-
_proto.updateInputs = function updateInputs(inputs) {
|
|
5920
|
-
if (!this._platformFrame) return;
|
|
5921
|
-
this._updateController(inputs);
|
|
5922
|
-
this._updateCamera(inputs);
|
|
5923
|
-
};
|
|
5924
|
-
_proto._updateController = function _updateController(inputs) {
|
|
5925
|
-
var _this = this, frame = _this._platformFrame;
|
|
5926
|
-
var _this__session = this._session, session = _this__session._platformSession, referenceSpace = _this__session._platformReferenceSpace;
|
|
5927
|
-
var inputSources = session.inputSources;
|
|
5928
|
-
for(var i = 0, n = inputSources.length; i < n; i++){
|
|
5929
|
-
var inputSource = inputSources[i];
|
|
5930
|
-
var type = getInputSource(inputSource);
|
|
5931
|
-
var input = inputs[type];
|
|
5932
|
-
switch(inputSource.targetRayMode){
|
|
5933
|
-
case "screen":
|
|
5934
|
-
case "tracked-pointer":
|
|
5935
|
-
var gripSpace = inputSource.gripSpace, targetRaySpace = inputSource.targetRaySpace;
|
|
5936
|
-
if (gripSpace) {
|
|
5937
|
-
var _frame_getPose = frame.getPose(gripSpace, referenceSpace), transform = _frame_getPose.transform, emulatedPosition = _frame_getPose.emulatedPosition;
|
|
5938
|
-
if (transform) {
|
|
5939
|
-
var gripPose = input.gripPose;
|
|
5940
|
-
gripPose.matrix.copyFromArray(transform.matrix);
|
|
5941
|
-
gripPose.position.copyFrom(transform.position);
|
|
5942
|
-
gripPose.rotation.copyFrom(transform.orientation);
|
|
5943
|
-
}
|
|
5944
|
-
input.trackingState = emulatedPosition ? XRTrackingState.TrackingLost : XRTrackingState.Tracking;
|
|
5945
|
-
}
|
|
5946
|
-
if (targetRaySpace) {
|
|
5947
|
-
var _frame_getPose1 = frame.getPose(targetRaySpace, referenceSpace), transform1 = _frame_getPose1.transform, emulatedPosition1 = _frame_getPose1.emulatedPosition;
|
|
5948
|
-
if (transform1) {
|
|
5949
|
-
var targetRayPose = input.targetRayPose;
|
|
5950
|
-
targetRayPose.matrix.copyFromArray(transform1.matrix);
|
|
5951
|
-
targetRayPose.position.copyFrom(transform1.position);
|
|
5952
|
-
targetRayPose.rotation.copyFrom(transform1.orientation);
|
|
5953
|
-
input.trackingState = emulatedPosition1 ? XRTrackingState.TrackingLost : XRTrackingState.Tracking;
|
|
5954
|
-
}
|
|
5955
|
-
}
|
|
5956
|
-
break;
|
|
5957
|
-
}
|
|
5958
|
-
}
|
|
4439
|
+
_proto._updateController = function _updateController(inputs) {
|
|
4440
|
+
var _this = this, frame = _this._platformFrame;
|
|
4441
|
+
var _this__session = this._session, session = _this__session._platformSession, referenceSpace = _this__session._platformReferenceSpace;
|
|
4442
|
+
var inputSources = session.inputSources;
|
|
4443
|
+
for(var i = 0, n = inputSources.length; i < n; i++){
|
|
4444
|
+
var inputSource = inputSources[i];
|
|
4445
|
+
var type = getInputSource(inputSource);
|
|
4446
|
+
var input = inputs[type];
|
|
4447
|
+
switch(inputSource.targetRayMode){
|
|
4448
|
+
case "screen":
|
|
4449
|
+
case "tracked-pointer":
|
|
4450
|
+
var gripSpace = inputSource.gripSpace, targetRaySpace = inputSource.targetRaySpace;
|
|
4451
|
+
if (gripSpace) {
|
|
4452
|
+
var _frame_getPose = frame.getPose(gripSpace, referenceSpace), transform = _frame_getPose.transform, emulatedPosition = _frame_getPose.emulatedPosition;
|
|
4453
|
+
if (transform) {
|
|
4454
|
+
var gripPose = input.gripPose;
|
|
4455
|
+
gripPose.matrix.copyFromArray(transform.matrix);
|
|
4456
|
+
gripPose.position.copyFrom(transform.position);
|
|
4457
|
+
gripPose.rotation.copyFrom(transform.orientation);
|
|
4458
|
+
}
|
|
4459
|
+
input.trackingState = emulatedPosition ? XRTrackingState.TrackingLost : XRTrackingState.Tracking;
|
|
4460
|
+
}
|
|
4461
|
+
if (targetRaySpace) {
|
|
4462
|
+
var _frame_getPose1 = frame.getPose(targetRaySpace, referenceSpace), transform1 = _frame_getPose1.transform, emulatedPosition1 = _frame_getPose1.emulatedPosition;
|
|
4463
|
+
if (transform1) {
|
|
4464
|
+
var targetRayPose = input.targetRayPose;
|
|
4465
|
+
targetRayPose.matrix.copyFromArray(transform1.matrix);
|
|
4466
|
+
targetRayPose.position.copyFrom(transform1.position);
|
|
4467
|
+
targetRayPose.rotation.copyFrom(transform1.orientation);
|
|
4468
|
+
input.trackingState = emulatedPosition1 ? XRTrackingState.TrackingLost : XRTrackingState.Tracking;
|
|
4469
|
+
}
|
|
4470
|
+
}
|
|
4471
|
+
break;
|
|
4472
|
+
}
|
|
4473
|
+
}
|
|
5959
4474
|
};
|
|
5960
4475
|
_proto._updateCamera = function _updateCamera(inputs) {
|
|
5961
4476
|
var _this = this, frame = _this._platformFrame;
|
|
@@ -6295,9 +4810,7 @@
|
|
|
6295
4810
|
};
|
|
6296
4811
|
return WebXRDevice;
|
|
6297
4812
|
}();
|
|
6298
|
-
|
|
6299
|
-
/** @internal */ WebXRDevice._platformFeatureMap = [];
|
|
6300
|
-
})();
|
|
4813
|
+
/** @internal */ WebXRDevice._platformFeatureMap = [];
|
|
6301
4814
|
function registerXRPlatformFeature(type) {
|
|
6302
4815
|
return function(platformFeatureConstructor) {
|
|
6303
4816
|
WebXRDevice._platformFeatureMap[type] = platformFeatureConstructor;
|
|
@@ -6311,10 +4824,10 @@
|
|
|
6311
4824
|
|
|
6312
4825
|
/**
|
|
6313
4826
|
* @internal
|
|
6314
|
-
*/ var WebXRTrackableFeature = /*#__PURE__*/ function(
|
|
6315
|
-
_inherits$1(WebXRTrackableFeature,
|
|
4827
|
+
*/ var WebXRTrackableFeature = /*#__PURE__*/ function(WebXRFeature) {
|
|
4828
|
+
_inherits$1(WebXRTrackableFeature, WebXRFeature);
|
|
6316
4829
|
function WebXRTrackableFeature() {
|
|
6317
|
-
return
|
|
4830
|
+
return WebXRFeature.apply(this, arguments) || this;
|
|
6318
4831
|
}
|
|
6319
4832
|
var _proto = WebXRTrackableFeature.prototype;
|
|
6320
4833
|
_proto.onAddRequestTracking = function onAddRequestTracking(requestTracking) {};
|
|
@@ -6332,10 +4845,10 @@
|
|
|
6332
4845
|
return WebXRTrackableFeature;
|
|
6333
4846
|
}(WebXRFeature);
|
|
6334
4847
|
|
|
6335
|
-
var WebXRAnchorTracking = /*#__PURE__*/ function(
|
|
6336
|
-
_inherits$1(WebXRAnchorTracking,
|
|
4848
|
+
var WebXRAnchorTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
|
|
4849
|
+
_inherits$1(WebXRAnchorTracking, WebXRTrackableFeature);
|
|
6337
4850
|
function WebXRAnchorTracking() {
|
|
6338
|
-
return
|
|
4851
|
+
return WebXRTrackableFeature.apply(this, arguments) || this;
|
|
6339
4852
|
}
|
|
6340
4853
|
var _proto = WebXRAnchorTracking.prototype;
|
|
6341
4854
|
_proto.checkAvailable = function checkAvailable(session, frame, requestTrackings) {
|
|
@@ -6446,14 +4959,11 @@
|
|
|
6446
4959
|
registerXRPlatformFeature(XRFeatureType.AnchorTracking)
|
|
6447
4960
|
], WebXRAnchorTracking);
|
|
6448
4961
|
|
|
6449
|
-
var WebXRImageTracking = /*#__PURE__*/ function(
|
|
6450
|
-
_inherits$1(WebXRImageTracking,
|
|
4962
|
+
var WebXRImageTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
|
|
4963
|
+
_inherits$1(WebXRImageTracking, WebXRTrackableFeature);
|
|
6451
4964
|
function WebXRImageTracking(images) {
|
|
6452
4965
|
var _this;
|
|
6453
|
-
_this =
|
|
6454
|
-
_this._trackingScoreStatus = 0;
|
|
6455
|
-
_this._tempIdx = 0;
|
|
6456
|
-
_this._tempArr = [];
|
|
4966
|
+
_this = WebXRTrackableFeature.call(this) || this, _this._trackingScoreStatus = 0, _this._tempIdx = 0, _this._tempArr = [];
|
|
6457
4967
|
_this._images = images;
|
|
6458
4968
|
return _this;
|
|
6459
4969
|
}
|
|
@@ -6570,17 +5080,12 @@
|
|
|
6570
5080
|
WebXRImageTracking = __decorate$1([
|
|
6571
5081
|
registerXRPlatformFeature(XRFeatureType.ImageTracking)
|
|
6572
5082
|
], WebXRImageTracking);
|
|
6573
|
-
var ImageTrackingScoreStatus;
|
|
6574
|
-
(function(ImageTrackingScoreStatus) {
|
|
6575
|
-
ImageTrackingScoreStatus[ImageTrackingScoreStatus["NotReceived"] = 0] = "NotReceived";
|
|
6576
|
-
ImageTrackingScoreStatus[ImageTrackingScoreStatus["Waiting"] = 1] = "Waiting";
|
|
6577
|
-
ImageTrackingScoreStatus[ImageTrackingScoreStatus["Received"] = 2] = "Received";
|
|
6578
|
-
})(ImageTrackingScoreStatus || (ImageTrackingScoreStatus = {}));
|
|
6579
5083
|
|
|
6580
|
-
var WebXRPlaneTracking = /*#__PURE__*/ function(
|
|
6581
|
-
_inherits$1(WebXRPlaneTracking,
|
|
5084
|
+
var WebXRPlaneTracking = /*#__PURE__*/ function(WebXRTrackableFeature) {
|
|
5085
|
+
_inherits$1(WebXRPlaneTracking, WebXRTrackableFeature);
|
|
6582
5086
|
function WebXRPlaneTracking(detectedMode) {
|
|
6583
|
-
var _this
|
|
5087
|
+
var _this;
|
|
5088
|
+
_this = WebXRTrackableFeature.call(this) || this;
|
|
6584
5089
|
if (detectedMode !== XRPlaneMode.EveryThing) {
|
|
6585
5090
|
console.warn("WebXR only support XRPlaneMode.EveryThing");
|
|
6586
5091
|
}
|
|
@@ -6609,8 +5114,7 @@
|
|
|
6609
5114
|
}
|
|
6610
5115
|
var _this1 = this, lastDetectedPlanes = _this1._lastDetectedPlanes;
|
|
6611
5116
|
detectedPlanes.forEach(function(xrPlane) {
|
|
6612
|
-
|
|
6613
|
-
if (!((_lastDetectedPlanes = lastDetectedPlanes) == null ? void 0 : _lastDetectedPlanes.has(xrPlane))) {
|
|
5117
|
+
if (!(lastDetectedPlanes == null ? void 0 : lastDetectedPlanes.has(xrPlane))) {
|
|
6614
5118
|
var plane = generateTracked();
|
|
6615
5119
|
plane.xrPlane = xrPlane;
|
|
6616
5120
|
plane.lastChangedTime = -1;
|