@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/main.js CHANGED
@@ -7,54 +7,37 @@ var engineMath = require('@galacean/engine-math');
7
7
  var engineDraco = require('@galacean/engine-draco');
8
8
  var engineRhiWebgl = require('@galacean/engine-rhi-webgl');
9
9
 
10
- function extends_() {
11
- extends_ = Object.assign || function (target) {
12
- for (var i = 1; i < arguments.length; i++) {
13
- var source = arguments[i];
14
-
15
- for (var key in source) {
16
- if (Object.prototype.hasOwnProperty.call(source, key)) {
17
- target[key] = source[key];
10
+ function _extends() {
11
+ _extends = Object.assign || function assign(target) {
12
+ for (var i = 1; i < arguments.length; i++) {
13
+ var source = arguments[i];
14
+ for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
18
15
  }
19
- }
20
- }
21
-
22
- return target;
23
- };
24
16
 
25
- return extends_.apply(this, arguments);
26
- }
17
+ return target;
18
+ };
27
19
 
28
- function _extends() {
29
- return extends_.apply(this, arguments);
20
+ return _extends.apply(this, arguments);
30
21
  }
31
22
 
32
- function setPrototypeOf(o, p) {
33
- setPrototypeOf = Object.setPrototypeOf || function setPrototypeOf(o, p) {
34
- o.__proto__ = p;
35
- return o;
36
- };
23
+ function _set_prototype_of(o, p) {
24
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
25
+ o.__proto__ = p;
37
26
 
38
- return setPrototypeOf(o, p);
39
- }
27
+ return o;
28
+ };
40
29
 
41
- function _setPrototypeOf(o, p) {
42
- return setPrototypeOf(o, p);
30
+ return _set_prototype_of(o, p);
43
31
  }
44
32
 
45
33
  function _inherits(subClass, superClass) {
46
- if (typeof superClass !== "function" && superClass !== null) {
47
- throw new TypeError("Super expression must either be null or a function");
48
- }
49
-
50
- subClass.prototype = Object.create(superClass && superClass.prototype, {
51
- constructor: {
52
- value: subClass,
53
- writable: true,
54
- configurable: true
34
+ if (typeof superClass !== "function" && superClass !== null) {
35
+ throw new TypeError("Super expression must either be null or a function");
55
36
  }
56
- });
57
- if (superClass) _setPrototypeOf(subClass, superClass);
37
+
38
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
39
+
40
+ if (superClass) _set_prototype_of(subClass, superClass);
58
41
  }
59
42
 
60
43
  /******************************************************************************
@@ -270,39 +253,34 @@ EnvLoader = __decorate([
270
253
  ], EnvLoader);
271
254
 
272
255
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
273
- try {
274
- var info = gen[key](arg);
275
- var value = info.value;
276
- } catch (error) {
277
- reject(error);
278
- return;
279
- }
280
-
281
- if (info.done) {
282
- resolve(value);
283
- } else {
284
- Promise.resolve(value).then(_next, _throw);
285
- }
256
+ try {
257
+ var info = gen[key](arg);
258
+ var value = info.value;
259
+ } catch (error) {
260
+ reject(error);
261
+ return;
262
+ }
263
+ if (info.done) resolve(value);
264
+ else Promise.resolve(value).then(_next, _throw);
286
265
  }
266
+ function _async_to_generator(fn) {
267
+ return function() {
268
+ var self = this, args = arguments;
287
269
 
288
- function _asyncToGenerator(fn) {
289
- return function () {
290
- var self = this,
291
- args = arguments;
292
- return new Promise(function (resolve, reject) {
293
- var gen = fn.apply(self, args);
270
+ return new Promise(function(resolve, reject) {
271
+ var gen = fn.apply(self, args);
294
272
 
295
- function _next(value) {
296
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
297
- }
273
+ function _next(value) {
274
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
275
+ }
298
276
 
299
- function _throw(err) {
300
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
301
- }
277
+ function _throw(err) {
278
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
279
+ }
302
280
 
303
- _next(undefined);
304
- });
305
- };
281
+ _next(undefined);
282
+ });
283
+ };
306
284
  }
307
285
 
308
286
  var FontLoader = /*#__PURE__*/ function(Loader) {
@@ -335,7 +313,7 @@ var FontLoader = /*#__PURE__*/ function(Loader) {
335
313
  });
336
314
  };
337
315
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
338
- return _asyncToGenerator(function() {
316
+ return _async_to_generator(function() {
339
317
  var fontFace;
340
318
  return __generator(this, function(_state) {
341
319
  switch(_state.label){
@@ -948,36 +926,41 @@ var TextureWrapMode;
948
926
  return GLTFUtil;
949
927
  }();
950
928
 
951
- function _arrayLikeToArray(arr, len) {
952
- if (len == null || len > arr.length) len = arr.length;
953
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
954
- return arr2;
929
+ function _array_like_to_array(arr, len) {
930
+ if (len == null || len > arr.length) len = arr.length;
931
+
932
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
933
+
934
+ return arr2;
955
935
  }
956
936
 
957
- function _arrayWithoutHoles(arr) {
958
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
937
+ function _array_without_holes(arr) {
938
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
959
939
  }
960
940
 
961
- function _iterableToArray(iter) {
962
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
941
+ function _iterable_to_array(iter) {
942
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
943
+ return Array.from(iter);
944
+ }
963
945
  }
964
946
 
965
- function _nonIterableSpread() {
966
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
947
+ function _non_iterable_spread() {
948
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
967
949
  }
968
950
 
969
- function _unsupportedIterableToArray(o, minLen) {
970
- if (!o) return;
971
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
972
- var n = Object.prototype.toString.call(o).slice(8, -1);
973
- if (n === "Object" && o.constructor) n = o.constructor.name;
974
- if (n === "Map" || n === "Set") return Array.from(n);
975
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
976
- return _arrayLikeToArray(o, minLen);
951
+ function _unsupported_iterable_to_array(o, minLen) {
952
+ if (!o) return;
953
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
954
+
955
+ var n = Object.prototype.toString.call(o).slice(8, -1);
956
+
957
+ if (n === "Object" && o.constructor) n = o.constructor.name;
958
+ if (n === "Map" || n === "Set") return Array.from(n);
959
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
977
960
  }
978
961
 
979
- function _toConsumableArray(arr) {
980
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
962
+ function _to_consumable_array(arr) {
963
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
981
964
  }
982
965
 
983
966
  var Parser = /*#__PURE__*/ function() {
@@ -994,7 +977,7 @@ var Parser = /*#__PURE__*/ function() {
994
977
  extensionSchema,
995
978
  parseResource,
996
979
  context
997
- ].concat(_toConsumableArray(extra)));
980
+ ].concat(_to_consumable_array(extra)));
998
981
  }
999
982
  }
1000
983
  };
@@ -1008,7 +991,7 @@ var Parser = /*#__PURE__*/ function() {
1008
991
  return (_parsers_ = parsers[0]).createEngineResource.apply(_parsers_, [
1009
992
  extensionSchema,
1010
993
  context
1011
- ].concat(_toConsumableArray(extra)));
994
+ ].concat(_to_consumable_array(extra)));
1012
995
  }
1013
996
  };
1014
997
  Parser.hasExtensionParser = function hasExtensionParser(extensionName) {
@@ -1033,7 +1016,9 @@ var Parser = /*#__PURE__*/ function() {
1033
1016
  };
1034
1017
  return Parser;
1035
1018
  }();
1036
- Parser._extensionParsers = {};
1019
+ (function() {
1020
+ Parser._extensionParsers = {};
1021
+ })();
1037
1022
  /**
1038
1023
  * Declare ExtensionParser's decorator.
1039
1024
  * @param extensionName - Extension name
@@ -1108,11 +1093,9 @@ KHR_draco_mesh_compression = __decorate([
1108
1093
  ], KHR_draco_mesh_compression);
1109
1094
 
1110
1095
  function _instanceof(left, right) {
1111
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1112
- return !!right[Symbol.hasInstance](left);
1113
- } else {
1114
- return left instanceof right;
1115
- }
1096
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1097
+ return !!right[Symbol.hasInstance](left);
1098
+ } else return left instanceof right;
1116
1099
  }
1117
1100
 
1118
1101
  var KHR_lights_punctual = /*#__PURE__*/ function(ExtensionParser) {
@@ -1435,23 +1418,24 @@ GalaceanMaterialsRemap = __decorate([
1435
1418
  registerExtension("OASIS_materials_remap")
1436
1419
  ], GalaceanMaterialsRemap);
1437
1420
 
1438
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
1421
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
1439
1422
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
1423
+
1440
1424
  if (it) return (it = it.call(o)).next.bind(it);
1441
1425
  // Fallback for engines without symbol support
1442
- if (
1443
- Array.isArray(o) ||
1444
- (it = _unsupportedIterableToArray(o)) ||
1445
- (allowArrayLike && o && typeof o.length === "number")
1446
- ) {
1426
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
1447
1427
  if (it) o = it;
1428
+
1448
1429
  var i = 0;
1449
- return function () {
1430
+
1431
+ return function() {
1450
1432
  if (i >= o.length) return { done: true };
1433
+
1451
1434
  return { done: false, value: o[i++] };
1452
- }
1435
+ };
1453
1436
  }
1454
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1437
+
1438
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1455
1439
  }
1456
1440
 
1457
1441
  var AnimationParser = /*#__PURE__*/ function(Parser) {
@@ -1744,7 +1728,9 @@ var EntityParser = /*#__PURE__*/ function(Parser) {
1744
1728
  };
1745
1729
  return EntityParser;
1746
1730
  }(Parser);
1747
- /** @internal */ EntityParser._defaultName = "_GLTF_ENTITY_";
1731
+ (function() {
1732
+ /** @internal */ EntityParser._defaultName = "_GLTF_ENTITY_";
1733
+ })();
1748
1734
 
1749
1735
  var MeshParser = /*#__PURE__*/ function(Parser1) {
1750
1736
  _inherits(MeshParser, Parser1);
@@ -1821,21 +1807,31 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1821
1807
  var vertexCount;
1822
1808
  var bufferBindIndex = 0;
1823
1809
  var positions;
1824
- keepMeshData && (positions = new Array(vertexCount));
1810
+ var boneIndices;
1811
+ var boneWeights;
1812
+ if (keepMeshData) {
1813
+ positions = new Array(vertexCount);
1814
+ boneIndices = new Array(vertexCount);
1815
+ boneWeights = new Array(vertexCount);
1816
+ }
1825
1817
  for(var attribute in attributes){
1826
1818
  var accessor = accessors[attributes[attribute]];
1827
1819
  var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf, accessor);
1828
- var dataElmentSize = GLTFUtil.getAccessorTypeSize(accessor.type);
1829
- var attributeCount = accessor.count;
1820
+ var dataElementSize = GLTFUtil.getAccessorTypeSize(accessor.type);
1821
+ var accessorCount = accessor.count;
1830
1822
  var vertices = accessorBuffer.data;
1831
1823
  var vertexElement = void 0;
1832
1824
  var meshId = mesh.instanceId;
1833
1825
  var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
1834
- var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElmentSize, accessor.normalized);
1826
+ var elementNormalized = accessor.normalized;
1827
+ var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElementSize, elementNormalized);
1828
+ var scaleFactor = void 0;
1829
+ elementNormalized && (scaleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType));
1830
+ var elementOffset = void 0;
1835
1831
  if (accessorBuffer.interleaved) {
1836
1832
  var byteOffset = accessor.byteOffset || 0;
1837
1833
  var stride = accessorBuffer.stride;
1838
- var elementOffset = byteOffset % stride;
1834
+ elementOffset = byteOffset % stride;
1839
1835
  if (vertexBindingInfos[meshId] === undefined) {
1840
1836
  vertexElement = new engineCore.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
1841
1837
  var vertexBuffer = accessorBuffer.vertexBuffer;
@@ -1850,7 +1846,8 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1850
1846
  vertexElement = new engineCore.VertexElement(attribute, elementOffset, elementFormat, vertexBindingInfos[meshId]);
1851
1847
  }
1852
1848
  } else {
1853
- vertexElement = new engineCore.VertexElement(attribute, 0, elementFormat, bufferBindIndex);
1849
+ elementOffset = 0;
1850
+ vertexElement = new engineCore.VertexElement(attribute, elementOffset, elementFormat, bufferBindIndex);
1854
1851
  var vertexBuffer1 = new engineCore.Buffer(engine, engineCore.BufferBindFlag.VertexBuffer, vertices.byteLength, engineCore.BufferUsage.Static);
1855
1852
  vertexBuffer1.setData(vertices);
1856
1853
  mesh.setVertexBufferBinding(vertexBuffer1, accessorBuffer.stride, bufferBindIndex);
@@ -1858,35 +1855,60 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1858
1855
  }
1859
1856
  vertexElements.push(vertexElement);
1860
1857
  if (attribute === "POSITION") {
1861
- vertexCount = attributeCount;
1858
+ vertexCount = accessorCount;
1862
1859
  var _mesh_bounds = mesh.bounds, min = _mesh_bounds.min, max = _mesh_bounds.max;
1863
1860
  if (accessor.min && accessor.max) {
1864
1861
  min.copyFromArray(accessor.min);
1865
1862
  max.copyFromArray(accessor.max);
1866
1863
  if (keepMeshData) {
1867
- var stride1 = vertices.length / attributeCount;
1868
- for(var j = 0; j < attributeCount; j++){
1869
- var offset = j * stride1;
1870
- positions[j] = new engineMath.Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1864
+ var baseOffset = elementOffset / vertices.BYTES_PER_ELEMENT;
1865
+ var stride1 = vertices.length / accessorCount;
1866
+ for(var j = 0; j < accessorCount; j++){
1867
+ var offset = baseOffset + j * stride1;
1868
+ var position = new engineMath.Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1869
+ elementNormalized && position.scale(scaleFactor);
1870
+ positions[j] = position;
1871
1871
  }
1872
1872
  }
1873
1873
  } else {
1874
- var position = MeshParser._tempVector3;
1874
+ var position1 = MeshParser._tempVector3;
1875
1875
  min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
1876
1876
  max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
1877
- var stride2 = vertices.length / attributeCount;
1878
- for(var j1 = 0; j1 < attributeCount; j1++){
1879
- var offset1 = j1 * stride2;
1880
- position.copyFromArray(vertices, offset1);
1881
- engineMath.Vector3.min(min, position, min);
1882
- engineMath.Vector3.max(max, position, max);
1883
- keepMeshData && (positions[j1] = position.clone());
1877
+ var baseOffset1 = elementOffset / vertices.BYTES_PER_ELEMENT;
1878
+ var stride2 = vertices.length / accessorCount;
1879
+ for(var j1 = 0; j1 < accessorCount; j1++){
1880
+ var offset1 = baseOffset1 + j1 * stride2;
1881
+ position1.copyFromArray(vertices, offset1);
1882
+ engineMath.Vector3.min(min, position1, min);
1883
+ engineMath.Vector3.max(max, position1, max);
1884
+ if (keepMeshData) {
1885
+ var clonePosition = position1.clone();
1886
+ elementNormalized && clonePosition.scale(scaleFactor);
1887
+ positions[j1] = clonePosition;
1888
+ }
1884
1889
  }
1885
1890
  }
1886
- if (accessor.normalized) {
1887
- var sacleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType);
1888
- min.scale(sacleFactor);
1889
- max.scale(sacleFactor);
1891
+ if (elementNormalized) {
1892
+ min.scale(scaleFactor);
1893
+ max.scale(scaleFactor);
1894
+ }
1895
+ } else if (attribute === "JOINTS_0" && keepMeshData) {
1896
+ var baseOffset2 = elementOffset / vertices.BYTES_PER_ELEMENT;
1897
+ var stride3 = vertices.length / accessorCount;
1898
+ for(var j2 = 0; j2 < accessorCount; j2++){
1899
+ var offset2 = baseOffset2 + j2 * stride3;
1900
+ var boneIndex = new engineMath.Vector4(vertices[offset2], vertices[offset2 + 1], vertices[offset2 + 2], vertices[offset2 + 3]);
1901
+ elementNormalized && boneIndex.scale(scaleFactor);
1902
+ boneIndices[j2] = boneIndex;
1903
+ }
1904
+ } else if (attribute === "WEIGHTS_0" && keepMeshData) {
1905
+ var baseOffset3 = elementOffset / vertices.BYTES_PER_ELEMENT;
1906
+ var stride4 = vertices.length / accessorCount;
1907
+ for(var j3 = 0; j3 < accessorCount; j3++){
1908
+ var offset3 = baseOffset3 + j3 * stride4;
1909
+ var boneWeight = new engineMath.Vector4(vertices[offset3], vertices[offset3 + 1], vertices[offset3 + 2], vertices[offset3 + 3]);
1910
+ elementNormalized && boneWeight.scale(scaleFactor);
1911
+ boneWeights[j3] = boneWeight;
1890
1912
  }
1891
1913
  }
1892
1914
  }
@@ -1905,6 +1927,10 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
1905
1927
  mesh.uploadData(!keepMeshData);
1906
1928
  //@ts-ignore
1907
1929
  mesh._positions = positions;
1930
+ //@ts-ignore
1931
+ mesh._boneIndices = boneIndices;
1932
+ //@ts-ignore
1933
+ mesh._boneWeights = boneWeights;
1908
1934
  return Promise.resolve(mesh);
1909
1935
  };
1910
1936
  _proto._createBlendShape = function _createBlendShape(mesh, glTFMesh, glTFTargets, getBlendShapeData) {
@@ -2026,7 +2052,9 @@ var MeshParser = /*#__PURE__*/ function(Parser1) {
2026
2052
  };
2027
2053
  return MeshParser;
2028
2054
  }(Parser);
2029
- MeshParser._tempVector3 = new engineMath.Vector3();
2055
+ (function() {
2056
+ MeshParser._tempVector3 = new engineMath.Vector3();
2057
+ })();
2030
2058
 
2031
2059
  var SceneParser$1 = /*#__PURE__*/ function(Parser1) {
2032
2060
  _inherits(SceneParser, Parser1);
@@ -2235,7 +2263,7 @@ var SkinParser = /*#__PURE__*/ function(Parser) {
2235
2263
  };
2236
2264
  _proto._findSkeletonRootBone = function _findSkeletonRootBone(joints, entities) {
2237
2265
  var paths = {};
2238
- for(var _iterator = _createForOfIteratorHelperLoose(joints), _step; !(_step = _iterator()).done;){
2266
+ for(var _iterator = _create_for_of_iterator_helper_loose(joints), _step; !(_step = _iterator()).done;){
2239
2267
  var index = _step.value;
2240
2268
  var path = new Array();
2241
2269
  var entity = entities[index];
@@ -2337,8 +2365,10 @@ var TextureParser = /*#__PURE__*/ function(Parser) {
2337
2365
  };
2338
2366
  return TextureParser;
2339
2367
  }(Parser);
2340
- var _obj;
2341
- TextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = engineCore.TextureWrapMode.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = engineCore.TextureWrapMode.Mirror, _obj[TextureWrapMode.REPEAT] = engineCore.TextureWrapMode.Repeat, _obj);
2368
+ (function() {
2369
+ var _obj;
2370
+ TextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = engineCore.TextureWrapMode.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = engineCore.TextureWrapMode.Mirror, _obj[TextureWrapMode.REPEAT] = engineCore.TextureWrapMode.Repeat, _obj);
2371
+ })();
2342
2372
 
2343
2373
  var Validator = /*#__PURE__*/ function(Parser1) {
2344
2374
  _inherits(Validator, Parser1);
@@ -2410,17 +2440,19 @@ var GLTFParser = /*#__PURE__*/ function() {
2410
2440
  };
2411
2441
  return GLTFParser;
2412
2442
  }();
2413
- GLTFParser.defaultPipeline = new GLTFParser([
2414
- BufferParser,
2415
- Validator,
2416
- TextureParser,
2417
- MaterialParser,
2418
- MeshParser,
2419
- EntityParser,
2420
- SkinParser,
2421
- AnimationParser,
2422
- SceneParser$1
2423
- ]);
2443
+ (function() {
2444
+ GLTFParser.defaultPipeline = new GLTFParser([
2445
+ BufferParser,
2446
+ Validator,
2447
+ TextureParser,
2448
+ MaterialParser,
2449
+ MeshParser,
2450
+ EntityParser,
2451
+ SkinParser,
2452
+ AnimationParser,
2453
+ SceneParser$1
2454
+ ]);
2455
+ })();
2424
2456
 
2425
2457
  /**
2426
2458
  * Product after GLTF parser, usually, `defaultSceneRoot` is only needed to use.
@@ -2472,7 +2504,7 @@ var GLTFLoader = /*#__PURE__*/ function(Loader) {
2472
2504
  context.keepMeshData = (_item_params_keepMeshData = (_item_params = item.params) == null ? void 0 : _item_params.keepMeshData) != null ? _item_params_keepMeshData : false;
2473
2505
  masterPromiseInfo.onCancel(function() {
2474
2506
  var chainPromises = context.chainPromises;
2475
- for(var _iterator = _createForOfIteratorHelperLoose(chainPromises), _step; !(_step = _iterator()).done;){
2507
+ for(var _iterator = _create_for_of_iterator_helper_loose(chainPromises), _step; !(_step = _iterator()).done;){
2476
2508
  var promise = _step.value;
2477
2509
  promise.cancel();
2478
2510
  }
@@ -2733,37 +2765,75 @@ var HDRLoader = (_HDRLoader = /*#__PURE__*/ function(Loader) {
2733
2765
  color.a *= M;
2734
2766
  };
2735
2767
  return HDRLoader1;
2736
- }(engineCore.Loader), _HDRLoader._rightBottomBack = new engineMath.Vector3(1.0, -1.0, -1.0), _HDRLoader._rightBottomFront = new engineMath.Vector3(1.0, -1.0, 1.0), _HDRLoader._rightUpBack = new engineMath.Vector3(1.0, 1.0, -1.0), _HDRLoader._rightUpFront = new engineMath.Vector3(1.0, 1.0, 1.0), _HDRLoader._leftBottomBack = new engineMath.Vector3(-1.0, -1.0, -1.0), _HDRLoader._leftBottomFront = new engineMath.Vector3(-1.0, -1.0, 1.0), _HDRLoader._leftUpBack = new engineMath.Vector3(-1.0, 1.0, -1.0), _HDRLoader._leftUpFront = new engineMath.Vector3(-1.0, 1.0, 1.0), _HDRLoader._faceRight = [
2737
- _HDRLoader._rightBottomBack,
2738
- _HDRLoader._rightBottomFront,
2739
- _HDRLoader._rightUpBack,
2740
- _HDRLoader._rightUpFront
2741
- ], _HDRLoader._faceLeft = [
2742
- _HDRLoader._leftBottomFront,
2743
- _HDRLoader._leftBottomBack,
2744
- _HDRLoader._leftUpFront,
2745
- _HDRLoader._leftUpBack
2746
- ], _HDRLoader._faceUp = [
2747
- _HDRLoader._leftBottomFront,
2748
- _HDRLoader._rightBottomFront,
2749
- _HDRLoader._leftBottomBack,
2750
- _HDRLoader._rightBottomBack
2751
- ], _HDRLoader._faceBottom = [
2752
- _HDRLoader._leftUpBack,
2753
- _HDRLoader._rightUpBack,
2754
- _HDRLoader._leftUpFront,
2755
- _HDRLoader._rightUpFront
2756
- ], _HDRLoader._faceFront = [
2757
- _HDRLoader._leftBottomBack,
2758
- _HDRLoader._rightBottomBack,
2759
- _HDRLoader._leftUpBack,
2760
- _HDRLoader._rightUpBack
2761
- ], _HDRLoader._faceBack = [
2762
- _HDRLoader._rightBottomFront,
2763
- _HDRLoader._leftBottomFront,
2764
- _HDRLoader._rightUpFront,
2765
- _HDRLoader._leftUpFront
2766
- ], _HDRLoader._tempVector3 = new engineMath.Vector3(), _HDRLoader._temp2Vector3 = new engineMath.Vector3(), _HDRLoader._temp3Vector3 = new engineMath.Vector3(), _HDRLoader._temp4Vector3 = new engineMath.Vector3(), _HDRLoader._temp5Vector3 = new engineMath.Vector3(), _HDRLoader);
2768
+ }(engineCore.Loader), function() {
2769
+ _HDRLoader._rightBottomBack = new engineMath.Vector3(1.0, -1.0, -1.0);
2770
+ }(), function() {
2771
+ _HDRLoader._rightBottomFront = new engineMath.Vector3(1.0, -1.0, 1.0);
2772
+ }(), function() {
2773
+ _HDRLoader._rightUpBack = new engineMath.Vector3(1.0, 1.0, -1.0);
2774
+ }(), function() {
2775
+ _HDRLoader._rightUpFront = new engineMath.Vector3(1.0, 1.0, 1.0);
2776
+ }(), function() {
2777
+ _HDRLoader._leftBottomBack = new engineMath.Vector3(-1.0, -1.0, -1.0);
2778
+ }(), function() {
2779
+ _HDRLoader._leftBottomFront = new engineMath.Vector3(-1.0, -1.0, 1.0);
2780
+ }(), function() {
2781
+ _HDRLoader._leftUpBack = new engineMath.Vector3(-1.0, 1.0, -1.0);
2782
+ }(), function() {
2783
+ _HDRLoader._leftUpFront = new engineMath.Vector3(-1.0, 1.0, 1.0);
2784
+ }(), function() {
2785
+ _HDRLoader._faceRight = [
2786
+ _HDRLoader._rightBottomBack,
2787
+ _HDRLoader._rightBottomFront,
2788
+ _HDRLoader._rightUpBack,
2789
+ _HDRLoader._rightUpFront
2790
+ ];
2791
+ }(), function() {
2792
+ _HDRLoader._faceLeft = [
2793
+ _HDRLoader._leftBottomFront,
2794
+ _HDRLoader._leftBottomBack,
2795
+ _HDRLoader._leftUpFront,
2796
+ _HDRLoader._leftUpBack
2797
+ ];
2798
+ }(), function() {
2799
+ _HDRLoader._faceUp = [
2800
+ _HDRLoader._leftBottomFront,
2801
+ _HDRLoader._rightBottomFront,
2802
+ _HDRLoader._leftBottomBack,
2803
+ _HDRLoader._rightBottomBack
2804
+ ];
2805
+ }(), function() {
2806
+ _HDRLoader._faceBottom = [
2807
+ _HDRLoader._leftUpBack,
2808
+ _HDRLoader._rightUpBack,
2809
+ _HDRLoader._leftUpFront,
2810
+ _HDRLoader._rightUpFront
2811
+ ];
2812
+ }(), function() {
2813
+ _HDRLoader._faceFront = [
2814
+ _HDRLoader._leftBottomBack,
2815
+ _HDRLoader._rightBottomBack,
2816
+ _HDRLoader._leftUpBack,
2817
+ _HDRLoader._rightUpBack
2818
+ ];
2819
+ }(), function() {
2820
+ _HDRLoader._faceBack = [
2821
+ _HDRLoader._rightBottomFront,
2822
+ _HDRLoader._leftBottomFront,
2823
+ _HDRLoader._rightUpFront,
2824
+ _HDRLoader._leftUpFront
2825
+ ];
2826
+ }(), function() {
2827
+ _HDRLoader._tempVector3 = new engineMath.Vector3();
2828
+ }(), function() {
2829
+ _HDRLoader._temp2Vector3 = new engineMath.Vector3();
2830
+ }(), function() {
2831
+ _HDRLoader._temp3Vector3 = new engineMath.Vector3();
2832
+ }(), function() {
2833
+ _HDRLoader._temp4Vector3 = new engineMath.Vector3();
2834
+ }(), function() {
2835
+ _HDRLoader._temp5Vector3 = new engineMath.Vector3();
2836
+ }(), _HDRLoader);
2767
2837
  HDRLoader = __decorate([
2768
2838
  engineCore.resourceLoader(engineCore.AssetType.HDR, [
2769
2839
  "hdr"
@@ -3133,19 +3203,21 @@ MaterialLoader = __decorate([
3133
3203
  ], MaterialLoader);
3134
3204
 
3135
3205
  function _defineProperties(target, props) {
3136
- for (var i = 0; i < props.length; i++) {
3137
- var descriptor = props[i];
3138
- descriptor.enumerable = descriptor.enumerable || false;
3139
- descriptor.configurable = true;
3140
- if ("value" in descriptor) descriptor.writable = true;
3141
- Object.defineProperty(target, descriptor.key, descriptor);
3142
- }
3206
+ for (var i = 0; i < props.length; i++) {
3207
+ var descriptor = props[i];
3208
+ descriptor.enumerable = descriptor.enumerable || false;
3209
+ descriptor.configurable = true;
3210
+
3211
+ if ("value" in descriptor) descriptor.writable = true;
3212
+
3213
+ Object.defineProperty(target, descriptor.key, descriptor);
3214
+ }
3143
3215
  }
3216
+ function _create_class(Constructor, protoProps, staticProps) {
3217
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3218
+ if (staticProps) _defineProperties(Constructor, staticProps);
3144
3219
 
3145
- function _createClass(Constructor, protoProps, staticProps) {
3146
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3147
- if (staticProps) _defineProperties(Constructor, staticProps);
3148
- return Constructor;
3220
+ return Constructor;
3149
3221
  }
3150
3222
 
3151
3223
  var BufferReader = /*#__PURE__*/ function() {
@@ -3254,7 +3326,7 @@ var BufferReader = /*#__PURE__*/ function() {
3254
3326
  if (byteLength < maxByteLength) this._offset++;
3255
3327
  return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
3256
3328
  };
3257
- _createClass(BufferReader, [
3329
+ _create_class(BufferReader, [
3258
3330
  {
3259
3331
  key: "offset",
3260
3332
  get: function get() {
@@ -3264,12 +3336,14 @@ var BufferReader = /*#__PURE__*/ function() {
3264
3336
  ]);
3265
3337
  return BufferReader;
3266
3338
  }();
3267
- BufferReader.imageMapping = {
3268
- 0: "image/png",
3269
- 1: "image/jpg",
3270
- 2: "image/webp",
3271
- 3: "ktx"
3272
- };
3339
+ (function() {
3340
+ BufferReader.imageMapping = {
3341
+ 0: "image/png",
3342
+ 1: "image/jpg",
3343
+ 2: "image/webp",
3344
+ 3: "ktx"
3345
+ };
3346
+ })();
3273
3347
 
3274
3348
  var decoderMap = {};
3275
3349
  /**
@@ -3308,7 +3382,7 @@ var FileHeader = /*#__PURE__*/ function() {
3308
3382
  header.headerLength = nameUint8Array.byteLength + typeUint8Array.byteLength + 9;
3309
3383
  return header;
3310
3384
  };
3311
- _createClass(FileHeader, [
3385
+ _create_class(FileHeader, [
3312
3386
  {
3313
3387
  key: "dataLength",
3314
3388
  get: function get() {
@@ -3527,38 +3601,36 @@ exports.Texture2DDecoder = __decorate([
3527
3601
  decoder("Texture2D")
3528
3602
  ], exports.Texture2DDecoder);
3529
3603
 
3530
- function isNativeReflectConstruct() {
3531
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3532
- if (Reflect.construct.sham) return false;
3533
- if (typeof Proxy === "function") return true;
3534
-
3535
- try {
3536
- Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
3537
- return true;
3538
- } catch (e) {
3539
- return false;
3540
- }
3541
- }
3604
+ function _is_native_reflect_construct() {
3605
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3606
+ if (Reflect.construct.sham) return false;
3607
+ if (typeof Proxy === "function") return true;
3542
3608
 
3543
- function construct(Parent, args, Class) {
3544
- if (isNativeReflectConstruct()) {
3545
- construct = Reflect.construct;
3546
- } else {
3547
- construct = function construct(Parent, args, Class) {
3548
- var a = [null];
3549
- a.push.apply(a, args);
3550
- var Constructor = Function.bind.apply(Parent, a);
3551
- var instance = new Constructor();
3552
- if (Class) _setPrototypeOf(instance, Class.prototype);
3553
- return instance;
3554
- };
3555
- }
3609
+ try {
3610
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3556
3611
 
3557
- return construct.apply(null, arguments);
3612
+ return true;
3613
+ } catch (e) {
3614
+ return false;
3615
+ }
3558
3616
  }
3559
3617
 
3560
3618
  function _construct(Parent, args, Class) {
3561
- return construct.apply(null, arguments);
3619
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
3620
+ else {
3621
+ _construct = function construct(Parent, args, Class) {
3622
+ var a = [null];
3623
+ a.push.apply(a, args);
3624
+ var Constructor = Function.bind.apply(Parent, a);
3625
+ var instance = new Constructor();
3626
+
3627
+ if (Class) _set_prototype_of(instance, Class.prototype);
3628
+
3629
+ return instance;
3630
+ };
3631
+ }
3632
+
3633
+ return _construct.apply(null, arguments);
3562
3634
  }
3563
3635
 
3564
3636
  var ReflectionParser = /*#__PURE__*/ function() {
@@ -3673,7 +3745,9 @@ var ReflectionParser = /*#__PURE__*/ function() {
3673
3745
  };
3674
3746
  return ReflectionParser;
3675
3747
  }();
3676
- ReflectionParser.customParseComponentHandles = new Map();
3748
+ (function() {
3749
+ ReflectionParser.customParseComponentHandles = new Map();
3750
+ })();
3677
3751
 
3678
3752
  var PrefabParser = /*#__PURE__*/ function() {
3679
3753
  function PrefabParser() {}
@@ -3927,7 +4001,7 @@ var SceneParserContext = /*#__PURE__*/ function() {
3927
4001
  };
3928
4002
  _proto._organizeEntities = function _organizeEntities() {
3929
4003
  var _this_context = this.context, entityConfigMap = _this_context.entityConfigMap, entityMap = _this_context.entityMap, scene = _this_context.scene, rootIds = _this_context.rootIds;
3930
- for(var _iterator = _createForOfIteratorHelperLoose(rootIds), _step; !(_step = _iterator()).done;){
4004
+ for(var _iterator = _create_for_of_iterator_helper_loose(rootIds), _step; !(_step = _iterator()).done;){
3931
4005
  var rootId = _step.value;
3932
4006
  PrefabParser.parseChildren(entityConfigMap, entityMap, rootId);
3933
4007
  }
@@ -4091,7 +4165,7 @@ var SourceFontLoader = /*#__PURE__*/ function(Loader) {
4091
4165
  });
4092
4166
  };
4093
4167
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
4094
- return _asyncToGenerator(function() {
4168
+ return _async_to_generator(function() {
4095
4169
  var fontFace;
4096
4170
  return __generator(this, function(_state) {
4097
4171
  switch(_state.label){
@@ -4412,7 +4486,7 @@ SceneLoader = __decorate([
4412
4486
  "prefab"
4413
4487
  ], true)
4414
4488
  ], SceneLoader);
4415
- ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _asyncToGenerator(function(instance, item, engine) {
4489
+ ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item, engine) {
4416
4490
  var props;
4417
4491
  return __generator(this, function(_state) {
4418
4492
  props = item.props;