@galacean/engine-xr 0.0.0-experimental-stateMachine.0 → 0.0.0-experimental-1.2-xr.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.js +73 -63
- 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 +73 -63
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +73 -63
- package/dist/module.js +72 -64
- package/dist/module.js.map +1 -1
- package/package.json +4 -4
- package/types/XRManagerExtended.d.ts +5 -7
- package/types/feature/trackable/XRTrackableFeature.d.ts +1 -1
- package/types/index.d.ts +2 -0
package/dist/browser.js
CHANGED
|
@@ -554,6 +554,7 @@
|
|
|
554
554
|
engine.pause();
|
|
555
555
|
engine.resume();
|
|
556
556
|
}
|
|
557
|
+
engine.dispatch("XRSessionStart");
|
|
557
558
|
};
|
|
558
559
|
/**
|
|
559
560
|
* Stop the session.
|
|
@@ -574,6 +575,7 @@
|
|
|
574
575
|
engine.pause();
|
|
575
576
|
engine.resume();
|
|
576
577
|
}
|
|
578
|
+
engine.dispatch("XRSessionStop");
|
|
577
579
|
};
|
|
578
580
|
/**
|
|
579
581
|
* @internal
|
|
@@ -595,6 +597,7 @@
|
|
|
595
597
|
platformSession.addEventListener();
|
|
596
598
|
xrManager._onSessionInit();
|
|
597
599
|
resolve();
|
|
600
|
+
_this._engine.dispatch("XRSessionInit");
|
|
598
601
|
}, reject);
|
|
599
602
|
});
|
|
600
603
|
};
|
|
@@ -627,11 +630,14 @@
|
|
|
627
630
|
/**
|
|
628
631
|
* @internal
|
|
629
632
|
*/ _proto._exit = function _exit() {
|
|
630
|
-
var _this = this
|
|
633
|
+
var _this = this;
|
|
634
|
+
var _this1 = this, platformSession = _this1._platformSession;
|
|
631
635
|
if (!platformSession) {
|
|
632
636
|
return Promise.reject("Without session to stop.");
|
|
633
637
|
}
|
|
634
|
-
return platformSession.end()
|
|
638
|
+
return platformSession.end().then(function() {
|
|
639
|
+
_this._engine.dispatch("XRSessionExit");
|
|
640
|
+
});
|
|
635
641
|
};
|
|
636
642
|
_proto._onSessionExit = function _onSessionExit() {
|
|
637
643
|
var _this = this, rhi = _this._rhi, platformSession = _this._platformSession, engine = _this._engine;
|
|
@@ -713,14 +719,16 @@
|
|
|
713
719
|
if (this.sessionManager._platformSession) {
|
|
714
720
|
throw new Error("Cannot add feature when the session is initialized.");
|
|
715
721
|
}
|
|
716
|
-
var _this = this, features = _this._features;
|
|
722
|
+
var _this = this, features = _this._features; _this._platformDevice;
|
|
723
|
+
if (!this._platformDevice.isSupportedFeature(XRManagerExtended._featureMap.get(type))) {
|
|
724
|
+
throw new Error("The feature is not supported");
|
|
725
|
+
}
|
|
717
726
|
for(var i = 0, n = features.length; i < n; i++){
|
|
718
|
-
|
|
719
|
-
if (_instanceof(feature, type)) throw new Error("The feature has been added");
|
|
727
|
+
if (_instanceof(features[i], type)) throw new Error("The feature has been added");
|
|
720
728
|
}
|
|
721
|
-
var
|
|
722
|
-
this._features.push(
|
|
723
|
-
return
|
|
729
|
+
var feature = _construct(type, [].concat(this, args));
|
|
730
|
+
this._features.push(feature);
|
|
731
|
+
return feature;
|
|
724
732
|
};
|
|
725
733
|
/**
|
|
726
734
|
* Get feature which match the type.
|
|
@@ -735,16 +743,16 @@
|
|
|
735
743
|
}
|
|
736
744
|
}
|
|
737
745
|
};
|
|
738
|
-
_proto.getFeatures = function getFeatures(
|
|
746
|
+
_proto.getFeatures = function getFeatures(out) {
|
|
747
|
+
var _this = this, features = _this._features;
|
|
748
|
+
var length = features.length;
|
|
739
749
|
if (out) {
|
|
740
|
-
out.length =
|
|
750
|
+
out.length = length;
|
|
741
751
|
} else {
|
|
742
|
-
out =
|
|
752
|
+
out = new Array(length);
|
|
743
753
|
}
|
|
744
|
-
var
|
|
745
|
-
|
|
746
|
-
var feature = features[i];
|
|
747
|
-
_instanceof(feature, type) && out.push(feature);
|
|
754
|
+
for(var i = 0; i < length; i--){
|
|
755
|
+
out[i] = features[i];
|
|
748
756
|
}
|
|
749
757
|
return out;
|
|
750
758
|
};
|
|
@@ -979,47 +987,10 @@
|
|
|
979
987
|
}();
|
|
980
988
|
|
|
981
989
|
/**
|
|
982
|
-
*
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
|
|
987
|
-
TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
|
|
988
|
-
})(exports.TrackableType || (exports.TrackableType = {}));
|
|
989
|
-
|
|
990
|
-
/**
|
|
991
|
-
* XR hit result.
|
|
992
|
-
* It is the detection result returned by using XR HitTest feature.
|
|
993
|
-
*/ var XRHitResult = function XRHitResult() {
|
|
994
|
-
/** The position of the hit point. */ this.point = new engine.Vector3();
|
|
995
|
-
/** The normal of the hit point. */ this.normal = new engine.Vector3();
|
|
996
|
-
};
|
|
997
|
-
|
|
998
|
-
/******************************************************************************
|
|
999
|
-
Copyright (c) Microsoft Corporation.
|
|
1000
|
-
|
|
1001
|
-
Permission to use, copy, modify, and/or distribute this software for any
|
|
1002
|
-
purpose with or without fee is hereby granted.
|
|
1003
|
-
|
|
1004
|
-
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1005
|
-
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1006
|
-
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1007
|
-
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1008
|
-
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1009
|
-
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1010
|
-
PERFORMANCE OF THIS SOFTWARE.
|
|
1011
|
-
***************************************************************************** */
|
|
1012
|
-
|
|
1013
|
-
function __decorate(decorators, target, key, desc) {
|
|
1014
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1015
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1016
|
-
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;
|
|
1017
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1018
|
-
}
|
|
1019
|
-
|
|
1020
|
-
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1021
|
-
var e = new Error(message);
|
|
1022
|
-
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
990
|
+
* The base class of XR tracked object.
|
|
991
|
+
*/ var XRTracked = function XRTracked() {
|
|
992
|
+
/** The pose of the trackable in XR space. */ this.pose = new XRPose();
|
|
993
|
+
/** The tracking state of the trackable. */ this.state = exports.XRTrackingState.NotTracking;
|
|
1023
994
|
};
|
|
1024
995
|
|
|
1025
996
|
exports.XRFeatureType = void 0;
|
|
@@ -1175,6 +1146,50 @@
|
|
|
1175
1146
|
XRTrackableFeature._uuid = 0;
|
|
1176
1147
|
})();
|
|
1177
1148
|
|
|
1149
|
+
/**
|
|
1150
|
+
* Enum for the types of hit test that can be performed.
|
|
1151
|
+
* Note: currently only supports plane.
|
|
1152
|
+
*/ exports.TrackableType = void 0;
|
|
1153
|
+
(function(TrackableType) {
|
|
1154
|
+
TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
|
|
1155
|
+
TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
|
|
1156
|
+
})(exports.TrackableType || (exports.TrackableType = {}));
|
|
1157
|
+
|
|
1158
|
+
/**
|
|
1159
|
+
* XR hit result.
|
|
1160
|
+
* It is the detection result returned by using XR HitTest feature.
|
|
1161
|
+
*/ var XRHitResult = function XRHitResult() {
|
|
1162
|
+
/** The position of the hit point. */ this.point = new engine.Vector3();
|
|
1163
|
+
/** The normal of the hit point. */ this.normal = new engine.Vector3();
|
|
1164
|
+
};
|
|
1165
|
+
|
|
1166
|
+
/******************************************************************************
|
|
1167
|
+
Copyright (c) Microsoft Corporation.
|
|
1168
|
+
|
|
1169
|
+
Permission to use, copy, modify, and/or distribute this software for any
|
|
1170
|
+
purpose with or without fee is hereby granted.
|
|
1171
|
+
|
|
1172
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
|
|
1173
|
+
REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
|
|
1174
|
+
AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
|
|
1175
|
+
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
|
|
1176
|
+
LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
1177
|
+
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
1178
|
+
PERFORMANCE OF THIS SOFTWARE.
|
|
1179
|
+
***************************************************************************** */
|
|
1180
|
+
|
|
1181
|
+
function __decorate(decorators, target, key, desc) {
|
|
1182
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1183
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
1184
|
+
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;
|
|
1185
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1186
|
+
}
|
|
1187
|
+
|
|
1188
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
1189
|
+
var e = new Error(message);
|
|
1190
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
1191
|
+
};
|
|
1192
|
+
|
|
1178
1193
|
/**
|
|
1179
1194
|
* Enumerates modes of plane in XR.
|
|
1180
1195
|
*/ exports.XRPlaneMode = void 0;
|
|
@@ -1205,13 +1220,6 @@
|
|
|
1205
1220
|
return XRRequestPlane;
|
|
1206
1221
|
}(XRRequestTracking);
|
|
1207
1222
|
|
|
1208
|
-
/**
|
|
1209
|
-
* The base class of XR tracked object.
|
|
1210
|
-
*/ var XRTracked = function XRTracked() {
|
|
1211
|
-
/** The pose of the trackable in XR space. */ this.pose = new XRPose();
|
|
1212
|
-
/** The tracking state of the trackable. */ this.state = exports.XRTrackingState.NotTracking;
|
|
1213
|
-
};
|
|
1214
|
-
|
|
1215
1223
|
/**
|
|
1216
1224
|
* The tracked plane in XR space.
|
|
1217
1225
|
*/ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked1) {
|
|
@@ -1569,6 +1577,8 @@
|
|
|
1569
1577
|
exports.XRPose = XRPose;
|
|
1570
1578
|
exports.XRReferenceImage = XRReferenceImage;
|
|
1571
1579
|
exports.XRSessionManager = XRSessionManager;
|
|
1580
|
+
exports.XRTrackableFeature = XRTrackableFeature;
|
|
1581
|
+
exports.XRTracked = XRTracked;
|
|
1572
1582
|
exports.XRTrackedImage = XRTrackedImage;
|
|
1573
1583
|
exports.XRTrackedPlane = XRTrackedPlane;
|
|
1574
1584
|
|