@galacean/engine-loader 1.1.0-beta.12 → 1.1.0-beta.14
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 +23 -27
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +23 -27
- package/dist/module.js +23 -27
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/GLTFLoader.d.ts +1 -0
- package/types/gltf/parser/GLTFParserContext.d.ts +3 -2
- package/types/ktx2/KTX2Loader.d.ts +4 -3
package/dist/main.js
CHANGED
|
@@ -293,7 +293,7 @@ exports.MeshDecoder = /*#__PURE__*/ function() {
|
|
|
293
293
|
var encodedMeshData = JSON.parse(jsonDataString);
|
|
294
294
|
// @ts-ignore Vector3 is not compatible with {x: number, y: number, z: number}.
|
|
295
295
|
encodedMeshData.bounds && modelMesh.bounds.copyFrom(encodedMeshData.bounds);
|
|
296
|
-
var offset = Math.ceil(bufferReader.
|
|
296
|
+
var offset = Math.ceil(bufferReader.position / 4) * 4;
|
|
297
297
|
var buffer = bufferReader.data.buffer;
|
|
298
298
|
var byteOffset = bufferReader.data.byteOffset;
|
|
299
299
|
var float32Array = new Float32Array(buffer, encodedMeshData.positions.start + offset + byteOffset, (encodedMeshData.positions.end - encodedMeshData.positions.start) / 4);
|
|
@@ -1546,10 +1546,10 @@ var TextureWrapMode;
|
|
|
1546
1546
|
/**
|
|
1547
1547
|
* @internal
|
|
1548
1548
|
*/ var GLTFParserContext = /*#__PURE__*/ function() {
|
|
1549
|
-
function GLTFParserContext(glTFResource, resourceManager,
|
|
1549
|
+
function GLTFParserContext(glTFResource, resourceManager, params) {
|
|
1550
1550
|
this.glTFResource = glTFResource;
|
|
1551
1551
|
this.resourceManager = resourceManager;
|
|
1552
|
-
this.
|
|
1552
|
+
this.params = params;
|
|
1553
1553
|
this.accessorBufferCache = {};
|
|
1554
1554
|
this._resourceCache = new Map();
|
|
1555
1555
|
this.contentRestorer = new GLTFContentRestorer(glTFResource);
|
|
@@ -2247,7 +2247,7 @@ var SupercompressionScheme;
|
|
|
2247
2247
|
alphaSliceByteLength: sgdReader.nextUint32()
|
|
2248
2248
|
};
|
|
2249
2249
|
}
|
|
2250
|
-
var endpointsByteOffset = sgdByteOffset + sgdReader.
|
|
2250
|
+
var endpointsByteOffset = sgdByteOffset + sgdReader.position;
|
|
2251
2251
|
var selectorsByteOffset = endpointsByteOffset + endpointsByteLength;
|
|
2252
2252
|
var tablesByteOffset = selectorsByteOffset + selectorsByteLength;
|
|
2253
2253
|
var extendedByteOffset = tablesByteOffset + tablesByteLength;
|
|
@@ -2907,6 +2907,7 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2907
2907
|
_proto.initialize = function initialize(engine, configuration) {
|
|
2908
2908
|
if (configuration.ktx2Loader) {
|
|
2909
2909
|
var options = configuration.ktx2Loader;
|
|
2910
|
+
if (options.priorityFormats) exports.KTX2Loader._priorityFormats = options.priorityFormats;
|
|
2910
2911
|
if (this._isKhronosSupported(options.priorityFormats, engine) && options.workerCount !== 0) {
|
|
2911
2912
|
return exports.KTX2Loader._getKhronosTranscoder(options.workerCount).init();
|
|
2912
2913
|
} else {
|
|
@@ -2935,17 +2936,7 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2935
2936
|
exports.KTX2TargetFormat.PVRTC,
|
|
2936
2937
|
exports.KTX2TargetFormat.R8G8B8A8
|
|
2937
2938
|
];
|
|
2938
|
-
|
|
2939
|
-
if (Array.isArray(priorityFormats[0])) {
|
|
2940
|
-
for(var i = 0; i < priorityFormats.length; i++){
|
|
2941
|
-
supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats[i]));
|
|
2942
|
-
}
|
|
2943
|
-
} else {
|
|
2944
|
-
supportedList.push(exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats));
|
|
2945
|
-
}
|
|
2946
|
-
return supportedList.every(function(format) {
|
|
2947
|
-
return KhronosTranscoder.transcoderMap[format];
|
|
2948
|
-
});
|
|
2939
|
+
return !!KhronosTranscoder.transcoderMap[exports.KTX2Loader._detectSupportedFormat(engine._hardwareRenderer, priorityFormats)];
|
|
2949
2940
|
};
|
|
2950
2941
|
/**
|
|
2951
2942
|
* Destroy ktx2 transcoder worker.
|
|
@@ -2959,7 +2950,8 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
2959
2950
|
/** @internal */ KTX2Loader1._parseBuffer = function _parseBuffer(buffer, engine, params) {
|
|
2960
2951
|
var _params;
|
|
2961
2952
|
var ktx2Container = new KTX2Container(buffer);
|
|
2962
|
-
var
|
|
2953
|
+
var _params_priorityFormats;
|
|
2954
|
+
var formatPriorities = (_params_priorityFormats = (_params = params) == null ? void 0 : _params.priorityFormats) != null ? _params_priorityFormats : exports.KTX2Loader._priorityFormats;
|
|
2963
2955
|
var targetFormat = exports.KTX2Loader._decideTargetFormat(engine, ktx2Container, formatPriorities);
|
|
2964
2956
|
var transcodeResultPromise;
|
|
2965
2957
|
if (exports.KTX2Loader._isBinomialInit || !KhronosTranscoder.transcoderMap[targetFormat] || !ktx2Container.isUASTC) {
|
|
@@ -3026,13 +3018,6 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
3026
3018
|
return targetFormat;
|
|
3027
3019
|
};
|
|
3028
3020
|
KTX2Loader1._detectSupportedFormat = function _detectSupportedFormat(renderer, priorityFormats) {
|
|
3029
|
-
if (priorityFormats === void 0) priorityFormats = [
|
|
3030
|
-
exports.KTX2TargetFormat.ASTC,
|
|
3031
|
-
exports.KTX2TargetFormat.ETC,
|
|
3032
|
-
exports.KTX2TargetFormat.BC7,
|
|
3033
|
-
exports.KTX2TargetFormat.BC1_BC3,
|
|
3034
|
-
exports.KTX2TargetFormat.PVRTC
|
|
3035
|
-
];
|
|
3036
3021
|
for(var i = 0; i < priorityFormats.length; i++){
|
|
3037
3022
|
var capabilities = this._supportedMap[priorityFormats[i]];
|
|
3038
3023
|
for(var j = 0; j < capabilities.length; j++){
|
|
@@ -3074,6 +3059,14 @@ exports.KTX2Loader = (_KTX2Loader = /*#__PURE__*/ function(Loader1) {
|
|
|
3074
3059
|
return KTX2Loader1;
|
|
3075
3060
|
}(engineCore.Loader), function() {
|
|
3076
3061
|
_KTX2Loader._isBinomialInit = false;
|
|
3062
|
+
}(), function() {
|
|
3063
|
+
_KTX2Loader._priorityFormats = [
|
|
3064
|
+
exports.KTX2TargetFormat.BC7,
|
|
3065
|
+
exports.KTX2TargetFormat.ASTC,
|
|
3066
|
+
exports.KTX2TargetFormat.BC1_BC3,
|
|
3067
|
+
exports.KTX2TargetFormat.ETC,
|
|
3068
|
+
exports.KTX2TargetFormat.PVRTC
|
|
3069
|
+
];
|
|
3077
3070
|
}(), function() {
|
|
3078
3071
|
var _obj;
|
|
3079
3072
|
_KTX2Loader._supportedMap = (_obj = {}, _obj[exports.KTX2TargetFormat.ASTC] = [
|
|
@@ -3884,7 +3877,7 @@ exports.GLTFMeshParser = (_GLTFMeshParser = /*#__PURE__*/ function(GLTFParser1)
|
|
|
3884
3877
|
return context.get(exports.GLTFParserType.Buffer).then(function(buffers) {
|
|
3885
3878
|
return GLTFUtils.getAccessorData(glTF, indexAccessor, buffers);
|
|
3886
3879
|
});
|
|
3887
|
-
}, context.keepMeshData).then(resolve);
|
|
3880
|
+
}, context.params.keepMeshData).then(resolve);
|
|
3888
3881
|
}
|
|
3889
3882
|
});
|
|
3890
3883
|
};
|
|
@@ -4065,6 +4058,7 @@ exports.GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
4065
4058
|
var _this = this;
|
|
4066
4059
|
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;
|
|
4067
4060
|
var sceneInfo = scenes[index];
|
|
4061
|
+
var sceneExtensions = sceneInfo.extensions;
|
|
4068
4062
|
var engine = glTFResource.engine;
|
|
4069
4063
|
var isDefaultScene = scene === index;
|
|
4070
4064
|
var sceneNodes = sceneInfo.nodes;
|
|
@@ -4090,6 +4084,7 @@ exports.GLTFSceneParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
4090
4084
|
promises.push(this._parseEntityComponent(context, sceneNodes[i1]));
|
|
4091
4085
|
}
|
|
4092
4086
|
return Promise.all(promises).then(function() {
|
|
4087
|
+
GLTFParser.executeExtensionsAdditiveAndParse(sceneExtensions, context, sceneRoot, sceneInfo);
|
|
4093
4088
|
if (isDefaultScene) {
|
|
4094
4089
|
return Promise.all([
|
|
4095
4090
|
context.get(exports.GLTFParserType.Skin),
|
|
@@ -4466,11 +4461,12 @@ var GLTFLoader = /*#__PURE__*/ function(Loader1) {
|
|
|
4466
4461
|
}
|
|
4467
4462
|
var _proto = GLTFLoader.prototype;
|
|
4468
4463
|
_proto.load = function load(item, resourceManager) {
|
|
4469
|
-
var _params;
|
|
4470
4464
|
var url = item.url;
|
|
4471
4465
|
var params = item.params;
|
|
4472
4466
|
var glTFResource = new GLTFResource(resourceManager.engine, url);
|
|
4473
|
-
var context = new GLTFParserContext(glTFResource, resourceManager,
|
|
4467
|
+
var context = new GLTFParserContext(glTFResource, resourceManager, _extends({
|
|
4468
|
+
keepMeshData: false
|
|
4469
|
+
}, params));
|
|
4474
4470
|
return context.parse();
|
|
4475
4471
|
};
|
|
4476
4472
|
return GLTFLoader;
|
|
@@ -5682,7 +5678,7 @@ var KHR_draco_mesh_compression = (_KHR_draco_mesh_compression = /*#__PURE__*/ fu
|
|
|
5682
5678
|
throw "BlendShape animation is not supported when using draco.";
|
|
5683
5679
|
}, function() {
|
|
5684
5680
|
return decodedGeometry.index.array;
|
|
5685
|
-
}, context.keepMeshData);
|
|
5681
|
+
}, context.params.keepMeshData);
|
|
5686
5682
|
});
|
|
5687
5683
|
});
|
|
5688
5684
|
};
|