@galacean/engine-xr-webxr 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
@@ -159,9 +159,10 @@
159
159
  */ var XRSessionState;
160
160
  (function(XRSessionState) {
161
161
  XRSessionState[XRSessionState[/** Not initialized. */ "None"] = 0] = "None";
162
- XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 1] = "Initialized";
163
- XRSessionState[XRSessionState[/** Running. */ "Running"] = 2] = "Running";
164
- XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 3] = "Paused";
162
+ XRSessionState[XRSessionState[/** Requesting the session. */ "Requesting"] = 1] = "Requesting";
163
+ XRSessionState[XRSessionState[/** Initialized but not started. */ "Initialized"] = 2] = "Initialized";
164
+ XRSessionState[XRSessionState[/** Running. */ "Running"] = 3] = "Running";
165
+ XRSessionState[XRSessionState[/** Paused. */ "Paused"] = 4] = "Paused";
165
166
  })(XRSessionState || (XRSessionState = {}));
166
167
  /**
167
168
  * The manager of XR camera.
@@ -828,6 +829,7 @@
828
829
  return new Promise(function(resolve, reject) {
829
830
  // 1. Check if this xr mode is supported
830
831
  sessionManager.isSupportedMode(sessionMode).then(function() {
832
+ sessionManager.state = XRSessionState.Requesting;
831
833
  // 2. Initialize session
832
834
  sessionManager._initialize(sessionMode, _this.features).then(function() {
833
835
  autoRun && sessionManager.run();
@@ -1038,139 +1040,6 @@
1038
1040
  ]);
1039
1041
  return XRFeature;
1040
1042
  }();
1041
- /**
1042
- * Enum for the types of hit test that can be performed.
1043
- * Note: currently only supports plane.
1044
- */ var TrackableType;
1045
- (function(TrackableType) {
1046
- TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
1047
- TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
1048
- })(TrackableType || (TrackableType = {}));
1049
- /**
1050
- * XR hit result.
1051
- * It is the detection result returned by using XR HitTest feature.
1052
- */ var XRHitResult = function XRHitResult() {
1053
- /** The position of the hit point. */ this.point = new engine.Vector3();
1054
- /** The normal of the hit point. */ this.normal = new engine.Vector3();
1055
- };
1056
- /******************************************************************************
1057
- Copyright (c) Microsoft Corporation.
1058
-
1059
- Permission to use, copy, modify, and/or distribute this software for any
1060
- purpose with or without fee is hereby granted.
1061
-
1062
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1063
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1064
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1065
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1066
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1067
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1068
- PERFORMANCE OF THIS SOFTWARE.
1069
- ***************************************************************************** */ function __decorate(decorators, target, key, desc) {
1070
- var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1071
- if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1072
- 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;
1073
- return c > 3 && r && Object.defineProperty(target, key, r), r;
1074
- }
1075
- function __generator(thisArg, body) {
1076
- var verb = function verb(n) {
1077
- return function(v) {
1078
- return step([
1079
- n,
1080
- v
1081
- ]);
1082
- };
1083
- };
1084
- var step = function step(op) {
1085
- if (f) throw new TypeError("Generator is already executing.");
1086
- while(g && (g = 0, op[0] && (_ = 0)), _)try {
1087
- 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;
1088
- if (y = 0, t) op = [
1089
- op[0] & 2,
1090
- t.value
1091
- ];
1092
- switch(op[0]){
1093
- case 0:
1094
- case 1:
1095
- t = op;
1096
- break;
1097
- case 4:
1098
- _.label++;
1099
- return {
1100
- value: op[1],
1101
- done: false
1102
- };
1103
- case 5:
1104
- _.label++;
1105
- y = op[1];
1106
- op = [
1107
- 0
1108
- ];
1109
- continue;
1110
- case 7:
1111
- op = _.ops.pop();
1112
- _.trys.pop();
1113
- continue;
1114
- default:
1115
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1116
- _ = 0;
1117
- continue;
1118
- }
1119
- if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1120
- _.label = op[1];
1121
- break;
1122
- }
1123
- if (op[0] === 6 && _.label < t[1]) {
1124
- _.label = t[1];
1125
- t = op;
1126
- break;
1127
- }
1128
- if (t && _.label < t[2]) {
1129
- _.label = t[2];
1130
- _.ops.push(op);
1131
- break;
1132
- }
1133
- if (t[2]) _.ops.pop();
1134
- _.trys.pop();
1135
- continue;
1136
- }
1137
- op = body.call(thisArg, _);
1138
- } catch (e) {
1139
- op = [
1140
- 6,
1141
- e
1142
- ];
1143
- y = 0;
1144
- } finally{
1145
- f = t = 0;
1146
- }
1147
- if (op[0] & 5) throw op[1];
1148
- return {
1149
- value: op[0] ? op[1] : void 0,
1150
- done: true
1151
- };
1152
- };
1153
- var _ = {
1154
- label: 0,
1155
- sent: function sent() {
1156
- if (t[0] & 1) throw t[1];
1157
- return t[1];
1158
- },
1159
- trys: [],
1160
- ops: []
1161
- }, f, y, t, g;
1162
- return g = {
1163
- next: verb(0),
1164
- "throw": verb(1),
1165
- "return": verb(2)
1166
- }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1167
- return this;
1168
- }), g;
1169
- }
1170
- typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1171
- var e = new Error(message);
1172
- return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1173
- };
1174
1043
  var XRFeatureType;
