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