@galacean/engine-loader 1.1.0-beta.45 → 1.1.0-beta.47
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 +19 -21
- package/dist/main.js.map +1 -1
- package/dist/miniprogram.js +19 -21
- package/dist/module.js +19 -21
- package/dist/module.js.map +1 -1
- package/package.json +5 -5
- package/types/gltf/GLTFUtils.d.ts +4 -3
- package/types/gltf/parser/GLTFJSONParser.d.ts +7 -0
- package/types/gltf/parser/GLTFSchemaParser.d.ts +0 -1
- package/types/resource-deserialize/resources/prefab/PrefabParser.d.ts +4 -13
- package/types/PrimitiveMeshLoader.d.ts +0 -1
- package/types/gltf/extensions/EXT_meshopt_compression.d.ts +0 -13
- package/types/gltf/extensions/MeshoptDecoder.d.ts +0 -8
- package/types/gltf/parser/GLTFBufferViewParser.d.ts +0 -5
- package/types/ktx2/BinomialLLCTranscoder/BinomialLLCTranscoder.d.ts +0 -13
- package/types/ktx2/BinomialLLCTranscoder/TranscodeWorkerCode.d.ts +0 -33
- package/types/ktx2/KhronosTranscoder/KhronosTranscoder.d.ts +0 -17
- package/types/ktx2/KhronosTranscoder/TranscoderWorkerCode.d.ts +0 -34
- package/types/ktx2/TranscodeResult.d.ts +0 -10
- package/types/ktx2/constants.d.ts +0 -7
- package/types/ktx2/zstddec.d.ts +0 -62
- package/types/resource-deserialize/resources/parser/HierarchyParser.d.ts +0 -36
- package/types/resource-deserialize/resources/parser/ParserContext.d.ts +0 -29
- package/types/resource-deserialize/resources/prefab/PrefabParserContext.d.ts +0 -5
package/dist/main.js
CHANGED
|
@@ -2060,7 +2060,7 @@ function registerGLTFParser(pipeline) {
|
|
|
2060
2060
|
};
|
|
2061
2061
|
/**
|
|
2062
2062
|
* Parse the glb format.
|
|
2063
|
-
*/ GLTFUtils.parseGLB = function parseGLB(context,
|
|
2063
|
+
*/ GLTFUtils.parseGLB = function parseGLB(context, originBuffer) {
|
|
2064
2064
|
var UINT32_LENGTH = 4;
|
|
2065
2065
|
var GLB_HEADER_MAGIC = 0x46546c67; // 'glTF'
|
|
2066
2066
|
var GLB_HEADER_LENGTH = 12;
|
|
@@ -2068,7 +2068,7 @@ function registerGLTFParser(pipeline) {
|
|
|
2068
2068
|
JSON: 0x4e4f534a,
|
|
2069
2069
|
BIN: 0x004e4942
|
|
2070
2070
|
};
|
|
2071
|
-
var dataView = new DataView(
|
|
2071
|
+
var dataView = new DataView(originBuffer);
|
|
2072
2072
|
// read header
|
|
2073
2073
|
var header = {
|
|
2074
2074
|
magic: dataView.getUint32(0, true),
|
|
@@ -2076,8 +2076,9 @@ function registerGLTFParser(pipeline) {
|
|
|
2076
2076
|
length: dataView.getUint32(2 * UINT32_LENGTH, true)
|
|
2077
2077
|
};
|
|
2078
2078
|
if (header.magic !== GLB_HEADER_MAGIC) {
|
|
2079
|
-
|
|
2080
|
-
|
|
2079
|
+
return {
|
|
2080
|
+
originBuffer: originBuffer
|
|
2081
|
+
};
|
|
2081
2082
|
}
|
|
2082
2083
|
// read main data
|
|
2083
2084
|
var chunkLength = dataView.getUint32(GLB_HEADER_LENGTH, true);
|
|
@@ -2087,7 +2088,7 @@ function registerGLTFParser(pipeline) {
|
|
|
2087
2088
|
console.error("Invalid glb chunk type. Expected 0x4E4F534A, found 0x" + chunkType.toString(16));
|
|
2088
2089
|
return null;
|
|
2089
2090
|
}
|
|
2090
|
-
var glTFData = new Uint8Array(
|
|
2091
|
+
var glTFData = new Uint8Array(originBuffer, GLB_HEADER_LENGTH + 2 * UINT32_LENGTH, chunkLength);
|
|
2091
2092
|
var glTF = JSON.parse(engineCore.Utils.decodeText(glTFData));
|
|
2092
2093
|
// read all buffers
|
|
2093
2094
|
var buffers = [];
|
|
@@ -2101,7 +2102,7 @@ function registerGLTFParser(pipeline) {
|
|
|
2101
2102
|
return null;
|
|
2102
2103
|
}
|
|
2103
2104
|
var currentOffset = byteOffset + 2 * UINT32_LENGTH;
|
|
2104
|
-
var buffer =
|
|
2105
|
+
var buffer = originBuffer.slice(currentOffset, currentOffset + chunkLength);
|
|
2105
2106
|
buffers.push(buffer);
|
|
2106
2107
|
restoreGLBBufferSlice.push(new engineMath.Vector2(currentOffset, chunkLength));
|
|
2107
2108
|
byteOffset += chunkLength + 2 * UINT32_LENGTH;
|
|
@@ -3511,23 +3512,20 @@ exports.GLTFSchemaParser = /*#__PURE__*/ function(GLTFParser1) {
|
|
|
3511
3512
|
var requestConfig = {
|
|
3512
3513
|
type: "arraybuffer"
|
|
3513
3514
|
};
|
|
3514
|
-
|
|
3515
|
-
contentRestorer.isGLB = isGLB;
|
|
3516
|
-
var promise = isGLB ? engineCore.request(url, requestConfig).then(function(glb) {
|
|
3515
|
+
return engineCore.request(url, requestConfig).then(function(buffer) {
|
|
3517
3516
|
restoreBufferRequests.push(new BufferRequestInfo(url, requestConfig));
|
|
3518
|
-
return GLTFUtils.parseGLB(context,
|
|
3519
|
-
}).then(function(
|
|
3520
|
-
var
|
|
3521
|
-
|
|
3522
|
-
|
|
3523
|
-
|
|
3524
|
-
|
|
3517
|
+
return GLTFUtils.parseGLB(context, buffer);
|
|
3518
|
+
}).then(function(result) {
|
|
3519
|
+
var _result;
|
|
3520
|
+
if ((_result = result) == null ? void 0 : _result.glTF) {
|
|
3521
|
+
contentRestorer.isGLB = true;
|
|
3522
|
+
context.buffers = result.buffers;
|
|
3523
|
+
return result.glTF;
|
|
3524
|
+
} else {
|
|
3525
|
+
contentRestorer.isGLB = false;
|
|
3526
|
+
return JSON.parse(engineCore.Utils.decodeText(new Uint8Array(result.originBuffer)));
|
|
3527
|
+
}
|
|
3525
3528
|
});
|
|
3526
|
-
return promise;
|
|
3527
|
-
};
|
|
3528
|
-
_proto._isGLB = function _isGLB(url) {
|
|
3529
|
-
var index = url.lastIndexOf(".");
|
|
3530
|
-
return url.substring(index + 1, index + 4) === "glb";
|
|
3531
3529
|
};
|
|
3532
3530
|
return GLTFSchemaParser;
|
|
3533
3531
|
}(GLTFParser);
|