1175
1044
  (function(XRFeatureType) {
1176
1045
  XRFeatureType[XRFeatureType["AnchorTracking"] = 0] = "AnchorTracking";
@@ -1287,10 +1156,6 @@
1287
1156
  // prettier-ignore
1288
1157
  this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1289
1158
  };
1290
- _proto._onDestroy = function _onDestroy() {
1291
- // prettier-ignore
1292
- this._requestTrackings.length = this._tracked.length = this._added.length = this._updated.length = this._removed.length = 0;
1293
- };
1294
1159
  _proto._addRequestTracking = function _addRequestTracking(requestTracking) {
1295
1160
  var _this = this, platformFeature = _this._platformFeature;
1296
1161
  if (this._xrManager.sessionManager._platformSession && !platformFeature.canModifyRequestTrackingAfterInit) {
@@ -1321,6 +1186,145 @@
1321
1186
  (function() {
1322
1187
  XRTrackableFeature._uuid = 0;
1323
1188
  })();
1189
+ /**
1190
+ * The base class of XR tracked object.
1191
+ */ var XRTracked = function XRTracked() {
1192
+ /** The pose of the trackable in XR space. */ this.pose = new XRPose();
1193
+ /** The tracking state of the trackable. */ this.state = XRTrackingState.NotTracking;
1194
+ };
1195
+ /**
1196
+ * Enum for the types of hit test that can be performed.
1197
+ * Note: currently only supports plane.
1198
+ */ var TrackableType;
1199
+ (function(TrackableType) {
1200
+ TrackableType[TrackableType[/** Tracked plane. */ "Plane"] = 0x1] = "Plane";
1201
+ TrackableType[TrackableType[/** All tracked objects. */ "All"] = 0x1] = "All";
1202
+ })(TrackableType || (TrackableType = {}));
1203
+ /**
1204
+ * XR hit result.
1205
+ * It is the detection result returned by using XR HitTest feature.
1206
+ */ var XRHitResult = function XRHitResult() {
1207
+ /** The position of the hit point. */ this.point = new engine.Vector3();
1208
+ /** The normal of the hit point. */ this.normal = new engine.Vector3();
1209
+ };
1210
+ /******************************************************************************
1211
+ Copyright (c) Microsoft Corporation.
1212
+
1213
+ Permission to use, copy, modify, and/or distribute this software for any
1214
+ purpose with or without fee is hereby granted.
1215
+
1216
+ THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
1217
+ REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
1218
+ AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
1219
+ INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
1220
+ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
1221
+ OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
1222
+ PERFORMANCE OF THIS SOFTWARE.
1223
+ ***************************************************************************** */ function __decorate(decorators, target, key, desc) {
1224
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1225
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
1226
+ 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;
1227
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
1228
+ }
1229
+ function __generator(thisArg, body) {
1230
+ var verb = function verb(n) {
1231
+ return function(v) {
1232
+ return step([
1233
+ n,
1234
+ v
1235
+ ]);
1236
+ };
1237
+ };
1238
+ var step = function step(op) {
1239
+ if (f) throw new TypeError("Generator is already executing.");
1240
+ while(g && (g = 0, op[0] && (_ = 0)), _)try {
1241
+ 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;
1242
+ if (y = 0, t) op = [
1243
+ op[0] & 2,
1244
+ t.value
1245
+ ];
1246
+ switch(op[0]){
1247
+ case 0:
1248
+ case 1:
1249
+ t = op;
1250
+ break;
1251
+ case 4:
1252
+ _.label++;
1253
+ return {
1254
+ value: op[1],
1255
+ done: false
1256
+ };
1257
+ case 5:
1258
+ _.label++;
1259
+ y = op[1];
1260
+ op = [
1261
+ 0
1262
+ ];
1263
+ continue;
1264
+ case 7:
1265
+ op = _.ops.pop();
1266
+ _.trys.pop();
1267
+ continue;
1268
+ default:
1269
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
1270
+ _ = 0;
1271
+ continue;
1272
+ }
1273
+ if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
1274
+ _.label = op[1];
1275
+ break;
1276
+ }
1277
+ if (op[0] === 6 && _.label < t[1]) {
1278
+ _.label = t[1];
1279
+ t = op;
1280
+ break;
1281
+ }
1282
+ if (t && _.label < t[2]) {
1283
+ _.label = t[2];
1284
+ _.ops.push(op);
1285
+ break;
1286
+ }
1287
+ if (t[2]) _.ops.pop();
1288
+ _.trys.pop();
1289
+ continue;
1290
+ }
1291
+ op = body.call(thisArg, _);
1292
+ } catch (e) {
1293
+ op = [
1294
+ 6,
1295
+ e
1296
+ ];
1297
+ y = 0;
1298
+ } finally{
1299
+ f = t = 0;
1300
+ }
1301
+ if (op[0] & 5) throw op[1];
1302
+ return {
1303
+ value: op[0] ? op[1] : void 0,
1304
+ done: true
1305
+ };
1306
+ };
1307
+ var _ = {
1308
+ label: 0,
1309
+ sent: function sent() {
1310
+ if (t[0] & 1) throw t[1];
1311
+ return t[1];
1312
+ },
1313
+ trys: [],
1314
+ ops: []
1315
+ }, f, y, t, g;
1316
+ return g = {
1317
+ next: verb(0),
1318
+ "throw": verb(1),
1319
+ "return": verb(2)
1320
+ }, typeof Symbol === "function" && (g[Symbol.iterator] = function() {
1321
+ return this;
1322
+ }), g;
1323
+ }
1324
+ typeof SuppressedError === "function" ? SuppressedError : function(error, suppressed, message) {
1325
+ var e = new Error(message);
1326
+ return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
1327
+ };
1324
1328
  /**
1325
1329
  * Enumerates modes of plane in XR.
1326
1330
  */ var XRPlaneMode;
@@ -1348,12 +1352,6 @@
1348
1352
  _inherits(XRRequestPlane, XRRequestTracking1);
1349
1353
  return XRRequestPlane;
1350
1354
  }(XRRequestTracking);
1351
- /**
1352
- * The base class of XR tracked object.
1353
- */ var XRTracked = function XRTracked() {
1354
- /** The pose of the trackable in XR space. */ this.pose = new XRPose();
1355
- /** The tracking state of the trackable. */ this.state = XRTrackingState.NotTracking;
1356
- };
1357
1355
  /**
1358
1356
  * The tracked plane in XR space.
1359
1357
  */ var XRTrackedPlane = /*#__PURE__*/ function(XRTracked1) {