@galacean/engine-loader 1.0.0-alpha.6 → 1.0.0-beta.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.
@@ -8,54 +8,37 @@ var miniprogram$1 = require('@galacean/engine-math/dist/miniprogram');
8
8
  var miniprogram$2 = require('@galacean/engine-rhi-webgl/dist/miniprogram');
9
9
  var miniprogram$3 = require('@galacean/engine-draco/dist/miniprogram');
10
10
 
11
- function extends_() {
12
- extends_ = Object.assign || function (target) {
13
- for (var i = 1; i < arguments.length; i++) {
14
- var source = arguments[i];
15
-
16
- for (var key in source) {
17
- if (Object.prototype.hasOwnProperty.call(source, key)) {
18
- target[key] = source[key];
11
+ function _extends() {
12
+ _extends = Object.assign || function assign(target) {
13
+ for (var i = 1; i < arguments.length; i++) {
14
+ var source = arguments[i];
15
+ for (var key in source) if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
19
16
  }
20
- }
21
- }
22
17
 
23
- return target;
24
- };
25
-
26
- return extends_.apply(this, arguments);
27
- }
18
+ return target;
19
+ };
28
20
 
29
- function _extends() {
30
- return extends_.apply(this, arguments);
21
+ return _extends.apply(this, arguments);
31
22
  }
32
23
 
33
- function setPrototypeOf(o, p) {
34
- setPrototypeOf = Object.setPrototypeOf || function setPrototypeOf(o, p) {
35
- o.__proto__ = p;
36
- return o;
37
- };
24
+ function _set_prototype_of(o, p) {
25
+ _set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
26
+ o.__proto__ = p;
38
27
 
39
- return setPrototypeOf(o, p);
40
- }
28
+ return o;
29
+ };
41
30
 
42
- function _setPrototypeOf(o, p) {
43
- return setPrototypeOf(o, p);
31
+ return _set_prototype_of(o, p);
44
32
  }
45
33
 
46
34
  function _inherits(subClass, superClass) {
47
- if (typeof superClass !== "function" && superClass !== null) {
48
- throw new TypeError("Super expression must either be null or a function");
49
- }
50
-
51
- subClass.prototype = Object.create(superClass && superClass.prototype, {
52
- constructor: {
53
- value: subClass,
54
- writable: true,
55
- configurable: true
35
+ if (typeof superClass !== "function" && superClass !== null) {
36
+ throw new TypeError("Super expression must either be null or a function");
56
37
  }
57
- });
58
- if (superClass) _setPrototypeOf(subClass, superClass);
38
+
39
+ subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } });
40
+
41
+ if (superClass) _set_prototype_of(subClass, superClass);
59
42
  }
60
43
 
61
44
  /******************************************************************************
@@ -274,39 +257,34 @@ EnvLoader = __decorate([
274
257
  ], EnvLoader);
275
258
 
276
259
  function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
277
- try {
278
- var info = gen[key](arg);
279
- var value = info.value;
280
- } catch (error) {
281
- reject(error);
282
- return;
283
- }
284
-
285
- if (info.done) {
286
- resolve(value);
287
- } else {
288
- Promise.resolve(value).then(_next, _throw);
289
- }
260
+ try {
261
+ var info = gen[key](arg);
262
+ var value = info.value;
263
+ } catch (error) {
264
+ reject(error);
265
+ return;
266
+ }
267
+ if (info.done) resolve(value);
268
+ else Promise.resolve(value).then(_next, _throw);
290
269
  }
270
+ function _async_to_generator(fn) {
271
+ return function() {
272
+ var self = this, args = arguments;
291
273
 
292
- function _asyncToGenerator(fn) {
293
- return function () {
294
- var self = this,
295
- args = arguments;
296
- return new Promise(function (resolve, reject) {
297
- var gen = fn.apply(self, args);
274
+ return new Promise(function(resolve, reject) {
275
+ var gen = fn.apply(self, args);
298
276
 
299
- function _next(value) {
300
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
301
- }
277
+ function _next(value) {
278
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
279
+ }
302
280
 
303
- function _throw(err) {
304
- asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
305
- }
281
+ function _throw(err) {
282
+ asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
283
+ }
306
284
 
307
- _next(undefined);
308
- });
309
- };
285
+ _next(undefined);
286
+ });
287
+ };
310
288
  }
311
289
 
312
290
  var FontLoader = /*#__PURE__*/ function(Loader) {
@@ -339,7 +317,7 @@ var FontLoader = /*#__PURE__*/ function(Loader) {
339
317
  });
340
318
  };
