@galacean/engine-xr 0.0.0-experimental-1.3-xr.2 → 0.0.0-experimental-1.3-xr.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/browser.js CHANGED
@@ -99,9 +99,10 @@
99
99
  */ exports.XRSessionState = void 0;
100
100
  (function(XRSessionState) {
101
101
  XRSessionState[XRSessionState[/** Not initialized. */ "None"] = 0] = "None";
102
- XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 1] = "Initialized";
103
- XRSessionState[XRSessionState[/** Running. */ "Running"] = 2] = "Running";
104
- XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 3] = "Paused";
102
+ XRSessionState[XRSessionState[/** Requesting the session. */ "Requesting"] = 1] = "Requesting";
103
+ XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 2] = "Initialized";
104
+ XRSessionState[XRSessionState[/** Running. */ "Running"] = 3] = "Running";
105
+ XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 4] = "Paused";
105
106
  })(exports.XRSessionState || (exports.XRSessionState = {}));
106
107
 
107
108
  /**
@@ -781,6 +782,7 @@
781
782
  return new Promise(function(resolve, reject) {
782
783
  // 1. Check if this xr mode is supported
783
784
  sessionManager.isSupportedMode(sessionMode).then(function() {
785
+ sessionManager.state = exports.XRSessionState.Requesting;
784
786
  // 2. Initialize session
785
787
  sessionManager._initialize(sessionMode, _this.features).then(function() {
786
788
  autoRun && sessionManager.run();
@@ -993,78 +995,6 @@
993
995
  return XRFeature;
994
996
  }();
995
997
 
996
- /**
997
- * Enum for the types of hit test that can be performed.
998
- * Note: currently only supports plane.
999
- */ exports.TrackableType = void 0;
1000
- (function(TrackableType) {
1001
- TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
1002
- TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
1003
- })(exports.TrackableType || (exports.TrackableType = {}));
1004
-
1005
- /**
1006
- * XR hit result.
1007
- * It is the detection result returned by using XR HitTest feature.
1008
- */ var XRHitResult = function XRHitResult() {
1009
- /** The position of the hit point. */ this.point = new engine.Vector3();
1010
- /** The normal of the hit point. */ this.normal = new engine.Vector3();
1011
- };
1012
-
1013
- /******************************************************************************
1014
- Copyright (c) Microsoft Corporation.
1015
-
1016
- Permission to use, copy, modify, and/or distribute this software for any
1017
- purpose with or without fee is hereby granted.
1018
-
1019
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1020
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1021
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1022
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1023
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1024
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1025
- PERFORMANCE OF THIS SOFTWARE.
1026
- ***************************************************************************** */
1027
-
1028
- function __decorate(decorators, target, key, desc) {
1029
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1030
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1031
- 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;
1032
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1033
- }
1034
-
1035
- function __generator(thisArg, body) {
1036
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1037
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1038
- function verb(n) { return function (v) { return step([n, v]); }; }
1039
- function step(op) {
1040
- if (f) throw new TypeError("Generator is already executing.");
1041
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
1042
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1043
- if (y = 0, t) op = [op[0] & 2, t.value];
1044
- switch (op[0]) {
1045
- case 0: case 1: t = op; break;
1046
- case 4: _.label++; return { value: op[1], done: false };
1047
- case 5: _.label++; y = op[1]; op = [0]; continue;
1048
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
1049
- default:
1050
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1051
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1052
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1053
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1054
- if (t[2]) _.ops.pop();
1055
- _.trys.pop(); continue;
1056
- }
1057
- op = body.call(thisArg, _);
1058
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1059
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1060
- }
1061
- }
1062
-
1063
- typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1064
- var e = new Error(message);
1065
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1066
- };
1067
-
1068
998
  exports.XRFeatureType = void 0;
