@galacean/engine-loader 0.9.0-beta.82 → 0.9.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/module.js CHANGED
@@ -3,54 +3,37 @@ import { SphericalHarmonics3, Vector2, Vector3, Vector4, Color, Quaternion, Matr
3
3
  import { DRACODecoder } from '@galacean/engine-draco';
4
4
  import { GLCompressedTextureInternalFormat } from '@galacean/engine-rhi-webgl';
5
5
 
6
- function extends_() {
7
- extends_ = Object.assign || function (target) {
8
- for (var i = 1; i < arguments.length; i++) {
9
- var source = arguments[i];
10
-
11
- for (var key in source) {
12
- if (Object.prototype.hasOwnProperty.call(source, key)) {
13
- target[key] = source[key];
6
+ function _extends() {
7
+ _extends = Object.assign || function assign(target) {
8
+ for (var i = 1; i < arguments.length; i++) {
9
+ var source = arguments[i];
10
+ for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
14
11
  }
15
- }
16
- }
17
-
18
- return target;
19
- };
20
12
 
21
- return extends_.apply(this, arguments);
22
- }
13
+ return target;
14
+ };
23
15
 
24
- function _extends() {
25
- return extends_.apply(this, arguments);
16
+ return _extends.apply(this, arguments);
26
17
  }
27
18
 
28
- function setPrototypeOf(o, p) {
29
- setPrototypeOf = Object.setPrototypeOf || function setPrototypeOf(o, p) {
30
- o.__proto__ = p;
31
- return o;
32
- };
19
+ function _set_prototype_of(o, p) {
20
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
21
+ o.__proto__ = p;
33
22
 
34
- return setPrototypeOf(o, p);
35
- }
23
+ return o;
24
+ };
36
25
 
37
- function _setPrototypeOf(o, p) {
38
- return setPrototypeOf(o, p);
26
+ return _set_prototype_of(o, p);
39
27
  }
40
28
 
41
29
  function _inherits(subClass, superClass) {
42
- if (typeof superClass !== "function" && superClass !== null) {
43
- throw new TypeError("Super expression must either be null or a function");
44
- }
45
-
46
- subClass.prototype = Object.create(superClass && superClass.prototype, {
47
- constructor: {
48
- value: subClass,
49
- writable: true,
50
- configurable: true
30
+ if (typeof superClass !== "function" && superClass !== null) {
31
+ throw new TypeError("Super expression must either be null or a function");
51
32
  }
52
- });
53
- if (superClass) _setPrototypeOf(subClass, superClass);
33
+
34
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
35
+
36
+ if (superClass) _set_prototype_of(subClass, superClass);
54
37
  }
55
38
 
56
39
  /******************************************************************************
@@ -266,39 +249,34 @@ EnvLoader = __decorate([
266
249
  ], EnvLoader);
267
250
 
268
251
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
269
- try {
270
- var info = gen[key](arg);
271
- var value = info.value;
272
- } catch (error) {
273
- reject(error);
274
- return;
275
- }
276
-
277
- if (info.done) {
278
- resolve(value);
279
- } else {
280
- Promise.resolve(value).then(_next, _throw);
281
- }
252
+ try {
253
+ var info = gen[key](arg);
254
+ var value = info.value;
255
+ } catch (error) {
256
+ reject(error);
257
+ return;
258
+ }
259
+ if (info.done) resolve(value);
260
+ else Promise.resolve(value).then(_next, _throw);
282
261
  }
262
+ function _async_to_generator(fn) {
263
+ return function() {
264
+ var self = this, args = arguments;
283
265
 
284
- function _asyncToGenerator(fn) {
285
- return function () {
286
- var self = this,
287
- args = arguments;
288
- return new Promise(function (resolve, reject) {
289
- var gen = fn.apply(self, args);
266
+ return new Promise(function(resolve, reject) {
267
+ var gen = fn.apply(self, args);
290
268
 
291
- function _next(value) {
292
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
293
- }
269
+ function _next(value) {
270
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
271
+ }
294
272
 
295
- function _throw(err) {
296
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
297
- }
273
+ function _throw(err) {
274
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
275
+ }
298
276
 
299
- _next(undefined);
300
- });
301
- };
277
+ _next(undefined);
278
+ });
279
+ };
302
280
  }
303
281
 
304
282
  var FontLoader = /*#__PURE__*/ function(Loader) {
@@ -331,7 +309,7 @@ var FontLoader = /*#__PURE__*/ function(Loader) {
331
309
  });
332
310
  };
333
311
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
334
- return _asyncToGenerator(function() {
312
+ return _async_to_generator(function() {
335
313
  var fontFace;
336
314
  return __generator(this, function(_state) {
337
315
  switch(_state.label){
@@ -944,36 +922,41 @@ var TextureWrapMode;
944
922
  return GLTFUtil;
945
923
  }();
946
924
 
947
- function _arrayLikeToArray(arr, len) {
948
- if (len == null || len > arr.length) len = arr.length;
949
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
950
- return arr2;
925
+ function _array_like_to_array(arr, len) {
926
+ if (len == null || len > arr.length) len = arr.length;
927
+
928
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
929
+
930
+ return arr2;
951
931
  }
952
932
 
953
- function _arrayWithoutHoles(arr) {
954
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
933
+ function _array_without_holes(arr) {
934
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
955
935
  }
956
936
 
957
- function _iterableToArray(iter) {
958
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
937
+ function _iterable_to_array(iter) {
938
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
939
+ return Array.from(iter);
940
+ }
959
941
  }
960
942
 
961
- function _nonIterableSpread() {
962
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
943
+ function _non_iterable_spread() {
944
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
963
945
  }
964
946
 
965
- function _unsupportedIterableToArray(o, minLen) {
966
- if (!o) return;
967
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
968
- var n = Object.prototype.toString.call(o).slice(8, -1);
969
- if (n === "Object" && o.constructor) n = o.constructor.name;
970
- if (n === "Map" || n === "Set") return Array.from(n);
971
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
972
- return _arrayLikeToArray(o, minLen);
947
+ function _unsupported_iterable_to_array(o, minLen) {
948
+ if (!o) return;
949
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
950
+
951
+ var n = Object.prototype.toString.call(o).slice(8, -1);
952
+
953
+ if (n === "Object" && o.constructor) n = o.constructor.name;
954
+ if (n === "Map" || n === "Set") return Array.from(n);
955
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
973
956
  }
974
957
 
975
- function _toConsumableArray(arr) {
976
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
958
+ function _to_consumable_array(arr) {
959
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
977
960
  }
978
961
 
979
962
  var Parser = /*#__PURE__*/ function() {
@@ -990,7 +973,7 @@ var Parser = /*#__PURE__*/ function() {
990
973
  extensionSchema,
991
974
  parseResource,
992
975
  context
993
- ].concat(_toConsumableArray(extra)));
976
+ ].concat(_to_consumable_array(extra)));
994
977
  }
995
978
  }
996
979
  };
@@ -1004,7 +987,7 @@ var Parser = /*#__PURE__*/ function() {
1004
987
  return (_parsers_ = parsers[0]).createEngineResource.apply(_parsers_, [
1005
988
  extensionSchema,
1006
989
  context
1007
- ].concat(_toConsumableArray(extra)));
990
+ ].concat(_to_consumable_array(extra)));
1008
991
  }
1009
992
  };
1010
993
  Parser.hasExtensionParser = function hasExtensionParser(extensionName) {
@@ -1029,7 +1012,9 @@ var Parser = /*#__PURE__*/ function() {
1029
1012
  };
1030
1013
  return Parser;
1031
1014
  }();
1032
- Parser._extensionParsers = {};
1015
+ (function() {
1016
+ Parser._extensionParsers = {};
1017
+ })();
1033
1018
  /**
1034
1019
  * Declare ExtensionParser's decorator.
1035
1020
  * @param extensionName - Extension name
@@ -1104,11 +1089,9 @@ KHR_draco_mesh_compression = __decorate([
1104
1089
  ], KHR_draco_mesh_compression);
1105
1090
 
1106
1091
  function _instanceof(left, right) {
1107
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1108
- return !!right[Symbol.hasInstance](left);
1109
- } else {
1110
- return left instanceof right;
1111
- }
1092
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1093
+ return !!right[Symbol.hasInstance](left);
1094
+ } else return left instanceof right;
1112
1095
  }
1113
1096
 
1114
1097
  var KHR_lights_punctual = /*#__PURE__*/ function(ExtensionParser) {
@@ -1431,23 +1414,24 @@ GalaceanMaterialsRemap = __decorate([
1431
1414
  registerExtension("OASIS_materials_remap")
1432
1415
  ], GalaceanMaterialsRemap);
1433
1416
 
1434
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1417
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1435
1418
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1419
+
1436
1420
  if (it) return (it = it.call(o)).next.bind(it);
1437
1421
  // Fallback for engines without symbol support
1438
- if (
1439
- Array.isArray(o) ||
1440
- (it = _unsupportedIterableToArray(o)) ||
1441
- (allowArrayLike && o && typeof o.length === "number")
1442
- ) {
1422
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
1443
1423
  if (it) o = it;
1424
+
1444
1425
  var i = 0;
1445
- return function () {
1426
+
1427
+ return function() {
1446
1428
  if (i >= o.length) return { done: true };
1429
+
1447
1430
  return { done: false, value: o[i++] };
1448
- }
1431
+ };
1449
1432
  }
1450
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1433
+
1434
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1451
1435
  }
1452
1436
 
1453
1437
  var AnimationParser = /*#__PURE__*/ function(Parser) {
@@ -1740,7 +1724,9 @@ var EntityParser = /*#__PURE__*/ function(Parser) {
1740
1724
  };
1741
1725
  return EntityParser;
1742
1726
  }(Parser);
1743
- /** @internal */ EntityParser._defaultName = "_GLTF_ENTITY_";
1727
+ (function() {
1728
+ /** @internal */ EntityParser._defaultName = "_GLTF_ENTITY_";
1729
+ })();
1744
1730
 
1745
1731
  var MeshParser = /*#__PURE__*/ function(Parser1) {
1746
1732
  _inherits(MeshParser, Parser1);
@@ -1817,21 +1803,31 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1817
1803
  var vertexCount;
1818
1804
  var bufferBindIndex = 0;
1819
1805
  var positions;
1820
- keepMeshData && (positions = new Array(vertexCount));
1806
+ var boneIndices;
1807
+ var boneWeights;
1808
+ if (keepMeshData) {
1809
+ positions = new Array(vertexCount);
1810
+ boneIndices = new Array(vertexCount);
1811
+ boneWeights = new Array(vertexCount);
1812
+ }
1821
1813
  for(var attribute in attributes){
1822
1814
  var accessor = accessors[attributes[attribute]];
1823
1815
  var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf, accessor);
1824
- var dataElmentSize = GLTFUtil.getAccessorTypeSize(accessor.type);
1825
- var attributeCount = accessor.count;
1816
+ var dataElementSize = GLTFUtil.getAccessorTypeSize(accessor.type);
1817
+ var accessorCount = accessor.count;
1826
1818
  var vertices = accessorBuffer.data;
1827
1819
  var vertexElement = void 0;
1828
1820
  var meshId = mesh.instanceId;
1829
1821
  var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
1830
- var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElmentSize, accessor.normalized);
1822
+ var elementNormalized = accessor.normalized;
1823
+ var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElementSize, elementNormalized);
1824
+ var scaleFactor = void 0;
1825
+ elementNormalized && (scaleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType));
1826
+ var elementOffset = void 0;
1831
1827
  if (accessorBuffer.interleaved) {
1832
1828
  var byteOffset = accessor.byteOffset || 0;
1833
1829
  var stride = accessorBuffer.stride;
1834
- var elementOffset = byteOffset % stride;
1830
+ elementOffset = byteOffset % stride;
1835
1831
  if (vertexBindingInfos[meshId] === undefined) {
1836
1832
  vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
1837
1833
  var vertexBuffer = accessorBuffer.vertexBuffer;
@@ -1846,7 +1842,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1846
1842
  vertexElement = new VertexElement(attribute, elementOffset, elementFormat, vertexBindingInfos[meshId]);
1847
1843
  }
1848
1844
  } else {
1849
- vertexElement = new VertexElement(attribute, 0, elementFormat, bufferBindIndex);
1845
+ elementOffset = 0;
1846
+ vertexElement = new VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
1850
1847
  var vertexBuffer1 = new Buffer(engine, BufferBindFlag.VertexBuffer, vertices.byteLength, BufferUsage.Static);
1851
1848
  vertexBuffer1.setData(vertices);
1852
1849
  mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
@@ -1854,35 +1851,60 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1854
1851
  }
1855
1852
  vertexElements.push(vertexElement);
1856
1853
  if (attribute === "POSITION") {
1857
- vertexCount = attributeCount;
1854
+ vertexCount = accessorCount;
1858
1855
  var _mesh_bounds = mesh.bounds, min = _mesh_bounds.min, max = _mesh_bounds.max;
1859
1856
  if (accessor.min && accessor.max) {
1860
1857
  min.copyFromArray(accessor.min);
1861
1858
  max.copyFromArray(accessor.max);
1862
1859
  if (keepMeshData) {
1863
- var stride1 = vertices.length / attributeCount;
1864
- for(var j = 0; j < attributeCount; j++){
1865
- var offset = j * stride1;
1866
- positions[j] = new Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1860
+ var baseOffset = elementOffset / vertices.BYTES_PER_ELEMENT;
1861
+ var stride1 = vertices.length / accessorCount;
1862
+ for(var j = 0; j < accessorCount; j++){
1863
+ var offset = baseOffset + j * stride1;
1864
+ var position = new Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1865
+ elementNormalized && position.scale(scaleFactor);
1866
+ positions[j] = position;
1867
1867
  }
1868
1868
  }
1869
1869
  } else {
1870
- var position = MeshParser._tempVector3;
1870
+ var position1 = MeshParser._tempVector3;
1871
1871
  min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
1872
1872
  max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
1873
- var stride2 = vertices.length / attributeCount;
1874
- for(var j1 = 0; j1 < attributeCount; j1++){
1875
- var offset1 = j1 * stride2;
1876
- position.copyFromArray(vertices, offset1);
1877
- Vector3.min(min, position, min);
1878
- Vector3.max(max, position, max);
1879
- keepMeshData && (positions[j1] = position.clone());
1873
+ var baseOffset1 = elementOffset / vertices.BYTES_PER_ELEMENT;
1874
+ var stride2 = vertices.length / accessorCount;
1875
+ for(var j1 = 0; j1 < accessorCount; j1++){
1876
+ var offset1 = baseOffset1 + j1 * stride2;
1877
+ position1.copyFromArray(vertices, offset1);
1878
+ Vector3.min(min, position1, min);
1879
+ Vector3.max(max, position1, max);
1880
+ if (keepMeshData) {
1881
+ var clonePosition = position1.clone();
1882
+ elementNormalized && clonePosition.scale(scaleFactor);
1883
+ positions[j1] = clonePosition;
1884
+ }
1880
1885
  }
1881
1886
  }
1882
- if (accessor.normalized) {
1883
- var sacleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType);
1884
- min.scale(sacleFactor);
1885
- max.scale(sacleFactor);
1887
+ if (elementNormalized) {
1888
+ min.scale(scaleFactor);
1889
+ max.scale(scaleFactor);
1890
+ }
1891
+ } else if (attribute === "JOINTS_0" && keepMeshData) {
1892
+ var baseOffset2 = elementOffset / vertices.BYTES_PER_ELEMENT;
1893
+ var stride3 = vertices.length / accessorCount;
1894
+ for(var j2 = 0; j2 < accessorCount; j2++){
1895
+ var offset2 = baseOffset2 + j2 * stride3;
1896
+ var boneIndex = new Vector4(vertices[offset2], vertices[offset2 + 1], vertices[offset2 + 2], vertices[offset2 + 3]);
1897
+ elementNormalized && boneIndex.scale(scaleFactor);
1898
+ boneIndices[j2] = boneIndex;
1899
+ }
1900
+ } else if (attribute === "WEIGHTS_0" && keepMeshData) {
1901
+ var baseOffset3 = elementOffset / vertices.BYTES_PER_ELEMENT;
1902
+ var stride4 = vertices.length / accessorCount;
1903
+ for(var j3 = 0; j3 < accessorCount; j3++){
1904
+ var offset3 = baseOffset3 + j3 * stride4;
1905
+ var boneWeight = new Vector4(vertices[offset3], vertices[offset3 + 1], vertices[offset3 + 2], vertices[offset3 + 3]);
1906
+ elementNormalized && boneWeight.scale(scaleFactor);
1907
+ boneWeights[j3] = boneWeight;
1886
1908
  }
1887
1909
  }
1888
1910
  }
@@ -1901,6 +1923,10 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1901
1923
  mesh.uploadData(!keepMeshData);
1902
1924
  //@ts-ignore
1903
1925
  mesh._positions = positions;
1926
+ //@ts-ignore
1927
+ mesh._boneIndices = boneIndices;
1928
+ //@ts-ignore
1929
+ mesh._boneWeights = boneWeights;
1904
1930
  return Promise.resolve(mesh);
1905
1931
  };
1906
1932
  _proto._createBlendShape = function _createBlendShape(mesh, glTFMesh, glTFTargets, getBlendShapeData) {
@@ -2022,7 +2048,9 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
2022
2048
  };
2023
2049
  return MeshParser;
2024
2050
  }(Parser);
2025
- MeshParser._tempVector3 = new Vector3();
2051
+ (function() {
2052
+ MeshParser._tempVector3 = new Vector3();
2053
+ })();
2026
2054
 
2027
2055
  var SceneParser$1 = /*#__PURE__*/ function(Parser1) {
2028
2056
  _inherits(SceneParser, Parser1);
@@ -2231,7 +2259,7 @@ var SkinParser = /*#__PURE__*/ function(Parser) {
2231
2259
  };
2232
2260
  _proto._findSkeletonRootBone = function _findSkeletonRootBone(joints, entities) {
2233
2261
  var paths = {};
2234
- for(var _iterator = _createForOfIteratorHelperLoose(joints), _step; !(_step = _iterator()).done;){
2262
+ for(var _iterator = _create_for_of_iterator_helper_loose(joints), _step; !(_step = _iterator()).done;){
2235
2263
  var index = _step.value;
2236
2264
  var path = new Array();
2237
2265
  var entity = entities[index];
@@ -2333,8 +2361,10 @@ var TextureParser = /*#__PURE__*/ function(Parser) {
2333
2361
  };
2334
2362
  return TextureParser;
2335
2363
  }(Parser);
2336
- var _obj;
2337
- TextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = TextureWrapMode$1.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = TextureWrapMode$1.Mirror, _obj[TextureWrapMode.REPEAT] = TextureWrapMode$1.Repeat, _obj);
2364
+ (function() {
2365
+ var _obj;
2366
+ TextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = TextureWrapMode$1.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = TextureWrapMode$1.Mirror, _obj[TextureWrapMode.REPEAT] = TextureWrapMode$1.Repeat, _obj);
2367
+ })();
2338
2368
 
2339
2369
  var Validator = /*#__PURE__*/ function(Parser1) {
2340
2370
  _inherits(Validator, Parser1);
@@ -2406,17 +2436,19 @@ var GLTFParser = /*#__PURE__*/ function() {
2406
2436
  };
2407
2437
  return GLTFParser;
2408
2438
  }();
2409
- GLTFParser.defaultPipeline = new GLTFParser([
2410
- BufferParser,
2411
- Validator,
2412
- TextureParser,
2413
- MaterialParser,
2414
- MeshParser,
2415
- EntityParser,
2416
- SkinParser,
2417
- AnimationParser,
2418
- SceneParser$1
2419
- ]);
2439
+ (function() {
2440
+ GLTFParser.defaultPipeline = new GLTFParser([
2441
+ BufferParser,
2442
+ Validator,
2443
+ TextureParser,
2444
+ MaterialParser,
2445
+ MeshParser,
2446
+ EntityParser,
2447
+ SkinParser,
2448
+ AnimationParser,
2449
+ SceneParser$1
2450
+ ]);
2451
+ })();
2420
2452
 
2421
2453
  /**
2422
2454
  * Product after GLTF parser, usually, `defaultSceneRoot` is only needed to use.
@@ -2468,7 +2500,7 @@ var GLTFLoader = /*#__PURE__*/ function(Loader) {
2468
2500
  context.keepMeshData = (_item_params_keepMeshData = (_item_params = item.params) == null ? void 0 : _item_params.keepMeshData) != null ? _item_params_keepMeshData : false;
2469
2501
  masterPromiseInfo.onCancel(function() {
2470
2502
  var chainPromises = context.chainPromises;
2471
- for(var _iterator = _createForOfIteratorHelperLoose(chainPromises), _step; !(_step = _iterator()).done;){
2503
+ for(var _iterator = _create_for_of_iterator_helper_loose(chainPromises), _step; !(_step = _iterator()).done;){
2472
2504
  var promise = _step.value;
2473
2505
  promise.cancel();
2474
2506
  }
@@ -2729,37 +2761,75 @@ var HDRLoader = (_HDRLoader = /*#__PURE__*/ function(Loader) {
2729
2761
  color.a *= M;
2730
2762
  };
2731
2763
  return HDRLoader1;
2732
- }(Loader), _HDRLoader._rightBottomBack = new Vector3(1.0, -1.0, -1.0), _HDRLoader._rightBottomFront = new Vector3(1.0, -1.0, 1.0), _HDRLoader._rightUpBack = new Vector3(1.0, 1.0, -1.0), _HDRLoader._rightUpFront = new Vector3(1.0, 1.0, 1.0), _HDRLoader._leftBottomBack = new Vector3(-1.0, -1.0, -1.0), _HDRLoader._leftBottomFront = new Vector3(-1.0, -1.0, 1.0), _HDRLoader._leftUpBack = new Vector3(-1.0, 1.0, -1.0), _HDRLoader._leftUpFront = new Vector3(-1.0, 1.0, 1.0), _HDRLoader._faceRight = [
2733
- _HDRLoader._rightBottomBack,
2734
- _HDRLoader._rightBottomFront,
2735
- _HDRLoader._rightUpBack,
2736
- _HDRLoader._rightUpFront
2737
- ], _HDRLoader._faceLeft = [
2738
- _HDRLoader._leftBottomFront,
2739
- _HDRLoader._leftBottomBack,
2740
- _HDRLoader._leftUpFront,
2741
- _HDRLoader._leftUpBack
2742
- ], _HDRLoader._faceUp = [
2743
- _HDRLoader._leftBottomFront,
2744
- _HDRLoader._rightBottomFront,
2745
- _HDRLoader._leftBottomBack,
2746
- _HDRLoader._rightBottomBack
2747
- ], _HDRLoader._faceBottom = [
2748
- _HDRLoader._leftUpBack,
2749
- _HDRLoader._rightUpBack,
2750
- _HDRLoader._leftUpFront,
2751
- _HDRLoader._rightUpFront
2752
- ], _HDRLoader._faceFront = [
2753
- _HDRLoader._leftBottomBack,
2754
- _HDRLoader._rightBottomBack,
2755
- _HDRLoader._leftUpBack,
2756
- _HDRLoader._rightUpBack
2757
- ], _HDRLoader._faceBack = [
2758
- _HDRLoader._rightBottomFront,
2759
- _HDRLoader._leftBottomFront,
2760
- _HDRLoader._rightUpFront,
2761
- _HDRLoader._leftUpFront
2762
- ], _HDRLoader._tempVector3 = new Vector3(), _HDRLoader._temp2Vector3 = new Vector3(), _HDRLoader._temp3Vector3 = new Vector3(), _HDRLoader._temp4Vector3 = new Vector3(), _HDRLoader._temp5Vector3 = new Vector3(), _HDRLoader);
2764
+ }(Loader), function() {
2765
+ _HDRLoader._rightBottomBack = new Vector3(1.0, -1.0, -1.0);
2766
+ }(), function() {
2767
+ _HDRLoader._rightBottomFront = new Vector3(1.0, -1.0, 1.0);
2768
+ }(), function() {
2769
+ _HDRLoader._rightUpBack = new Vector3(1.0, 1.0, -1.0);
2770
+ }(), function() {
2771
+ _HDRLoader._rightUpFront = new Vector3(1.0, 1.0, 1.0);
2772
+ }(), function() {
2773
+ _HDRLoader._leftBottomBack = new Vector3(-1.0, -1.0, -1.0);
2774
+ }(), function() {
2775
+ _HDRLoader._leftBottomFront = new Vector3(-1.0, -1.0, 1.0);
2776
+ }(), function() {
2777
+ _HDRLoader._leftUpBack = new Vector3(-1.0, 1.0, -1.0);
2778
+ }(), function() {
2779
+ _HDRLoader._leftUpFront = new Vector3(-1.0, 1.0, 1.0);
2780
+ }(), function() {
2781
+ _HDRLoader._faceRight = [
2782
+ _HDRLoader._rightBottomBack,
2783
+ _HDRLoader._rightBottomFront,
2784
+ _HDRLoader._rightUpBack,
2785
+ _HDRLoader._rightUpFront
2786
+ ];
2787
+ }(), function() {
2788
+ _HDRLoader._faceLeft = [
2789
+ _HDRLoader._leftBottomFront,
2790
+ _HDRLoader._leftBottomBack,
2791
+ _HDRLoader._leftUpFront,
2792
+ _HDRLoader._leftUpBack
2793
+ ];
2794
+ }(), function() {
2795
+ _HDRLoader._faceUp = [
2796
+ _HDRLoader._leftBottomFront,
2797
+ _HDRLoader._rightBottomFront,
2798
+ _HDRLoader._leftBottomBack,
2799
+ _HDRLoader._rightBottomBack
2800
+ ];
2801
+ }(), function() {
2802
+ _HDRLoader._faceBottom = [
2803
+ _HDRLoader._leftUpBack,
2804
+ _HDRLoader._rightUpBack,
2805
+ _HDRLoader._leftUpFront,
2806
+ _HDRLoader._rightUpFront
2807
+ ];
2808
+ }(), function() {
2809
+ _HDRLoader._faceFront = [
2810
+ _HDRLoader._leftBottomBack,
2811
+ _HDRLoader._rightBottomBack,
2812
+ _HDRLoader._leftUpBack,
2813
+ _HDRLoader._rightUpBack
2814
+ ];
2815
+ }(), function() {
2816
+ _HDRLoader._faceBack = [
2817
+ _HDRLoader._rightBottomFront,
2818
+ _HDRLoader._leftBottomFront,
2819
+ _HDRLoader._rightUpFront,
2820
+ _HDRLoader._leftUpFront
2821
+ ];
2822
+ }(), function() {
2823
+ _HDRLoader._tempVector3 = new Vector3();
2824
+ }(), function() {
2825
+ _HDRLoader._temp2Vector3 = new Vector3();
2826
+ }(), function() {
2827
+ _HDRLoader._temp3Vector3 = new Vector3();
2828
+ }(), function() {
2829
+ _HDRLoader._temp4Vector3 = new Vector3();
2830
+ }(), function() {
2831
+ _HDRLoader._temp5Vector3 = new Vector3();
2832
+ }(), _HDRLoader);
2763
2833
  HDRLoader = __decorate([
2764
2834
  resourceLoader(AssetType.HDR, [
2765
2835
  "hdr"
@@ -3129,19 +3199,21 @@ MaterialLoader = __decorate([
3129
3199
  ], MaterialLoader);
3130
3200
 
3131
3201
  function _defineProperties(target, props) {
3132
- for (var i = 0; i < props.length; i++) {
3133
- var descriptor = props[i];
3134
- descriptor.enumerable = descriptor.enumerable || false;
3135
- descriptor.configurable = true;
3136
- if ("value" in descriptor) descriptor.writable = true;
3137
- Object.defineProperty(target, descriptor.key, descriptor);
3138
- }
3202
+ for (var i = 0; i < props.length; i++) {
3203
+ var descriptor = props[i];
3204
+ descriptor.enumerable = descriptor.enumerable || false;
3205
+ descriptor.configurable = true;
3206
+
3207
+ if ("value" in descriptor) descriptor.writable = true;
3208
+
3209
+ Object.defineProperty(target, descriptor.key, descriptor);
3210
+ }
3139
3211
  }
3212
+ function _create_class(Constructor, protoProps, staticProps) {
3213
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3214
+ if (staticProps) _defineProperties(Constructor, staticProps);
3140
3215
 
3141
- function _createClass(Constructor, protoProps, staticProps) {
3142
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3143
- if (staticProps) _defineProperties(Constructor, staticProps);
3144
- return Constructor;
3216
+ return Constructor;
3145
3217
  }
3146
3218
 
3147
3219
  var BufferReader = /*#__PURE__*/ function() {
@@ -3250,7 +3322,7 @@ var BufferReader = /*#__PURE__*/ function() {
3250
3322
  if (byteLength < maxByteLength) this._offset++;
3251
3323
  return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
3252
3324
  };
3253
- _createClass(BufferReader, [
3325
+ _create_class(BufferReader, [
3254
3326
  {
3255
3327
  key: "offset",
3256
3328
  get: function get() {
@@ -3260,12 +3332,14 @@ var BufferReader = /*#__PURE__*/ function() {
3260
3332
  ]);
3261
3333
  return BufferReader;
3262
3334
  }();
3263
- BufferReader.imageMapping = {
3264
- 0: "image/png",
3265
- 1: "image/jpg",
3266
- 2: "image/webp",
3267
- 3: "ktx"
3268
- };
3335
+ (function() {
3336
+ BufferReader.imageMapping = {
3337
+ 0: "image/png",
3338
+ 1: "image/jpg",
3339
+ 2: "image/webp",
3340
+ 3: "ktx"
3341
+ };
3342
+ })();
3269
3343
 
3270
3344
  var decoderMap = {};
3271
3345
  /**
@@ -3304,7 +3378,7 @@ var FileHeader = /*#__PURE__*/ function() {
3304
3378
  header.headerLength = nameUint8Array.byteLength + typeUint8Array.byteLength + 9;
3305
3379
  return header;
3306
3380
  };
3307
- _createClass(FileHeader, [
3381
+ _create_class(FileHeader, [
3308
3382
  {
3309
3383
  key: "dataLength",
3310
3384
  get: function get() {
@@ -3523,38 +3597,36 @@ Texture2DDecoder = __decorate([
3523
3597
  decoder("Texture2D")
3524
3598
  ], Texture2DDecoder);
3525
3599
 
3526
- function isNativeReflectConstruct() {
3527
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3528
- if (Reflect.construct.sham) return false;
3529
- if (typeof Proxy === "function") return true;
3530
-
3531
- try {
3532
- Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
3533
- return true;
3534
- } catch (e) {
3535
- return false;
3536
- }
3537
- }
3600
+ function _is_native_reflect_construct() {
3601
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3602
+ if (Reflect.construct.sham) return false;
3603
+ if (typeof Proxy === "function") return true;
3538
3604
 
3539
- function construct(Parent, args, Class) {
3540
- if (isNativeReflectConstruct()) {
3541
- construct = Reflect.construct;
3542
- } else {
3543
- construct = function construct(Parent, args, Class) {
3544
- var a = [null];
3545
- a.push.apply(a, args);
3546
- var Constructor = Function.bind.apply(Parent, a);
3547
- var instance = new Constructor();
3548
- if (Class) _setPrototypeOf(instance, Class.prototype);
3549
- return instance;
3550
- };
3551
- }
3605
+ try {
3606
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3552
3607
 
3553
- return construct.apply(null, arguments);
3608
+ return true;
3609
+ } catch (e) {
3610
+ return false;
3611
+ }
3554
3612
  }
3555
3613
 
3556
3614
  function _construct(Parent, args, Class) {
3557
- return construct.apply(null, arguments);
3615
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
3616
+ else {
3617
+ _construct = function construct(Parent, args, Class) {
3618
+ var a = [null];
3619
+ a.push.apply(a, args);
3620
+ var Constructor = Function.bind.apply(Parent, a);
3621
+ var instance = new Constructor();
3622
+
3623
+ if (Class) _set_prototype_of(instance, Class.prototype);
3624
+
3625
+ return instance;
3626
+ };
3627
+ }
3628
+
3629
+ return _construct.apply(null, arguments);
3558
3630
  }
3559
3631
 
3560
3632
  var ReflectionParser = /*#__PURE__*/ function() {
@@ -3669,7 +3741,9 @@ var ReflectionParser = /*#__PURE__*/ function() {
3669
3741
  };
3670
3742
  return ReflectionParser;
3671
3743
  }();
3672
- ReflectionParser.customParseComponentHandles = new Map();
3744
+ (function() {
3745
+ ReflectionParser.customParseComponentHandles = new Map();
3746
+ })();
3673
3747
 
3674
3748
  var PrefabParser = /*#__PURE__*/ function() {
3675
3749
  function PrefabParser() {}
@@ -3923,7 +3997,7 @@ var SceneParserContext = /*#__PURE__*/ function() {
3923
3997
  };
3924
3998
  _proto._organizeEntities = function _organizeEntities() {
3925
3999
  var _this_context = this.context, entityConfigMap = _this_context.entityConfigMap, entityMap = _this_context.entityMap, scene = _this_context.scene, rootIds = _this_context.rootIds;
3926
- for(var _iterator = _createForOfIteratorHelperLoose(rootIds), _step; !(_step = _iterator()).done;){
4000
+ for(var _iterator = _create_for_of_iterator_helper_loose(rootIds), _step; !(_step = _iterator()).done;){
3927
4001
  var rootId = _step.value;
3928
4002
  PrefabParser.parseChildren(entityConfigMap, entityMap, rootId);
3929
4003
  }
@@ -4087,7 +4161,7 @@ var SourceFontLoader = /*#__PURE__*/ function(Loader) {
4087
4161
  });
4088
4162
  };
4089
4163
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
4090
- return _asyncToGenerator(function() {
4164
+ return _async_to_generator(function() {
4091
4165
  var fontFace;
4092
4166
  return __generator(this, function(_state) {
4093
4167
  switch(_state.label){
@@ -4408,7 +4482,7 @@ SceneLoader = __decorate([
4408
4482
  "prefab"
4409
4483
  ], true)
4410
4484
  ], SceneLoader);
4411
- ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _asyncToGenerator(function(instance, item, engine) {
4485
+ ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item, engine) {
4412
4486
  var props;
4413
4487
  return __generator(this, function(_state) {
4414
4488
  props = item.props;