341
319
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
342
- return _asyncToGenerator(function() {
320
+ return _async_to_generator(function() {
343
321
  var fontFace;
344
322
  return __generator(this, function(_state) {
345
323
  switch(_state.label){
@@ -367,39 +345,43 @@ FontLoader = __decorate([
367
345
  ], false)
368
346
  ], FontLoader);
369
347
 
370
- function _arrayLikeToArray(arr, len) {
371
- if (len == null || len > arr.length) len = arr.length;
372
- for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
373
- return arr2;
348
+ function _array_like_to_array(arr, len) {
349
+ if (len == null || len > arr.length) len = arr.length;
350
+
351
+ for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i];
352
+
353
+ return arr2;
374
354
  }
375
355
 
376
- function _unsupportedIterableToArray(o, minLen) {
377
- if (!o) return;
378
- if (typeof o === "string") return _arrayLikeToArray(o, minLen);
379
- var n = Object.prototype.toString.call(o).slice(8, -1);
380
- if (n === "Object" && o.constructor) n = o.constructor.name;
381
- if (n === "Map" || n === "Set") return Array.from(n);
382
- if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
383
- return _arrayLikeToArray(o, minLen);
356
+ function _unsupported_iterable_to_array(o, minLen) {
357
+ if (!o) return;
358
+ if (typeof o === "string") return _array_like_to_array(o, minLen);
359
+
360
+ var n = Object.prototype.toString.call(o).slice(8, -1);
361
+
362
+ if (n === "Object" && o.constructor) n = o.constructor.name;
363
+ if (n === "Map" || n === "Set") return Array.from(n);
364
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
384
365
  }
385
366
 
386
- function _createForOfIteratorHelperLoose(o, allowArrayLike) {
367
+ function _create_for_of_iterator_helper_loose(o, allowArrayLike) {
387
368
  var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
369
+
388
370
  if (it) return (it = it.call(o)).next.bind(it);
389
371
  // Fallback for engines without symbol support
390
- if (
391
- Array.isArray(o) ||
392
- (it = _unsupportedIterableToArray(o)) ||
393
- (allowArrayLike && o && typeof o.length === "number")
394
- ) {
372
+ if (Array.isArray(o) || (it = _unsupported_iterable_to_array(o)) || allowArrayLike && o && typeof o.length === "number") {
395
373
  if (it) o = it;
374
+
396
375
  var i = 0;
397
- return function () {
376
+
377
+ return function() {
398
378
  if (i >= o.length) return { done: true };
379
+
399
380
  return { done: false, value: o[i++] };
400
- }
381
+ };
401
382
  }
402
- throw new TypeError("Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
383
+
384
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
403
385
  }
404
386
 
405
387
  /**
@@ -441,16 +423,16 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
441
423
  var buffer = buffers[bufferView.buffer];
442
424
  var _bufferView_byteOffset;
443
425
  var bufferData = new Uint8Array(buffer, (_bufferView_byteOffset = bufferView.byteOffset) != null ? _bufferView_byteOffset : 0, bufferView.byteLength);
444
- return GLTFUtil.loadImageBuffer(bufferData, textureRestoreInfo.mimeType).then(function(image) {
426
+ return GLTFUtils.loadImageBuffer(bufferData, textureRestoreInfo.mimeType).then(function(image) {
445
427
  textureRestoreInfo.texture.setImageSource(image);
446
428
  textureRestoreInfo.texture.generateMipmaps();
447
429
  });
448
430
  })).then(function() {
449
431
  // Restore mesh
450
- for(var _iterator = _createForOfIteratorHelperLoose(_this.meshes), _step; !(_step = _iterator()).done;){
432
+ for(var _iterator = _create_for_of_iterator_helper_loose(_this.meshes), _step; !(_step = _iterator()).done;){
451
433
  var meshInfo = _step.value;
452
434
  var mesh = meshInfo.mesh;
453
- for(var _iterator1 = _createForOfIteratorHelperLoose(meshInfo.vertexBuffers), _step1; !(_step1 = _iterator1()).done;){
435
+ for(var _iterator1 = _create_for_of_iterator_helper_loose(meshInfo.vertexBuffers), _step1; !(_step1 = _iterator1()).done;){
454
436
  var bufferRestoreInfo = _step1.value;
455
437
  var vertexData = _this._getBufferData(buffers, bufferRestoreInfo.data);
456
438
  bufferRestoreInfo.buffer.setData(vertexData);
@@ -459,18 +441,18 @@ function _createForOfIteratorHelperLoose(o, allowArrayLike) {
459
441
  var indexData = _this._getBufferData(buffers, meshInfo.indexBuffer);
460
442
  mesh.setIndices(indexData);
461
443
  }
462
- for(var _iterator2 = _createForOfIteratorHelperLoose(meshInfo.blendShapes), _step2; !(_step2 = _iterator2()).done;){
444
+ for(var _iterator2 = _create_for_of_iterator_helper_loose(meshInfo.blendShapes), _step2; !(_step2 = _iterator2()).done;){
463
445
  var restoreInfo = _step2.value;
464
446
  var frame = restoreInfo.blendShape.frames[0];
465
447
  var positionData = _this._getBufferData(buffers, restoreInfo.position);
466
- frame.deltaPositions = GLTFUtil.floatBufferToVector3Array(positionData);
448
+ frame.deltaPositions = GLTFUtils.floatBufferToVector3Array(positionData);
467
449
  if (restoreInfo.normal) {
468
450
  var normalData = _this._getBufferData(buffers, restoreInfo.normal);
469
- frame.deltaNormals = GLTFUtil.floatBufferToVector3Array(normalData);
451
+ frame.deltaNormals = GLTFUtils.floatBufferToVector3Array(normalData);
470
452
  }
471
453
  if (restoreInfo.tangent) {
472
454
  var tangentData = _this._getBufferData(buffers, restoreInfo.tangent);
473
- frame.deltaTangents = GLTFUtil.floatBufferToVector3Array(tangentData);
455
+ frame.deltaTangents = GLTFUtils.floatBufferToVector3Array(tangentData);
474
456
  }
475
457
  }
476
458
  mesh.uploadData(true);
@@ -752,9 +734,9 @@ var TextureWrapMode;
752
734
 
753
735
  /**
754
736
  * @internal
755
- */ var GLTFUtil = /*#__PURE__*/ function() {
756
- function GLTFUtil() {}
757
- GLTFUtil.floatBufferToVector2Array = function floatBufferToVector2Array(buffer) {
737
+ */ var GLTFUtils = /*#__PURE__*/ function() {
738
+ function GLTFUtils() {}
739
+ GLTFUtils.floatBufferToVector2Array = function floatBufferToVector2Array(buffer) {
758
740
  var bufferLen = buffer.length;
759
741
  var array = new Array(bufferLen / 2);
760
742
  for(var i = 0; i < bufferLen; i += 2){
@@ -762,7 +744,7 @@ var TextureWrapMode;
762
744
  }
763
745
  return array;
764
746
  };
765
- GLTFUtil.floatBufferToVector3Array = function floatBufferToVector3Array(buffer) {
747
+ GLTFUtils.floatBufferToVector3Array = function floatBufferToVector3Array(buffer) {
766
748
  var bufferLen = buffer.length;
767
749
  var array = new Array(bufferLen / 3);
768
750
  for(var i = 0; i < bufferLen; i += 3){
@@ -770,7 +752,7 @@ var TextureWrapMode;
770
752
  }
771
753
  return array;
772
754
  };
773
- GLTFUtil.floatBufferToVector4Array = function floatBufferToVector4Array(buffer) {
755
+ GLTFUtils.floatBufferToVector4Array = function floatBufferToVector4Array(buffer) {
774
756
  var bufferLen = buffer.length;
775
757
  var array = new Array(bufferLen / 4);
776
758
  for(var i = 0; i < bufferLen; i += 4){
@@ -778,7 +760,7 @@ var TextureWrapMode;
778
760
  }
779
761
  return array;
780
762
  };
781
- GLTFUtil.floatBufferToColorArray = function floatBufferToColorArray(buffer, isColor3) {
763
+ GLTFUtils.floatBufferToColorArray = function floatBufferToColorArray(buffer, isColor3) {
782
764
  var bufferLen = buffer.length;
783
765
  var colors = new Array(bufferLen / (isColor3 ? 3 : 4));
784
766
  if (isColor3) {
@@ -793,21 +775,8 @@ var TextureWrapMode;
793
775
  return colors;
794
776
  };
795
777
  /**
796
- * Parse binary text for glb loader.
797
- */ GLTFUtil.decodeText = function decodeText(array) {
798
- if (typeof TextDecoder !== "undefined") {
799
- return new TextDecoder().decode(array);
800
- }
801
- // TextDecoder polyfill
802
- var s = "";
803
- for(var i = 0, il = array.length; i < il; i++){
804
- s += String.fromCharCode(array[i]);
805
- }
806
- return decodeURIComponent(encodeURIComponent(s));
807
- };
808
- /**
809
778
  * Get the number of bytes occupied by accessor type.
810
- */ GLTFUtil.getAccessorTypeSize = function getAccessorTypeSize(accessorType) {
779
+ */ GLTFUtils.getAccessorTypeSize = function getAccessorTypeSize(accessorType) {
811
780
  switch(accessorType){
812
781
  case AccessorType.SCALAR:
813
782
  return 1;
@@ -827,7 +796,7 @@ var TextureWrapMode;
827
796
  };
828
797
  /**
829
798
  * Get the TypedArray corresponding to the component type.
830
- */ GLTFUtil.getComponentType = function getComponentType(componentType) {
799
+ */ GLTFUtils.getComponentType = function getComponentType(componentType) {
831
800
  switch(componentType){
832
801
  case AccessorComponentType.BYTE:
833
802
  return Int8Array;
@@ -843,7 +812,7 @@ var TextureWrapMode;
843
812
  return Float32Array;
844
813
  }
845
814
  };
846
- GLTFUtil.getNormalizedComponentScale = function getNormalizedComponentScale(componentType) {
815
+ GLTFUtils.getNormalizedComponentScale = function getNormalizedComponentScale(componentType) {
847
816
  // Reference: https://github.com/KhronosGroup/glTF/tree/master/extensions/2.0/Khronos/KHR_mesh_quantization#encoding-quantized-data
848
817
  switch(componentType){
849
818
  case AccessorComponentType.BYTE:
@@ -858,7 +827,7 @@ var TextureWrapMode;
858
827
  throw new Error("Galacean.GLTFLoader: Unsupported normalized accessor component type.");
859
828
  }
860
829
  };
861
- GLTFUtil.getAccessorBuffer = function getAccessorBuffer(context, bufferViews, accessor) {
830
+ GLTFUtils.getAccessorBuffer = function getAccessorBuffer(context, bufferViews, accessor) {
862
831
  var buffers = context.buffers;
863
832
  var componentType = accessor.componentType;
864
833
  var bufferView = bufferViews[accessor.bufferView];
@@ -866,8 +835,8 @@ var TextureWrapMode;
866
835
  var buffer = buffers[bufferIndex];
867
836
  var bufferByteOffset = bufferView.byteOffset || 0;
868
837
  var byteOffset = accessor.byteOffset || 0;
869
- var TypedArray = GLTFUtil.getComponentType(componentType);
870
- var dataElementSize = GLTFUtil.getAccessorTypeSize(accessor.type);
838
+ var TypedArray = GLTFUtils.getComponentType(componentType);
839
+ var dataElementSize = GLTFUtils.getAccessorTypeSize(accessor.type);
871
840
  var dataElementBytes = TypedArray.BYTES_PER_ELEMENT;
872
841
  var elementStride = dataElementSize * dataElementBytes;
873
842
  var accessorCount = accessor.count;
@@ -894,25 +863,25 @@ var TextureWrapMode;
894
863
  bufferInfo.restoreInfo = new BufferDataRestoreInfo(new RestoreDataAccessor(bufferIndex, TypedArray, offset1, count1));
895
864
  }
896
865
  if (accessor.sparse) {
897
- GLTFUtil.processingSparseData(bufferViews, accessor, buffers, bufferInfo);
866
+ GLTFUtils.processingSparseData(bufferViews, accessor, buffers, bufferInfo);
898
867
  }
899
868
  return bufferInfo;
900
869
  };
901
870
  /**
902
871
  * @deprecated
903
872
  * Get accessor data.
904
- */ GLTFUtil.getAccessorData = function getAccessorData(glTF, accessor, buffers) {
873
+ */ GLTFUtils.getAccessorData = function getAccessorData(glTF, accessor, buffers) {
905
874
  var bufferViews = glTF.bufferViews;
906
875
  var bufferView = bufferViews[accessor.bufferView];
907
876
  var arrayBuffer = buffers[bufferView.buffer];
908
877
  var accessorByteOffset = accessor.hasOwnProperty("byteOffset") ? accessor.byteOffset : 0;
909
878
  var bufferViewByteOffset = bufferView.hasOwnProperty("byteOffset") ? bufferView.byteOffset : 0;
910
879
  var byteOffset = accessorByteOffset + bufferViewByteOffset;
911
- var accessorTypeSize = GLTFUtil.getAccessorTypeSize(accessor.type);
880
+ var accessorTypeSize = GLTFUtils.getAccessorTypeSize(accessor.type);
912
881
  var length = accessorTypeSize * accessor.count;
913
882
  var _bufferView_byteStride;
914
883
  var byteStride = (_bufferView_byteStride = bufferView.byteStride) != null ? _bufferView_byteStride : 0;
915
- var arrayType = GLTFUtil.getComponentType(accessor.componentType);
884
+ var arrayType = GLTFUtils.getComponentType(accessor.componentType);
916
885
  var uint8Array;
917
886
  if (byteStride) {
918
887
  var accessorByteSize = accessorTypeSize * arrayType.BYTES_PER_ELEMENT;
@@ -939,7 +908,7 @@ var TextureWrapMode;
939
908
  var _values_byteOffset, _valuesBufferView_byteOffset;
940
909
  var valuesByteOffset = ((_values_byteOffset = values.byteOffset) != null ? _values_byteOffset : 0) + ((_valuesBufferView_byteOffset = valuesBufferView.byteOffset) != null ? _valuesBufferView_byteOffset : 0);
941
910
  var valuesByteLength = valuesBufferView.byteLength;
942
- var indicesType = GLTFUtil.getComponentType(indices.componentType);
911
+ var indicesType = GLTFUtils.getComponentType(indices.componentType);
943
912
  var indicesArray = new indicesType(indicesArrayBuffer, indicesByteOffset, indicesByteLength / indicesType.BYTES_PER_ELEMENT);
944
913
  var valuesArray = new arrayType(valuesArrayBuffer, valuesByteOffset, valuesByteLength / arrayType.BYTES_PER_ELEMENT);
945
914
  for(var i1 = 0; i1 < count; i1++){
@@ -951,17 +920,17 @@ var TextureWrapMode;
951
920
  }
952
921
  return typedArray;
953
922
  };
954
- GLTFUtil.getBufferViewData = function getBufferViewData(bufferView, buffers) {
923
+ GLTFUtils.getBufferViewData = function getBufferViewData(bufferView, buffers) {
955
924
  var _bufferView_byteOffset = bufferView.byteOffset, byteOffset = _bufferView_byteOffset === void 0 ? 0 : _bufferView_byteOffset;
956
925
  var arrayBuffer = buffers[bufferView.buffer];
957
926
  return arrayBuffer.slice(byteOffset, byteOffset + bufferView.byteLength);
958
927
  };
959
928
  /**
960
929
  * Get accessor data.
961
- */ GLTFUtil.processingSparseData = function processingSparseData(bufferViews, accessor, buffers, bufferInfo) {
930
+ */ GLTFUtils.processingSparseData = function processingSparseData(bufferViews, accessor, buffers, bufferInfo) {
962
931
  var restoreInfo = bufferInfo.restoreInfo;
963
- var accessorTypeSize = GLTFUtil.getAccessorTypeSize(accessor.type);
964
- var TypedArray = GLTFUtil.getComponentType(accessor.componentType);
932
+ var accessorTypeSize = GLTFUtils.getAccessorTypeSize(accessor.type);
933
+ var TypedArray = GLTFUtils.getComponentType(accessor.componentType);
965
934
  var data = bufferInfo.data.slice();
966
935
  var _accessor_sparse = accessor.sparse, count = _accessor_sparse.count, indices = _accessor_sparse.indices, values = _accessor_sparse.values;
967
936
  var indicesBufferView = bufferViews[indices.bufferView];
@@ -978,7 +947,7 @@ var TextureWrapMode;
978
947
  var valuesByteLength = valuesBufferView.byteLength;
979
948
  restoreInfo.typeSize = accessorTypeSize;
980
949
  restoreInfo.sparseCount = count;
981
- var IndexTypeArray = GLTFUtil.getComponentType(indices.componentType);
950
+ var IndexTypeArray = GLTFUtils.getComponentType(indices.componentType);
982
951
  var indexLength = indicesByteLength / IndexTypeArray.BYTES_PER_ELEMENT;
983
952
  var indicesArray = new IndexTypeArray(indicesArrayBuffer, indicesByteOffset, indexLength);
984
953
  restoreInfo.sparseIndices = new RestoreDataAccessor(indicesBufferIndex, IndexTypeArray, indicesByteOffset, indexLength);
@@ -993,7 +962,7 @@ var TextureWrapMode;
993
962
  }
994
963
  bufferInfo.data = data;
995
964
  };
996
- GLTFUtil.getIndexFormat = function getIndexFormat(type) {
965
+ GLTFUtils.getIndexFormat = function getIndexFormat(type) {
997
966
  switch(type){
998
967
  case AccessorComponentType.UNSIGNED_BYTE:
999
968
  return miniprogram.IndexFormat.UInt8;
@@ -1003,7 +972,7 @@ var TextureWrapMode;
1003
972
  return miniprogram.IndexFormat.UInt32;
1004
973
  }
1005
974
  };
1006
- GLTFUtil.getElementFormat = function getElementFormat(type, size, normalized) {
975
+ GLTFUtils.getElementFormat = function getElementFormat(type, size, normalized) {
1007
976
  if (normalized === void 0) normalized = false;
1008
977
  if (type == AccessorComponentType.FLOAT) {
1009
978
  switch(size){
@@ -1054,7 +1023,7 @@ var TextureWrapMode;
1054
1023
  };
1055
1024
  /**
1056
1025
  * Load image buffer
1057
- */ GLTFUtil.loadImageBuffer = function loadImageBuffer(imageBuffer, type) {
1026
+ */ GLTFUtils.loadImageBuffer = function loadImageBuffer(imageBuffer, type) {
1058
1027
  return new Promise(function(resolve, reject) {
1059
1028
  var blob = new engineMiniprogramAdapter.window.Blob([
1060
1029
  imageBuffer
@@ -1078,18 +1047,9 @@ var TextureWrapMode;
1078
1047
  img.src = engineMiniprogramAdapter.URL.createObjectURL(blob);
1079
1048
  });
1080
1049
  };
1081
- GLTFUtil.isAbsoluteUrl = function isAbsoluteUrl(url) {
1082
- return /^(?:http|blob|data:|\/)/.test(url);
1083
- };
1084
- GLTFUtil.parseRelativeUrl = function parseRelativeUrl(baseUrl, relativeUrl) {
1085
- if (GLTFUtil.isAbsoluteUrl(relativeUrl)) {
1086
- return relativeUrl;
1087
- }
1088
- return baseUrl.substring(0, baseUrl.lastIndexOf("/") + 1) + GLTFUtil._formatRelativePath(relativeUrl);
1089
- };
1090
1050
  /**
1091
1051
  * Parse the glb format.
1092
- */ GLTFUtil.parseGLB = function parseGLB(context, glb) {
1052
+ */ GLTFUtils.parseGLB = function parseGLB(context, glb) {
1093
1053
  var UINT32_LENGTH = 4;
1094
1054
  var GLB_HEADER_MAGIC = 0x46546c67; // 'glTF'
1095
1055
  var GLB_HEADER_LENGTH = 12;
@@ -1117,7 +1077,7 @@ var TextureWrapMode;
1117
1077
  return null;
1118
1078
  }
1119
1079
  var glTFData = new Uint8Array(glb, GLB_HEADER_LENGTH + 2 * UINT32_LENGTH, chunkLength);
1120
- var glTF = JSON.parse(GLTFUtil.decodeText(glTFData));
1080
+ var glTF = JSON.parse(miniprogram.Utils.decodeText(glTFData));
1121
1081
  // read all buffers
1122
1082
  var buffers = [];
1123
1083
  var byteOffset = GLB_HEADER_LENGTH + 2 * UINT32_LENGTH + chunkLength;
@@ -1140,7 +1100,7 @@ var TextureWrapMode;
1140
1100
  buffers: buffers
1141
1101
  };
1142
1102
  };
1143
- GLTFUtil._formatRelativePath = function _formatRelativePath(path) {
1103
+ GLTFUtils._formatRelativePath = function _formatRelativePath(path) {
1144
1104
  // For example input is "a/b", "/a/b", "./a/b", "./a/./b", "./a/../a/b", output is "a/b"
1145
1105
  return path.split("/").filter(Boolean).reduce(function(acc, cur) {
1146
1106
  if (cur === "..") acc.pop();
@@ -1148,23 +1108,25 @@ var TextureWrapMode;
1148
1108
  return acc;
1149
1109
  }, []).join("/");
1150
1110
  };
1151
- return GLTFUtil;
1111
+ return GLTFUtils;
1152
1112
  }();
1153
1113
 
1154
- function _arrayWithoutHoles(arr) {
1155
- if (Array.isArray(arr)) return _arrayLikeToArray(arr);
1114
+ function _array_without_holes(arr) {
1115
+ if (Array.isArray(arr)) return _array_like_to_array(arr);
1156
1116
  }
1157
1117
 
1158
- function _iterableToArray(iter) {
1159
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
1118
+ function _iterable_to_array(iter) {
1119
+ if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) {
1120
+ return Array.from(iter);
1121
+ }
1160
1122
  }
1161
1123
 
1162
- function _nonIterableSpread() {
1163
- throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1124
+ function _non_iterable_spread() {
1125
+ throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
1164
1126
  }
1165
1127
 
1166
- function _toConsumableArray(arr) {
1167
- return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
1128
+ function _to_consumable_array(arr) {
1129
+ return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
1168
1130
  }
1169
1131
 
1170
1132
  /**
@@ -1254,7 +1216,7 @@ exports.GLTFExtensionMode = void 0;
1254
1216
  context,
1255
1217
  extensionSchema,
1256
1218
  ownerSchema
1257
- ].concat(_toConsumableArray(extra)));
1219
+ ].concat(_to_consumable_array(extra)));
1258
1220
  if (resource) {
1259
1221
  return resource;
1260
1222
  }
@@ -1280,7 +1242,7 @@ exports.GLTFExtensionMode = void 0;
1280
1242
  parseResource,
1281
1243
  extensionSchema,
1282
1244
  ownerSchema
1283
- ].concat(_toConsumableArray(extra)));
1245
+ ].concat(_to_consumable_array(extra)));
1284
1246
  }
1285
1247
  };
1286
1248
  /**
@@ -1328,7 +1290,7 @@ exports.GLTFExtensionMode = void 0;
1328
1290
  context,
1329
1291
  extensionSchema,
1330
1292
  ownerSchema
1331
- ].concat(_toConsumableArray(extra)));
1293
+ ].concat(_to_consumable_array(extra)));
1332
1294
  }
1333
1295
  };
1334
1296
  GLTFParser._additiveParse = function _additiveParse(extensionName, context, parseResource, extensionSchema, ownerSchema) {
@@ -1343,12 +1305,14 @@ exports.GLTFExtensionMode = void 0;
1343
1305
  parseResource,
1344
1306
  extensionSchema,
1345
1307
  ownerSchema
1346
- ].concat(_toConsumableArray(extra)));
1308
+ ].concat(_to_consumable_array(extra)));
1347
1309
  }
1348
1310
  };
1349
1311
  return GLTFParser;
1350
1312
  }();
1351
- GLTFParser._extensionParsers = {};
1313
+ (function() {
1314
+ GLTFParser._extensionParsers = {};
1315
+ })();
1352
1316
  /**
1353
1317
  * Declare ExtensionParser's decorator.
1354
1318
  * @param extensionName - Extension name
@@ -1410,10 +1374,10 @@ var GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
1410
1374
  var gltfSampler = samplers[j];
1411
1375
  var inputAccessor = accessors[gltfSampler.input];
1412
1376
  var outputAccessor = accessors[gltfSampler.output];
1413
- var input = GLTFUtil.getAccessorBuffer(context, bufferViews, inputAccessor).data;
1414
- var output = GLTFUtil.getAccessorBuffer(context, bufferViews, outputAccessor).data;
1377
+ var input = GLTFUtils.getAccessorBuffer(context, bufferViews, inputAccessor).data;
1378
+ var output = GLTFUtils.getAccessorBuffer(context, bufferViews, outputAccessor).data;
1415
1379
  if (outputAccessor.normalized) {
1416
- var scale = GLTFUtil.getNormalizedComponentScale(outputAccessor.componentType);
1380
+ var scale = GLTFUtils.getNormalizedComponentScale(outputAccessor.componentType);
1417
1381
  var scaled = new Float32Array(output.length);
1418
1382
  for(var k = 0, v = output.length; k < v; k++){
1419
1383
  scaled[k] = output[k] * scale;
@@ -1567,7 +1531,7 @@ var GLTFBufferParser = /*#__PURE__*/ function(GLTFParser) {
1567
1531
  if (isGLB) {
1568
1532
  return miniprogram.request(url, requestConfig).then(function(glb) {
1569
1533
  restoreBufferRequests.push(new BufferRequestInfo(url, requestConfig));
1570
- return GLTFUtil.parseGLB(context, glb);
1534
+ return GLTFUtils.parseGLB(context, glb);
1571
1535
  }).then(function(param) {
1572
1536
  var glTF = param.glTF, buffers = param.buffers;
1573
1537
  context.glTF = glTF;
@@ -1579,7 +1543,7 @@ var GLTFBufferParser = /*#__PURE__*/ function(GLTFParser) {
1579
1543
  }).then(function(glTF) {
1580
1544
  context.glTF = glTF;
1581
1545
  return Promise.all(glTF.buffers.map(function(buffer) {
1582
- var absoluteUrl = GLTFUtil.parseRelativeUrl(url, buffer.uri);
1546
+ var absoluteUrl = miniprogram.Utils.resolveAbsoluteUrl(url, buffer.uri);
1583
1547
  restoreBufferRequests.push(new BufferRequestInfo(absoluteUrl, requestConfig));
1584
1548
  return miniprogram.request(absoluteUrl, requestConfig);
1585
1549
  })).then(function(buffers) {
@@ -1669,7 +1633,9 @@ var GLTFEntityParser = /*#__PURE__*/ function(GLTFParser) {
1669
1633
  };
1670
1634
  return GLTFEntityParser;
1671
1635
  }(GLTFParser);
1672
- /** @internal */ GLTFEntityParser._defaultName = "_GLTF_ENTITY_";
1636
+ (function() {
1637
+ /** @internal */ GLTFEntityParser._defaultName = "_GLTF_ENTITY_";
1638
+ })();
1673
1639
 
1674
1640
  var GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
1675
1641
  _inherits(GLTFMaterialParser, GLTFParser1);
@@ -1784,11 +1750,9 @@ var GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
1784
1750
  }(GLTFParser);
1785
1751
 
1786
1752
  function _instanceof(left, right) {
1787
- if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1788
- return !!right[Symbol.hasInstance](left);
1789
- } else {
1790
- return left instanceof right;
1791
- }
1753
+ if (right != null && typeof Symbol !== "undefined" && right[Symbol.hasInstance]) {
1754
+ return !!right[Symbol.hasInstance](left);
1755
+ } else return left instanceof right;
1792
1756
  }
1793
1757
 
1794
1758
  var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
@@ -1823,13 +1787,13 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1823
1787
  var attributeAccessorIdx = shapeAccessorIdx[attributeName];
1824
1788
  if (attributeAccessorIdx) {
1825
1789
  var accessor = glTF.accessors[attributeAccessorIdx];
1826
- return GLTFUtil.getAccessorBuffer(context, context.glTF.bufferViews, accessor);
1790
+ return GLTFUtils.getAccessorBuffer(context, context.glTF.bufferViews, accessor);
1827
1791
  } else {
1828
1792
  return null;
1829
1793
  }
1830
1794
  }, function() {
1831
1795
  var indexAccessor = glTF.accessors[gltfPrimitive.indices];
1832
- return GLTFUtil.getAccessorData(glTF, indexAccessor, buffers);
1796
+ return GLTFUtils.getAccessorData(glTF, indexAccessor, buffers);
1833
1797
  }, context.keepMeshData).then(resolve);
1834
1798
  }
1835
1799
  });
@@ -1861,16 +1825,18 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1861
1825
  var vertexElements = new Array();
1862
1826
  var vertexCount;
1863
1827
  var bufferBindIndex = 0;
1828
+ var positions;
1829
+ keepMeshData && (positions = new Array(vertexCount));
1864
1830
  for(var attribute in attributes){
1865
1831
  var accessor = accessors[attributes[attribute]];
1866
- var accessorBuffer = GLTFUtil.getAccessorBuffer(context, gltf.bufferViews, accessor);
1867
- var dataElementSize = GLTFUtil.getAccessorTypeSize(accessor.type);
1832
+ var accessorBuffer = GLTFUtils.getAccessorBuffer(context, gltf.bufferViews, accessor);
1833
+ var dataElementSize = GLTFUtils.getAccessorTypeSize(accessor.type);
1868
1834
  var attributeCount = accessor.count;
1869
1835
  var vertices = accessorBuffer.data;
1870
1836
  var vertexElement = void 0;
1871
1837
  var meshId = mesh.instanceId;
1872
1838
  var vertexBindingInfos = accessorBuffer.vertexBindingInfos;
1873
- var elementFormat = GLTFUtil.getElementFormat(accessor.componentType, dataElementSize, accessor.normalized);
1839
+ var elementFormat = GLTFUtils.getElementFormat(accessor.componentType, dataElementSize, accessor.normalized);
1874
1840
  if (accessorBuffer.interleaved) {
1875
1841
  var byteOffset = accessor.byteOffset || 0;
1876
1842
  var stride = accessorBuffer.stride;
@@ -1904,20 +1870,27 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1904
1870
  if (accessor.min && accessor.max) {
1905
1871
  min.copyFromArray(accessor.min);
1906
1872
  max.copyFromArray(accessor.max);
1873
+ if (keepMeshData) {
1874
+ var stride1 = vertices.length / attributeCount;
1875
+ for(var j = 0; j < attributeCount; j++){
1876
+ var offset = j * stride1;
1877
+ positions[j] = new miniprogram$1.Vector3(vertices[offset], vertices[offset + 1], vertices[offset + 2]);
1878
+ }
1879
+ }
1907
1880
  } else {
1908
1881
  var position = GLTFMeshParser._tempVector3;
1909
1882
  min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
1910
1883
  max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
1911
- var stride1 = vertices.length / attributeCount;
1912
- for(var j = 0; j < attributeCount; j++){
1913
- var offset = j * stride1;
1914
- position.copyFromArray(vertices, offset);
1884
+ var stride2 = vertices.length / attributeCount;
1885
+ for(var j1 = 0; j1 < attributeCount; j1++){
1886
+ var offset1 = j1 * stride2;
1887
+ position.copyFromArray(vertices, offset1);
1915
1888
  miniprogram$1.Vector3.min(min, position, min);
1916
1889
  miniprogram$1.Vector3.max(max, position, max);
1917
1890
  }
1918
1891
  }
1919
1892
  if (accessor.normalized) {
1920
- var scaleFactor = GLTFUtil.getNormalizedComponentScale(accessor.componentType);
1893
+ var scaleFactor = GLTFUtils.getNormalizedComponentScale(accessor.componentType);
1921
1894
  min.scale(scaleFactor);
1922
1895
  max.scale(scaleFactor);
1923
1896
  }
@@ -1927,7 +1900,7 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1927
1900
  // Indices
1928
1901
  if (indices !== undefined) {
1929
1902
  var indexAccessor = gltf.accessors[indices];
1930
- var accessorBuffer1 = GLTFUtil.getAccessorBuffer(context, gltf.bufferViews, indexAccessor);
1903
+ var accessorBuffer1 = GLTFUtils.getAccessorBuffer(context, gltf.bufferViews, indexAccessor);
1931
1904
  mesh.setIndices(accessorBuffer1.data);
1932
1905
  mesh.addSubMesh(0, indexAccessor.count, mode);
1933
1906
  meshRestoreInfo.indexBuffer = accessorBuffer1.restoreInfo;
@@ -1937,6 +1910,8 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1937
1910
  // BlendShapes
1938
1911
  targets && GLTFMeshParser._createBlendShape(mesh, meshRestoreInfo, gltfMesh, targets, getBlendShapeData);
1939
1912
  mesh.uploadData(!keepMeshData);
1913
+ //@ts-ignore
1914
+ mesh._positions = positions;
1940
1915
  return Promise.resolve(mesh);
1941
1916
  };
1942
1917
  /**
@@ -1948,9 +1923,9 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1948
1923
  var deltaPosBufferInfo = getBlendShapeData("POSITION", i);
1949
1924
  var deltaNorBufferInfo = getBlendShapeData("NORMAL", i);
1950
1925
  var deltaTanBufferInfo = getBlendShapeData("TANGENT", i);
1951
- var deltaPositions = deltaPosBufferInfo.data ? GLTFUtil.floatBufferToVector3Array(deltaPosBufferInfo.data) : null;
1952
- var deltaNormals = (deltaNorBufferInfo == null ? void 0 : deltaNorBufferInfo.data) ? GLTFUtil.floatBufferToVector3Array(deltaNorBufferInfo == null ? void 0 : deltaNorBufferInfo.data) : null;
1953
- var deltaTangents = (deltaTanBufferInfo == null ? void 0 : deltaTanBufferInfo.data) ? GLTFUtil.floatBufferToVector3Array(deltaTanBufferInfo == null ? void 0 : deltaTanBufferInfo.data) : null;
1926
+ var deltaPositions = deltaPosBufferInfo.data ? GLTFUtils.floatBufferToVector3Array(deltaPosBufferInfo.data) : null;
1927
+ var deltaNormals = (deltaNorBufferInfo == null ? void 0 : deltaNorBufferInfo.data) ? GLTFUtils.floatBufferToVector3Array(deltaNorBufferInfo == null ? void 0 : deltaNorBufferInfo.data) : null;
1928
+ var deltaTangents = (deltaTanBufferInfo == null ? void 0 : deltaTanBufferInfo.data) ? GLTFUtils.floatBufferToVector3Array(deltaTanBufferInfo == null ? void 0 : deltaTanBufferInfo.data) : null;
1954
1929
  var blendShape = new miniprogram.BlendShape(name);
1955
1930
  blendShape.addFrame(1.0, deltaPositions, deltaNormals, deltaTangents);
1956
1931
  mesh.addBlendShape(blendShape);
@@ -1959,7 +1934,9 @@ var GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1) {
1959
1934
  };
1960
1935
  return GLTFMeshParser;
1961
1936
  }(GLTFParser);
1962
- GLTFMeshParser._tempVector3 = new miniprogram$1.Vector3();
1937
+ (function() {
1938
+ GLTFMeshParser._tempVector3 = new miniprogram$1.Vector3();
1939
+ })();
1963
1940
 
1964
1941
  var GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
1965
1942
  _inherits(GLTFSceneParser, GLTFParser1);
@@ -2111,7 +2088,7 @@ var GLTFSkinParser = /*#__PURE__*/ function(GLTFParser) {
2111
2088
  skin.inverseBindMatrices.length = jointCount;
2112
2089
  // parse IBM
2113
2090
  var accessor = glTF.accessors[inverseBindMatrices];
2114
- var buffer = GLTFUtil.getAccessorBuffer(context, glTF.bufferViews, accessor).data;
2091
+ var buffer = GLTFUtils.getAccessorBuffer(context, glTF.bufferViews, accessor).data;
2115
2092
  for(var i1 = 0; i1 < jointCount; i1++){
2116
2093
  var inverseBindMatrix = new miniprogram$1.Matrix();
2117
2094
  inverseBindMatrix.copyFromArray(buffer, i1 * 16);
@@ -2146,7 +2123,7 @@ var GLTFSkinParser = /*#__PURE__*/ function(GLTFParser) {
2146
2123
  };
2147
2124
  _proto._findSkeletonRootBone = function _findSkeletonRootBone(joints, entities) {
2148
2125
  var paths = {};
2149
- for(var _iterator = _createForOfIteratorHelperLoose(joints), _step; !(_step = _iterator()).done;){
2126
+ for(var _iterator = _create_for_of_iterator_helper_loose(joints), _step; !(_step = _iterator()).done;){
2150
2127
  var index = _step.value;
2151
2128
  var path = new Array();
2152
2129
  var entity = entities[index];
@@ -2196,7 +2173,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser) {
2196
2173
  var ext = uri.substring(index1 + 1);
2197
2174
  var type = ext.startsWith("ktx") ? miniprogram.AssetType.KTX : miniprogram.AssetType.Texture2D;
2198
2175
  return engine.resourceManager.load({
2199
- url: GLTFUtil.parseRelativeUrl(url, uri),
2176
+ url: miniprogram.Utils.resolveAbsoluteUrl(url, uri),
2200
2177
  type: type
2201
2178
  }).then(function(texture) {
2202
2179
  if (!texture.name) {
@@ -2211,7 +2188,7 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser) {
2211
2188
  var bufferView = glTF.bufferViews[bufferViewIndex];
2212
2189
  var buffer = buffers[bufferView.buffer];
2213
2190
  var imageBuffer = new Uint8Array(buffer, bufferView.byteOffset, bufferView.byteLength);
2214
- return GLTFUtil.loadImageBuffer(imageBuffer, mimeType).then(function(image) {
2191
+ return GLTFUtils.loadImageBuffer(imageBuffer, mimeType).then(function(image) {
2215
2192
  var texture = new miniprogram.Texture2D(engine, image.width, image.height);
2216
2193
  texture.setImageSource(image);
2217
2194
  texture.generateMipmaps();
@@ -2251,8 +2228,10 @@ var GLTFTextureParser = /*#__PURE__*/ function(GLTFParser) {
2251
2228
  };
2252
2229
  return GLTFTextureParser;
2253
2230
  }(GLTFParser);
2254
- var _obj;
2255
- GLTFTextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = miniprogram.TextureWrapMode.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = miniprogram.TextureWrapMode.Mirror, _obj[TextureWrapMode.REPEAT] = miniprogram.TextureWrapMode.Repeat, _obj);
2231
+ (function() {
2232
+ var _obj;
2233
+ GLTFTextureParser._wrapMap = (_obj = {}, _obj[TextureWrapMode.CLAMP_TO_EDGE] = miniprogram.TextureWrapMode.Clamp, _obj[TextureWrapMode.MIRRORED_REPEAT] = miniprogram.TextureWrapMode.Mirror, _obj[TextureWrapMode.REPEAT] = miniprogram.TextureWrapMode.Repeat, _obj);
2234
+ })();
2256
2235
 
2257
2236
  var GLTFValidator = /*#__PURE__*/ function(GLTFParser1) {
2258
2237
  _inherits(GLTFValidator, GLTFParser1);
@@ -2334,9 +2313,11 @@ var GLTFValidator = /*#__PURE__*/ function(GLTFParser1) {
2334
2313
  };
2335
2314
  return GLTFPipeline;
2336
2315
  }();
2337
- /**
2316
+ (function() {
2317
+ /**
2338
2318
  * Default pipeline.
2339
2319
  */ GLTFPipeline.defaultPipeline = new GLTFPipeline(GLTFBufferParser, GLTFValidator, GLTFTextureParser, GLTFMaterialParser, GLTFMeshParser, GLTFEntityParser, GLTFSkinParser, GLTFAnimationParser, GLTFSceneParser);
2320
+ })();
2340
2321
 
2341
2322
  /**
2342
2323
  * Product after glTF parser, usually, `defaultSceneRoot` is only needed to use.
@@ -2389,7 +2370,7 @@ var GLTFLoader = /*#__PURE__*/ function(Loader) {
2389
2370
  context.keepMeshData = (_params_keepMeshData = params == null ? void 0 : params.keepMeshData) != null ? _params_keepMeshData : false;
2390
2371
  masterPromiseInfo.onCancel(function() {
2391
2372
  var chainPromises = context.chainPromises;
2392
- for(var _iterator = _createForOfIteratorHelperLoose(chainPromises), _step; !(_step = _iterator()).done;){
2373
+ for(var _iterator = _create_for_of_iterator_helper_loose(chainPromises), _step; !(_step = _iterator()).done;){
2393
2374
  var promise = _step.value;
2394
2375
  promise.cancel();
2395
2376
  }
@@ -2492,7 +2473,7 @@ var HDRLoader = (_HDRLoader = /*#__PURE__*/ function(Loader) {
2492
2473
  return textureArray;
2493
2474
  };
2494
2475
  HDRLoader1._calcProjectionSpherical = function _calcProjectionSpherical(vDir, pixels, inputWidth, inputHeight) {
2495
- var theta = Math.atan2(vDir.z, -vDir.x);
2476
+ var theta = Math.atan2(vDir.z, vDir.x);
2496
2477
  var phi = Math.acos(vDir.y);
2497
2478
  while(theta < -PI){
2498
2479
  theta += 2 * PI;
@@ -2653,37 +2634,75 @@ var HDRLoader = (_HDRLoader = /*#__PURE__*/ function(Loader) {
2653
2634
  color.a *= M;
2654
2635
  };
2655
2636
  return HDRLoader1;
2656
- }(miniprogram.Loader), _HDRLoader._rightBottomBack = new miniprogram$1.Vector3(1.0, -1.0, -1.0), _HDRLoader._rightBottomFront = new miniprogram$1.Vector3(1.0, -1.0, 1.0), _HDRLoader._rightUpBack = new miniprogram$1.Vector3(1.0, 1.0, -1.0), _HDRLoader._rightUpFront = new miniprogram$1.Vector3(1.0, 1.0, 1.0), _HDRLoader._leftBottomBack = new miniprogram$1.Vector3(-1.0, -1.0, -1.0), _HDRLoader._leftBottomFront = new miniprogram$1.Vector3(-1.0, -1.0, 1.0), _HDRLoader._leftUpBack = new miniprogram$1.Vector3(-1.0, 1.0, -1.0), _HDRLoader._leftUpFront = new miniprogram$1.Vector3(-1.0, 1.0, 1.0), _HDRLoader._faceRight = [
2657
- _HDRLoader._rightBottomBack,
2658
- _HDRLoader._rightBottomFront,
2659
- _HDRLoader._rightUpBack,
2660
- _HDRLoader._rightUpFront
2661
- ], _HDRLoader._faceLeft = [
2662
- _HDRLoader._leftBottomFront,
2663
- _HDRLoader._leftBottomBack,
2664
- _HDRLoader._leftUpFront,
2665
- _HDRLoader._leftUpBack
2666
- ], _HDRLoader._faceUp = [
2667
- _HDRLoader._leftBottomFront,
2668
- _HDRLoader._rightBottomFront,
2669
- _HDRLoader._leftBottomBack,
2670
- _HDRLoader._rightBottomBack
2671
- ], _HDRLoader._faceBottom = [
2672
- _HDRLoader._leftUpBack,
2673
- _HDRLoader._rightUpBack,
2674
- _HDRLoader._leftUpFront,
2675
- _HDRLoader._rightUpFront
2676
- ], _HDRLoader._faceFront = [
2677
- _HDRLoader._leftBottomBack,
2678
- _HDRLoader._rightBottomBack,
2679
- _HDRLoader._leftUpBack,
2680
- _HDRLoader._rightUpBack
2681
- ], _HDRLoader._faceBack = [
2682
- _HDRLoader._rightBottomFront,
2683
- _HDRLoader._leftBottomFront,
2684
- _HDRLoader._rightUpFront,
2685
- _HDRLoader._leftUpFront
2686
- ], _HDRLoader._tempVector3 = new miniprogram$1.Vector3(), _HDRLoader._temp2Vector3 = new miniprogram$1.Vector3(), _HDRLoader._temp3Vector3 = new miniprogram$1.Vector3(), _HDRLoader._temp4Vector3 = new miniprogram$1.Vector3(), _HDRLoader._temp5Vector3 = new miniprogram$1.Vector3(), _HDRLoader);
2637
+ }(miniprogram.Loader), function() {
2638
+ _HDRLoader._rightBottomBack = new miniprogram$1.Vector3(1.0, -1.0, -1.0);
2639
+ }(), function() {
2640
+ _HDRLoader._rightBottomFront = new miniprogram$1.Vector3(1.0, -1.0, 1.0);
2641
+ }(), function() {
2642
+ _HDRLoader._rightUpBack = new miniprogram$1.Vector3(1.0, 1.0, -1.0);
2643
+ }(), function() {
2644
+ _HDRLoader._rightUpFront = new miniprogram$1.Vector3(1.0, 1.0, 1.0);
2645
+ }(), function() {
2646
+ _HDRLoader._leftBottomBack = new miniprogram$1.Vector3(-1.0, -1.0, -1.0);
2647
+ }(), function() {
2648
+ _HDRLoader._leftBottomFront = new miniprogram$1.Vector3(-1.0, -1.0, 1.0);
2649
+ }(), function() {
2650
+ _HDRLoader._leftUpBack = new miniprogram$1.Vector3(-1.0, 1.0, -1.0);
2651
+ }(), function() {
2652
+ _HDRLoader._leftUpFront = new miniprogram$1.Vector3(-1.0, 1.0, 1.0);
2653
+ }(), function() {
2654
+ _HDRLoader._faceRight = [
2655
+ _HDRLoader._rightBottomBack,
2656
+ _HDRLoader._rightBottomFront,
2657
+ _HDRLoader._rightUpBack,
2658
+ _HDRLoader._rightUpFront
2659
+ ];
2660
+ }(), function() {
2661
+ _HDRLoader._faceLeft = [
2662
+ _HDRLoader._leftBottomFront,
2663
+ _HDRLoader._leftBottomBack,
2664
+ _HDRLoader._leftUpFront,
2665
+ _HDRLoader._leftUpBack
2666
+ ];
2667
+ }(), function() {
2668
+ _HDRLoader._faceUp = [
2669
+ _HDRLoader._leftBottomFront,
2670
+ _HDRLoader._rightBottomFront,
2671
+ _HDRLoader._leftBottomBack,
2672
+ _HDRLoader._rightBottomBack
2673
+ ];
2674
+ }(), function() {
2675
+ _HDRLoader._faceBottom = [
2676
+ _HDRLoader._leftUpBack,
2677
+ _HDRLoader._rightUpBack,
2678
+ _HDRLoader._leftUpFront,
2679
+ _HDRLoader._rightUpFront
2680
+ ];
2681
+ }(), function() {
2682
+ _HDRLoader._faceFront = [
2683
+ _HDRLoader._leftBottomBack,
2684
+ _HDRLoader._rightBottomBack,
2685
+ _HDRLoader._leftUpBack,
2686
+ _HDRLoader._rightUpBack
2687
+ ];
2688
+ }(), function() {
2689
+ _HDRLoader._faceBack = [
2690
+ _HDRLoader._rightBottomFront,
2691
+ _HDRLoader._leftBottomFront,
2692
+ _HDRLoader._rightUpFront,
2693
+ _HDRLoader._leftUpFront
2694
+ ];
2695
+ }(), function() {
2696
+ _HDRLoader._tempVector3 = new miniprogram$1.Vector3();
2697
+ }(), function() {
2698
+ _HDRLoader._temp2Vector3 = new miniprogram$1.Vector3();
2699
+ }(), function() {
2700
+ _HDRLoader._temp3Vector3 = new miniprogram$1.Vector3();
2701
+ }(), function() {
2702
+ _HDRLoader._temp4Vector3 = new miniprogram$1.Vector3();
2703
+ }(), function() {
2704
+ _HDRLoader._temp5Vector3 = new miniprogram$1.Vector3();
2705
+ }(), _HDRLoader);
2687
2706
  HDRLoader = __decorate([
2688
2707
  miniprogram.resourceLoader(miniprogram.AssetType.HDR, [
2689
2708
  "hdr"
@@ -3053,19 +3072,21 @@ MaterialLoader = __decorate([
3053
3072
  ], MaterialLoader);
3054
3073
 
3055
3074
  function _defineProperties(target, props) {
3056
- for (var i = 0; i < props.length; i++) {
3057
- var descriptor = props[i];
3058
- descriptor.enumerable = descriptor.enumerable || false;
3059
- descriptor.configurable = true;
3060
- if ("value" in descriptor) descriptor.writable = true;
3061
- Object.defineProperty(target, descriptor.key, descriptor);
3062
- }
3075
+ for (var i = 0; i < props.length; i++) {
3076
+ var descriptor = props[i];
3077
+ descriptor.enumerable = descriptor.enumerable || false;
3078
+ descriptor.configurable = true;
3079
+
3080
+ if ("value" in descriptor) descriptor.writable = true;
3081
+
3082
+ Object.defineProperty(target, descriptor.key, descriptor);
3083
+ }
3063
3084
  }
3085
+ function _create_class(Constructor, protoProps, staticProps) {
3086
+ if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3087
+ if (staticProps) _defineProperties(Constructor, staticProps);
3064
3088
 
3065
- function _createClass(Constructor, protoProps, staticProps) {
3066
- if (protoProps) _defineProperties(Constructor.prototype, protoProps);
3067
- if (staticProps) _defineProperties(Constructor, staticProps);
3068
- return Constructor;
3089
+ return Constructor;
3069
3090
  }
3070
3091
 
3071
3092
  var BufferReader = /*#__PURE__*/ function() {
@@ -3135,7 +3156,7 @@ var BufferReader = /*#__PURE__*/ function() {
3135
3156
  var strByteLength = this.nextUint16();
3136
3157
  var uint8Array = new Uint8Array(this.buffer, this._offset, strByteLength);
3137
3158
  this._offset += strByteLength;
3138
- return GLTFUtil.decodeText(uint8Array);
3159
+ return miniprogram.Utils.decodeText(uint8Array);
3139
3160
  };
3140
3161
  /**
3141
3162
  * image data 放在最后
@@ -3174,7 +3195,7 @@ var BufferReader = /*#__PURE__*/ function() {
3174
3195
  if (byteLength < maxByteLength) this._offset++;
3175
3196
  return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
3176
3197
  };
3177
- _createClass(BufferReader, [
3198
+ _create_class(BufferReader, [
3178
3199
  {
3179
3200
  key: "offset",
3180
3201
  get: function get() {
@@ -3184,12 +3205,14 @@ var BufferReader = /*#__PURE__*/ function() {
3184
3205
  ]);
3185
3206
  return BufferReader;
3186
3207
  }();
3187
- BufferReader.imageMapping = {
3188
- 0: "image/png",
3189
- 1: "image/jpg",
3190
- 2: "image/webp",
3191
- 3: "ktx"
3192
- };
3208
+ (function() {
3209
+ BufferReader.imageMapping = {
3210
+ 0: "image/png",
3211
+ 1: "image/jpg",
3212
+ 2: "image/webp",
3213
+ 3: "ktx"
3214
+ };
3215
+ })();
3193
3216
 
3194
3217
  var decoderMap = {};
3195
3218
  /**
@@ -3218,8 +3241,8 @@ var FileHeader = /*#__PURE__*/ function() {
3218
3241
  var typeUint8Array = new Uint8Array(arrayBuffer, 7, typeLen);
3219
3242
  var nameLen = dataView.getUint16(7 + typeLen, true);
3220
3243
  var nameUint8Array = new Uint8Array(arrayBuffer, 9 + typeLen, nameLen);
3221
- var name = GLTFUtil.decodeText(nameUint8Array);
3222
- var type = GLTFUtil.decodeText(typeUint8Array);
3244
+ var name = miniprogram.Utils.decodeText(nameUint8Array);
3245
+ var type = miniprogram.Utils.decodeText(typeUint8Array);
3223
3246
  var header = new FileHeader();
3224
3247
  header.totalLength = totalLen;
3225
3248
  header.name = name;
@@ -3228,7 +3251,7 @@ var FileHeader = /*#__PURE__*/ function() {
3228
3251
  header.headerLength = nameUint8Array.byteLength + typeUint8Array.byteLength + 9;
3229
3252
  return header;
3230
3253
  };
3231
- _createClass(FileHeader, [
3254
+ _create_class(FileHeader, [
3232
3255
  {
3233
3256
  key: "dataLength",
3234
3257
  get: function get() {
@@ -3447,38 +3470,36 @@ exports.Texture2DDecoder = __decorate([
3447
3470
  decoder("Texture2D")
3448
3471
  ], exports.Texture2DDecoder);
3449
3472
 
3450
- function isNativeReflectConstruct() {
3451
- if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3452
- if (Reflect.construct.sham) return false;
3453
- if (typeof Proxy === "function") return true;
3473
+ function _is_native_reflect_construct() {
3474
+ if (typeof Reflect === "undefined" || !Reflect.construct) return false;
3475
+ if (Reflect.construct.sham) return false;
3476
+ if (typeof Proxy === "function") return true;
3454
3477
 
3455
- try {
3456
- Date.prototype.toString.call(Reflect.construct(Date, [], function () { }));
3457
- return true;
3458
- } catch (e) {
3459
- return false;
3460
- }
3461
- }
3478
+ try {
3479
+ Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
3462
3480
 
3463
- function construct(Parent, args, Class) {
3464
- if (isNativeReflectConstruct()) {
3465
- construct = Reflect.construct;
3466
- } else {
3467
- construct = function construct(Parent, args, Class) {
3468
- var a = [null];
3469
- a.push.apply(a, args);
3470
- var Constructor = Function.bind.apply(Parent, a);
3471
- var instance = new Constructor();
3472
- if (Class) _setPrototypeOf(instance, Class.prototype);
3473
- return instance;
3474
- };
3475
- }
3476
-
3477
- return construct.apply(null, arguments);
3481
+ return true;
3482
+ } catch (e) {
3483
+ return false;
3484
+ }
3478
3485
  }
3479
3486
 
3480
3487
  function _construct(Parent, args, Class) {
3481
- return construct.apply(null, arguments);
3488
+ if (_is_native_reflect_construct()) _construct = Reflect.construct;
3489
+ else {
3490
+ _construct = function construct(Parent, args, Class) {
3491
+ var a = [null];
3492
+ a.push.apply(a, args);
3493
+ var Constructor = Function.bind.apply(Parent, a);
3494
+ var instance = new Constructor();
3495
+
3496
+ if (Class) _set_prototype_of(instance, Class.prototype);
3497
+
3498
+ return instance;
3499
+ };
3500
+ }
3501
+
3502
+ return _construct.apply(null, arguments);
3482
3503
  }
3483
3504
 
3484
3505
  var ReflectionParser = /*#__PURE__*/ function() {
@@ -3593,7 +3614,9 @@ var ReflectionParser = /*#__PURE__*/ function() {
3593
3614
  };
3594
3615
  return ReflectionParser;
3595
3616
  }();
3596
- ReflectionParser.customParseComponentHandles = new Map();
3617
+ (function() {
3618
+ ReflectionParser.customParseComponentHandles = new Map();
3619
+ })();
3597
3620
 
3598
3621
  var PrefabParser = /*#__PURE__*/ function() {
3599
3622
  function PrefabParser() {}
@@ -3847,7 +3870,7 @@ var SceneParserContext = /*#__PURE__*/ function() {
3847
3870
  };
3848
3871
  _proto._organizeEntities = function _organizeEntities() {
3849
3872
  var _this_context = this.context, entityConfigMap = _this_context.entityConfigMap, entityMap = _this_context.entityMap, scene = _this_context.scene, rootIds = _this_context.rootIds;
3850
- for(var _iterator = _createForOfIteratorHelperLoose(rootIds), _step; !(_step = _iterator()).done;){
3873
+ for(var _iterator = _create_for_of_iterator_helper_loose(rootIds), _step; !(_step = _iterator()).done;){
3851
3874
  var rootId = _step.value;
3852
3875
  PrefabParser.parseChildren(entityConfigMap, entityMap, rootId);
3853
3876
  }
@@ -4011,7 +4034,7 @@ var SourceFontLoader = /*#__PURE__*/ function(Loader) {
4011
4034
  });
4012
4035
  };
4013
4036
  _proto._registerFont = function _registerFont(fontName, fontUrl) {
4014
- return _asyncToGenerator(function() {
4037
+ return _async_to_generator(function() {
4015
4038
  var fontFace;
4016
4039
  return __generator(this, function(_state) {
4017
4040
  switch(_state.label){
@@ -4048,6 +4071,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
4048
4071
  _this = Loader.apply(this, arguments) || this;
4049
4072
  _this._tempRect = new miniprogram$1.Rect();
4050
4073
  _this._tempVec2 = new miniprogram$1.Vector2();
4074
+ _this._tempVec4 = new miniprogram$1.Vector4();
4051
4075
  return _this;
4052
4076
  }
4053
4077
  var _proto = SpriteAtlasLoader.prototype;
@@ -4065,57 +4089,65 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader) {
4065
4089
  }));
4066
4090
  chainPromises.push(configPromise);
4067
4091
  configPromise.then(function(atlasData) {
4068
- var atlasItems = atlasData.atlasItems, format = atlasData.format;
4069
- var atlasItemsLen = atlasItems.length;
4070
- var imagePromises = miniprogram.AssetPromise.all(atlasItems.map(function(param) {
4071
- var img = param.img;
4072
- return _this.request(GLTFUtil.parseRelativeUrl(item.url, img), _extends({}, item, {
4073
- type: "image"
4074
- }));
4075
- }));
4076
- chainPromises.push(imagePromises);
4077
- return imagePromises.then(function(imgs) {
4078
- var engine = resourceManager.engine;
4079
- // Generate a SpriteAtlas object.
4080
- var tempRect = _this._tempRect, tempVec2 = _this._tempVec2;
4081
- var spriteAtlas = new miniprogram.SpriteAtlas(engine);
4082
- for(var i = 0; i < atlasItemsLen; i++){
4083
- // Generate Texture2D according to configuration.
4084
- var originalImg = imgs[i];
4085
- var width = originalImg.width, height = originalImg.height;
4086
- var texture = new miniprogram.Texture2D(engine, width, height, format);
4087
- texture.setImageSource(originalImg);
4088
- texture.generateMipmaps();
4089
- // Generate all the sprites on this texture.
4090
- var atlasItem = atlasItems[i];
4091
- var sprites = atlasItem.sprites;
4092
- var sourceWidthReciprocal = 1.0 / width;
4093
- var sourceHeightReciprocal = 1.0 / height;
4094
- for(var j = sprites.length - 1; j >= 0; j--){
4095
- var atlasSprite = sprites[j];
4096
- var region = atlasSprite.region, atlasRegionOffset = atlasSprite.atlasRegionOffset, atlasRegion = atlasSprite.atlasRegion, id = atlasSprite.id, pivot = atlasSprite.pivot;
4097
- var sprite = new miniprogram.Sprite(engine, texture, region ? tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? tempVec2.set(pivot.x, pivot.y) : undefined, undefined, atlasSprite.name);
4098
- sprite.atlasRegion.set(atlasRegion.x * sourceWidthReciprocal, atlasRegion.y * sourceHeightReciprocal, atlasRegion.w * sourceWidthReciprocal, atlasRegion.h * sourceHeightReciprocal);
4099
- atlasSprite.atlasRotated && (sprite.atlasRotated = true);
4100
- if (atlasRegionOffset) {
4101
- var offsetLeft = atlasRegionOffset.x, offsetTop = atlasRegionOffset.y, offsetRight = atlasRegionOffset.z, offsetBottom = atlasRegionOffset.w;
4102
- sprite.atlasRegionOffset.set(offsetLeft * sourceWidthReciprocal, offsetTop * sourceHeightReciprocal, offsetRight * sourceWidthReciprocal, offsetBottom * sourceHeightReciprocal);
4092
+ var _loop = function(i) {
4093
+ var atlasItem = atlasItems[i];
4094
+ if (atlasItem.img) {
4095
+ chainPromises.push(resourceManager.load({
4096
+ url: atlasItem.img,
4097
+ type: miniprogram.AssetType.Texture2D,
4098
+ params: {
4099
+ format: format,
4100
+ mipmap: mipmap
4103
4101
  }
4104
- if (id !== undefined) {
4102
+ }).then(function(texture) {
4103
+ anisoLevel && (texture.anisoLevel = anisoLevel);
4104
+ filterMode !== undefined && (texture.filterMode = filterMode);
4105
+ wrapModeU !== undefined && (texture.wrapModeU = wrapModeU);
4106
+ wrapModeV !== undefined && (texture.wrapModeV = wrapModeV);
4107
+ for(var i = 0; i < atlasItem.sprites.length; i++){
4105
4108
  // @ts-ignore
4106
- sprite._assetID = id;
4109
+ spriteAtlas._addSprite(_this._makeSprite(engine, atlasItem.sprites[i], texture));
4107
4110
  }
4111
+ }).catch(reject));
4112
+ } else {
4113
+ for(var i1 = 0; i1 < atlasItem.sprites.length; i1++){
4108
4114
  // @ts-ignore
4109
- spriteAtlas._addSprite(sprite);
4115
+ spriteAtlas._addSprite(_this._makeSprite(engine, atlasItem.sprites[i1]));
4110
4116
  }
4111
4117
  }
4118
+ };
4119
+ var atlasItems = atlasData.atlasItems, mipmap = atlasData.mipmap, anisoLevel = atlasData.anisoLevel, filterMode = atlasData.filterMode, wrapModeU = atlasData.wrapModeU, wrapModeV = atlasData.wrapModeV, format = atlasData.format;
4120
+ var atlasItemsLen = atlasItems ? atlasItems.length : 0;
4121
+ var engine = resourceManager.engine;
4122
+ var spriteAtlas = new miniprogram.SpriteAtlas(engine);
4123
+ if (atlasItemsLen < 0) {
4112
4124
  resolve(spriteAtlas);
4113
- });
4114
- }).catch(function(e) {
4115
- reject(e);
4116
- });
4125
+ return;
4126
+ }
4127
+ chainPromises.length = 0;
4128
+ for(var i = 0; i < atlasItems.length; i++)_loop(i);
4129
+ miniprogram.AssetPromise.all(chainPromises).then(function() {
4130
+ resolve(spriteAtlas);
4131
+ }).catch(reject);
4132
+ }).catch(reject);
4117
4133
  });
4118
4134
  };
4135
+ _proto._makeSprite = function _makeSprite(engine, config, texture) {
4136
+ // Generate a SpriteAtlas object.
4137
+ var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
4138
+ var sprite = new miniprogram.Sprite(engine, texture, region ? this._tempRect.set(region.x, region.y, region.w, region.h) : undefined, pivot ? this._tempVec2.set(pivot.x, pivot.y) : undefined, border ? this._tempVec4.set(border.x, border.y, border.z, border.w) : undefined, config.name);
4139
+ if (texture) {
4140
+ var invW = 1 / texture.width;
4141
+ var invH = 1 / texture.height;
4142
+ sprite.atlasRegion.set(atlasRegion.x * invW, atlasRegion.y * invH, atlasRegion.w * invW, atlasRegion.h * invH);
4143
+ if (atlasRegionOffset) {
4144
+ var offsetLeft = atlasRegionOffset.x, offsetTop = atlasRegionOffset.y, offsetRight = atlasRegionOffset.z, offsetBottom = atlasRegionOffset.w;
4145
+ sprite.atlasRegionOffset.set(offsetLeft * invW, offsetTop * invH, offsetRight * invW, offsetBottom * invH);
4146
+ }
4147
+ config.atlasRotated && (sprite.atlasRotated = true);
4148
+ }
4149
+ return sprite;
4150
+ };
4119
4151
  return SpriteAtlasLoader;
4120
4152
  }(miniprogram.Loader);
4121
4153
  SpriteAtlasLoader = __decorate([
@@ -4136,13 +4168,19 @@ var SpriteLoader = /*#__PURE__*/ function(Loader) {
4136
4168
  _this.request(item.url, _extends({}, item, {
4137
4169
  type: "json"
4138
4170
  })).then(function(data) {
4139
- // @ts-ignore
4140
- resourceManager.getResourceByRef(data.texture).then(function(texture) {
4141
- var sprite = new miniprogram.Sprite(resourceManager.engine, texture);
4142
- sprite.region = data.region;
4143
- sprite.pivot = data.pivot;
4144
- resolve(sprite);
4145
- });
4171
+ if (data.belongToAtlas) {
4172
+ resourceManager// @ts-ignore
4173
+ .getResourceByRef(data.belongToAtlas).then(function(atlas) {
4174
+ resolve(atlas.getSprite(data.fullPath));
4175
+ }).catch(reject);
4176
+ } else if (data.texture) {
4177
+ resourceManager// @ts-ignore
4178
+ .getResourceByRef(data.texture).then(function(texture) {
4179
+ resolve(new miniprogram.Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border));
4180
+ }).catch(reject);
4181
+ } else {
4182
+ resolve(new miniprogram.Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
4183
+ }
4146
4184
  }).catch(reject);
4147
4185
  });
4148
4186
  };
@@ -4367,7 +4405,7 @@ var SceneLoader = /*#__PURE__*/ function(Loader) {
4367
4405
  backgroundPromise = resourceManager.getResourceByRef(background.sky).then(function(light) {
4368
4406
  var sky = scene.background.sky;
4369
4407
  var skyMaterial = new miniprogram.SkyBoxMaterial(engine);
4370
- skyMaterial.textureCubeMap = light.specularTexture;
4408
+ skyMaterial.texture = light.specularTexture;
4371
4409
  skyMaterial.textureDecodeRGBM = true;
4372
4410
  sky.material = skyMaterial;
4373
4411
  sky.mesh = miniprogram.PrimitiveMesh.createCuboid(engine, 1, 1, 1);
@@ -4408,7 +4446,7 @@ SceneLoader = __decorate([
4408
4446
  "prefab"
4409
4447
  ], true)
4410
4448
  ], SceneLoader);
4411
- ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _asyncToGenerator(function(instance, item, engine) {
4449
+ ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item, engine) {
4412
4450
  var props;
4413
4451
  return __generator(this, function(_state) {
4414
4452
  props = item.props;
@@ -4452,18 +4490,18 @@ var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ fu
4452
4490
  for(var attributeName1 in glTFPrimitive.attributes){
4453
4491
  if (gltfAttributeMap[attributeName1] !== undefined) {
4454
4492
  var accessorDef = accessors[glTFPrimitive.attributes[attributeName1]];
4455
- attributeTypeMap[attributeName1] = GLTFUtil.getComponentType(accessorDef.componentType).name;
4493
+ attributeTypeMap[attributeName1] = GLTFUtils.getComponentType(accessorDef.componentType).name;
4456
4494
  }
4457
4495
  }
4458
4496
  var indexAccessor = accessors[glTFPrimitive.indices];
4459
- var indexType = GLTFUtil.getComponentType(indexAccessor.componentType).name;
4497
+ var indexType = GLTFUtils.getComponentType(indexAccessor.componentType).name;
4460
4498
  var taskConfig = {
4461
4499
  attributeIDs: attributeMap,
4462
4500
  attributeTypes: attributeTypeMap,
4463
4501
  useUniqueIDs: true,
4464
4502
  indexType: indexType
4465
4503
  };
4466
- var buffer = GLTFUtil.getBufferViewData(bufferViews[bufferViewIndex], buffers);
4504
+ var buffer = GLTFUtils.getBufferViewData(bufferViews[bufferViewIndex], buffers);
4467
4505
  return KHR_draco_mesh_compression._decoder.decode(buffer, taskConfig).then(function(decodedGeometry) {
4468
4506
  var mesh = new miniprogram.ModelMesh(engine, glTFMesh.name);
4469
4507
  return _this._parseMeshFromGLTFPrimitiveDraco(mesh, glTFMesh, glTFPrimitive, glTF, function(attributeSemantic) {
@@ -4486,7 +4524,7 @@ var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ fu
4486
4524
  var accessors = gltf.accessors;
4487
4525
  var accessor = accessors[attributes["POSITION"]];
4488
4526
  var positionBuffer = getVertexBufferData("POSITION");
4489
- var positions = GLTFUtil.floatBufferToVector3Array(positionBuffer);
4527
+ var positions = GLTFUtils.floatBufferToVector3Array(positionBuffer);
4490
4528
  mesh.setPositions(positions);
4491
4529
  var bounds = mesh.bounds;
4492
4530
  vertexCount = accessor.count;
@@ -4513,55 +4551,55 @@ var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ fu
4513
4551
  var bufferData = getVertexBufferData(attributeSemantic);
4514
4552
  switch(attributeSemantic){
4515
4553
  case "NORMAL":
4516
- var normals = GLTFUtil.floatBufferToVector3Array(bufferData);
4554
+ var normals = GLTFUtils.floatBufferToVector3Array(bufferData);
4517
4555
  mesh.setNormals(normals);
4518
4556
  break;
4519
4557
  case "TEXCOORD_0":
4520
- var texturecoords = GLTFUtil.floatBufferToVector2Array(bufferData);
4558
+ var texturecoords = GLTFUtils.floatBufferToVector2Array(bufferData);
4521
4559
  mesh.setUVs(texturecoords, 0);
4522
4560
  break;
4523
4561
  case "TEXCOORD_1":
4524
- var texturecoords1 = GLTFUtil.floatBufferToVector2Array(bufferData);
4562
+ var texturecoords1 = GLTFUtils.floatBufferToVector2Array(bufferData);
4525
4563
  mesh.setUVs(texturecoords1, 1);
4526
4564
  break;
4527
4565
  case "TEXCOORD_2":
4528
- var texturecoords2 = GLTFUtil.floatBufferToVector2Array(bufferData);
4566
+ var texturecoords2 = GLTFUtils.floatBufferToVector2Array(bufferData);
4529
4567
  mesh.setUVs(texturecoords2, 2);
4530
4568
  break;
4531
4569
  case "TEXCOORD_3":
4532
- var texturecoords3 = GLTFUtil.floatBufferToVector2Array(bufferData);
4570
+ var texturecoords3 = GLTFUtils.floatBufferToVector2Array(bufferData);
4533
4571
  mesh.setUVs(texturecoords3, 3);
4534
4572
  break;
4535
4573
  case "TEXCOORD_4":
4536
- var texturecoords4 = GLTFUtil.floatBufferToVector2Array(bufferData);
4574
+ var texturecoords4 = GLTFUtils.floatBufferToVector2Array(bufferData);
4537
4575
  mesh.setUVs(texturecoords4, 4);
4538
4576
  break;
4539
4577
  case "TEXCOORD_5":
4540
- var texturecoords5 = GLTFUtil.floatBufferToVector2Array(bufferData);
4578
+ var texturecoords5 = GLTFUtils.floatBufferToVector2Array(bufferData);
4541
4579
  mesh.setUVs(texturecoords5, 5);
4542
4580
  break;
4543
4581
  case "TEXCOORD_6":
4544
- var texturecoords6 = GLTFUtil.floatBufferToVector2Array(bufferData);
4582
+ var texturecoords6 = GLTFUtils.floatBufferToVector2Array(bufferData);
4545
4583
  mesh.setUVs(texturecoords6, 6);
4546
4584
  break;
4547
4585
  case "TEXCOORD_7":
4548
- var texturecoords7 = GLTFUtil.floatBufferToVector2Array(bufferData);
4586
+ var texturecoords7 = GLTFUtils.floatBufferToVector2Array(bufferData);
4549
4587
  mesh.setUVs(texturecoords7, 7);
4550
4588
  break;
4551
4589
  case "COLOR_0":
4552
- var colors = GLTFUtil.floatBufferToColorArray(bufferData, accessors[attributes["COLOR_0"]].type === AccessorType.VEC3);
4590
+ var colors = GLTFUtils.floatBufferToColorArray(bufferData, accessors[attributes["COLOR_0"]].type === AccessorType.VEC3);
4553
4591
  mesh.setColors(colors);
4554
4592
  break;
4555
4593
  case "TANGENT":
4556
- var tangents = GLTFUtil.floatBufferToVector4Array(bufferData);
4594
+ var tangents = GLTFUtils.floatBufferToVector4Array(bufferData);
4557
4595
  mesh.setTangents(tangents);
4558
4596
  break;
4559
4597
  case "JOINTS_0":
4560
- var joints = GLTFUtil.floatBufferToVector4Array(bufferData);
4598
+ var joints = GLTFUtils.floatBufferToVector4Array(bufferData);
4561
4599
  mesh.setBoneIndices(joints);
4562
4600
  break;
4563
4601
  case "WEIGHTS_0":
4564
- var weights = GLTFUtil.floatBufferToVector4Array(bufferData);
4602
+ var weights = GLTFUtils.floatBufferToVector4Array(bufferData);
4565
4603
  mesh.setBoneWeights(weights);
4566
4604
  break;
4567
4605
  }
@@ -4581,7 +4619,9 @@ var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ fu
4581
4619
  return Promise.resolve(mesh);
4582
4620
  };
4583
4621
  return KHR_draco_mesh_compression1;
4584
- }(GLTFExtensionParser), _KHR_draco_mesh_compression._tempVector3 = new miniprogram$1.Vector3(), _KHR_draco_mesh_compression);
4622
+ }(GLTFExtensionParser), function() {
4623
+ _KHR_draco_mesh_compression._tempVector3 = new miniprogram$1.Vector3();
4624
+ }(), _KHR_draco_mesh_compression);
4585
4625
  KHR_draco_mesh_compression = __decorate([
4586
4626
  registerGLTFExtension("KHR_draco_mesh_compression", exports.GLTFExtensionMode.CreateAndParse)
4587
4627
  ], KHR_draco_mesh_compression);
@@ -4762,12 +4802,12 @@ KHR_texture_transform = __decorate([
4762
4802
  registerGLTFExtension("KHR_texture_transform", exports.GLTFExtensionMode.AdditiveParse)
4763
4803
  ], KHR_texture_transform);
4764
4804
 
4765
- var GalaceanMaterialsRemap = /*#__PURE__*/ function(GLTFExtensionParser) {
4766
- _inherits(GalaceanMaterialsRemap, GLTFExtensionParser);
4767
- function GalaceanMaterialsRemap() {
4805
+ var GALACEAN_materials_remap = /*#__PURE__*/ function(GLTFExtensionParser) {
4806
+ _inherits(GALACEAN_materials_remap, GLTFExtensionParser);
4807
+ function GALACEAN_materials_remap() {
4768
4808
  return GLTFExtensionParser.apply(this, arguments);
4769
4809
  }
4770
- var _proto = GalaceanMaterialsRemap.prototype;
4810
+ var _proto = GALACEAN_materials_remap.prototype;
4771
4811
  /**
4772
4812
  * @override
4773
4813
  */ _proto.createAndParse = function createAndParse(context, schema) {
@@ -4775,18 +4815,18 @@ var GalaceanMaterialsRemap = /*#__PURE__*/ function(GLTFExtensionParser) {
4775
4815
  // @ts-ignore
4776
4816
  return engine.resourceManager.getResourceByRef(schema);
4777
4817
  };
4778
- return GalaceanMaterialsRemap;
4818
+ return GALACEAN_materials_remap;
4779
4819
  }(GLTFExtensionParser);
4780
- GalaceanMaterialsRemap = __decorate([
4781
- registerGLTFExtension("OASIS_materials_remap", exports.GLTFExtensionMode.CreateAndParse)
4782
- ], GalaceanMaterialsRemap);
4820
+ GALACEAN_materials_remap = __decorate([
4821
+ registerGLTFExtension("GALACEAN_materials_remap", exports.GLTFExtensionMode.CreateAndParse)
4822
+ ], GALACEAN_materials_remap);
4783
4823
 
4784
- var OASIS_animation_event = /*#__PURE__*/ function(GLTFExtensionParser) {
4785
- _inherits(OASIS_animation_event, GLTFExtensionParser);
4786
- function OASIS_animation_event() {
4824
+ var GALACEAN_animation_event = /*#__PURE__*/ function(GLTFExtensionParser) {
4825
+ _inherits(GALACEAN_animation_event, GLTFExtensionParser);
4826
+ function GALACEAN_animation_event() {
4787
4827
  return GLTFExtensionParser.apply(this, arguments);
4788
4828
  }
4789
- var _proto = OASIS_animation_event.prototype;
4829
+ var _proto = GALACEAN_animation_event.prototype;
4790
4830
  /**
4791
4831
  * @override
4792
4832
  */ _proto.additiveParse = function additiveParse(context, animationClip, schema) {
@@ -4800,11 +4840,11 @@ var OASIS_animation_event = /*#__PURE__*/ function(GLTFExtensionParser) {
4800
4840
  animationClip.addEvent(event);
4801
4841
  });
4802
4842
  };
4803
- return OASIS_animation_event;
4843
+ return GALACEAN_animation_event;
4804
4844
  }(GLTFExtensionParser);
4805
- OASIS_animation_event = __decorate([
4806
- registerGLTFExtension("OASIS_animation_event", exports.GLTFExtensionMode.AdditiveParse)
4807
- ], OASIS_animation_event);
4845
+ GALACEAN_animation_event = __decorate([
4846
+ registerGLTFExtension("GALACEAN_animation_event", exports.GLTFExtensionMode.AdditiveParse)
4847
+ ], GALACEAN_animation_event);
4808
4848
 
4809
4849
  exports.ComponentMap = ComponentMap;
4810
4850
  exports.GLTFAnimationParser = GLTFAnimationParser;
@@ -4820,7 +4860,7 @@ exports.GLTFResource = GLTFResource;
4820
4860
  exports.GLTFSceneParser = GLTFSceneParser;
4821
4861
  exports.GLTFSkinParser = GLTFSkinParser;
4822
4862
  exports.GLTFTextureParser = GLTFTextureParser;
4823
- exports.GLTFUtil = GLTFUtil;
4863
+ exports.GLTFUtils = GLTFUtils;
4824
4864
  exports.GLTFValidator = GLTFValidator;
4825
4865
  exports.PrefabParser = PrefabParser;
4826
4866
  exports.ReflectionParser = ReflectionParser;