@galacean/engine-loader 1.1.0-beta.9 → 1.2.0-alpha.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 +863 -487
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +862 -487
- package/dist/module.js +852 -477
- package/dist/module.js.map +1 -1
- package/package.json +4 -5
- package/types/GLTFLoader.d.ts +8 -1
- package/types/Texture2DLoader.d.ts +9 -1
- package/types/gltf/GLTFResource.d.ts +50 -16
- package/types/gltf/GLTFSchema.d.ts +1 -1
- package/types/gltf/GLTFUtils.d.ts +1 -1
- package/types/gltf/extensions/EXT_meshopt_compression.d.ts +13 -0
- package/types/gltf/extensions/GLTFExtensionParser.d.ts +1 -1
- package/types/gltf/extensions/GLTFExtensionSchema.d.ts +18 -10
- package/types/gltf/extensions/KHR_materials_anisotropy.d.ts +1 -0
- package/types/gltf/extensions/MeshoptDecoder.d.ts +8 -0
- package/types/gltf/extensions/index.d.ts +2 -1
- package/types/gltf/index.d.ts +2 -1
- package/types/gltf/parser/GLTFBufferViewParser.d.ts +5 -0
- package/types/gltf/parser/GLTFParser.d.ts +1 -1
- package/types/gltf/parser/GLTFParserContext.d.ts +24 -8
- package/types/gltf/parser/GLTFSceneParser.d.ts +0 -1
- package/types/gltf/parser/index.d.ts +2 -1
- package/types/index.d.ts +2 -1
- package/types/ktx2/KTX2Loader.d.ts +20 -8
- package/types/resource-deserialize/resources/parser/ReflectionParser.d.ts +1 -1
- package/types/resource-deserialize/resources/schema/BasicSchema.d.ts +2 -0
- package/types/resource-deserialize/resources/schema/MaterialSchema.d.ts +1 -1
- package/types/resource-deserialize/resources/schema/SceneSchema.d.ts +3 -1
- package/types/resource-deserialize/utils/BufferReader.d.ts +1 -1
package/dist/miniprogram.js
CHANGED
|
@@ -6,7 +6,6 @@ var miniprogram = require('@galacean/engine-core/dist/miniprogram');
|
|
|
6
6
|
var miniprogram$1 = require('@galacean/engine-math/dist/miniprogram');
|
|
7
7
|
var engineMiniprogramAdapter = require('@galacean/engine-miniprogram-adapter');
|
|
8
8
|
var miniprogram$2 = require('@galacean/engine-rhi-webgl/dist/miniprogram');
|
|
9
|
-
var miniprogram$3 = require('@galacean/engine-draco/dist/miniprogram');
|
|
10
9
|
|
|
11
10
|
function _extends() {
|
|
12
11
|
_extends = Object.assign || function assign(target) {
|
|
@@ -121,116 +120,116 @@ var BufferReader = /*#__PURE__*/ function() {
|
|
|
121
120
|
this.data = data;
|
|
122
121
|
this._dataView = new DataView(data.buffer, data.byteOffset + byteOffset, byteLength != null ? byteLength : data.byteLength - byteOffset);
|
|
123
122
|
this._littleEndian = littleEndian;
|
|
124
|
-
this.
|
|
123
|
+
this._position = 0;
|
|
125
124
|
this._baseOffset = byteOffset;
|
|
126
125
|
}
|
|
127
126
|
var _proto = BufferReader.prototype;
|
|
128
127
|
_proto.nextUint8 = function nextUint8() {
|
|
129
|
-
var value = this._dataView.getUint8(this.
|
|
130
|
-
this.
|
|
128
|
+
var value = this._dataView.getUint8(this._position);
|
|
129
|
+
this._position += 1;
|
|
131
130
|
return value;
|
|
132
131
|
};
|
|
133
132
|
_proto.nextUint16 = function nextUint16() {
|
|
134
|
-
var value = this._dataView.getUint16(this.
|
|
135
|
-
this.
|
|
133
|
+
var value = this._dataView.getUint16(this._position, this._littleEndian);
|
|
134
|
+
this._position += 2;
|
|
136
135
|
return value;
|
|
137
136
|
};
|
|
138
137
|
_proto.nextUint32 = function nextUint32() {
|
|
139
|
-
var value = this._dataView.getUint32(this.
|
|
140
|
-
this.
|
|
138
|
+
var value = this._dataView.getUint32(this._position, this._littleEndian);
|
|
139
|
+
this._position += 4;
|
|
141
140
|
return value;
|
|
142
141
|
};
|
|
143
142
|
_proto.nextInt32 = function nextInt32() {
|
|
144
|
-
var value = this._dataView.getInt32(this.
|
|
145
|
-
this.
|
|
143
|
+
var value = this._dataView.getInt32(this._position, this._littleEndian);
|
|
144
|
+
this._position += 4;
|
|
146
145
|
return value;
|
|
147
146
|
};
|
|
148
147
|
_proto.nextInt32Array = function nextInt32Array(len) {
|
|
149
|
-
var value = new Int32Array(this.data.buffer, this.
|
|
150
|
-
this.
|
|
148
|
+
var value = new Int32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
149
|
+
this._position += 4 * len;
|
|
151
150
|
return value;
|
|
152
151
|
};
|
|
153
152
|
_proto.nextFloat32 = function nextFloat32() {
|
|
154
|
-
var value = this._dataView.getFloat32(this.
|
|
155
|
-
this.
|
|
153
|
+
var value = this._dataView.getFloat32(this._position, this._littleEndian);
|
|
154
|
+
this._position += 4;
|
|
156
155
|
return value;
|
|
157
156
|
};
|
|
158
157
|
_proto.nextFloat32Array = function nextFloat32Array(len) {
|
|
159
|
-
var value = new Float32Array(this.data.buffer, this.
|
|
160
|
-
this.
|
|
158
|
+
var value = new Float32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
159
|
+
this._position += 4 * len;
|
|
161
160
|
return value;
|
|
162
161
|
};
|
|
163
162
|
_proto.nextUint32Array = function nextUint32Array(len) {
|
|
164
|
-
var value = new Uint32Array(this.data.buffer, this.
|
|
165
|
-
this.
|
|
163
|
+
var value = new Uint32Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
164
|
+
this._position += 4 * len;
|
|
166
165
|
return value;
|
|
167
166
|
};
|
|
168
167
|
_proto.nextUint8Array = function nextUint8Array(len) {
|
|
169
|
-
var value = new Uint8Array(this.data.buffer, this.
|
|
170
|
-
this.
|
|
168
|
+
var value = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, len);
|
|
169
|
+
this._position += len;
|
|
171
170
|
return value;
|
|
172
171
|
};
|
|
173
172
|
_proto.nextUint64 = function nextUint64() {
|
|
174
|
-
var left = this._dataView.getUint32(this.
|
|
175
|
-
var right = this._dataView.getUint32(this.
|
|
173
|
+
var left = this._dataView.getUint32(this._position, this._littleEndian);
|
|
174
|
+
var right = this._dataView.getUint32(this._position + 4, this._littleEndian);
|
|
176
175
|
var value = left + Math.pow(2, 32) * right;
|
|
177
|
-
this.
|
|
176
|
+
this._position += 8;
|
|
178
177
|
return value;
|
|
179
178
|
};
|
|
180
179
|
_proto.nextStr = function nextStr() {
|
|
181
180
|
var strByteLength = this.nextUint16();
|
|
182
|
-
var uint8Array = new Uint8Array(this.data.buffer, this.
|
|
183
|
-
this.
|
|
181
|
+
var uint8Array = new Uint8Array(this.data.buffer, this._position + this._dataView.byteOffset, strByteLength);
|
|
182
|
+
this._position += strByteLength;
|
|
184
183
|
return miniprogram.Utils.decodeText(uint8Array);
|
|
185
184
|
};
|
|
186
185
|
/**
|
|
187
186
|
* image data 放在最后
|
|
188
187
|
*/ _proto.nextImageData = function nextImageData(count) {
|
|
189
|
-
return new Uint8Array(this.data.buffer, this.data.byteOffset + this.
|
|
188
|
+
return new Uint8Array(this.data.buffer, this.data.byteOffset + this._position);
|
|
190
189
|
};
|
|
191
190
|
_proto.nextImagesData = function nextImagesData(count) {
|
|
192
191
|
var imagesLen = new Array(count);
|
|
193
192
|
// Start offset of Uint32Array should be a multiple of 4. ref: https://stackoverflow.com/questions/15417310/why-typed-array-constructors-require-offset-to-be-multiple-of-underlying-type-si
|
|
194
193
|
for(var i = 0; i < count; i++){
|
|
195
|
-
var len = this._dataView.getUint32(this.
|
|
194
|
+
var len = this._dataView.getUint32(this._position, this._littleEndian);
|
|
196
195
|
imagesLen[i] = len;
|
|
197
|
-
this.
|
|
196
|
+
this._position += 4;
|
|
198
197
|
}
|
|
199
198
|
var imagesData = [];
|
|
200
199
|
for(var i1 = 0; i1 < count; i1++){
|
|
201
200
|
var len1 = imagesLen[i1];
|
|
202
|
-
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this.
|
|
203
|
-
this.
|
|
201
|
+
var buffer = new Uint8Array(this.data.buffer, this._dataView.byteOffset + this._position, len1);
|
|
202
|
+
this._position += len1;
|
|
204
203
|
imagesData.push(buffer);
|
|
205
204
|
}
|
|
206
205
|
return imagesData;
|
|
207
206
|
};
|
|
208
207
|
_proto.skip = function skip(bytes) {
|
|
209
|
-
this.
|
|
208
|
+
this._position += bytes;
|
|
210
209
|
return this;
|
|
211
210
|
};
|
|
212
211
|
_proto.scan = function scan(maxByteLength, term) {
|
|
213
212
|
if (term === void 0) term = 0x00;
|
|
214
|
-
var byteOffset = this.
|
|
213
|
+
var byteOffset = this._position;
|
|
215
214
|
var byteLength = 0;
|
|
216
|
-
while(this._dataView.getUint8(this.
|
|
215
|
+
while(this._dataView.getUint8(this._position) !== term && byteLength < maxByteLength){
|
|
217
216
|
byteLength++;
|
|
218
|
-
this.
|
|
217
|
+
this._position++;
|
|
219
218
|
}
|
|
220
|
-
if (byteLength < maxByteLength) this.
|
|
219
|
+
if (byteLength < maxByteLength) this._position++;
|
|
221
220
|
return new Uint8Array(this._dataView.buffer, this._dataView.byteOffset + byteOffset, byteLength);
|
|
222
221
|
};
|
|
223
222
|
_create_class(BufferReader, [
|
|
224
223
|
{
|
|
225
224
|
key: "position",
|
|
226
225
|
get: function get() {
|
|
227
|
-
return this.
|
|
226
|
+
return this._position;
|
|
228
227
|
}
|
|
229
228
|
},
|
|
230
229
|
{
|
|
231
230
|
key: "offset",
|
|
232
231
|
get: function get() {
|
|
233
|
-
return this.
|
|
232
|
+
return this._position + this._baseOffset;
|
|
234
233
|
}
|
|
235
234
|
}
|
|
236
235
|
]);
|
|
@@ -294,75 +293,74 @@ exports.MeshDecoder = /*#__PURE__*/ function() {
|
|
|
294
293
|
var encodedMeshData = JSON.parse(jsonDataString);
|
|
295
294
|
// @ts-ignore Vector3 is not compatible with {x: number, y: number, z: number}.
|
|
296
295
|
encodedMeshData.bounds && modelMesh.bounds.copyFrom(encodedMeshData.bounds);
|
|
297
|
-
var offset = Math.ceil(bufferReader.offset / 4) * 4;
|
|
296
|
+
var offset = Math.ceil(bufferReader.offset / 4) * 4 + bufferReader.data.byteOffset;
|
|
298
297
|
var buffer = bufferReader.data.buffer;
|
|
299
|
-
var
|
|
300
|
-
var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset + byteOffset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
|
|
298
|
+
var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
|
|
301
299
|
var vertexCount = float32Array.length / 3;
|
|
302
300
|
var positions = float32ArrayToVector3(float32Array, vertexCount);
|
|
303
301
|
modelMesh.setPositions(positions);
|
|
304
302
|
if (encodedMeshData.normals) {
|
|
305
|
-
var float32Array1 = new Float32Array(buffer, encodedMeshData.normals.start + offset
|
|
303
|
+
var float32Array1 = new Float32Array(buffer, encodedMeshData.normals.start + offset, (encodedMeshData.normals.end - encodedMeshData.normals.start) / 4);
|
|
306
304
|
var normals = float32ArrayToVector3(float32Array1, vertexCount);
|
|
307
305
|
modelMesh.setNormals(normals);
|
|
308
306
|
}
|
|
309
307
|
if (encodedMeshData.uvs) {
|
|
310
|
-
var float32Array2 = new Float32Array(buffer, encodedMeshData.uvs.start + offset
|
|
308
|
+
var float32Array2 = new Float32Array(buffer, encodedMeshData.uvs.start + offset, (encodedMeshData.uvs.end - encodedMeshData.uvs.start) / 4);
|
|
311
309
|
modelMesh.setUVs(float32ArrayToVector2(float32Array2, vertexCount));
|
|
312
310
|
}
|
|
313
311
|
if (encodedMeshData.uv1) {
|
|
314
|
-
var float32Array3 = new Float32Array(buffer, encodedMeshData.uv1.start + offset
|
|
312
|
+
var float32Array3 = new Float32Array(buffer, encodedMeshData.uv1.start + offset, (encodedMeshData.uv1.end - encodedMeshData.uv1.start) / 4);
|
|
315
313
|
modelMesh.setUVs(float32ArrayToVector2(float32Array3, vertexCount), 1);
|
|
316
314
|
}
|
|
317
315
|
if (encodedMeshData.uv2) {
|
|
318
|
-
var float32Array4 = new Float32Array(buffer, encodedMeshData.uv2.start + offset
|
|
316
|
+
var float32Array4 = new Float32Array(buffer, encodedMeshData.uv2.start + offset, (encodedMeshData.uv2.end - encodedMeshData.uv2.start) / 4);
|
|
319
317
|
modelMesh.setUVs(float32ArrayToVector2(float32Array4, vertexCount), 2);
|
|
320
318
|
}
|
|
321
319
|
if (encodedMeshData.uv3) {
|
|
322
|
-
var float32Array5 = new Float32Array(buffer, encodedMeshData.uv3.start + offset
|
|
320
|
+
var float32Array5 = new Float32Array(buffer, encodedMeshData.uv3.start + offset, (encodedMeshData.uv3.end - encodedMeshData.uv3.start) / 4);
|
|
323
321
|
modelMesh.setUVs(float32ArrayToVector2(float32Array5, vertexCount), 3);
|
|
324
322
|
}
|
|
325
323
|
if (encodedMeshData.uv4) {
|
|
326
|
-
var float32Array6 = new Float32Array(buffer, encodedMeshData.uv4.start + offset
|
|
324
|
+
var float32Array6 = new Float32Array(buffer, encodedMeshData.uv4.start + offset, (encodedMeshData.uv4.end - encodedMeshData.uv4.start) / 4);
|
|
327
325
|
modelMesh.setUVs(float32ArrayToVector2(float32Array6, vertexCount), 4);
|
|
328
326
|
}
|
|
329
327
|
if (encodedMeshData.uv5) {
|
|
330
|
-
var float32Array7 = new Float32Array(buffer, encodedMeshData.uv5.start + offset
|
|
328
|
+
var float32Array7 = new Float32Array(buffer, encodedMeshData.uv5.start + offset, (encodedMeshData.uv5.end - encodedMeshData.uv5.start) / 4);
|
|
331
329
|
modelMesh.setUVs(float32ArrayToVector2(float32Array7, vertexCount), 5);
|
|
332
330
|
}
|
|
333
331
|
if (encodedMeshData.uv6) {
|
|
334
|
-
var float32Array8 = new Float32Array(buffer, encodedMeshData.uv6.start + offset
|
|
332
|
+
var float32Array8 = new Float32Array(buffer, encodedMeshData.uv6.start + offset, (encodedMeshData.uv6.end - encodedMeshData.uv6.start) / 4);
|
|
335
333
|
modelMesh.setUVs(float32ArrayToVector2(float32Array8, vertexCount), 6);
|
|
336
334
|
}
|
|
337
335
|
if (encodedMeshData.uv7) {
|
|
338
|
-
var float32Array9 = new Float32Array(buffer, encodedMeshData.uv7.start + offset
|
|
336
|
+
var float32Array9 = new Float32Array(buffer, encodedMeshData.uv7.start + offset, (encodedMeshData.uv7.end - encodedMeshData.uv7.start) / 4);
|
|
339
337
|
modelMesh.setUVs(float32ArrayToVector2(float32Array9, vertexCount), 7);
|
|
340
338
|
}
|
|
341
339
|
if (encodedMeshData.colors) {
|
|
342
|
-
var float32Array10 = new Float32Array(buffer, encodedMeshData.colors.start + offset
|
|
340
|
+
var float32Array10 = new Float32Array(buffer, encodedMeshData.colors.start + offset, (encodedMeshData.colors.end - encodedMeshData.colors.start) / 4);
|
|
343
341
|
modelMesh.setColors(float32ArrayToVColor(float32Array10, vertexCount));
|
|
344
342
|
}
|
|
345
343
|
if (encodedMeshData.boneWeights) {
|
|
346
|
-
var float32Array11 = new Float32Array(buffer, encodedMeshData.boneWeights.start + offset
|
|
344
|
+
var float32Array11 = new Float32Array(buffer, encodedMeshData.boneWeights.start + offset, (encodedMeshData.boneWeights.end - encodedMeshData.boneWeights.start) / 4);
|
|
347
345
|
modelMesh.setBoneWeights(float32ArrayToVector4(float32Array11, vertexCount));
|
|
348
346
|
}
|
|
349
347
|
if (encodedMeshData.boneIndices) {
|
|
350
|
-
var float32Array12 = new Float32Array(buffer, encodedMeshData.boneIndices.start + offset
|
|
348
|
+
var float32Array12 = new Float32Array(buffer, encodedMeshData.boneIndices.start + offset, (encodedMeshData.boneIndices.end - encodedMeshData.boneIndices.start) / 4);
|
|
351
349
|
modelMesh.setBoneIndices(float32ArrayToVector4(float32Array12, vertexCount));
|
|
352
350
|
}
|
|
353
351
|
if (encodedMeshData.blendShapes) {
|
|
354
352
|
encodedMeshData.blendShapes.forEach(function(blendShapeData) {
|
|
355
353
|
var blendShape = new miniprogram.BlendShape(blendShapeData.name);
|
|
356
354
|
blendShapeData.frames.forEach(function(frameData) {
|
|
357
|
-
var positionArray = new Float32Array(buffer, frameData.deltaPosition.start + offset
|
|
355
|
+
var positionArray = new Float32Array(buffer, frameData.deltaPosition.start + offset, (frameData.deltaPosition.end - frameData.deltaPosition.start) / 4);
|
|
358
356
|
var count = positionArray.length / 3;
|
|
359
357
|
var deltaPosition = float32ArrayToVector3(positionArray, count);
|
|
360
358
|
if (frameData.deltaNormals) {
|
|
361
|
-
var normalsArray = new Float32Array(buffer, frameData.deltaNormals.start + offset
|
|
359
|
+
var normalsArray = new Float32Array(buffer, frameData.deltaNormals.start + offset, (frameData.deltaNormals.end - frameData.deltaNormals.start) / 4);
|
|
362
360
|
float32ArrayToVector3(normalsArray, count);
|
|
363
361
|
}
|
|
364
362
|
if (frameData.deltaTangents) {
|
|
365
|
-
var tangentsArray = new Float32Array(buffer, frameData.deltaTangents.start + offset
|
|
363
|
+
var tangentsArray = new Float32Array(buffer, frameData.deltaTangents.start + offset, (frameData.deltaTangents.end - frameData.deltaTangents.start) / 4);
|
|
366
364
|
float32ArrayToVector4(tangentsArray, count);
|
|
367
365
|
}
|
|
368
366
|
blendShape.addFrame(frameData.weight, deltaPosition);
|
|
@@ -373,9 +371,9 @@ exports.MeshDecoder = /*#__PURE__*/ function() {
|
|
|
373
371
|
if (encodedMeshData.indices) {
|
|
374
372
|
var indices = null;
|
|
375
373
|
if (encodedMeshData.indices.type === 0) {
|
|
376
|
-
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset
|
|
374
|
+
indices = new Uint16Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 2);
|
|
377
375
|
} else {
|
|
378
|
-
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset
|
|
376
|
+
indices = new Uint32Array(buffer, encodedMeshData.indices.start + offset, (encodedMeshData.indices.end - encodedMeshData.indices.start) / 4);
|
|
379
377
|
}
|
|
380
378
|
modelMesh.setIndices(indices);
|
|
381
379
|
}
|
|
@@ -540,15 +538,23 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
540
538
|
if (position) entity.transform.position.copyFrom(position);
|
|
541
539
|
if (rotation) entity.transform.rotation.copyFrom(rotation);
|
|
542
540
|
if (scale) entity.transform.scale.copyFrom(scale);
|
|
541
|
+
var _entityConfig_layer;
|
|
542
|
+
entity.layer = (_entityConfig_layer = entityConfig.layer) != null ? _entityConfig_layer : entity.layer;
|
|
543
543
|
return entity;
|
|
544
544
|
});
|
|
545
545
|
};
|
|
546
546
|
_proto.parseClassObject = function parseClassObject(item) {
|
|
547
|
+
var _this = this;
|
|
547
548
|
var Class = miniprogram.Loader.getClass(item.class);
|
|
548
549
|
var _item_constructParams;
|
|
549
550
|
var params = (_item_constructParams = item.constructParams) != null ? _item_constructParams : [];
|
|
550
|
-
|
|
551
|
-
|
|
551
|
+
return Promise.all(params.map(function(param) {
|
|
552
|
+
return _this.parseBasicType(param);
|
|
553
|
+
})).then(function(resultParams) {
|
|
554
|
+
return _construct(Class, [].concat(resultParams));
|
|
555
|
+
}).then(function(instance) {
|
|
556
|
+
return _this.parsePropsAndMethods(instance, item);
|
|
557
|
+
});
|
|
552
558
|
};
|
|
553
559
|
_proto.parsePropsAndMethods = function parsePropsAndMethods(instance, item) {
|
|
554
560
|
var promises = [];
|
|
@@ -556,16 +562,14 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
556
562
|
for(var methodName in item.methods){
|
|
557
563
|
var methodParams = item.methods[methodName];
|
|
558
564
|
for(var i = 0, count = methodParams.length; i < count; i++){
|
|
559
|
-
|
|
560
|
-
var promise = this.parseMethod(instance, methodName, params);
|
|
561
|
-
promises.push(promise);
|
|
565
|
+
promises.push(this.parseMethod(instance, methodName, methodParams[i]));
|
|
562
566
|
}
|
|
563
567
|
}
|
|
564
568
|
}
|
|
565
569
|
if (item.props) {
|
|
566
570
|
var _this = this, _loop = function(key) {
|
|
567
571
|
var value = item.props[key];
|
|
568
|
-
var promise = _this.parseBasicType(value).then(function(v) {
|
|
572
|
+
var promise = _this.parseBasicType(value, instance[key]).then(function(v) {
|
|
569
573
|
return instance[key] = v;
|
|
570
574
|
});
|
|
571
575
|
promises.push(promise);
|
|
@@ -587,7 +591,7 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
587
591
|
return (_instance = instance)[methodName].apply(_instance, [].concat(result));
|
|
588
592
|
});
|
|
589
593
|
};
|
|
590
|
-
_proto.parseBasicType = function parseBasicType(value) {
|
|
594
|
+
_proto.parseBasicType = function parseBasicType(value, originValue) {
|
|
591
595
|
var _this = this;
|
|
592
596
|
if (Array.isArray(value)) {
|
|
593
597
|
return Promise.all(value.map(function(item) {
|
|
@@ -604,13 +608,33 @@ var ReflectionParser = /*#__PURE__*/ function() {
|
|
|
604
608
|
} else if (ReflectionParser._isEntityRef(value)) {
|
|
605
609
|
// entity reference
|
|
606
610
|
return Promise.resolve(this._context.entityMap.get(value.entityId));
|
|
607
|
-
} else {
|
|
608
|
-
|
|
609
|
-
|
|
611
|
+
} else if (originValue) {
|
|
612
|
+
var _this1 = this, _loop = function(key) {
|
|
613
|
+
if (key === "methods") {
|
|
614
|
+
var methods = value[key];
|
|
615
|
+
for(var methodName in methods){
|
|
616
|
+
var methodParams = methods[methodName];
|
|
617
|
+
for(var i = 0, count = methodParams.length; i < count; i++){
|
|
618
|
+
var params = methodParams[i];
|
|
619
|
+
var promise = _this1.parseMethod(originValue, methodName, params);
|
|
620
|
+
promises.push(promise);
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
} else {
|
|
624
|
+
promises.push(_this1.parseBasicType(value[key], originValue[key]).then(function(v) {
|
|
625
|
+
return originValue[key] = v;
|
|
626
|
+
}));
|
|
627
|
+
}
|
|
628
|
+
};
|
|
629
|
+
var promises = [];
|
|
630
|
+
for(var key in value)_loop(key);
|
|
631
|
+
return Promise.all(promises).then(function() {
|
|
632
|
+
return originValue;
|
|
633
|
+
});
|
|
610
634
|
}
|
|
611
|
-
} else {
|
|
612
|
-
return Promise.resolve(value);
|
|
613
635
|
}
|
|
636
|
+
// primitive type
|
|
637
|
+
return Promise.resolve(value);
|
|
614
638
|
};
|
|
615
639
|
_proto._getEntityByConfig = function _getEntityByConfig(entityConfig) {
|
|
616
640
|
// @ts-ignore
|
|
@@ -715,6 +739,7 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
715
739
|
var componentStr = bufferReader.nextStr();
|
|
716
740
|
var componentType = ComponentMap[componentStr];
|
|
717
741
|
var property = bufferReader.nextStr();
|
|
742
|
+
var getProperty = bufferReader.nextStr();
|
|
718
743
|
var curve = void 0;
|
|
719
744
|
var interpolation = bufferReader.nextUint8();
|
|
720
745
|
var keysLen = bufferReader.nextUint16();
|
|
@@ -839,13 +864,42 @@ exports.AnimationClipDecoder = /*#__PURE__*/ function() {
|
|
|
839
864
|
for(var j7 = 0; j7 < keysLen; ++j7){
|
|
840
865
|
var keyframe8 = new miniprogram.Keyframe();
|
|
841
866
|
keyframe8.time = bufferReader.nextFloat32();
|
|
842
|
-
|
|
867
|
+
var str = bufferReader.nextStr();
|
|
868
|
+
if (str) {
|
|
869
|
+
keyframe8.value = JSON.parse(str);
|
|
870
|
+
} else {
|
|
871
|
+
keyframe8.value = null;
|
|
872
|
+
}
|
|
843
873
|
curve.addKey(keyframe8);
|
|
844
874
|
}
|
|
845
875
|
break;
|
|
846
876
|
}
|
|
877
|
+
case "AnimationBoolCurve":
|
|
878
|
+
{
|
|
879
|
+
curve = new miniprogram.AnimationBoolCurve();
|
|
880
|
+
curve.interpolation = interpolation;
|
|
881
|
+
for(var j8 = 0; j8 < keysLen; ++j8){
|
|
882
|
+
var keyframe9 = new miniprogram.Keyframe();
|
|
883
|
+
keyframe9.time = bufferReader.nextFloat32();
|
|
884
|
+
keyframe9.value = bufferReader.nextUint8() === 1;
|
|
885
|
+
curve.addKey(keyframe9);
|
|
886
|
+
}
|
|
887
|
+
break;
|
|
888
|
+
}
|
|
889
|
+
case "AnimationStringCurve":
|
|
890
|
+
{
|
|
891
|
+
curve = new miniprogram.AnimationStringCurve();
|
|
892
|
+
curve.interpolation = interpolation;
|
|
893
|
+
for(var j9 = 0; j9 < keysLen; ++j9){
|
|
894
|
+
var keyframe10 = new miniprogram.Keyframe();
|
|
895
|
+
keyframe10.time = bufferReader.nextFloat32();
|
|
896
|
+
keyframe10.value = bufferReader.nextStr();
|
|
897
|
+
curve.addKey(keyframe10);
|
|
898
|
+
}
|
|
899
|
+
break;
|
|
900
|
+
}
|
|
847
901
|
}
|
|
848
|
-
clip.addCurveBinding(relativePath, componentType, property, curve);
|
|
902
|
+
clip.addCurveBinding(relativePath, componentType, property, getProperty, curve);
|
|
849
903
|
}
|
|
850
904
|
resolve(clip);
|
|
851
905
|
});
|
|
@@ -1099,26 +1153,34 @@ var AnimationClipLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
1099
1153
|
var curveBindingPromises = clip.curveBindings.map(function(curveBinding) {
|
|
1100
1154
|
var curve = curveBinding.curve;
|
|
1101
1155
|
var promises = curve.keys.map(function(key) {
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
resourceManager// @ts-ignore
|
|
1106
|
-
.getResourceByRef(value).then(function(asset) {
|
|
1107
|
-
key.value = asset;
|
|
1108
|
-
resolve(key);
|
|
1109
|
-
}).catch(reject);
|
|
1110
|
-
});
|
|
1111
|
-
}
|
|
1156
|
+
return _this._parseKeyframeValue(key, resourceManager).then(function(actualValue) {
|
|
1157
|
+
key.value = actualValue;
|
|
1158
|
+
});
|
|
1112
1159
|
});
|
|
1113
1160
|
return Promise.all(promises);
|
|
1114
1161
|
});
|
|
1115
1162
|
return Promise.all(curveBindingPromises).then(function() {
|
|
1116
1163
|
resolve(clip);
|
|
1117
1164
|
});
|
|
1118
|
-
});
|
|
1165
|
+
}).catch(reject);
|
|
1119
1166
|
}).catch(reject);
|
|
1120
1167
|
});
|
|
1121
1168
|
};
|
|
1169
|
+
_proto._parseKeyframeValue = function _parseKeyframeValue(keyframe, resourceManager) {
|
|
1170
|
+
var _value;
|
|
1171
|
+
var value = keyframe.value;
|
|
1172
|
+
if (typeof value === "object" && ((_value = value) == null ? void 0 : _value.refId)) {
|
|
1173
|
+
return new Promise(function(resolve) {
|
|
1174
|
+
resourceManager// @ts-ignore
|
|
1175
|
+
.getResourceByRef(value).then(function(asset) {
|
|
1176
|
+
keyframe.value = asset;
|
|
1177
|
+
resolve(keyframe);
|
|
1178
|
+
});
|
|
1179
|
+
});
|
|
1180
|
+
} else {
|
|
1181
|
+
return Promise.resolve(keyframe.value);
|
|
1182
|
+
}
|
|
1183
|
+
};
|
|
1122
1184
|
return AnimationClipLoader;
|
|
1123
1185
|
}(miniprogram.Loader);
|
|
1124
1186
|
AnimationClipLoader = __decorate([
|
|
@@ -1394,6 +1456,60 @@ FontLoader = __decorate([
|
|
|
1394
1456
|
_this.url = url;
|
|
1395
1457
|
return _this;
|
|
1396
1458
|
}
|
|
1459
|
+
var _proto = GLTFResource.prototype;
|
|
1460
|
+
/**
|
|
1461
|
+
* Instantiate scene root entity.
|
|
1462
|
+
* @param sceneIndex - Scene index
|
|
1463
|
+
* @returns Root entity
|
|
1464
|
+
*/ _proto.instantiateSceneRoot = function instantiateSceneRoot(sceneIndex) {
|
|
1465
|
+
var sceneRoot = sceneIndex === undefined ? this._defaultSceneRoot : this._sceneRoots[sceneIndex];
|
|
1466
|
+
return sceneRoot.clone();
|
|
1467
|
+
};
|
|
1468
|
+
_proto._onDestroy = function _onDestroy() {
|
|
1469
|
+
ReferResource1.prototype._onDestroy.call(this);
|
|
1470
|
+
var _this = this, textures = _this.textures, materials = _this.materials, meshes = _this.meshes;
|
|
1471
|
+
textures && this._disassociationSuperResource(textures);
|
|
1472
|
+
materials && this._disassociationSuperResource(materials);
|
|
1473
|
+
if (meshes) {
|
|
1474
|
+
for(var i = 0, n = meshes.length; i < n; i++){
|
|
1475
|
+
this._disassociationSuperResource(meshes[i]);
|
|
1476
|
+
}
|
|
1477
|
+
}
|
|
1478
|
+
};
|
|
1479
|
+
_proto._disassociationSuperResource = function _disassociationSuperResource(resources) {
|
|
1480
|
+
for(var i = 0, n = resources.length; i < n; i++){
|
|
1481
|
+
// @ts-ignore
|
|
1482
|
+
resources[i]._disassociationSuperResource(this);
|
|
1483
|
+
}
|
|
1484
|
+
};
|
|
1485
|
+
_create_class(GLTFResource, [
|
|
1486
|
+
{
|
|
1487
|
+
key: "extensionsData",
|
|
1488
|
+
get: /**
|
|
1489
|
+
* Extensions data.
|
|
1490
|
+
*/ function get() {
|
|
1491
|
+
return this._extensionsData;
|
|
1492
|
+
}
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
key: "sceneRoots",
|
|
1496
|
+
get: /**
|
|
1497
|
+
* @deprecated Please use `instantiateSceneRoot` instead.
|
|
1498
|
+
* RootEntities after SceneParser.
|
|
1499
|
+
*/ function get() {
|
|
1500
|
+
return this._sceneRoots;
|
|
1501
|
+
}
|
|
1502
|
+
},
|
|
1503
|
+
{
|
|
1504
|
+
key: "defaultSceneRoot",
|
|
1505
|
+
get: /**
|
|
1506
|
+
* @deprecated Please use `instantiateSceneRoot` instead.
|
|
1507
|
+
* RootEntity after SceneParser.
|
|
1508
|
+
*/ function get() {
|
|
1509
|
+
return this._defaultSceneRoot;
|
|
1510
|
+
}
|
|
1511
|
+
}
|
|
1512
|
+
]);
|
|
1397
1513
|
return GLTFResource;
|
|
1398
1514
|
}(miniprogram.ReferResource);
|
|
1399
1515
|
|
|
@@ -1420,7 +1536,7 @@ FontLoader = __decorate([
|
|
|
1420
1536
|
* Float
|
|
1421
1537
|
*/ "FLOAT"] = 5126] = "FLOAT";
|
|
1422
1538
|
})(AccessorComponentType || (AccessorComponentType = {}));
|
|
1423
|
-
|
|
1539
|
+
exports.AccessorType = void 0;
|
|
1424
1540
|
(function(AccessorType) {
|
|
1425
1541
|
AccessorType[/**
|
|
1426
1542
|
* Scalar
|
|
@@ -1443,7 +1559,7 @@ var AccessorType;
|
|
|
1443
1559
|
AccessorType[/**
|
|
1444
1560
|
* Matrix4x4
|
|
1445
1561
|
*/ "MAT4"] = "MAT4";
|
|
1446
|
-
})(AccessorType || (AccessorType = {}));
|
|
1562
|
+
})(exports.AccessorType || (exports.AccessorType = {}));
|
|
1447
1563
|
var AnimationChannelTargetPath;
|
|
1448
1564
|
(function(AnimationChannelTargetPath) {
|
|
1449
1565
|
AnimationChannelTargetPath[/**
|
|
@@ -1547,12 +1663,29 @@ var TextureWrapMode;
|
|
|
1547
1663
|
/**
|
|
1548
1664
|
* @internal
|
|
1549
1665
|
*/ var GLTFParserContext = /*#__PURE__*/ function() {
|
|
1550
|
-
function GLTFParserContext(glTFResource, resourceManager,
|
|
1666
|
+
function GLTFParserContext(glTFResource, resourceManager, params) {
|
|
1667
|
+
var _this = this;
|
|
1551
1668
|
this.glTFResource = glTFResource;
|
|
1552
1669
|
this.resourceManager = resourceManager;
|
|
1553
|
-
this.
|
|
1670
|
+
this.params = params;
|
|
1554
1671
|
this.accessorBufferCache = {};
|
|
1555
1672
|
this._resourceCache = new Map();
|
|
1673
|
+
this._progress = {
|
|
1674
|
+
taskDetail: {},
|
|
1675
|
+
taskComplete: {
|
|
1676
|
+
loaded: 0,
|
|
1677
|
+
total: 0
|
|
1678
|
+
}
|
|
1679
|
+
};
|
|
1680
|
+
this./**
|
|
1681
|
+
* @internal
|
|
1682
|
+
*/ _onTaskDetail = function(url, loaded, total) {
|
|
1683
|
+
var _this__progress_taskDetail, _url;
|
|
1684
|
+
var detail = (_this__progress_taskDetail = _this._progress.taskDetail)[_url = url] || (_this__progress_taskDetail[_url] = {});
|
|
1685
|
+
detail.loaded = loaded;
|
|
1686
|
+
detail.total = total;
|
|
1687
|
+
_this._setTaskDetailProgress(url, loaded, total);
|
|
1688
|
+
};
|
|
1556
1689
|
this.contentRestorer = new GLTFContentRestorer(glTFResource);
|
|
1557
1690
|
}
|
|
1558
1691
|
var _proto = GLTFParserContext.prototype;
|
|
@@ -1575,7 +1708,7 @@ var TextureWrapMode;
|
|
|
1575
1708
|
var glTFItems = this.glTF[glTFSchemaMap[type]];
|
|
1576
1709
|
if (glTFItems && (index === undefined || glTFItems[index])) {
|
|
1577
1710
|
if (index === undefined) {
|
|
1578
|
-
resource = type ===
|
|
1711
|
+
resource = type === 8 ? glTFItems.map(function(_, index) {
|
|
1579
1712
|
return _this.get(type, index);
|
|
1580
1713
|
}) : Promise.all(glTFItems.map(function(_, index) {
|
|
1581
1714
|
return _this.get(type, index);
|
|
@@ -1593,27 +1726,65 @@ var TextureWrapMode;
|
|
|
1593
1726
|
};
|
|
1594
1727
|
_proto.parse = function parse() {
|
|
1595
1728
|
var _this = this;
|
|
1596
|
-
|
|
1729
|
+
var promise = this.get(0).then(function(json) {
|
|
1597
1730
|
_this.glTF = json;
|
|
1598
1731
|
return Promise.all([
|
|
1599
1732
|
_this.get(1),
|
|
1600
|
-
_this.get(4),
|
|
1601
1733
|
_this.get(5),
|
|
1602
1734
|
_this.get(6),
|
|
1603
|
-
_this.get(
|
|
1735
|
+
_this.get(7),
|
|
1604
1736
|
_this.get(9),
|
|
1737
|
+
_this.get(10),
|
|
1605
1738
|
_this.get(2)
|
|
1606
1739
|
]).then(function() {
|
|
1740
|
+
var glTFResource = _this.glTFResource;
|
|
1741
|
+
if (glTFResource.skins || glTFResource.animations) {
|
|
1742
|
+
_this._createAnimator(_this, glTFResource.animations);
|
|
1743
|
+
}
|
|
1607
1744
|
_this.resourceManager.addContentRestorer(_this.contentRestorer);
|
|
1608
|
-
return
|
|
1745
|
+
return glTFResource;
|
|
1609
1746
|
});
|
|
1610
1747
|
});
|
|
1748
|
+
this._addTaskCompletePromise(promise);
|
|
1749
|
+
return promise;
|
|
1750
|
+
};
|
|
1751
|
+
/**
|
|
1752
|
+
* @internal
|
|
1753
|
+
*/ _proto._addTaskCompletePromise = function _addTaskCompletePromise(taskPromise) {
|
|
1754
|
+
var _this = this;
|
|
1755
|
+
var task = this._progress.taskComplete;
|
|
1756
|
+
task.total += 1;
|
|
1757
|
+
taskPromise.then(function() {
|
|
1758
|
+
_this._setTaskCompleteProgress(++task.loaded, task.total);
|
|
1759
|
+
});
|
|
1760
|
+
};
|
|
1761
|
+
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
1762
|
+
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
1763
|
+
var animator = defaultSceneRoot.addComponent(miniprogram.Animator);
|
|
1764
|
+
var animatorController = new miniprogram.AnimatorController();
|
|
1765
|
+
var layer = new miniprogram.AnimatorControllerLayer("layer");
|
|
1766
|
+
var animatorStateMachine = new miniprogram.AnimatorStateMachine();
|
|
1767
|
+
animatorController.addLayer(layer);
|
|
1768
|
+
animator.animatorController = animatorController;
|
|
1769
|
+
layer.stateMachine = animatorStateMachine;
|
|
1770
|
+
if (animations) {
|
|
1771
|
+
for(var i = 0; i < animations.length; i++){
|
|
1772
|
+
var animationClip = animations[i];
|
|
1773
|
+
var name = animationClip.name;
|
|
1774
|
+
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
1775
|
+
if (uniqueName !== name) {
|
|
1776
|
+
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
1777
|
+
}
|
|
1778
|
+
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
1779
|
+
animatorState.clip = animationClip;
|
|
1780
|
+
}
|
|
1781
|
+
}
|
|
1611
1782
|
};
|
|
1612
1783
|
_proto._handleSubAsset = function _handleSubAsset(resource, type, index) {
|
|
1613
1784
|
var _this = this;
|
|
1614
1785
|
var glTFResourceKey = glTFResourceMap[type];
|
|
1615
1786
|
if (!glTFResourceKey) return;
|
|
1616
|
-
if (type ===
|
|
1787
|
+
if (type === 8) {
|
|
1617
1788
|
var _this_glTFResource, _glTFResourceKey;
|
|
1618
1789
|
((_this_glTFResource = this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = resource;
|
|
1619
1790
|
} else {
|
|
@@ -1621,7 +1792,7 @@ var TextureWrapMode;
|
|
|
1621
1792
|
resource.then(function(item) {
|
|
1622
1793
|
var _this_glTFResource, _glTFResourceKey;
|
|
1623
1794
|
((_this_glTFResource = _this.glTFResource)[_glTFResourceKey = glTFResourceKey] || (_this_glTFResource[_glTFResourceKey] = []))[index] = item;
|
|
1624
|
-
if (type ===
|
|
1795
|
+
if (type === 7) {
|
|
1625
1796
|
for(var i = 0, length = item.length; i < length; i++){
|
|
1626
1797
|
var mesh = item[i];
|
|
1627
1798
|
// @ts-ignore
|
|
@@ -1661,17 +1832,18 @@ exports.GLTFParserType = void 0;
|
|
|
1661
1832
|
GLTFParserType[GLTFParserType["Validator"] = 1] = "Validator";
|
|
1662
1833
|
GLTFParserType[GLTFParserType["Scene"] = 2] = "Scene";
|
|
1663
1834
|
GLTFParserType[GLTFParserType["Buffer"] = 3] = "Buffer";
|
|
1664
|
-
GLTFParserType[GLTFParserType["
|
|
1665
|
-
GLTFParserType[GLTFParserType["
|
|
1666
|
-
GLTFParserType[GLTFParserType["
|
|
1667
|
-
GLTFParserType[GLTFParserType["
|
|
1668
|
-
GLTFParserType[GLTFParserType["
|
|
1669
|
-
GLTFParserType[GLTFParserType["
|
|
1835
|
+
GLTFParserType[GLTFParserType["BufferView"] = 4] = "BufferView";
|
|
1836
|
+
GLTFParserType[GLTFParserType["Texture"] = 5] = "Texture";
|
|
1837
|
+
GLTFParserType[GLTFParserType["Material"] = 6] = "Material";
|
|
1838
|
+
GLTFParserType[GLTFParserType["Mesh"] = 7] = "Mesh";
|
|
1839
|
+
GLTFParserType[GLTFParserType["Entity"] = 8] = "Entity";
|
|
1840
|
+
GLTFParserType[GLTFParserType["Skin"] = 9] = "Skin";
|
|
1841
|
+
GLTFParserType[GLTFParserType["Animation"] = 10] = "Animation";
|
|
1670
1842
|
})(exports.GLTFParserType || (exports.GLTFParserType = {}));
|
|
1671
1843
|
var _obj;
|
|
1672
|
-
var glTFSchemaMap = (_obj = {}, _obj[2] = "scenes", _obj[3] = "buffers", _obj[
|
|
1844
|
+
var glTFSchemaMap = (_obj = {}, _obj[2] = "scenes", _obj[3] = "buffers", _obj[5] = "textures", _obj[6] = "materials", _obj[7] = "meshes", _obj[8] = "nodes", _obj[9] = "skins", _obj[10] = "animations", _obj[4] = "bufferViews", _obj);
|
|
1673
1845
|
var _obj1;
|
|
1674
|
-
var glTFResourceMap = (_obj1 = {}, _obj1[2] = "
|
|
1846
|
+
var glTFResourceMap = (_obj1 = {}, _obj1[2] = "_sceneRoots", _obj1[5] = "textures", _obj1[6] = "materials", _obj1[7] = "meshes", _obj1[8] = "entities", _obj1[9] = "skins", _obj1[10] = "animations", _obj1);
|
|
1675
1847
|
function registerGLTFParser(pipeline) {
|
|
1676
1848
|
return function(Parser) {
|
|
1677
1849
|
var parser = new Parser();
|
|
@@ -1725,19 +1897,19 @@ function registerGLTFParser(pipeline) {
|
|
|
1725
1897
|
* Get the number of bytes occupied by accessor type.
|
|
1726
1898
|
*/ GLTFUtils.getAccessorTypeSize = function getAccessorTypeSize(accessorType) {
|
|
1727
1899
|
switch(accessorType){
|
|
1728
|
-
case AccessorType.SCALAR:
|
|
1900
|
+
case exports.AccessorType.SCALAR:
|
|
1729
1901
|
return 1;
|
|
1730
|
-
case AccessorType.VEC2:
|
|
1902
|
+
case exports.AccessorType.VEC2:
|
|
1731
1903
|
return 2;
|
|
1732
|
-
case AccessorType.VEC3:
|
|
1904
|
+
case exports.AccessorType.VEC3:
|
|
1733
1905
|
return 3;
|
|
1734
|
-
case AccessorType.VEC4:
|
|
1906
|
+
case exports.AccessorType.VEC4:
|
|
1735
1907
|
return 4;
|
|
1736
|
-
case AccessorType.MAT2:
|
|
1908
|
+
case exports.AccessorType.MAT2:
|
|
1737
1909
|
return 4;
|
|
1738
|
-
case AccessorType.MAT3:
|
|
1910
|
+
case exports.AccessorType.MAT3:
|
|
1739
1911
|
return 9;
|
|
1740
|
-
case AccessorType.MAT4:
|
|
1912
|
+
case exports.AccessorType.MAT4:
|
|
1741
1913
|
return 16;
|
|
1742
1914
|
}
|
|
1743
1915
|
};
|
|
@@ -1777,11 +1949,10 @@ function registerGLTFParser(pipeline) {
|
|
|
1777
1949
|
GLTFUtils.getAccessorBuffer = function getAccessorBuffer(context, bufferViews, accessor) {
|
|
1778
1950
|
var componentType = accessor.componentType;
|
|
1779
1951
|
var bufferView = bufferViews[accessor.bufferView];
|
|
1780
|
-
return context.get(exports.GLTFParserType.
|
|
1952
|
+
return context.get(exports.GLTFParserType.BufferView, accessor.bufferView).then(function(bufferViewData) {
|
|
1781
1953
|
var bufferIndex = bufferView.buffer;
|
|
1782
|
-
var
|
|
1783
|
-
var
|
|
1784
|
-
var bufferByteOffset = (_bufferView_byteOffset = bufferView.byteOffset) != null ? _bufferView_byteOffset : 0;
|
|
1954
|
+
var _bufferViewData_byteOffset;
|
|
1955
|
+
var bufferByteOffset = (_bufferViewData_byteOffset = bufferViewData.byteOffset) != null ? _bufferViewData_byteOffset : 0;
|
|
1785
1956
|
var _accessor_byteOffset;
|
|
1786
1957
|
var byteOffset = (_accessor_byteOffset = accessor.byteOffset) != null ? _accessor_byteOffset : 0;
|
|
1787
1958
|
var TypedArray = GLTFUtils.getComponentType(componentType);
|
|
@@ -1800,19 +1971,21 @@ function registerGLTFParser(pipeline) {
|
|
|
1800
1971
|
if (!bufferInfo) {
|
|
1801
1972
|
var offset = bufferByteOffset + bufferSlice * bufferStride;
|
|
1802
1973
|
var count = accessorCount * (bufferStride / dataElementBytes);
|
|
1803
|
-
var data = new TypedArray(buffer, offset, count);
|
|
1974
|
+
var data = new TypedArray(bufferViewData.buffer, offset, count);
|
|
1804
1975
|
accessorBufferCache[bufferCacheKey] = bufferInfo = new BufferInfo(data, true, bufferStride);
|
|
1805
1976
|
bufferInfo.restoreInfo = new BufferDataRestoreInfo(new RestoreDataAccessor(bufferIndex, TypedArray, offset, count));
|
|
1806
1977
|
}
|
|
1807
1978
|
} else {
|
|
1808
1979
|
var offset1 = bufferByteOffset + byteOffset;
|
|
1809
1980
|
var count1 = accessorCount * dataElementSize;
|
|
1810
|
-
var data1 = new TypedArray(buffer, offset1, count1);
|
|
1981
|
+
var data1 = new TypedArray(bufferViewData.buffer, offset1, count1);
|
|
1811
1982
|
bufferInfo = new BufferInfo(data1, false, elementStride);
|
|
1812
1983
|
bufferInfo.restoreInfo = new BufferDataRestoreInfo(new RestoreDataAccessor(bufferIndex, TypedArray, offset1, count1));
|
|
1813
1984
|
}
|
|
1814
1985
|
if (accessor.sparse) {
|
|
1815
|
-
GLTFUtils.processingSparseData(
|
|
1986
|
+
return GLTFUtils.processingSparseData(context, accessor, bufferInfo).then(function() {
|
|
1987
|
+
return bufferInfo;
|
|
1988
|
+
});
|
|
1816
1989
|
}
|
|
1817
1990
|
return bufferInfo;
|
|
1818
1991
|
});
|
|
@@ -1888,40 +2061,43 @@ function registerGLTFParser(pipeline) {
|
|
|
1888
2061
|
};
|
|
1889
2062
|
/**
|
|
1890
2063
|
* Get accessor data.
|
|
1891
|
-
*/ GLTFUtils.processingSparseData = function processingSparseData(
|
|
2064
|
+
*/ GLTFUtils.processingSparseData = function processingSparseData(context, accessor, bufferInfo) {
|
|
1892
2065
|
var restoreInfo = bufferInfo.restoreInfo;
|
|
2066
|
+
var bufferViews = context.glTF.bufferViews;
|
|
1893
2067
|
var accessorTypeSize = GLTFUtils.getAccessorTypeSize(accessor.type);
|
|
1894
2068
|
var TypedArray = GLTFUtils.getComponentType(accessor.componentType);
|
|
1895
2069
|
var data = bufferInfo.data.slice();
|
|
1896
2070
|
var _accessor_sparse = accessor.sparse, count = _accessor_sparse.count, indices = _accessor_sparse.indices, values = _accessor_sparse.values;
|
|
1897
2071
|
var indicesBufferView = bufferViews[indices.bufferView];
|
|
1898
2072
|
var valuesBufferView = bufferViews[values.bufferView];
|
|
1899
|
-
|
|
1900
|
-
|
|
1901
|
-
|
|
1902
|
-
|
|
1903
|
-
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
|
|
1914
|
-
|
|
1915
|
-
|
|
1916
|
-
|
|
1917
|
-
|
|
1918
|
-
|
|
1919
|
-
var
|
|
1920
|
-
|
|
1921
|
-
|
|
2073
|
+
return Promise.all([
|
|
2074
|
+
context.get(exports.GLTFParserType.BufferView, indices.bufferView),
|
|
2075
|
+
context.get(exports.GLTFParserType.BufferView, values.bufferView)
|
|
2076
|
+
]).then(function(param) {
|
|
2077
|
+
var indicesUint8Array = param[0], valuesUin8Array = param[1];
|
|
2078
|
+
var _indices_byteOffset, _indicesUint8Array_byteOffset;
|
|
2079
|
+
var indicesByteOffset = ((_indices_byteOffset = indices.byteOffset) != null ? _indices_byteOffset : 0) + ((_indicesUint8Array_byteOffset = indicesUint8Array.byteOffset) != null ? _indicesUint8Array_byteOffset : 0);
|
|
2080
|
+
var indicesByteLength = indicesUint8Array.byteLength;
|
|
2081
|
+
var _values_byteOffset, _valuesUin8Array_byteOffset;
|
|
2082
|
+
var valuesByteOffset = ((_values_byteOffset = values.byteOffset) != null ? _values_byteOffset : 0) + ((_valuesUin8Array_byteOffset = valuesUin8Array.byteOffset) != null ? _valuesUin8Array_byteOffset : 0);
|
|
2083
|
+
var valuesByteLength = valuesUin8Array.byteLength;
|
|
2084
|
+
restoreInfo.typeSize = accessorTypeSize;
|
|
2085
|
+
restoreInfo.sparseCount = count;
|
|
2086
|
+
var IndexTypeArray = GLTFUtils.getComponentType(indices.componentType);
|
|
2087
|
+
var indexLength = indicesByteLength / IndexTypeArray.BYTES_PER_ELEMENT;
|
|
2088
|
+
var indicesArray = new IndexTypeArray(indicesUint8Array.buffer, indicesByteOffset, indexLength);
|
|
2089
|
+
restoreInfo.sparseIndices = new RestoreDataAccessor(indicesBufferView.buffer, IndexTypeArray, indicesByteOffset, indexLength);
|
|
2090
|
+
var valueLength = valuesByteLength / TypedArray.BYTES_PER_ELEMENT;
|
|
2091
|
+
var valuesArray = new TypedArray(valuesUin8Array.buffer, valuesByteOffset, valueLength);
|
|
2092
|
+
restoreInfo.sparseValues = new RestoreDataAccessor(valuesBufferView.buffer, TypedArray, valuesByteOffset, valueLength);
|
|
2093
|
+
for(var i = 0; i < count; i++){
|
|
2094
|
+
var replaceIndex = indicesArray[i];
|
|
2095
|
+
for(var j = 0; j < accessorTypeSize; j++){
|
|
2096
|
+
data[replaceIndex * accessorTypeSize + j] = valuesArray[i * accessorTypeSize + j];
|
|
2097
|
+
}
|
|
1922
2098
|
}
|
|
1923
|
-
|
|
1924
|
-
|
|
2099
|
+
bufferInfo.data = data;
|
|
2100
|
+
});
|
|
1925
2101
|
};
|
|
1926
2102
|
GLTFUtils.getIndexFormat = function getIndexFormat(type) {
|
|
1927
2103
|
switch(type){
|
|
@@ -2248,7 +2424,7 @@ var SupercompressionScheme;
|
|
|
2248
2424
|
alphaSliceByteLength: sgdReader.nextUint32()
|
|
2249
2425
|
};
|
|
2250
2426
|
}
|
|
2251
|
-
var endpointsByteOffset = sgdByteOffset + sgdReader.
|
|
2427
|
+
var endpointsByteOffset = sgdByteOffset + sgdReader.position;
|
|
2252
2428
|
var selectorsByteOffset = endpointsByteOffset + endpointsByteLength;
|
|
2253
2429
|
var tablesByteOffset = selectorsByteOffset + selectorsByteLength;
|
|
2254
2430
|
var extendedByteOffset = tablesByteOffset + tablesByteLength;
|
|
@@ -2440,6 +2616,25 @@ var AbstractTranscoder = /*#__PURE__*/ function() {
|
|
|
2440
2616
|
}();
|
|
2441
2617
|
|
|
2442
2618
|
/** @internal */ function TranscodeWorkerCode$1() {
|
|
2619
|
+
var initPromise;
|
|
2620
|
+
var init = function init(wasmBinary) {
|
|
2621
|
+
if (!initPromise) {
|
|
2622
|
+
initPromise = new Promise(function(resolve, reject) {
|
|
2623
|
+
var BasisModule = {
|
|
2624
|
+
wasmBinary: wasmBinary,
|
|
2625
|
+
onRuntimeInitialized: function() {
|
|
2626
|
+
return resolve(BasisModule);
|
|
2627
|
+
},
|
|
2628
|
+
onAbort: reject
|
|
2629
|
+
};
|
|
2630
|
+
self["BASIS"](BasisModule);
|
|
2631
|
+
}).then(function(BasisModule) {
|
|
2632
|
+
BasisModule.initializeBasis();
|
|
2633
|
+
return BasisModule.KTX2File;
|
|
2634
|
+
});
|
|
2635
|
+
}
|
|
2636
|
+
return initPromise;
|
|
2637
|
+
};
|
|
2443
2638
|
self.onmessage = function onmessage(event) {
|
|
2444
2639
|
var message = event.data;
|
|
2445
2640
|
switch(message.type){
|
|
@@ -2566,6 +2761,7 @@ function transcode(buffer, targetFormat, KTX2File) {
|
|
|
2566
2761
|
var faceCount = ktx2File.getFaces();
|
|
2567
2762
|
var format = getTranscodeFormatFromTarget(targetFormat, hasAlpha);
|
|
2568
2763
|
var faces = new Array(faceCount);
|
|
2764
|
+
var isBC = format === 2 || format === 3 || format === 7;
|
|
2569
2765
|
for(var face = 0; face < faceCount; face++){
|
|
2570
2766
|
var mipmaps = new Array(levelCount);
|
|
2571
2767
|
for(var mip = 0; mip < levelCount; mip++){
|
|
@@ -2573,8 +2769,15 @@ function transcode(buffer, targetFormat, KTX2File) {
|
|
|
2573
2769
|
var mipWidth = void 0, mipHeight = void 0;
|
|
2574
2770
|
for(var layer = 0; layer < layerCount; layer++){
|
|
2575
2771
|
var levelInfo = ktx2File.getImageLevelInfo(mip, layer, face);
|
|
2576
|
-
|
|
2577
|
-
|
|
2772
|
+
// see: https://github.com/KhronosGroup/KTX-Software/issues/254
|
|
2773
|
+
if (isBC && mip === 0 && (width !== levelInfo.width || height !== levelInfo.height)) {
|
|
2774
|
+
width = mipWidth = levelInfo.width;
|
|
2775
|
+
height = mipHeight = levelInfo.height;
|
|
2776
|
+
console.warn("KTX2 transcode to BC will resize to width: " + width + ", height: " + height + ". You'd better use an image whose size if multiple of 4.");
|
|
2777
|
+
} else {
|
|
2778
|
+
mipWidth = levelInfo.origWidth;
|
|
2779
|
+
mipHeight = levelInfo.origHeight;
|
|
2780
|
+
}
|
|
2578
2781
|
var dst = new Uint8Array(ktx2File.getImageTranscodedSizeInBytes(mip, layer, 0, format));
|
|
2579
2782
|
var status = ktx2File.transcodeImage(dst, mip, layer, face, format, 0, -1, -1);
|
|
2580
2783
|
if (!status) {
|
|
@@ -2640,7 +2843,7 @@ function transcode(buffer, targetFormat, KTX2File) {
|
|
|
2640
2843
|
} else {
|
|
2641
2844
|
var funcCode = TranscodeWorkerCode$1.toString();
|
|
2642
2845
|
var transcodeString = funcCode.substring(funcCode.indexOf("{"), funcCode.lastIndexOf("}") + 1);
|
|
2643
|
-
var workerCode = "\n " + jsCode + "\n
|
|
2846
|
+
var workerCode = "\n " + jsCode + "\n " + transcode.toString() + "\n " + transcodeString + "\n ";
|
|
2644
2847
|
var workerURL = engineMiniprogramAdapter.URL.createObjectURL(new engineMiniprogramAdapter.Blob([
|
|
2645
2848
|
workerCode
|
|
2646
2849
|
], {
|
|
@@ -2886,10 +3089,14 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2886
3089
|
return Loader1.apply(this, arguments);
|
|
2887
3090
|
}
|
|
2888
3091
|
var _proto = KTX2Loader1.prototype;
|
|
2889
|
-
_proto.initialize = function initialize(
|
|
3092
|
+
_proto.initialize = function initialize(_, configuration) {
|
|
2890
3093
|
if (configuration.ktx2Loader) {
|
|
2891
3094
|
var options = configuration.ktx2Loader;
|
|
2892
|
-
if (
|
|
3095
|
+
if (options.priorityFormats) {
|
|
3096
|
+
exports.KTX2Loader._priorityFormats["etc1s"] = options.priorityFormats;
|
|
3097
|
+
exports.KTX2Loader._priorityFormats["uastc"] = options.priorityFormats;
|
|
3098
|
+
}
|
|
3099
|
+
if (options.transcoder === /** Khronos transcoder. */ 1) {
|
|
2893
3100
|
return exports.KTX2Loader._getKhronosTranscoder(options.workerCount).init();
|
|
2894
3101
|
} else {
|
|
2895
3102
|
return exports.KTX2Loader._getBinomialLLCTranscoder(options.workerCount).init();
|
|
@@ -2899,39 +3106,22 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2899
3106
|
/**
|
|
2900
3107
|
* @internal
|
|
2901
3108
|
*/ _proto.load = function load(item, resourceManager) {
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2905
|
-
|
|
2906
|
-
|
|
2907
|
-
return exports.KTX2Loader.
|
|
2908
|
-
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
if (priorityFormats === void 0) priorityFormats = [
|
|
2913
|
-
exports.KTX2TargetFormat.ASTC,
|
|
2914
|
-
exports.KTX2TargetFormat.ETC,
|
|
2915
|
-
exports.KTX2TargetFormat.BC7,
|
|
2916
|
-
exports.KTX2TargetFormat.BC1_BC3,
|
|
2917
|
-
exports.KTX2TargetFormat.PVRTC,
|
|
2918
|
-
exports.KTX2TargetFormat.R8G8B8A8
|
|
2919
|
-
];
|
|
2920
|
-
var supportedList = new Array();
|
|
2921
|
-
if (Array.isArray(priorityFormats[0])) {
|
|
2922
|
-
for(var i = 0; i < priorityFormats.length; i++){
|
|
2923
|
-
supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats[i]));
|
|
2924
|
-
}
|
|
2925
|
-
} else {
|
|
2926
|
-
supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats));
|
|
2927
|
-
}
|
|
2928
|
-
return supportedList.every(function(format) {
|
|
2929
|
-
return KhronosTranscoder.transcoderMap[format];
|
|
3109
|
+
var _this = this;
|
|
3110
|
+
return new miniprogram.AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
3111
|
+
_this.request(item.url, {
|
|
3112
|
+
type: "arraybuffer"
|
|
3113
|
+
}).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(buffer) {
|
|
3114
|
+
return exports.KTX2Loader._parseBuffer(new Uint8Array(buffer), resourceManager.engine, item.params).then(function(param) {
|
|
3115
|
+
var engine = param.engine, result = param.result, targetFormat = param.targetFormat, params = param.params;
|
|
3116
|
+
return exports.KTX2Loader._createTextureByBuffer(engine, result, targetFormat, params);
|
|
3117
|
+
});
|
|
3118
|
+
}).then(resolve).catch(reject);
|
|
2930
3119
|
});
|
|
2931
3120
|
};
|
|
2932
3121
|
/**
|
|
2933
|
-
*
|
|
2934
|
-
|
|
3122
|
+
* Release ktx2 transcoder worker.
|
|
3123
|
+
* @remarks If use loader after releasing, we should release again.
|
|
3124
|
+
*/ KTX2Loader1.release = function release() {
|
|
2935
3125
|
if (this._binomialLLCTranscoder) this._binomialLLCTranscoder.destroy();
|
|
2936
3126
|
if (this._khronosTranscoder) this._khronosTranscoder.destroy();
|
|
2937
3127
|
this._binomialLLCTranscoder = null;
|
|
@@ -2941,7 +3131,8 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2941
3131
|
/** @internal */ KTX2Loader1._parseBuffer = function _parseBuffer(buffer, engine, params) {
|
|
2942
3132
|
var _params;
|
|
2943
3133
|
var ktx2Container = new KTX2Container(buffer);
|
|
2944
|
-
var
|
|
3134
|
+
var _params_priorityFormats;
|
|
3135
|
+
var formatPriorities = (_params_priorityFormats = (_params = params) == null ? void 0 : _params.priorityFormats) != null ? _params_priorityFormats : exports.KTX2Loader._priorityFormats[ktx2Container.isUASTC ? "uastc" : "etc1s"];
|
|
2945
3136
|
var targetFormat = exports.KTX2Loader._decideTargetFormat(engine, ktx2Container, formatPriorities);
|
|
2946
3137
|
var transcodeResultPromise;
|
|
2947
3138
|
if (exports.KTX2Loader._isBinomialInit || !KhronosTranscoder.transcoderMap[targetFormat] || !ktx2Container.isUASTC) {
|
|
@@ -3008,18 +3199,22 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
3008
3199
|
return targetFormat;
|
|
3009
3200
|
};
|
|
3010
3201
|
KTX2Loader1._detectSupportedFormat = function _detectSupportedFormat(renderer, priorityFormats) {
|
|
3011
|
-
if (priorityFormats === void 0) priorityFormats = [
|
|
3012
|
-
exports.KTX2TargetFormat.ASTC,
|
|
3013
|
-
exports.KTX2TargetFormat.ETC,
|
|
3014
|
-
exports.KTX2TargetFormat.BC7,
|
|
3015
|
-
exports.KTX2TargetFormat.BC1_BC3,
|
|
3016
|
-
exports.KTX2TargetFormat.PVRTC
|
|
3017
|
-
];
|
|
3018
3202
|
for(var i = 0; i < priorityFormats.length; i++){
|
|
3019
|
-
var
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3203
|
+
var format = priorityFormats[i];
|
|
3204
|
+
var capabilities = this._supportedMap[format];
|
|
3205
|
+
if (capabilities) {
|
|
3206
|
+
for(var j = 0; j < capabilities.length; j++){
|
|
3207
|
+
if (renderer.canIUse(capabilities[j])) {
|
|
3208
|
+
return format;
|
|
3209
|
+
}
|
|
3210
|
+
}
|
|
3211
|
+
} else {
|
|
3212
|
+
switch(priorityFormats[i]){
|
|
3213
|
+
case exports.KTX2TargetFormat.R8G8B8A8:
|
|
3214
|
+
return format;
|
|
3215
|
+
case exports.KTX2TargetFormat.R8:
|
|
3216
|
+
case exports.KTX2TargetFormat.R8G8:
|
|
3217
|
+
if (renderer.isWebGL2) return format;
|
|
3023
3218
|
}
|
|
3024
3219
|
}
|
|
3025
3220
|
}
|
|
@@ -3056,6 +3251,23 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
3056
3251
|
return KTX2Loader1;
|
|
3057
3252
|
}(miniprogram.Loader), function() {
|
|
3058
3253
|
_KTX2Loader._isBinomialInit = false;
|
|
3254
|
+
}(), function() {
|
|
3255
|
+
_KTX2Loader._priorityFormats = {
|
|
3256
|
+
etc1s: [
|
|
3257
|
+
exports.KTX2TargetFormat.ETC,
|
|
3258
|
+
exports.KTX2TargetFormat.BC7,
|
|
3259
|
+
exports.KTX2TargetFormat.ASTC,
|
|
3260
|
+
exports.KTX2TargetFormat.BC1_BC3,
|
|
3261
|
+
exports.KTX2TargetFormat.PVRTC
|
|
3262
|
+
],
|
|
3263
|
+
uastc: [
|
|
3264
|
+
exports.KTX2TargetFormat.ASTC,
|
|
3265
|
+
exports.KTX2TargetFormat.BC7,
|
|
3266
|
+
exports.KTX2TargetFormat.ETC,
|
|
3267
|
+
exports.KTX2TargetFormat.BC1_BC3,
|
|
3268
|
+
exports.KTX2TargetFormat.PVRTC
|
|
3269
|
+
]
|
|
3270
|
+
};
|
|
3059
3271
|
}(), function() {
|
|
3060
3272
|
var _obj;
|
|
3061
3273
|
_KTX2Loader._supportedMap = (_obj = {}, _obj[exports.KTX2TargetFormat.ASTC] = [
|
|
@@ -3076,6 +3288,11 @@ exports.KTX2Loader = __decorate([
|
|
|
3076
3288
|
"ktx2"
|
|
3077
3289
|
])
|
|
3078
3290
|
], exports.KTX2Loader);
|
|
3291
|
+
exports.KTX2Transcoder = void 0;
|
|
3292
|
+
(function(KTX2Transcoder) {
|
|
3293
|
+
KTX2Transcoder[KTX2Transcoder[/** BinomialLLC transcoder. */ "BinomialLLC"] = 0] = "BinomialLLC";
|
|
3294
|
+
KTX2Transcoder[KTX2Transcoder["Khronos"] = 1] = "Khronos";
|
|
3295
|
+
})(exports.KTX2Transcoder || (exports.KTX2Transcoder = {}));
|
|
3079
3296
|
|
|
3080
3297
|
/**
|
|
3081
3298
|
* @internal
|
|
@@ -3426,7 +3643,7 @@ exports.GLTFSchemaParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3426
3643
|
};
|
|
3427
3644
|
var isGLB = this._isGLB(url);
|
|
3428
3645
|
contentRestorer.isGLB = isGLB;
|
|
3429
|
-
var promise = isGLB ? miniprogram.request(url, requestConfig).then(function(glb) {
|
|
3646
|
+
var promise = isGLB ? miniprogram.request(url, requestConfig).onProgress(undefined, context._onTaskDetail).then(function(glb) {
|
|
3430
3647
|
restoreBufferRequests.push(new BufferRequestInfo(url, requestConfig));
|
|
3431
3648
|
return GLTFUtils.parseGLB(context, glb);
|
|
3432
3649
|
}).then(function(param) {
|
|
@@ -3435,7 +3652,7 @@ exports.GLTFSchemaParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3435
3652
|
return glTF;
|
|
3436
3653
|
}) : miniprogram.request(url, {
|
|
3437
3654
|
type: "json"
|
|
3438
|
-
});
|
|
3655
|
+
}).onProgress(undefined, context._onTaskDetail);
|
|
3439
3656
|
return promise;
|
|
3440
3657
|
};
|
|
3441
3658
|
_proto._isGLB = function _isGLB(url) {
|
|
@@ -3467,9 +3684,9 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3467
3684
|
* @internal
|
|
3468
3685
|
*/ GLTFAnimationParser1._parseStandardProperty = function _parseStandardProperty(context, animationClip, animationInfo) {
|
|
3469
3686
|
var _loop = function(j, m) {
|
|
3470
|
-
var
|
|
3471
|
-
var inputAccessor = accessors[
|
|
3472
|
-
var outputAccessor = accessors[
|
|
3687
|
+
var glTFSampler = samplers[j];
|
|
3688
|
+
var inputAccessor = accessors[glTFSampler.input];
|
|
3689
|
+
var outputAccessor = accessors[glTFSampler.output];
|
|
3473
3690
|
var promise = Promise.all([
|
|
3474
3691
|
GLTFUtils.getAccessorBuffer(context, bufferViews, inputAccessor),
|
|
3475
3692
|
GLTFUtils.getAccessorBuffer(context, bufferViews, outputAccessor)
|
|
@@ -3485,8 +3702,8 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3485
3702
|
output = scaled;
|
|
3486
3703
|
}
|
|
3487
3704
|
var outputStride = output.length / input.length;
|
|
3488
|
-
var
|
|
3489
|
-
var interpolation = (
|
|
3705
|
+
var _glTFSampler_interpolation;
|
|
3706
|
+
var interpolation = (_glTFSampler_interpolation = glTFSampler.interpolation) != null ? _glTFSampler_interpolation : AnimationSamplerInterpolation.Linear;
|
|
3490
3707
|
var samplerInterpolation;
|
|
3491
3708
|
switch(interpolation){
|
|
3492
3709
|
case AnimationSamplerInterpolation.CubicSpine:
|
|
@@ -3519,10 +3736,11 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3519
3736
|
var promises = new Array();
|
|
3520
3737
|
// parse samplers
|
|
3521
3738
|
for(var j = 0, m = samplers.length; j < m; j++)_loop(j);
|
|
3739
|
+
promises.push(context.get(exports.GLTFParserType.Scene));
|
|
3522
3740
|
return Promise.all(promises).then(function() {
|
|
3523
3741
|
for(var j = 0, m = channels.length; j < m; j++){
|
|
3524
|
-
var
|
|
3525
|
-
var target =
|
|
3742
|
+
var glTFChannel = channels[j];
|
|
3743
|
+
var target = glTFChannel.target;
|
|
3526
3744
|
var channelTargetEntity = entities[target.node];
|
|
3527
3745
|
var relativePath = "";
|
|
3528
3746
|
var entity = channelTargetEntity;
|
|
@@ -3530,6 +3748,10 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3530
3748
|
relativePath = relativePath === "" ? "" + entity.name : entity.name + "/" + relativePath;
|
|
3531
3749
|
entity = entity.parent;
|
|
3532
3750
|
}
|
|
3751
|
+
// If the target node is in the default scene, relativePath will be empty
|
|
3752
|
+
if (context.glTFResource.sceneRoots.indexOf(entity) === -1) {
|
|
3753
|
+
continue;
|
|
3754
|
+
}
|
|
3533
3755
|
var ComponentType = void 0;
|
|
3534
3756
|
var propertyName = void 0;
|
|
3535
3757
|
switch(target.path){
|
|
@@ -3550,14 +3772,21 @@ exports.GLTFAnimationParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3550
3772
|
propertyName = "blendShapeWeights";
|
|
3551
3773
|
break;
|
|
3552
3774
|
}
|
|
3553
|
-
var curve = _this._addCurve(target.path,
|
|
3554
|
-
|
|
3775
|
+
var curve = _this._addCurve(target.path, glTFChannel, sampleDataCollection);
|
|
3776
|
+
if (target.path === AnimationChannelTargetPath.WEIGHTS) {
|
|
3777
|
+
var mesh = glTF.nodes[target.node].mesh;
|
|
3778
|
+
for(var i = 0, n = glTF.meshes[mesh].primitives.length; i < n; i++){
|
|
3779
|
+
animationClip.addCurveBinding(relativePath, ComponentType, i, propertyName, curve);
|
|
3780
|
+
}
|
|
3781
|
+
} else {
|
|
3782
|
+
animationClip.addCurveBinding(relativePath, ComponentType, propertyName, curve);
|
|
3783
|
+
}
|
|
3555
3784
|
}
|
|
3556
3785
|
return animationClip;
|
|
3557
3786
|
});
|
|
3558
3787
|
};
|
|
3559
|
-
GLTFAnimationParser1._addCurve = function _addCurve(animationChannelTargetPath,
|
|
3560
|
-
var sampleData = sampleDataCollection[
|
|
3788
|
+
GLTFAnimationParser1._addCurve = function _addCurve(animationChannelTargetPath, glTFChannel, sampleDataCollection) {
|
|
3789
|
+
var sampleData = sampleDataCollection[glTFChannel.sampler];
|
|
3561
3790
|
var input = sampleData.input, output = sampleData.output, outputSize = sampleData.outputSize;
|
|
3562
3791
|
switch(animationChannelTargetPath){
|
|
3563
3792
|
case AnimationChannelTargetPath.TRANSLATION:
|
|
@@ -3649,7 +3878,9 @@ exports.GLTFBufferParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3649
3878
|
};
|
|
3650
3879
|
var absoluteUrl = miniprogram.Utils.resolveAbsoluteUrl(url, bufferInfo.uri);
|
|
3651
3880
|
restoreBufferRequests.push(new BufferRequestInfo(absoluteUrl, requestConfig));
|
|
3652
|
-
|
|
3881
|
+
var promise = miniprogram.request(absoluteUrl, requestConfig).onProgress(undefined, context._onTaskDetail);
|
|
3882
|
+
context._addTaskCompletePromise(promise);
|
|
3883
|
+
return promise;
|
|
3653
3884
|
};
|
|
3654
3885
|
return GLTFBufferParser;
|
|
3655
3886
|
}(GLTFParser);
|
|
@@ -3664,10 +3895,13 @@ exports.GLTFEntityParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3664
3895
|
}
|
|
3665
3896
|
var _proto = GLTFEntityParser.prototype;
|
|
3666
3897
|
_proto.parse = function parse(context, index) {
|
|
3898
|
+
var glTFResource = context.glTFResource;
|
|
3667
3899
|
var entityInfo = context.glTF.nodes[index];
|
|
3668
|
-
var engine =
|
|
3900
|
+
var engine = glTFResource.engine;
|
|
3669
3901
|
var matrix = entityInfo.matrix, translation = entityInfo.translation, rotation = entityInfo.rotation, scale = entityInfo.scale, extensions = entityInfo.extensions;
|
|
3670
3902
|
var entity = new miniprogram.Entity(engine, entityInfo.name || "_GLTF_ENTITY_" + index);
|
|
3903
|
+
// @ts-ignore
|
|
3904
|
+
entity._markAsTemplate(glTFResource);
|
|
3671
3905
|
var transform = entity.transform;
|
|
3672
3906
|
if (matrix) {
|
|
3673
3907
|
var localMatrix = transform.localMatrix;
|
|
@@ -3709,7 +3943,8 @@ exports.GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3709
3943
|
var _proto = GLTFMaterialParser1.prototype;
|
|
3710
3944
|
_proto.parse = function parse(context, index) {
|
|
3711
3945
|
var materialInfo = context.glTF.materials[index];
|
|
3712
|
-
var
|
|
3946
|
+
var glTFResource = context.glTFResource;
|
|
3947
|
+
var engine = glTFResource.engine;
|
|
3713
3948
|
var material = GLTFParser.executeExtensionsCreateAndParse(materialInfo.extensions, context, materialInfo);
|
|
3714
3949
|
if (!material) {
|
|
3715
3950
|
material = new miniprogram.PBRMaterial(engine);
|
|
@@ -3717,8 +3952,10 @@ exports.GLTFMaterialParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3717
3952
|
exports.GLTFMaterialParser._parseStandardProperty(context, material, materialInfo);
|
|
3718
3953
|
}
|
|
3719
3954
|
return Promise.resolve(material).then(function(material) {
|
|
3720
|
-
material || (material = exports.GLTFMaterialParser._getDefaultMaterial(
|
|
3955
|
+
material || (material = exports.GLTFMaterialParser._getDefaultMaterial(engine));
|
|
3721
3956
|
GLTFParser.executeExtensionsAdditiveAndParse(materialInfo.extensions, context, material, materialInfo);
|
|
3957
|
+
// @ts-ignore
|
|
3958
|
+
material._associationSuperResource(glTFResource);
|
|
3722
3959
|
return material;
|
|
3723
3960
|
});
|
|
3724
3961
|
};
|
|
@@ -3839,14 +4076,20 @@ exports.GLTFMeshParser = (_GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1)
|
|
|
3839
4076
|
var mesh = GLTFParser.executeExtensionsCreateAndParse(gltfPrimitive.extensions, context, gltfPrimitive, meshInfo);
|
|
3840
4077
|
if (mesh) {
|
|
3841
4078
|
if (_instanceof(mesh, miniprogram.ModelMesh)) {
|
|
4079
|
+
// @ts-ignore
|
|
4080
|
+
mesh._associationSuperResource(glTFResource);
|
|
3842
4081
|
resolve(mesh);
|
|
3843
4082
|
} else {
|
|
3844
4083
|
mesh.then(function(mesh) {
|
|
3845
|
-
|
|
4084
|
+
// @ts-ignore
|
|
4085
|
+
mesh._associationSuperResource(glTFResource);
|
|
4086
|
+
resolve(mesh);
|
|
3846
4087
|
});
|
|
3847
4088
|
}
|
|
3848
4089
|
} else {
|
|
3849
4090
|
var mesh1 = new miniprogram.ModelMesh(engine, meshInfo.name || i + "");
|
|
4091
|
+
// @ts-ignore
|
|
4092
|
+
mesh1._associationSuperResource(glTFResource);
|
|
3850
4093
|
var meshRestoreInfo = new ModelMeshRestoreInfo();
|
|
3851
4094
|
meshRestoreInfo.mesh = mesh1;
|
|
3852
4095
|
context.contentRestorer.meshes.push(meshRestoreInfo);
|
|
@@ -3866,12 +4109,13 @@ exports.GLTFMeshParser = (_GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1)
|
|
|
3866
4109
|
return context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
3867
4110
|
return GLTFUtils.getAccessorData(glTF, indexAccessor, buffers);
|
|
3868
4111
|
});
|
|
3869
|
-
}, context.keepMeshData).then(resolve);
|
|
4112
|
+
}, context.params.keepMeshData).then(resolve);
|
|
3870
4113
|
}
|
|
3871
4114
|
});
|
|
3872
4115
|
};
|
|
3873
4116
|
var meshInfo = context.glTF.meshes[index];
|
|
3874
|
-
var glTF = context.glTF,
|
|
4117
|
+
var glTF = context.glTF, glTFResource = context.glTFResource;
|
|
4118
|
+
var engine = glTFResource.engine;
|
|
3875
4119
|
var primitivePromises = new Array();
|
|
3876
4120
|
for(var i = 0, length = meshInfo.primitives.length; i < length; i++)_loop(i);
|
|
3877
4121
|
return Promise.all(primitivePromises);
|
|
@@ -4044,9 +4288,9 @@ exports.GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
4044
4288
|
}
|
|
4045
4289
|
var _proto = GLTFSceneParser.prototype;
|
|
4046
4290
|
_proto.parse = function parse(context, index) {
|
|
4047
|
-
var _this = this;
|
|
4048
4291
|
var _context_glTF = context.glTF, scenes = _context_glTF.scenes, _context_glTF_scene = _context_glTF.scene, scene = _context_glTF_scene === void 0 ? 0 : _context_glTF_scene, glTFResource = context.glTFResource;
|
|
4049
4292
|
var sceneInfo = scenes[index];
|
|
4293
|
+
var sceneExtensions = sceneInfo.extensions;
|
|
4050
4294
|
var engine = glTFResource.engine;
|
|
4051
4295
|
var isDefaultScene = scene === index;
|
|
4052
4296
|
var sceneNodes = sceneInfo.nodes;
|
|
@@ -4060,30 +4304,15 @@ exports.GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
4060
4304
|
sceneRoot.addChild(childEntity);
|
|
4061
4305
|
}
|
|
4062
4306
|
}
|
|
4063
|
-
// @ts-ignore
|
|
4064
|
-
sceneRoot._hookResource = glTFResource;
|
|
4065
|
-
// @ts-ignore
|
|
4066
|
-
glTFResource._addReferCount(1);
|
|
4067
4307
|
if (isDefaultScene) {
|
|
4068
|
-
glTFResource.
|
|
4308
|
+
glTFResource._defaultSceneRoot = sceneRoot;
|
|
4069
4309
|
}
|
|
4070
4310
|
var promises = new Array();
|
|
4071
4311
|
for(var i1 = 0; i1 < sceneNodes.length; i1++){
|
|
4072
4312
|
promises.push(this._parseEntityComponent(context, sceneNodes[i1]));
|
|
4073
4313
|
}
|
|
4074
4314
|
return Promise.all(promises).then(function() {
|
|
4075
|
-
|
|
4076
|
-
return Promise.all([
|
|
4077
|
-
context.get(exports.GLTFParserType.Skin),
|
|
4078
|
-
context.get(exports.GLTFParserType.Animation)
|
|
4079
|
-
]).then(function(param) {
|
|
4080
|
-
var skins = param[0], animations = param[1];
|
|
4081
|
-
if (skins || animations) {
|
|
4082
|
-
_this._createAnimator(context, animations);
|
|
4083
|
-
}
|
|
4084
|
-
return sceneRoot;
|
|
4085
|
-
});
|
|
4086
|
-
}
|
|
4315
|
+
GLTFParser.executeExtensionsAdditiveAndParse(sceneExtensions, context, sceneRoot, sceneInfo);
|
|
4087
4316
|
return sceneRoot;
|
|
4088
4317
|
});
|
|
4089
4318
|
};
|
|
@@ -4195,28 +4424,6 @@ exports.GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
4195
4424
|
for(var i = 0; i < glTFMeshPrimitives.length; i++)_loop(i);
|
|
4196
4425
|
return Promise.all(promises);
|
|
4197
4426
|
};
|
|
4198
|
-
_proto._createAnimator = function _createAnimator(context, animations) {
|
|
4199
|
-
var defaultSceneRoot = context.glTFResource.defaultSceneRoot;
|
|
4200
|
-
var animator = defaultSceneRoot.addComponent(miniprogram.Animator);
|
|
4201
|
-
var animatorController = new miniprogram.AnimatorController();
|
|
4202
|
-
var layer = new miniprogram.AnimatorControllerLayer("layer");
|
|
4203
|
-
var animatorStateMachine = new miniprogram.AnimatorStateMachine();
|
|
4204
|
-
animatorController.addLayer(layer);
|
|
4205
|
-
animator.animatorController = animatorController;
|
|
4206
|
-
layer.stateMachine = animatorStateMachine;
|
|
4207
|
-
if (animations) {
|
|
4208
|
-
for(var i = 0; i < animations.length; i++){
|
|
4209
|
-
var animationClip = animations[i];
|
|
4210
|
-
var name = animationClip.name;
|
|
4211
|
-
var uniqueName = animatorStateMachine.makeUniqueStateName(name);
|
|
4212
|
-
if (uniqueName !== name) {
|
|
4213
|
-
console.warn("AnimatorState name is existed, name: " + name + " reset to " + uniqueName);
|
|
4214
|
-
}
|
|
4215
|
-
var animatorState = animatorStateMachine.addState(uniqueName);
|
|
4216
|
-
animatorState.clip = animationClip;
|
|
4217
|
-
}
|
|
4218
|
-
}
|
|
4219
|
-
};
|
|
4220
4427
|
_proto._computeLocalBounds = function _computeLocalBounds(skinnedMeshRenderer, mesh, bones, rootBone, inverseBindMatrices) {
|
|
4221
4428
|
var rootBoneIndex = bones.indexOf(rootBone);
|
|
4222
4429
|
if (rootBoneIndex !== -1) {
|
|
@@ -4365,11 +4572,12 @@ exports.GLTFTextureParser = (_GLTFTextureParser = /*#__PURE__*/ function(GLTFPar
|
|
|
4365
4572
|
params: {
|
|
4366
4573
|
mipmap: (_samplerInfo = samplerInfo) == null ? void 0 : _samplerInfo.mipmap
|
|
4367
4574
|
}
|
|
4368
|
-
}).then(function(texture) {
|
|
4575
|
+
}).onProgress(undefined, context._onTaskDetail).then(function(texture) {
|
|
4369
4576
|
texture.name = textureName || imageName || texture.name || "texture_" + index;
|
|
4370
4577
|
useSampler && GLTFUtils.parseSampler(texture, samplerInfo);
|
|
4371
4578
|
return texture;
|
|
4372
4579
|
});
|
|
4580
|
+
context._addTaskCompletePromise(texture);
|
|
4373
4581
|
} else {
|
|
4374
4582
|
var bufferView = glTF.bufferViews[bufferViewIndex];
|
|
4375
4583
|
texture = context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
@@ -4391,6 +4599,8 @@ exports.GLTFTextureParser = (_GLTFTextureParser = /*#__PURE__*/ function(GLTFPar
|
|
|
4391
4599
|
}
|
|
4392
4600
|
return Promise.resolve(texture).then(function(texture) {
|
|
4393
4601
|
GLTFParser.executeExtensionsAdditiveAndParse(extensions, context, texture, textureInfo);
|
|
4602
|
+
// @ts-ignore
|
|
4603
|
+
texture._associationSuperResource(glTFResource);
|
|
4394
4604
|
return texture;
|
|
4395
4605
|
});
|
|
4396
4606
|
};
|
|
@@ -4441,28 +4651,282 @@ exports.GLTFValidator = __decorate([
|
|
|
4441
4651
|
registerGLTFParser(exports.GLTFParserType.Validator)
|
|
4442
4652
|
], exports.GLTFValidator);
|
|
4443
4653
|
|
|
4444
|
-
|
|
4654
|
+
exports.GLTFBufferViewParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
4655
|
+
_inherits(GLTFBufferViewParser, GLTFParser1);
|
|
4656
|
+
function GLTFBufferViewParser() {
|
|
4657
|
+
return GLTFParser1.apply(this, arguments);
|
|
4658
|
+
}
|
|
4659
|
+
var _proto = GLTFBufferViewParser.prototype;
|
|
4660
|
+
_proto.parse = function parse(context, index) {
|
|
4661
|
+
var bufferView = context.glTF.bufferViews[index];
|
|
4662
|
+
var extensions = bufferView.extensions, _bufferView_byteOffset = bufferView.byteOffset, byteOffset = _bufferView_byteOffset === void 0 ? 0 : _bufferView_byteOffset, byteLength = bufferView.byteLength, bufferIndex = bufferView.buffer;
|
|
4663
|
+
return extensions ? GLTFParser.executeExtensionsCreateAndParse(extensions, context, bufferView) : context.get(exports.GLTFParserType.Buffer, bufferIndex).then(function(buffer) {
|
|
4664
|
+
return new Uint8Array(buffer, byteOffset, byteLength);
|
|
4665
|
+
});
|
|
4666
|
+
};
|
|
4667
|
+
return GLTFBufferViewParser;
|
|
4668
|
+
}(GLTFParser);
|
|
4669
|
+
exports.GLTFBufferViewParser = __decorate([
|
|
4670
|
+
registerGLTFParser(exports.GLTFParserType.BufferView)
|
|
4671
|
+
], exports.GLTFBufferViewParser);
|
|
4672
|
+
|
|
4673
|
+
var MeshoptDecoder = function() {
|
|
4674
|
+
var unpack = function unpack(data) {
|
|
4675
|
+
var result = new Uint8Array(data.length);
|
|
4676
|
+
for(var i = 0; i < data.length; ++i){
|
|
4677
|
+
var ch = data.charCodeAt(i);
|
|
4678
|
+
result[i] = ch > 96 ? ch - 97 : ch > 64 ? ch - 39 : ch + 4;
|
|
4679
|
+
}
|
|
4680
|
+
var write = 0;
|
|
4681
|
+
for(var i1 = 0; i1 < data.length; ++i1){
|
|
4682
|
+
result[write++] = result[i1] < 60 ? wasmpack[result[i1]] : (result[i1] - 60) * 64 + result[++i1];
|
|
4683
|
+
}
|
|
4684
|
+
return result.buffer.slice(0, write);
|
|
4685
|
+
};
|
|
4686
|
+
var decode = function decode(fun, target, count, size, source, filter) {
|
|
4687
|
+
var sbrk = instance.exports.sbrk;
|
|
4688
|
+
var count4 = count + 3 & ~3;
|
|
4689
|
+
var tp = sbrk(count4 * size);
|
|
4690
|
+
var sp = sbrk(source.length);
|
|
4691
|
+
var heap = new Uint8Array(instance.exports.memory.buffer);
|
|
4692
|
+
heap.set(source, sp);
|
|
4693
|
+
var res = fun(tp, count, size, sp, source.length);
|
|
4694
|
+
if (res == 0 && filter) {
|
|
4695
|
+
filter(tp, count4, size);
|
|
4696
|
+
}
|
|
4697
|
+
target.set(heap.subarray(tp, tp + count * size));
|
|
4698
|
+
sbrk(tp - sbrk(0));
|
|
4699
|
+
if (res != 0) {
|
|
4700
|
+
throw new Error("Malformed buffer data: " + res);
|
|
4701
|
+
}
|
|
4702
|
+
};
|
|
4703
|
+
var createWorker = function createWorker(url) {
|
|
4704
|
+
var worker = {
|
|
4705
|
+
object: new Worker(url),
|
|
4706
|
+
pending: 0,
|
|
4707
|
+
requests: {}
|
|
4708
|
+
};
|
|
4709
|
+
worker.object.onmessage = function(event) {
|
|
4710
|
+
var data = event.data;
|
|
4711
|
+
worker.pending -= data.count;
|
|
4712
|
+
worker.requests[data.id][data.action](data.value);
|
|
4713
|
+
delete worker.requests[data.id];
|
|
4714
|
+
};
|
|
4715
|
+
return worker;
|
|
4716
|
+
};
|
|
4717
|
+
var initWorkers = function initWorkers(count) {
|
|
4718
|
+
var source = "var instance; var ready = WebAssembly.instantiate(new Uint8Array([" + new Uint8Array(unpack(wasm)) + "]), {})" + ".then(function(result) {instance = result.instance; instance.exports.__wasm_call_ctors();});" + "self.onmessage = workerProcess;" + decode.toString() + workerProcess.toString();
|
|
4719
|
+
var blob = new engineMiniprogramAdapter.Blob([
|
|
4720
|
+
source
|
|
4721
|
+
], {
|
|
4722
|
+
type: "text/javascript"
|
|
4723
|
+
});
|
|
4724
|
+
var url = engineMiniprogramAdapter.URL.createObjectURL(blob);
|
|
4725
|
+
for(var i = 0; i < count; ++i){
|
|
4726
|
+
workers[i] = createWorker(url);
|
|
4727
|
+
}
|
|
4728
|
+
engineMiniprogramAdapter.URL.revokeObjectURL(url);
|
|
4729
|
+
};
|
|
4730
|
+
var decodeWorker = function decodeWorker(count, size, source, mode, filter) {
|
|
4731
|
+
var worker = workers[0];
|
|
4732
|
+
for(var i = 1; i < workers.length; ++i){
|
|
4733
|
+
if (workers[i].pending < worker.pending) {
|
|
4734
|
+
worker = workers[i];
|
|
4735
|
+
}
|
|
4736
|
+
}
|
|
4737
|
+
return new Promise(function(resolve, reject) {
|
|
4738
|
+
var data = new Uint8Array(source);
|
|
4739
|
+
var id = requestId++;
|
|
4740
|
+
worker.pending += count;
|
|
4741
|
+
worker.requests[id] = {
|
|
4742
|
+
resolve: resolve,
|
|
4743
|
+
reject: reject
|
|
4744
|
+
};
|
|
4745
|
+
worker.object.postMessage({
|
|
4746
|
+
id: id,
|
|
4747
|
+
count: count,
|
|
4748
|
+
size: size,
|
|
4749
|
+
source: data,
|
|
4750
|
+
mode: mode,
|
|
4751
|
+
filter: filter
|
|
4752
|
+
}, [
|
|
4753
|
+
data.buffer
|
|
4754
|
+
]);
|
|
4755
|
+
});
|
|
4756
|
+
};
|
|
4757
|
+
var workerProcess = function workerProcess(event) {
|
|
4758
|
+
ready.then(function() {
|
|
4759
|
+
var data = event.data;
|
|
4760
|
+
try {
|
|
4761
|
+
var target = new Uint8Array(data.count * data.size);
|
|
4762
|
+
decode(instance.exports[data.mode], target, data.count, data.size, data.source, instance.exports[data.filter]);
|
|
4763
|
+
self.postMessage({
|
|
4764
|
+
id: data.id,
|
|
4765
|
+
count: data.count,
|
|
4766
|
+
action: "resolve",
|
|
4767
|
+
value: target
|
|
4768
|
+
}, [
|
|
4769
|
+
target.buffer
|
|
4770
|
+
]);
|
|
4771
|
+
} catch (error) {
|
|
4772
|
+
self.postMessage({
|
|
4773
|
+
id: data.id,
|
|
4774
|
+
count: data.count,
|
|
4775
|
+
action: "reject",
|
|
4776
|
+
value: error
|
|
4777
|
+
});
|
|
4778
|
+
}
|
|
4779
|
+
});
|
|
4780
|
+
};
|
|
4781
|
+
var wasm_base = "b9H79Tebbbe8Fv9Gbb9Gvuuuuueu9Giuuub9Geueu9Giuuueuikqbeeedddillviebeoweuec:q;iekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbeY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVbdE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbiL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtblK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbol79IV9Rbrq:P8Yqdbk;3sezu8Jjjjjbcj;eb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Radz1jjjbhwcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhDcbhqinaqae9pmeaDaeaq9RaqaDfae6Egkcsfgocl4cifcd4hxdndndndnaoc9WGgmTmbcbhPcehsawcjdfhzalhHinaraH9Rax6midnaraHaxfgl9RcK6mbczhoinawcj;cbfaogifgoc9WfhOdndndndndnaHaic9WfgAco4fRbbaAci4coG4ciGPlbedibkaO9cb83ibaOcwf9cb83ibxikaOalRblalRbbgAco4gCaCciSgCE86bbaocGfalclfaCfgORbbaAcl4ciGgCaCciSgCE86bbaocVfaOaCfgORbbaAcd4ciGgCaCciSgCE86bbaoc7faOaCfgORbbaAciGgAaAciSgAE86bbaoctfaOaAfgARbbalRbegOco4gCaCciSgCE86bbaoc91faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc4faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc93faAaCfgARbbaOciGgOaOciSgOE86bbaoc94faAaOfgARbbalRbdgOco4gCaCciSgCE86bbaoc95faAaCfgARbbaOcl4ciGgCaCciSgCE86bbaoc96faAaCfgARbbaOcd4ciGgCaCciSgCE86bbaoc97faAaCfgARbbaOciGgOaOciSgOE86bbaoc98faAaOfgORbbalRbiglco4gAaAciSgAE86bbaoc99faOaAfgORbbalcl4ciGgAaAciSgAE86bbaoc9:faOaAfgORbbalcd4ciGgAaAciSgAE86bbaocufaOaAfgoRbbalciGglalciSglE86bbaoalfhlxdkaOalRbwalRbbgAcl4gCaCcsSgCE86bbaocGfalcwfaCfgORbbaAcsGgAaAcsSgAE86bbaocVfaOaAfgORbbalRbegAcl4gCaCcsSgCE86bbaoc7faOaCfgORbbaAcsGgAaAcsSgAE86bbaoctfaOaAfgORbbalRbdgAcl4gCaCcsSgCE86bbaoc91faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc4faOaAfgORbbalRbigAcl4gCaCcsSgCE86bbaoc93faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc94faOaAfgORbbalRblgAcl4gCaCcsSgCE86bbaoc95faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc96faOaAfgORbbalRbvgAcl4gCaCcsSgCE86bbaoc97faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc98faOaAfgORbbalRbogAcl4gCaCcsSgCE86bbaoc99faOaCfgORbbaAcsGgAaAcsSgAE86bbaoc9:faOaAfgORbbalRbrglcl4gAaAcsSgAE86bbaocufaOaAfgoRbbalcsGglalcsSglE86bbaoalfhlxekaOal8Pbb83bbaOcwfalcwf8Pbb83bbalczfhlkdnaiam9pmbaiczfhoaral9RcL0mekkaiam6mialTmidnakTmbawaPfRbbhOcbhoazhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkkazcefhzaPcefgPad6hsalhHaPad9hmexvkkcbhlasceGmdxikalaxad2fhCdnakTmbcbhHcehsawcjdfhminaral9Rax6mialTmdalaxfhlawaHfRbbhOcbhoamhiinaiawcj;cbfaofRbbgAce4cbaAceG9R7aOfgO86bbaiadfhiaocefgoak9hmbkamcefhmaHcefgHad6hsaHad9hmbkaChlxikcbhocehsinaral9Rax6mdalTmealaxfhlaocefgoad6hsadao9hmbkaChlxdkcbhlasceGTmekc9:hoxikabaqad2fawcjdfakad2z1jjjb8Aawawcjdfakcufad2fadz1jjjb8Aakaqfhqalmbkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;ebf8Kjjjjbaok;yzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecjez:jjjjb8AavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:Lvoeue99dud99eud99dndnadcl9hmbaeTmeindndnabcdfgd8Sbb:Yab8Sbbgi:Ygl:l:tabcefgv8Sbbgo:Ygr:l:tgwJbb;:9cawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai86bbdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad86bbdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad86bbabclfhbaecufgembxdkkaeTmbindndnabclfgd8Ueb:Yab8Uebgi:Ygl:l:tabcdfgv8Uebgo:Ygr:l:tgwJb;:FSawawNJbbbbawawJbbbb9GgDEgq:mgkaqaicb9iEalMgwawNakaqaocb9iEarMgqaqNMM:r:vglNJbbbZJbbb:;aDEMgr:lJbbb9p9DTmbar:Ohixekcjjjj94hikadai87ebdndnaqalNJbbbZJbbb:;aqJbbbb9GEMgq:lJbbb9p9DTmbaq:Ohdxekcjjjj94hdkavad87ebdndnawalNJbbbZJbbb:;awJbbbb9GEMgw:lJbbb9p9DTmbaw:Ohdxekcjjjj94hdkabad87ebabcwfhbaecufgembkkk;siliui99iue99dnaeTmbcbhiabhlindndnJ;Zl81Zalcof8UebgvciV:Y:vgoal8Ueb:YNgrJb;:FSNJbbbZJbbb:;arJbbbb9GEMgw:lJbbb9p9DTmbaw:OhDxekcjjjj94hDkalclf8Uebhqalcdf8UebhkabavcefciGaiVcetfaD87ebdndnaoak:YNgwJb;:FSNJbbbZJbbb:;awJbbbb9GEMgx:lJbbb9p9DTmbax:Ohkxekcjjjj94hkkabavcdfciGaiVcetfak87ebdndnaoaq:YNgoJb;:FSNJbbbZJbbb:;aoJbbbb9GEMgx:lJbbb9p9DTmbax:Ohqxekcjjjj94hqkabavcufciGaiVcetfaq87ebdndnJbbjZararN:tawawN:taoaoN:tgrJbbbbarJbbbb9GE:rJb;:FSNJbbbZMgr:lJbbb9p9DTmbar:Ohqxekcjjjj94hqkabavciGaiVcetfaq87ebalcwfhlaiclfhiaecufgembkkk9mbdnadcd4ae2geTmbinababydbgdcwtcw91:Yadce91cjjj;8ifcjjj98G::NUdbabclfhbaecufgembkkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaik;LeeeudndnaeabVciGTmbabhixekdndnadcz9pmbabhixekabhiinaiaeydbBdbaiclfaeclfydbBdbaicwfaecwfydbBdbaicxfaecxfydbBdbaiczfhiaeczfheadc9Wfgdcs0mbkkadcl6mbinaiaeydbBdbaeclfheaiclfhiadc98fgdci0mbkkdnadTmbinaiaeRbb86bbaicefhiaecefheadcufgdmbkkabk;aeedudndnabciGTmbabhixekaecFeGc:b:c:ew2hldndnadcz9pmbabhixekabhiinaialBdbaicxfalBdbaicwfalBdbaiclfalBdbaiczfhiadc9Wfgdcs0mbkkadcl6mbinaialBdbaiclfhiadc98fgdci0mbkkdnadTmbinaiae86bbaicefhiadcufgdmbkkabkkkebcjwklz9Kbb";
|
|
4782
|
+
var wasm_simd = "b9H79TebbbeKl9Gbb9Gvuuuuueu9Giuuub9Geueuikqbbebeedddilve9Weeeviebeoweuec:q;Aekr;leDo9TW9T9VV95dbH9F9F939H79T9F9J9H229F9Jt9VV7bb8A9TW79O9V9Wt9F9KW9J9V9KW9wWVtW949c919M9MWVbdY9TW79O9V9Wt9F9KW9J9V9KW69U9KW949c919M9MWVblE9TW79O9V9Wt9F9KW9J9V9KW69U9KW949tWG91W9U9JWbvL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9p9JtboK9TW79O9V9Wt9F9KW9J9V9KWS9P2tWV9r919HtbrL9TW79O9V9Wt9F9KW9J9V9KWS9P2tWVT949Wbwl79IV9RbDq;t9tqlbzik9:evu8Jjjjjbcz9Rhbcbheincbhdcbhiinabcwfadfaicjuaead4ceGglE86bbaialfhiadcefgdcw9hmbkaec:q:yjjbfai86bbaecitc:q1jjbfab8Piw83ibaecefgecjd9hmbkk;h8JlHud97euo978Jjjjjbcj;kb9Rgv8Kjjjjbc9:hodnadcefal0mbcuhoaiRbbc:Ge9hmbavaialfgrad9Rad;8qbbcj;abad9UhoaicefhldnadTmbaoc;WFbGgocjdaocjd6EhwcbhDinaDae9pmeawaeaD9RaDawfae6Egqcsfgoc9WGgkci2hxakcethmaocl4cifcd4hPabaDad2fhscbhzdnincehHalhOcbhAdninaraO9RaP6miavcj;cbfaAak2fhCaOaPfhlcbhidnakc;ab6mbaral9Rc;Gb6mbcbhoinaCaofhidndndndndnaOaoco4fRbbgXciGPlbedibkaipxbbbbbbbbbbbbbbbbpklbxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklbalczfhlkdndndndndnaXcd4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklzxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklzalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklzalczfhlkdndndndndnaXcl4ciGPlbedibkaipxbbbbbbbbbbbbbbbbpklaxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklaalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaialpbbbpklaalczfhlkdndndndndnaXco4Plbedibkaipxbbbbbbbbbbbbbbbbpkl8WxikaialpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalclfaYpQbfaXc:q:yjjbfRbbfhlxdkaialpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibaXc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgXcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spkl8WalcwfaYpQbfaXc:q:yjjbfRbbfhlxekaialpbbbpkl8Walczfhlkaoc;abfhiaocjefak0meaihoaral9Rc;Fb0mbkkdndnaiak9pmbaici4hoinaral9RcK6mdaCaifhXdndndndndnaOaico4fRbbaocoG4ciGPlbedibkaXpxbbbbbbbbbbbbbbbbpklbxikaXalpbblalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLgQcdp:meaQpmbzeHdOiAlCvXoQrLpxiiiiiiiiiiiiiiiip9ogLpxiiiiiiiiiiiiiiiip8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalclfaYpQbfaKc:q:yjjbfRbbfhlxdkaXalpbbwalpbbbgQclp:meaQpmbzeHdOiAlCvXoQrLpxssssssssssssssssp9ogLpxssssssssssssssssp8JgQp5b9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibaKc:q:yjjbfpbbbgYaYpmbbbbbbbbbbbbbbbbaQp5e9cjF;8;4;W;G;ab9:9cU1:NgKcitc:q1jjbfpbibp9UpmbedilvorzHOACXQLpPaLaQp9spklbalcwfaYpQbfaKc:q:yjjbfRbbfhlxekaXalpbbbpklbalczfhlkaocdfhoaiczfgiak6mbkkalTmbaAci6hHalhOaAcefgohAaoclSmdxekkcbhlaHceGmdkdnakTmbavcjdfazfhiavazfpbdbhYcbhXinaiavcj;cbfaXfgopblbgLcep9TaLpxeeeeeeeeeeeeeeeegQp9op9Hp9rgLaoakfpblbg8Acep9Ta8AaQp9op9Hp9rg8ApmbzeHdOiAlCvXoQrLgEaoamfpblbg3cep9Ta3aQp9op9Hp9rg3aoaxfpblbg5cep9Ta5aQp9op9Hp9rg5pmbzeHdOiAlCvXoQrLg8EpmbezHdiOAlvCXorQLgQaQpmbedibedibedibediaYp9UgYp9AdbbaiadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaEa8EpmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwKDYq8AkEx3m5P8Es8FgLa3a5pmwKDYq8AkEx3m5P8Es8Fg8ApmbezHdiOAlvCXorQLgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfgoaYaLa8ApmwDKYqk8AExm35Ps8E8FgQaQpmbedibedibedibedip9UgYp9AdbbaoadfgoaYaQaQpmlvorlvorlvorlvorp9UgYp9AdbbaoadfgoaYaQaQpmwDqkwDqkwDqkwDqkp9UgYp9AdbbaoadfgoaYaQaQpmxmPsxmPsxmPsxmPsp9UgYp9AdbbaoadfhiaXczfgXak6mbkkazclfgzad6mbkasavcjdfaqad2;8qbbavavcjdfaqcufad2fad;8qbbaqaDfhDc9:hoalmexikkc9:hoxekcbc99aral9Radcaadca0ESEhokavcj;kbf8Kjjjjbaokwbz:bjjjbk;uzeHu8Jjjjjbc;ae9Rgv8Kjjjjbc9:hodnaeci9UgrcHfal0mbcuhoaiRbbgwc;WeGc;Ge9hmbawcsGgDce0mbavc;abfcFecje;8kbavcUf9cu83ibavc8Wf9cu83ibavcyf9cu83ibavcaf9cu83ibavcKf9cu83ibavczf9cu83ibav9cu83iwav9cu83ibaialfc9WfhqaicefgwarfhodnaeTmbcmcsaDceSEhkcbhxcbhmcbhDcbhicbhlindnaoaq9nmbc9:hoxikdndnawRbbgrc;Ve0mbavc;abfalarcl4cu7fcsGcitfgPydlhsaPydbhzdnarcsGgPak9pmbavaiarcu7fcsGcdtfydbaxaPEhraPThPdndnadcd9hmbabaDcetfgHaz87ebaHcdfas87ebaHclfar87ebxekabaDcdtfgHazBdbaHclfasBdbaHcwfarBdbkaxaPfhxavc;abfalcitfgHarBdbaHasBdlavaicdtfarBdbavc;abfalcefcsGglcitfgHazBdbaHarBdlaiaPfhialcefhlxdkdndnaPcsSmbamaPfaPc987fcefhmxekaocefhrao8SbbgPcFeGhHdndnaPcu9mmbarhoxekaocvfhoaHcFbGhHcrhPdninar8SbbgOcFbGaPtaHVhHaOcu9kmearcefhraPcrfgPc8J9hmbxdkkarcefhokaHce4cbaHceG9R7amfhmkdndnadcd9hmbabaDcetfgraz87ebarcdfas87ebarclfam87ebxekabaDcdtfgrazBdbarclfasBdbarcwfamBdbkavc;abfalcitfgramBdbarasBdlavaicdtfamBdbavc;abfalcefcsGglcitfgrazBdbaramBdlaicefhialcefhlxekdnarcpe0mbaxcefgOavaiaqarcsGfRbbgPcl49RcsGcdtfydbaPcz6gHEhravaiaP9RcsGcdtfydbaOaHfgsaPcsGgOEhPaOThOdndnadcd9hmbabaDcetfgzax87ebazcdfar87ebazclfaP87ebxekabaDcdtfgzaxBdbazclfarBdbazcwfaPBdbkavaicdtfaxBdbavc;abfalcitfgzarBdbazaxBdlavaicefgicsGcdtfarBdbavc;abfalcefcsGcitfgzaPBdbazarBdlavaiaHfcsGgicdtfaPBdbavc;abfalcdfcsGglcitfgraxBdbaraPBdlalcefhlaiaOfhiasaOfhxxekaxcbaoRbbgzEgAarc;:eSgrfhsazcsGhCazcl4hXdndnazcs0mbascefhOxekashOavaiaX9RcsGcdtfydbhskdndnaCmbaOcefhxxekaOhxavaiaz9RcsGcdtfydbhOkdndnarTmbaocefhrxekaocdfhrao8SbegHcFeGhPdnaHcu9kmbaocofhAaPcFbGhPcrhodninar8SbbgHcFbGaotaPVhPaHcu9kmearcefhraocrfgoc8J9hmbkaAhrxekarcefhrkaPce4cbaPceG9R7amfgmhAkdndnaXcsSmbarhPxekarcefhPar8SbbgocFeGhHdnaocu9kmbarcvfhsaHcFbGhHcrhodninaP8SbbgrcFbGaotaHVhHarcu9kmeaPcefhPaocrfgoc8J9hmbkashPxekaPcefhPkaHce4cbaHceG9R7amfgmhskdndnaCcsSmbaPhoxekaPcefhoaP8SbbgrcFeGhHdnarcu9kmbaPcvfhOaHcFbGhHcrhrdninao8SbbgPcFbGartaHVhHaPcu9kmeaocefhoarcrfgrc8J9hmbkaOhoxekaocefhokaHce4cbaHceG9R7amfgmhOkdndnadcd9hmbabaDcetfgraA87ebarcdfas87ebarclfaO87ebxekabaDcdtfgraABdbarclfasBdbarcwfaOBdbkavc;abfalcitfgrasBdbaraABdlavaicdtfaABdbavc;abfalcefcsGcitfgraOBdbarasBdlavaicefgicsGcdtfasBdbavc;abfalcdfcsGcitfgraABdbaraOBdlavaiazcz6aXcsSVfgicsGcdtfaOBdbaiaCTaCcsSVfhialcifhlkawcefhwalcsGhlaicsGhiaDcifgDae6mbkkcbc99aoaqSEhokavc;aef8Kjjjjbaok:llevu8Jjjjjbcz9Rhvc9:hodnaecvfal0mbcuhoaiRbbc;:eGc;qe9hmbav9cb83iwaicefhraialfc98fhwdnaeTmbdnadcdSmbcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcdtfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfglBdbaoalBdbaDcefgDae9hmbxdkkcbhDindnaraw6mbc9:skarcefhoar8SbbglcFeGhidndnalcu9mmbaohrxekarcvfhraicFbGhicrhldninao8SbbgdcFbGaltaiVhiadcu9kmeaocefhoalcrfglc8J9hmbxdkkaocefhrkabaDcetfaicd4cbaice4ceG9R7avcwfaiceGcdtVgoydbfgl87ebaoalBdbaDcefgDae9hmbkkcbc99arawSEhokaok:EPliuo97eue978Jjjjjbca9Rhidndnadcl9hmbdnaec98GglTmbcbhvabhdinadadpbbbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpkbbadczfhdavclfgval6mbkkalae9pmeaiaeciGgvcdtgdVcbczad9R;8kbaiabalcdtfglad;8qbbdnavTmbaiaipblbgocKp:RecKp:Sep;6egraocwp:RecKp:Sep;6earp;Geaoczp:RecKp:Sep;6egwp;Gep;Kep;LegDpxbbbbbbbbbbbbbbbbp:2egqarpxbbbjbbbjbbbjbbbjgkp9op9rp;Kegrpxbb;:9cbb;:9cbb;:9cbb;:9cararp;MeaDaDp;Meawaqawakp9op9rp;Kegrarp;Mep;Kep;Kep;Jep;Negwp;Mepxbbn0bbn0bbn0bbn0gqp;KepxFbbbFbbbFbbbFbbbp9oaopxbbbFbbbFbbbFbbbFp9op9qarawp;Meaqp;Kecwp:RepxbFbbbFbbbFbbbFbbp9op9qaDawp;Meaqp;Keczp:RepxbbFbbbFbbbFbbbFbp9op9qpklbkalaiad;8qbbskdnaec98GgxTmbcbhvabhdinadczfglalpbbbgopxbbbbbbFFbbbbbbFFgkp9oadpbbbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpkbbadaDakp9oawaopmbezHdiOAlvCXorQLp9qpkbbadcafhdavclfgvax6mbkkaxae9pmbaiaeciGgvcitgdfcbcaad9R;8kbaiabaxcitfglad;8qbbdnavTmbaiaipblzgopxbbbbbbFFbbbbbbFFgkp9oaipblbgDaopmlvorxmPsCXQL358E8FpxFubbFubbFubbFubbp9op;6eaDaopmbediwDqkzHOAKY8AEgoczp:Sep;6egrp;Geaoczp:Reczp:Sep;6egwp;Gep;Kep;Legopxb;:FSb;:FSb;:FSb;:FSawaopxbbbbbbbbbbbbbbbbp:2egqawpxbbbjbbbjbbbjbbbjgmp9op9rp;Kegwawp;Meaoaop;Mearaqaramp9op9rp;Kegoaop;Mep;Kep;Kep;Jep;Negrp;Mepxbbn0bbn0bbn0bbn0gqp;Keczp:Reawarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9op9qgwaoarp;Meaqp;KepxFFbbFFbbFFbbFFbbp9ogopmwDKYqk8AExm35Ps8E8Fp9qpklzaiaDakp9oawaopmbezHdiOAlvCXorQLp9qpklbkalaiad;8qbbkk;4wllue97euv978Jjjjjbc8W9Rhidnaec98GglTmbcbhvabhoinaiaopbbbgraoczfgwpbbbgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklbaopxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblbpEb:T:j83ibaocwfarp5eaipblbpEe:T:j83ibawaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblbpEd:T:j83ibaocKfakp5eaipblbpEi:T:j83ibaocafhoavclfgval6mbkkdnalae9pmbaiaeciGgvcitgofcbcaao9R;8kbaiabalcitfgwao;8qbbdnavTmbaiaipblbgraipblzgDpmlvorxmPsCXQL358E8Fgqczp:Segkclp:RepklaaipxbbjZbbjZbbjZbbjZpx;Zl81Z;Zl81Z;Zl81Z;Zl81Zakpxibbbibbbibbbibbbp9qp;6ep;NegkaraDpmbediwDqkzHOAKY8AEgrczp:Reczp:Sep;6ep;MegDaDp;Meakarczp:Sep;6ep;Megxaxp;Meakaqczp:Reczp:Sep;6ep;Megqaqp;Mep;Kep;Kep;Lepxbbbbbbbbbbbbbbbbp:4ep;Jepxb;:FSb;:FSb;:FSb;:FSgkp;Mepxbbn0bbn0bbn0bbn0grp;KepxFFbbFFbbFFbbFFbbgmp9oaxakp;Mearp;Keczp:Rep9qgxaqakp;Mearp;Keczp:ReaDakp;Mearp;Keamp9op9qgkpmbezHdiOAlvCXorQLgrp5baipblapEb:T:j83ibaiarp5eaipblapEe:T:j83iwaiaxakpmwDKYqk8AExm35Ps8E8Fgkp5baipblapEd:T:j83izaiakp5eaipblapEi:T:j83iKkawaiao;8qbbkk:Pddiue978Jjjjjbc;ab9Rhidnadcd4ae2glc98GgvTmbcbhdabheinaeaepbbbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepkbbaeczfheadclfgdav6mbkkdnaval9pmbaialciGgdcdtgeVcbc;abae9R;8kbaiabavcdtfgvae;8qbbdnadTmbaiaipblbgocwp:Recwp:Sep;6eaocep:SepxbbjZbbjZbbjZbbjZp:UepxbbjFbbjFbbjFbbjFp9op;Mepklbkavaiae;8qbbkk9teiucbcbydj1jjbgeabcifc98GfgbBdj1jjbdndnabZbcztgd9nmbcuhiabad9RcFFifcz4nbcuSmekaehikaikkkebcjwklz9Tbb";
|
|
4783
|
+
var wasmpack = new Uint8Array([
|
|
4784
|
+
32,
|
|
4785
|
+
0,
|
|
4786
|
+
65,
|
|
4787
|
+
2,
|
|
4788
|
+
1,
|
|
4789
|
+
106,
|
|
4790
|
+
34,
|
|
4791
|
+
33,
|
|
4792
|
+
3,
|
|
4793
|
+
128,
|
|
4794
|
+
11,
|
|
4795
|
+
4,
|
|
4796
|
+
13,
|
|
4797
|
+
64,
|
|
4798
|
+
6,
|
|
4799
|
+
253,
|
|
4800
|
+
10,
|
|
4801
|
+
7,
|
|
4802
|
+
15,
|
|
4803
|
+
116,
|
|
4804
|
+
127,
|
|
4805
|
+
5,
|
|
4806
|
+
8,
|
|
4807
|
+
12,
|
|
4808
|
+
40,
|
|
4809
|
+
16,
|
|
4810
|
+
19,
|
|
4811
|
+
54,
|
|
4812
|
+
20,
|
|
4813
|
+
9,
|
|
4814
|
+
27,
|
|
4815
|
+
255,
|
|
4816
|
+
113,
|
|
4817
|
+
17,
|
|
4818
|
+
42,
|
|
4819
|
+
67,
|
|
4820
|
+
24,
|
|
4821
|
+
23,
|
|
4822
|
+
146,
|
|
4823
|
+
148,
|
|
4824
|
+
18,
|
|
4825
|
+
14,
|
|
4826
|
+
22,
|
|
4827
|
+
45,
|
|
4828
|
+
70,
|
|
4829
|
+
69,
|
|
4830
|
+
56,
|
|
4831
|
+
114,
|
|
4832
|
+
101,
|
|
4833
|
+
21,
|
|
4834
|
+
25,
|
|
4835
|
+
63,
|
|
4836
|
+
75,
|
|
4837
|
+
136,
|
|
4838
|
+
108,
|
|
4839
|
+
28,
|
|
4840
|
+
118,
|
|
4841
|
+
29,
|
|
4842
|
+
73,
|
|
4843
|
+
115
|
|
4844
|
+
]);
|
|
4845
|
+
// @ts-ignore
|
|
4846
|
+
var wasm = miniprogram.SystemInfo._detectSIMDSupported() ? wasm_simd : wasm_base;
|
|
4847
|
+
var instance;
|
|
4848
|
+
var ready = WebAssembly.instantiate(unpack(wasm), {}).then(function(result) {
|
|
4849
|
+
instance = result.instance;
|
|
4850
|
+
instance.exports.__wasm_call_ctors();
|
|
4851
|
+
});
|
|
4852
|
+
var filters = {
|
|
4853
|
+
NONE: "",
|
|
4854
|
+
OCTAHEDRAL: "meshopt_decodeFilterOct",
|
|
4855
|
+
QUATERNION: "meshopt_decodeFilterQuat",
|
|
4856
|
+
EXPONENTIAL: "meshopt_decodeFilterExp"
|
|
4857
|
+
};
|
|
4858
|
+
var decoders = {
|
|
4859
|
+
ATTRIBUTES: "meshopt_decodeVertexBuffer",
|
|
4860
|
+
TRIANGLES: "meshopt_decodeIndexBuffer",
|
|
4861
|
+
INDICES: "meshopt_decodeIndexSequence"
|
|
4862
|
+
};
|
|
4863
|
+
var workers = [];
|
|
4864
|
+
var requestId = 0;
|
|
4865
|
+
return {
|
|
4866
|
+
workerCount: 4,
|
|
4867
|
+
ready: ready,
|
|
4868
|
+
useWorkers: function useWorkers() {
|
|
4869
|
+
initWorkers(this.workerCount);
|
|
4870
|
+
},
|
|
4871
|
+
decodeGltfBuffer: function decodeGltfBuffer(count, stride, source, mode, filter) {
|
|
4872
|
+
if (this.workerCount > 0 && workers.length === 0) this.useWorkers();
|
|
4873
|
+
if (workers.length > 0) return decodeWorker(count, stride, source, decoders[mode], filters[filter]);
|
|
4874
|
+
return ready.then(function() {
|
|
4875
|
+
var target = new Uint8Array(count * stride);
|
|
4876
|
+
decode(instance.exports[decoders[mode]], target, count, stride, source, instance.exports[filters[filter]]);
|
|
4877
|
+
return target;
|
|
4878
|
+
});
|
|
4879
|
+
},
|
|
4880
|
+
release: function release() {
|
|
4881
|
+
for(var i = 0; i < workers.length; i++){
|
|
4882
|
+
workers[i].object.terminate();
|
|
4883
|
+
}
|
|
4884
|
+
}
|
|
4885
|
+
};
|
|
4886
|
+
}();
|
|
4887
|
+
|
|
4888
|
+
exports.GLTFLoader = /*#__PURE__*/ function(Loader1) {
|
|
4445
4889
|
_inherits(GLTFLoader, Loader1);
|
|
4446
4890
|
function GLTFLoader() {
|
|
4447
4891
|
return Loader1.apply(this, arguments);
|
|
4448
4892
|
}
|
|
4449
4893
|
var _proto = GLTFLoader.prototype;
|
|
4894
|
+
_proto.initialize = function initialize(_, configuration) {
|
|
4895
|
+
var _configuration_glTF;
|
|
4896
|
+
var meshOptOptions = (_configuration_glTF = configuration.glTF) == null ? void 0 : _configuration_glTF.meshOpt;
|
|
4897
|
+
if (meshOptOptions) {
|
|
4898
|
+
MeshoptDecoder.workerCount = meshOptOptions.workerCount;
|
|
4899
|
+
MeshoptDecoder.useWorkers();
|
|
4900
|
+
}
|
|
4901
|
+
return Promise.resolve();
|
|
4902
|
+
};
|
|
4450
4903
|
_proto.load = function load(item, resourceManager) {
|
|
4451
|
-
var _params;
|
|
4452
4904
|
var url = item.url;
|
|
4453
4905
|
var params = item.params;
|
|
4454
4906
|
var glTFResource = new GLTFResource(resourceManager.engine, url);
|
|
4455
|
-
var context = new GLTFParserContext(glTFResource, resourceManager,
|
|
4456
|
-
|
|
4907
|
+
var context = new GLTFParserContext(glTFResource, resourceManager, _extends({
|
|
4908
|
+
keepMeshData: false
|
|
4909
|
+
}, params));
|
|
4910
|
+
return new miniprogram.AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
4911
|
+
context._setTaskCompleteProgress = setTaskCompleteProgress;
|
|
4912
|
+
context._setTaskDetailProgress = setTaskDetailProgress;
|
|
4913
|
+
context.parse().then(resolve).catch(reject);
|
|
4914
|
+
});
|
|
4915
|
+
};
|
|
4916
|
+
/**
|
|
4917
|
+
* Release glTF loader memory(includes meshopt workers).
|
|
4918
|
+
* @remarks If use loader after releasing, we should release again.
|
|
4919
|
+
*/ GLTFLoader.release = function release() {
|
|
4920
|
+
MeshoptDecoder.release();
|
|
4457
4921
|
};
|
|
4458
4922
|
return GLTFLoader;
|
|
4459
4923
|
}(miniprogram.Loader);
|
|
4460
|
-
GLTFLoader = __decorate([
|
|
4924
|
+
exports.GLTFLoader = __decorate([
|
|
4461
4925
|
miniprogram.resourceLoader(miniprogram.AssetType.GLTF, [
|
|
4462
4926
|
"gltf",
|
|
4463
4927
|
"glb"
|
|
4464
4928
|
])
|
|
4465
|
-
], GLTFLoader);
|
|
4929
|
+
], exports.GLTFLoader);
|
|
4466
4930
|
|
|
4467
4931
|
var _HDRLoader;
|
|
4468
4932
|
var PI = Math.PI;
|
|
@@ -5100,6 +5564,12 @@ var MaterialLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5100
5564
|
materialShaderData.setTexture(key, texture);
|
|
5101
5565
|
}));
|
|
5102
5566
|
break;
|
|
5567
|
+
case "Boolean":
|
|
5568
|
+
materialShaderData.setInt(key, value ? 1 : 0);
|
|
5569
|
+
break;
|
|
5570
|
+
case "Integer":
|
|
5571
|
+
materialShaderData.setInt(key, Number(value));
|
|
5572
|
+
break;
|
|
5103
5573
|
}
|
|
5104
5574
|
};
|
|
5105
5575
|
var engine = resourceManager.engine;
|
|
@@ -5220,7 +5690,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5220
5690
|
var _proto = SpriteAtlasLoader.prototype;
|
|
5221
5691
|
_proto.load = function load(item, resourceManager) {
|
|
5222
5692
|
var _this = this;
|
|
5223
|
-
return new miniprogram.AssetPromise(function(resolve, reject, _, onCancel) {
|
|
5693
|
+
return new miniprogram.AssetPromise(function(resolve, reject, _, __, onCancel) {
|
|
5224
5694
|
var chainPromises = [];
|
|
5225
5695
|
onCancel(function() {
|
|
5226
5696
|
for(var i = 0; i < chainPromises.length; i++){
|
|
@@ -5235,9 +5705,10 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5235
5705
|
var _loop = function(i) {
|
|
5236
5706
|
var atlasItem = atlasItems[i];
|
|
5237
5707
|
if (atlasItem.img) {
|
|
5708
|
+
var _atlasItem_type;
|
|
5238
5709
|
chainPromises.push(resourceManager.load({
|
|
5239
5710
|
url: miniprogram.Utils.resolveAbsoluteUrl(item.url, atlasItem.img),
|
|
5240
|
-
type: miniprogram.AssetType.Texture2D,
|
|
5711
|
+
type: (_atlasItem_type = atlasItem.type) != null ? _atlasItem_type : miniprogram.AssetType.Texture2D,
|
|
5241
5712
|
params: {
|
|
5242
5713
|
format: format,
|
|
5243
5714
|
mipmap: mipmap
|
|
@@ -5277,7 +5748,7 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5277
5748
|
};
|
|
5278
5749
|
_proto._makeSprite = function _makeSprite(engine, config, texture) {
|
|
5279
5750
|
// Generate a SpriteAtlas object.
|
|
5280
|
-
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border;
|
|
5751
|
+
var region = config.region, atlasRegionOffset = config.atlasRegionOffset, atlasRegion = config.atlasRegion, pivot = config.pivot, border = config.border, width = config.width, height = config.height;
|
|
5281
5752
|
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);
|
|
5282
5753
|
if (texture) {
|
|
5283
5754
|
var invW = 1 / texture.width;
|
|
@@ -5289,6 +5760,8 @@ var SpriteAtlasLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5289
5760
|
}
|
|
5290
5761
|
config.atlasRotated && (sprite.atlasRotated = true);
|
|
5291
5762
|
}
|
|
5763
|
+
isNaN(width) || (sprite.width = width);
|
|
5764
|
+
isNaN(height) || (sprite.height = height);
|
|
5292
5765
|
return sprite;
|
|
5293
5766
|
};
|
|
5294
5767
|
return SpriteAtlasLoader;
|
|
@@ -5307,26 +5780,39 @@ var SpriteLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5307
5780
|
var _proto = SpriteLoader.prototype;
|
|
5308
5781
|
_proto.load = function load(item, resourceManager) {
|
|
5309
5782
|
var _this = this;
|
|
5310
|
-
return
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
if (data.belongToAtlas) {
|
|
5315
|
-
resourceManager// @ts-ignore
|
|
5316
|
-
.getResourceByRef(data.belongToAtlas).then(function(atlas) {
|
|
5317
|
-
resolve(atlas.getSprite(data.fullPath));
|
|
5318
|
-
}).catch(reject);
|
|
5319
|
-
} else if (data.texture) {
|
|
5320
|
-
resourceManager// @ts-ignore
|
|
5321
|
-
.getResourceByRef(data.texture).then(function(texture) {
|
|
5322
|
-
resolve(new miniprogram.Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border));
|
|
5323
|
-
}).catch(reject);
|
|
5324
|
-
} else {
|
|
5325
|
-
resolve(new miniprogram.Sprite(resourceManager.engine, null, data.region, data.pivot, data.border));
|
|
5326
|
-
}
|
|
5327
|
-
}).catch(reject);
|
|
5783
|
+
return this.request(item.url, _extends({}, item, {
|
|
5784
|
+
type: "json"
|
|
5785
|
+
})).then(function(data) {
|
|
5786
|
+
return data.belongToAtlas ? _this._loadFromAtlas(resourceManager, data) : _this._loadFromTexture(resourceManager, data);
|
|
5328
5787
|
});
|
|
5329
5788
|
};
|
|
5789
|
+
_proto._loadFromAtlas = function _loadFromAtlas(resourceManager, data) {
|
|
5790
|
+
var _this = this;
|
|
5791
|
+
return resourceManager// @ts-ignore
|
|
5792
|
+
.getResourceByRef(data.belongToAtlas).then(function(atlas) {
|
|
5793
|
+
return atlas.getSprite(data.fullPath) || _this._loadFromTexture(resourceManager, data);
|
|
5794
|
+
});
|
|
5795
|
+
};
|
|
5796
|
+
_proto._loadFromTexture = function _loadFromTexture(resourceManager, data) {
|
|
5797
|
+
if (data.texture) {
|
|
5798
|
+
return resourceManager// @ts-ignore
|
|
5799
|
+
.getResourceByRef(data.texture).then(function(texture) {
|
|
5800
|
+
var sprite = new miniprogram.Sprite(resourceManager.engine, texture, data.region, data.pivot, data.border);
|
|
5801
|
+
var width = data.width, height = data.height;
|
|
5802
|
+
isNaN(width) || (sprite.width = width);
|
|
5803
|
+
isNaN(height) || (sprite.height = height);
|
|
5804
|
+
return sprite;
|
|
5805
|
+
});
|
|
5806
|
+
} else {
|
|
5807
|
+
return new miniprogram.AssetPromise(function(resolve) {
|
|
5808
|
+
var sprite = new miniprogram.Sprite(resourceManager.engine, null, data.region, data.pivot, data.border);
|
|
5809
|
+
var width = data.width, height = data.height;
|
|
5810
|
+
isNaN(width) || (sprite.width = width);
|
|
5811
|
+
isNaN(height) || (sprite.height = height);
|
|
5812
|
+
resolve(sprite);
|
|
5813
|
+
});
|
|
5814
|
+
}
|
|
5815
|
+
};
|
|
5330
5816
|
return SpriteLoader;
|
|
5331
5817
|
}(miniprogram.Loader);
|
|
5332
5818
|
SpriteLoader = __decorate([
|
|
@@ -5367,15 +5853,19 @@ var Texture2DLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5367
5853
|
var _proto = Texture2DLoader.prototype;
|
|
5368
5854
|
_proto.load = function load(item, resourceManager) {
|
|
5369
5855
|
var _this = this;
|
|
5370
|
-
return new miniprogram.AssetPromise(function(resolve, reject) {
|
|
5856
|
+
return new miniprogram.AssetPromise(function(resolve, reject, setTaskCompleteProgress, setTaskDetailProgress) {
|
|
5371
5857
|
var url = item.url;
|
|
5372
5858
|
var requestConfig = _extends({}, item, {
|
|
5373
5859
|
type: "image"
|
|
5374
5860
|
});
|
|
5375
|
-
_this.request(url, requestConfig).then(function(image) {
|
|
5376
|
-
var
|
|
5377
|
-
var
|
|
5378
|
-
var texture = new miniprogram.Texture2D(resourceManager.engine, image.width, image.height,
|
|
5861
|
+
_this.request(url, requestConfig).onProgress(setTaskCompleteProgress, setTaskDetailProgress).then(function(image) {
|
|
5862
|
+
var _item_params;
|
|
5863
|
+
var _ref = (_item_params = item.params) != null ? _item_params : {}, format = _ref.format, mipmap = _ref.mipmap, anisoLevel = _ref.anisoLevel, wrapModeU = _ref.wrapModeU, wrapModeV = _ref.wrapModeV, filterMode = _ref.filterMode;
|
|
5864
|
+
var texture = new miniprogram.Texture2D(resourceManager.engine, image.width, image.height, format, mipmap);
|
|
5865
|
+
texture.anisoLevel = anisoLevel != null ? anisoLevel : texture.anisoLevel;
|
|
5866
|
+
texture.filterMode = filterMode != null ? filterMode : texture.filterMode;
|
|
5867
|
+
texture.wrapModeU = wrapModeU != null ? wrapModeU : texture.wrapModeU;
|
|
5868
|
+
texture.wrapModeV = wrapModeV != null ? wrapModeV : texture.wrapModeV;
|
|
5379
5869
|
texture.setImageSource(image);
|
|
5380
5870
|
texture.generateMipmaps();
|
|
5381
5871
|
if (url.indexOf("data:") !== 0) {
|
|
@@ -5523,33 +6013,34 @@ var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5523
6013
|
var promises = [];
|
|
5524
6014
|
// parse ambient light
|
|
5525
6015
|
var ambient = data.scene.ambient;
|
|
5526
|
-
|
|
5527
|
-
|
|
5528
|
-
|
|
5529
|
-
// prettier-ignore
|
|
5530
|
-
var customAmbientPromise = resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
5531
|
-
scene.ambientLight = ambientLight;
|
|
5532
|
-
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
5533
|
-
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
5534
|
-
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
5535
|
-
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
5536
|
-
});
|
|
5537
|
-
promises.push(customAmbientPromise);
|
|
5538
|
-
} else if (!useCustomAmbient && ambient.ambientLight) {
|
|
5539
|
-
// @ts-ignore
|
|
5540
|
-
// prettier-ignore
|
|
5541
|
-
var ambientLightPromise = resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
5542
|
-
scene.ambientLight = ambientLight;
|
|
5543
|
-
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
5544
|
-
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
5545
|
-
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
5546
|
-
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
5547
|
-
});
|
|
5548
|
-
promises.push(ambientLightPromise);
|
|
5549
|
-
} else {
|
|
6016
|
+
if (ambient) {
|
|
6017
|
+
var useCustomAmbient = ambient.specularMode === "Custom";
|
|
6018
|
+
var useSH = ambient.diffuseMode === miniprogram.DiffuseMode.SphericalHarmonics;
|
|
5550
6019
|
scene.ambientLight.diffuseIntensity = ambient.diffuseIntensity;
|
|
5551
6020
|
scene.ambientLight.specularIntensity = ambient.specularIntensity;
|
|
6021
|
+
scene.ambientLight.diffuseMode = ambient.diffuseMode;
|
|
5552
6022
|
scene.ambientLight.diffuseSolidColor.copyFrom(ambient.diffuseSolidColor);
|
|
6023
|
+
scene.ambientLight.specularTextureDecodeRGBM = true;
|
|
6024
|
+
if (useCustomAmbient && ambient.customAmbientLight) {
|
|
6025
|
+
promises.push(// @ts-ignore
|
|
6026
|
+
resourceManager.getResourceByRef(ambient.customAmbientLight).then(function(ambientLight) {
|
|
6027
|
+
var _ambientLight;
|
|
6028
|
+
scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
|
|
6029
|
+
}));
|
|
6030
|
+
}
|
|
6031
|
+
if (ambient.ambientLight && (!useCustomAmbient || useSH)) {
|
|
6032
|
+
promises.push(// @ts-ignore
|
|
6033
|
+
resourceManager.getResourceByRef(ambient.ambientLight).then(function(ambientLight) {
|
|
6034
|
+
if (!useCustomAmbient) {
|
|
6035
|
+
var _ambientLight;
|
|
6036
|
+
scene.ambientLight.specularTexture = (_ambientLight = ambientLight) == null ? void 0 : _ambientLight.specularTexture;
|
|
6037
|
+
}
|
|
6038
|
+
if (useSH) {
|
|
6039
|
+
var _ambientLight1;
|
|
6040
|
+
scene.ambientLight.diffuseSphericalHarmonics = (_ambientLight1 = ambientLight) == null ? void 0 : _ambientLight1.diffuseSphericalHarmonics;
|
|
6041
|
+
}
|
|
6042
|
+
}));
|
|
6043
|
+
}
|
|
5553
6044
|
}
|
|
5554
6045
|
var background = data.scene.background;
|
|
5555
6046
|
scene.background.mode = background.mode;
|
|
@@ -5591,6 +6082,9 @@ var SceneLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
5591
6082
|
if (shadow.shadowResolution != undefined) scene.shadowResolution = shadow.shadowResolution;
|
|
5592
6083
|
if (shadow.shadowDistance != undefined) scene.shadowDistance = shadow.shadowDistance;
|
|
5593
6084
|
if (shadow.shadowCascades != undefined) scene.shadowCascades = shadow.shadowCascades;
|
|
6085
|
+
var _shadow_shadowTwoCascadeSplits;
|
|
6086
|
+
scene.shadowTwoCascadeSplits = (_shadow_shadowTwoCascadeSplits = shadow.shadowTwoCascadeSplits) != null ? _shadow_shadowTwoCascadeSplits : scene.shadowTwoCascadeSplits;
|
|
6087
|
+
shadow.shadowFourCascadeSplits && scene.shadowFourCascadeSplits.copyFrom(shadow.shadowFourCascadeSplits);
|
|
5594
6088
|
}
|
|
5595
6089
|
return Promise.all(promises).then(function() {
|
|
5596
6090
|
resolve(scene);
|
|
@@ -5606,13 +6100,13 @@ SceneLoader = __decorate([
|
|
|
5606
6100
|
"scene"
|
|
5607
6101
|
], true)
|
|
5608
6102
|
], SceneLoader);
|
|
5609
|
-
ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item
|
|
6103
|
+
ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _async_to_generator(function(instance, item) {
|
|
5610
6104
|
var props;
|
|
5611
6105
|
return __generator(this, function(_state) {
|
|
5612
6106
|
props = item.props;
|
|
5613
6107
|
if (!props.font) {
|
|
5614
6108
|
// @ts-ignore
|
|
5615
|
-
instance.font = miniprogram.Font.createFromOS(engine, props.fontFamily || "Arial");
|
|
6109
|
+
instance.font = miniprogram.Font.createFromOS(instance.engine, props.fontFamily || "Arial");
|
|
5616
6110
|
}
|
|
5617
6111
|
return [
|
|
5618
6112
|
2,
|
|
@@ -5621,170 +6115,6 @@ ReflectionParser.registerCustomParseComponent("TextRenderer", /*#__PURE__*/ _asy
|
|
|
5621
6115
|
});
|
|
5622
6116
|
}));
|
|
5623
6117
|
|
|
5624
|
-
var _KHR_draco_mesh_compression;
|
|
5625
|
-
var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
5626
|
-
_inherits(KHR_draco_mesh_compression1, GLTFExtensionParser1);
|
|
5627
|
-
function KHR_draco_mesh_compression1() {
|
|
5628
|
-
return GLTFExtensionParser1.apply(this, arguments);
|
|
5629
|
-
}
|
|
5630
|
-
var _proto = KHR_draco_mesh_compression1.prototype;
|
|
5631
|
-
_proto.createAndParse = function createAndParse(context, schema, glTFPrimitive, glTFMesh) {
|
|
5632
|
-
var _this = this;
|
|
5633
|
-
this._initialize();
|
|
5634
|
-
var glTF = context.glTF, engine = context.glTFResource.engine;
|
|
5635
|
-
var bufferViews = glTF.bufferViews, accessors = glTF.accessors;
|
|
5636
|
-
var bufferViewIndex = schema.bufferView, gltfAttributeMap = schema.attributes;
|
|
5637
|
-
var attributeMap = {};
|
|
5638
|
-
var attributeTypeMap = {};
|
|
5639
|
-
for(var attributeName in gltfAttributeMap){
|
|
5640
|
-
attributeMap[attributeName] = gltfAttributeMap[attributeName];
|
|
5641
|
-
}
|
|
5642
|
-
for(var attributeName1 in glTFPrimitive.attributes){
|
|
5643
|
-
if (gltfAttributeMap[attributeName1] !== undefined) {
|
|
5644
|
-
var accessorDef = accessors[glTFPrimitive.attributes[attributeName1]];
|
|
5645
|
-
attributeTypeMap[attributeName1] = GLTFUtils.getComponentType(accessorDef.componentType).name;
|
|
5646
|
-
}
|
|
5647
|
-
}
|
|
5648
|
-
var indexAccessor = accessors[glTFPrimitive.indices];
|
|
5649
|
-
var indexType = GLTFUtils.getComponentType(indexAccessor.componentType).name;
|
|
5650
|
-
var taskConfig = {
|
|
5651
|
-
attributeIDs: attributeMap,
|
|
5652
|
-
attributeTypes: attributeTypeMap,
|
|
5653
|
-
useUniqueIDs: true,
|
|
5654
|
-
indexType: indexType
|
|
5655
|
-
};
|
|
5656
|
-
return context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
5657
|
-
var buffer = GLTFUtils.getBufferViewData(bufferViews[bufferViewIndex], buffers);
|
|
5658
|
-
return KHR_draco_mesh_compression._decoder.decode(buffer, taskConfig).then(function(decodedGeometry) {
|
|
5659
|
-
var mesh = new miniprogram.ModelMesh(engine, glTFMesh.name);
|
|
5660
|
-
return _this._parseMeshFromGLTFPrimitiveDraco(mesh, glTFMesh, glTFPrimitive, glTF, function(attributeSemantic) {
|
|
5661
|
-
for(var j = 0; j < decodedGeometry.attributes.length; j++){
|
|
5662
|
-
if (decodedGeometry.attributes[j].name === attributeSemantic) {
|
|
5663
|
-
return decodedGeometry.attributes[j].array;
|
|
5664
|
-
}
|
|
5665
|
-
}
|
|
5666
|
-
return null;
|
|
5667
|
-
}, function(attributeSemantic, shapeIndex) {
|
|
5668
|
-
throw "BlendShape animation is not supported when using draco.";
|
|
5669
|
-
}, function() {
|
|
5670
|
-
return decodedGeometry.index.array;
|
|
5671
|
-
}, context.keepMeshData);
|
|
5672
|
-
});
|
|
5673
|
-
});
|
|
5674
|
-
};
|
|
5675
|
-
_proto._initialize = function _initialize() {
|
|
5676
|
-
if (!KHR_draco_mesh_compression._decoder) {
|
|
5677
|
-
KHR_draco_mesh_compression._decoder = new miniprogram$3.DRACODecoder();
|
|
5678
|
-
}
|
|
5679
|
-
};
|
|
5680
|
-
_proto._parseMeshFromGLTFPrimitiveDraco = function _parseMeshFromGLTFPrimitiveDraco(mesh, gltfMesh, gltfPrimitive, gltf, getVertexBufferData, getBlendShapeData, getIndexBufferData, keepMeshData) {
|
|
5681
|
-
var attributes = gltfPrimitive.attributes, targets = gltfPrimitive.targets, indices = gltfPrimitive.indices, mode = gltfPrimitive.mode;
|
|
5682
|
-
var vertexCount;
|
|
5683
|
-
var accessors = gltf.accessors;
|
|
5684
|
-
var accessor = accessors[attributes["POSITION"]];
|
|
5685
|
-
var positionBuffer = getVertexBufferData("POSITION");
|
|
5686
|
-
var positions = GLTFUtils.floatBufferToVector3Array(positionBuffer);
|
|
5687
|
-
mesh.setPositions(positions);
|
|
5688
|
-
var bounds = mesh.bounds;
|
|
5689
|
-
vertexCount = accessor.count;
|
|
5690
|
-
if (accessor.min && accessor.max) {
|
|
5691
|
-
bounds.min.copyFromArray(accessor.min);
|
|
5692
|
-
bounds.max.copyFromArray(accessor.max);
|
|
5693
|
-
} else {
|
|
5694
|
-
var position = KHR_draco_mesh_compression._tempVector3;
|
|
5695
|
-
var min = bounds.min, max = bounds.max;
|
|
5696
|
-
min.set(Number.MAX_VALUE, Number.MAX_VALUE, Number.MAX_VALUE);
|
|
5697
|
-
max.set(-Number.MAX_VALUE, -Number.MAX_VALUE, -Number.MAX_VALUE);
|
|
5698
|
-
var stride = positionBuffer.length / vertexCount;
|
|
5699
|
-
for(var j = 0; j < vertexCount; j++){
|
|
5700
|
-
var offset = j * stride;
|
|
5701
|
-
position.copyFromArray(positionBuffer, offset);
|
|
5702
|
-
miniprogram$1.Vector3.min(min, position, min);
|
|
5703
|
-
miniprogram$1.Vector3.max(max, position, max);
|
|
5704
|
-
}
|
|
5705
|
-
}
|
|
5706
|
-
for(var attributeSemantic in attributes){
|
|
5707
|
-
if (attributeSemantic === "POSITION") {
|
|
5708
|
-
continue;
|
|
5709
|
-
}
|
|
5710
|
-
var bufferData = getVertexBufferData(attributeSemantic);
|
|
5711
|
-
switch(attributeSemantic){
|
|
5712
|
-
case "NORMAL":
|
|
5713
|
-
var normals = GLTFUtils.floatBufferToVector3Array(bufferData);
|
|
5714
|
-
mesh.setNormals(normals);
|
|
5715
|
-
break;
|
|
5716
|
-
case "TEXCOORD_0":
|
|
5717
|
-
var texturecoords = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5718
|
-
mesh.setUVs(texturecoords, 0);
|
|
5719
|
-
break;
|
|
5720
|
-
case "TEXCOORD_1":
|
|
5721
|
-
var texturecoords1 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5722
|
-
mesh.setUVs(texturecoords1, 1);
|
|
5723
|
-
break;
|
|
5724
|
-
case "TEXCOORD_2":
|
|
5725
|
-
var texturecoords2 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5726
|
-
mesh.setUVs(texturecoords2, 2);
|
|
5727
|
-
break;
|
|
5728
|
-
case "TEXCOORD_3":
|
|
5729
|
-
var texturecoords3 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5730
|
-
mesh.setUVs(texturecoords3, 3);
|
|
5731
|
-
break;
|
|
5732
|
-
case "TEXCOORD_4":
|
|
5733
|
-
var texturecoords4 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5734
|
-
mesh.setUVs(texturecoords4, 4);
|
|
5735
|
-
break;
|
|
5736
|
-
case "TEXCOORD_5":
|
|
5737
|
-
var texturecoords5 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5738
|
-
mesh.setUVs(texturecoords5, 5);
|
|
5739
|
-
break;
|
|
5740
|
-
case "TEXCOORD_6":
|
|
5741
|
-
var texturecoords6 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5742
|
-
mesh.setUVs(texturecoords6, 6);
|
|
5743
|
-
break;
|
|
5744
|
-
case "TEXCOORD_7":
|
|
5745
|
-
var texturecoords7 = GLTFUtils.floatBufferToVector2Array(bufferData);
|
|
5746
|
-
mesh.setUVs(texturecoords7, 7);
|
|
5747
|
-
break;
|
|
5748
|
-
case "COLOR_0":
|
|
5749
|
-
var colors = GLTFUtils.floatBufferToColorArray(bufferData, accessors[attributes["COLOR_0"]].type === AccessorType.VEC3);
|
|
5750
|
-
mesh.setColors(colors);
|
|
5751
|
-
break;
|
|
5752
|
-
case "TANGENT":
|
|
5753
|
-
var tangents = GLTFUtils.floatBufferToVector4Array(bufferData);
|
|
5754
|
-
mesh.setTangents(tangents);
|
|
5755
|
-
break;
|
|
5756
|
-
case "JOINTS_0":
|
|
5757
|
-
var joints = GLTFUtils.floatBufferToVector4Array(bufferData);
|
|
5758
|
-
mesh.setBoneIndices(joints);
|
|
5759
|
-
break;
|
|
5760
|
-
case "WEIGHTS_0":
|
|
5761
|
-
var weights = GLTFUtils.floatBufferToVector4Array(bufferData);
|
|
5762
|
-
mesh.setBoneWeights(weights);
|
|
5763
|
-
break;
|
|
5764
|
-
}
|
|
5765
|
-
}
|
|
5766
|
-
// Indices
|
|
5767
|
-
if (indices !== undefined) {
|
|
5768
|
-
var indexAccessor = gltf.accessors[indices];
|
|
5769
|
-
var indexData = getIndexBufferData();
|
|
5770
|
-
mesh.setIndices(indexData);
|
|
5771
|
-
mesh.addSubMesh(0, indexAccessor.count, mode);
|
|
5772
|
-
} else {
|
|
5773
|
-
mesh.addSubMesh(0, vertexCount, mode);
|
|
5774
|
-
}
|
|
5775
|
-
// BlendShapes
|
|
5776
|
-
targets && exports.GLTFMeshParser._createBlendShape(mesh, null, gltfMesh, accessors, targets, getBlendShapeData);
|
|
5777
|
-
mesh.uploadData(!keepMeshData);
|
|
5778
|
-
return Promise.resolve(mesh);
|
|
5779
|
-
};
|
|
5780
|
-
return KHR_draco_mesh_compression1;
|
|
5781
|
-
}(GLTFExtensionParser), function() {
|
|
5782
|
-
_KHR_draco_mesh_compression._tempVector3 = new miniprogram$1.Vector3();
|
|
5783
|
-
}(), _KHR_draco_mesh_compression);
|
|
5784
|
-
KHR_draco_mesh_compression = __decorate([
|
|
5785
|
-
registerGLTFExtension("KHR_draco_mesh_compression", exports.GLTFExtensionMode.CreateAndParse)
|
|
5786
|
-
], KHR_draco_mesh_compression);
|
|
5787
|
-
|
|
5788
6118
|
var KHR_lights_punctual = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
5789
6119
|
_inherits(KHR_lights_punctual, GLTFExtensionParser1);
|
|
5790
6120
|
function KHR_lights_punctual() {
|
|
@@ -5959,7 +6289,7 @@ var KHR_materials_variants = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
|
5959
6289
|
var _glTFResource;
|
|
5960
6290
|
var _context_glTF = context.glTF, _context_glTF_extensions = _context_glTF.extensions, _context_glTF_extensions_KHR_materials_variants = _context_glTF_extensions.KHR_materials_variants, variantNames = _context_glTF_extensions_KHR_materials_variants.variants, glTFResource = context.glTFResource;
|
|
5961
6291
|
var mappings = schema.mappings;
|
|
5962
|
-
(_glTFResource = glTFResource).
|
|
6292
|
+
(_glTFResource = glTFResource)._extensionsData || (_glTFResource._extensionsData = {});
|
|
5963
6293
|
var extensionData = [];
|
|
5964
6294
|
glTFResource.extensionsData.variants = extensionData;
|
|
5965
6295
|
for(var i = 0; i < mappings.length; i++)_loop(i);
|
|
@@ -5989,7 +6319,7 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
|
5989
6319
|
var _proto = KHR_texture_basisu.prototype;
|
|
5990
6320
|
_proto.createAndParse = function createAndParse(context, schema, textureInfo) {
|
|
5991
6321
|
return _async_to_generator(function() {
|
|
5992
|
-
var glTF, glTFResource, engine, url, sampler, textureName, source, _glTF_images_source, uri, bufferViewIndex, mimeType, imageName, samplerInfo, index, bufferView;
|
|
6322
|
+
var glTF, glTFResource, engine, url, sampler, textureName, source, _glTF_images_source, uri, bufferViewIndex, mimeType, imageName, samplerInfo, index, promise, bufferView;
|
|
5993
6323
|
return __generator(this, function(_state) {
|
|
5994
6324
|
glTF = context.glTF, glTFResource = context.glTFResource;
|
|
5995
6325
|
engine = glTFResource.engine, url = glTFResource.url;
|
|
@@ -5999,20 +6329,22 @@ var KHR_texture_basisu = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
|
5999
6329
|
samplerInfo = sampler !== undefined && GLTFUtils.getSamplerInfo(glTF.samplers[sampler]);
|
|
6000
6330
|
if (uri) {
|
|
6001
6331
|
index = uri.lastIndexOf(".");
|
|
6332
|
+
promise = engine.resourceManager.load({
|
|
6333
|
+
url: miniprogram.Utils.resolveAbsoluteUrl(url, uri),
|
|
6334
|
+
type: miniprogram.AssetType.KTX2
|
|
6335
|
+
}).onProgress(undefined, context._onTaskDetail).then(function(texture) {
|
|
6336
|
+
if (!texture.name) {
|
|
6337
|
+
texture.name = textureName || imageName || "texture_" + index;
|
|
6338
|
+
}
|
|
6339
|
+
if (sampler !== undefined) {
|
|
6340
|
+
GLTFUtils.parseSampler(texture, samplerInfo);
|
|
6341
|
+
}
|
|
6342
|
+
return texture;
|
|
6343
|
+
});
|
|
6344
|
+
context._addTaskCompletePromise(promise);
|
|
6002
6345
|
return [
|
|
6003
6346
|
2,
|
|
6004
|
-
|
|
6005
|
-
url: miniprogram.Utils.resolveAbsoluteUrl(url, uri),
|
|
6006
|
-
type: miniprogram.AssetType.KTX2
|
|
6007
|
-
}).then(function(texture) {
|
|
6008
|
-
if (!texture.name) {
|
|
6009
|
-
texture.name = textureName || imageName || "texture_" + index;
|
|
6010
|
-
}
|
|
6011
|
-
if (sampler !== undefined) {
|
|
6012
|
-
GLTFUtils.parseSampler(texture, samplerInfo);
|
|
6013
|
-
}
|
|
6014
|
-
return texture;
|
|
6015
|
-
})
|
|
6347
|
+
promise
|
|
6016
6348
|
];
|
|
6017
6349
|
} else {
|
|
6018
6350
|
bufferView = glTF.bufferViews[bufferViewIndex];
|
|
@@ -6082,7 +6414,9 @@ var GALACEAN_materials_remap = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
|
6082
6414
|
_proto.createAndParse = function createAndParse(context, schema) {
|
|
6083
6415
|
var engine = context.glTFResource.engine;
|
|
6084
6416
|
// @ts-ignore
|
|
6085
|
-
|
|
6417
|
+
var promise = engine.resourceManager.getResourceByRef(schema);
|
|
6418
|
+
context._addTaskCompletePromise(promise);
|
|
6419
|
+
return promise;
|
|
6086
6420
|
};
|
|
6087
6421
|
return GALACEAN_materials_remap;
|
|
6088
6422
|
}(GLTFExtensionParser);
|
|
@@ -6113,6 +6447,47 @@ GALACEAN_animation_event = __decorate([
|
|
|
6113
6447
|
registerGLTFExtension("GALACEAN_animation_event", exports.GLTFExtensionMode.AdditiveParse)
|
|
6114
6448
|
], GALACEAN_animation_event);
|
|
6115
6449
|
|
|
6450
|
+
var EXT_meshopt_compression = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
6451
|
+
_inherits(EXT_meshopt_compression, GLTFExtensionParser1);
|
|
6452
|
+
function EXT_meshopt_compression() {
|
|
6453
|
+
return GLTFExtensionParser1.apply(this, arguments);
|
|
6454
|
+
}
|
|
6455
|
+
var _proto = EXT_meshopt_compression.prototype;
|
|
6456
|
+
_proto.createAndParse = function createAndParse(context, schema) {
|
|
6457
|
+
return context.get(exports.GLTFParserType.Buffer, schema.buffer).then(function(arrayBuffer) {
|
|
6458
|
+
return MeshoptDecoder.decodeGltfBuffer(schema.count, schema.byteStride, new Uint8Array(arrayBuffer, schema.byteOffset, schema.byteLength), schema.mode, schema.filter);
|
|
6459
|
+
});
|
|
6460
|
+
};
|
|
6461
|
+
return EXT_meshopt_compression;
|
|
6462
|
+
}(GLTFExtensionParser);
|
|
6463
|
+
EXT_meshopt_compression = __decorate([
|
|
6464
|
+
registerGLTFExtension("EXT_meshopt_compression", exports.GLTFExtensionMode.CreateAndParse)
|
|
6465
|
+
], EXT_meshopt_compression);
|
|
6466
|
+
|
|
6467
|
+
var KHR_materials_anisotropy = /*#__PURE__*/ function(GLTFExtensionParser1) {
|
|
6468
|
+
_inherits(KHR_materials_anisotropy, GLTFExtensionParser1);
|
|
6469
|
+
function KHR_materials_anisotropy() {
|
|
6470
|
+
return GLTFExtensionParser1.apply(this, arguments);
|
|
6471
|
+
}
|
|
6472
|
+
var _proto = KHR_materials_anisotropy.prototype;
|
|
6473
|
+
_proto.additiveParse = function additiveParse(context, material, schema) {
|
|
6474
|
+
var _schema_anisotropyStrength = schema.anisotropyStrength, anisotropyStrength = _schema_anisotropyStrength === void 0 ? 0 : _schema_anisotropyStrength, _schema_anisotropyRotation = schema.anisotropyRotation, anisotropyRotation = _schema_anisotropyRotation === void 0 ? 0 : _schema_anisotropyRotation, anisotropyTexture = schema.anisotropyTexture;
|
|
6475
|
+
material.anisotropy = anisotropyStrength;
|
|
6476
|
+
material.anisotropyRotation = anisotropyRotation;
|
|
6477
|
+
if (anisotropyTexture) {
|
|
6478
|
+
exports.GLTFMaterialParser._checkOtherTextureTransform(anisotropyTexture, "Anisotropy texture");
|
|
6479
|
+
context.get(exports.GLTFParserType.Texture, anisotropyTexture.index).then(function(texture) {
|
|
6480
|
+
material.anisotropyTexture = texture;
|
|
6481
|
+
});
|
|
6482
|
+
}
|
|
6483
|
+
};
|
|
6484
|
+
return KHR_materials_anisotropy;
|
|
6485
|
+
}(GLTFExtensionParser);
|
|
6486
|
+
KHR_materials_anisotropy = __decorate([
|
|
6487
|
+
registerGLTFExtension("KHR_materials_anisotropy", exports.GLTFExtensionMode.AdditiveParse)
|
|
6488
|
+
], KHR_materials_anisotropy);
|
|
6489
|
+
|
|
6490
|
+
exports.BufferInfo = BufferInfo;
|
|
6116
6491
|
exports.ComponentMap = ComponentMap;
|
|
6117
6492
|
exports.GLTFExtensionParser = GLTFExtensionParser;
|
|
6118
6493
|
exports.GLTFParser = GLTFParser;
|