1069
999
  (function(XRFeatureType) {
1070
1000
  XRFeatureType[XRFeatureType["AnchorTracking"] = 0] = "AnchorTracking";
@@ -1183,10 +1113,6 @@
1183
1113
  // prettier-ignore
1184
1114
  this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1185
1115
  };
1186
- _proto._onDestroy = function _onDestroy() {
1187
- // prettier-ignore
1188
- this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1189
- };
1190
1116
  _proto._addRequestTracking = function _addRequestTracking(requestTracking) {
1191
1117
  var _this = this, platformFeature = _this._platformFeature;
1192
1118
  if (this._xrManager.sessionManager._platformSession && !platformFeature.canModifyRequestTrackingAfterInit) {
@@ -1218,6 +1144,85 @@
1218
1144
  XRTrackableFeature._uuid = 0;
1219
1145
  })();
1220
1146
 
1147
+ /**
1148
+ * The base class of XR tracked object.
1149
+ */ var XRTracked = function XRTracked() {
1150
+ /** The pose of the trackable in XR space. */ this.pose = new XRPose();
1151
+ /** The tracking state of the trackable. */ this.state = exports.XRTrackingState.NotTracking;
1152
+ };
1153
+
1154
+ /**
1155
+ * Enum for the types of hit test that can be performed.
1156
+ * Note: currently only supports plane.
1157
+ */ exports.TrackableType = void 0;
1158
+ (function(TrackableType) {
1159
+ TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
1160
+ TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
1161
+ })(exports.TrackableType || (exports.TrackableType = {}));
1162
+
1163
+ /**
1164
+ * XR hit result.
1165
+ * It is the detection result returned by using XR HitTest feature.
1166
+ */ var XRHitResult = function XRHitResult() {
1167
+ /** The position of the hit point. */ this.point = new engine.Vector3();
1168
+ /** The normal of the hit point. */ this.normal = new engine.Vector3();
1169
+ };
1170
+
1171
+ /******************************************************************************
1172
+ Copyright (c) Microsoft Corporation.
1173
+
1174
+ Permission to use, copy, modify, and/or distribute this software for any
1175
+ purpose with or without fee is hereby granted.
1176
+
1177
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1178
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1179
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1180
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1181
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1182
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1183
+ PERFORMANCE OF THIS SOFTWARE.
1184
+ ***************************************************************************** */
1185
+
1186
+ function __decorate(decorators, target, key, desc) {
1187
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1188
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1189
+ 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;
1190
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1191
+ }
1192
+
1193
+ function __generator(thisArg, body) {
1194
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
1195
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
1196
+ function verb(n) { return function (v) { return step([n, v]); }; }
1197
+ function step(op) {
1198
+ if (f) throw new TypeError("Generator is already executing.");
1199
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
1200
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
1201
+ if (y = 0, t) op = [op[0] & 2, t.value];
1202
+ switch (op[0]) {
1203
+ case 0: case 1: t = op; break;
1204
+ case 4: _.label++; return { value: op[1], done: false };
1205
+ case 5: _.label++; y = op[1]; op = [0]; continue;
1206
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
1207
+ default:
1208
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
1209
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
1210
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
1211
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
1212
+ if (t[2]) _.ops.pop();
1213
+ _.trys.pop(); continue;
1214
+ }
1215
+ op = body.call(thisArg, _);
1216
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
1217
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
1218
+ }
1219
+ }
1220
+
1221
+ typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
1222
+ var e = new Error(message);
1223
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1224
+ };
1225
+
1221
1226
  /**
1222
1227
  * Enumerates modes of plane in XR.
1223
1228
  */ exports.XRPlaneMode = void 0;
@@ -1248,13 +1253,6 @@
1248
1253
  return XRRequestPlane;
1249
1254
  }(XRRequestTracking);
1250
1255
 
1251
- /**
1252
- * The base class of XR tracked object.
1253
- */ var XRTracked = function XRTracked() {
1254
- /** The pose of the trackable in XR space. */ this.pose = new XRPose();
1255
- /** The tracking state of the trackable. */ this.state = exports.XRTrackingState.NotTracking;
1256
- };
1257
-
1258
1256
  /**
1259
1257
  * The tracked plane in XR space.
1260
1258
  */ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked1) {
@@ -1866,6 +1864,8 @@
1866
1864
  exports.XRPose = XRPose;
1867
1865
  exports.XRReferenceImage = XRReferenceImage;
1868
1866
  exports.XRSessionManager = XRSessionManager;
1867
+ exports.XRTrackableFeature = XRTrackableFeature;
1868
+ exports.XRTracked = XRTracked;
1869
1869
  exports.XRTrackedImage = XRTrackedImage;
1870
1870
  exports.XRTrackedPlane = XRTrackedPlane;
1871
1871