three-stdlib 2.30.2 → 2.30.4
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/_polyfill/LoaderUtils.cjs +18 -0
- package/_polyfill/LoaderUtils.cjs.map +1 -0
- package/_polyfill/LoaderUtils.js +18 -0
- package/_polyfill/LoaderUtils.js.map +1 -0
- package/loaders/3MFLoader.cjs +4 -3
- package/loaders/3MFLoader.cjs.map +1 -1
- package/loaders/3MFLoader.js +5 -4
- package/loaders/3MFLoader.js.map +1 -1
- package/loaders/AMFLoader.cjs +2 -1
- package/loaders/AMFLoader.cjs.map +1 -1
- package/loaders/AMFLoader.js +3 -2
- package/loaders/AMFLoader.js.map +1 -1
- package/loaders/FBXLoader.cjs +3 -2
- package/loaders/FBXLoader.cjs.map +1 -1
- package/loaders/FBXLoader.js +3 -2
- package/loaders/FBXLoader.js.map +1 -1
- package/loaders/GLTFLoader.cjs +5 -4
- package/loaders/GLTFLoader.cjs.map +1 -1
- package/loaders/GLTFLoader.js +5 -4
- package/loaders/GLTFLoader.js.map +1 -1
- package/loaders/KTX2Loader.cjs +3 -3
- package/loaders/KTX2Loader.cjs.map +1 -1
- package/loaders/KTX2Loader.js +3 -3
- package/loaders/KTX2Loader.js.map +1 -1
- package/loaders/PCDLoader.cjs +2 -1
- package/loaders/PCDLoader.cjs.map +1 -1
- package/loaders/PCDLoader.js +3 -2
- package/loaders/PCDLoader.js.map +1 -1
- package/loaders/PLYLoader.cjs +2 -1
- package/loaders/PLYLoader.cjs.map +1 -1
- package/loaders/PLYLoader.js +3 -2
- package/loaders/PLYLoader.js.map +1 -1
- package/loaders/STLLoader.cjs +2 -1
- package/loaders/STLLoader.cjs.map +1 -1
- package/loaders/STLLoader.js +3 -2
- package/loaders/STLLoader.js.map +1 -1
- package/loaders/VTKLoader.cjs +4 -3
- package/loaders/VTKLoader.cjs.map +1 -1
- package/loaders/VTKLoader.js +5 -4
- package/loaders/VTKLoader.js.map +1 -1
- package/loaders/XLoader.cjs +3 -2
- package/loaders/XLoader.cjs.map +1 -1
- package/loaders/XLoader.js +3 -2
- package/loaders/XLoader.js.map +1 -1
- package/package.json +1 -1
package/loaders/GLTFLoader.cjs
CHANGED
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
|
3
3
|
const THREE = require("three");
|
|
4
4
|
const BufferGeometryUtils = require("../utils/BufferGeometryUtils.cjs");
|
|
5
5
|
const constants = require("../_polyfill/constants.cjs");
|
|
6
|
+
const LoaderUtils = require("../_polyfill/LoaderUtils.cjs");
|
|
6
7
|
const SRGBColorSpace = "srgb";
|
|
7
8
|
const LinearSRGBColorSpace = "srgb-linear";
|
|
8
9
|
const sRGBEncoding = 3001;
|
|
@@ -147,7 +148,7 @@ class GLTFLoader extends THREE.Loader {
|
|
|
147
148
|
if (typeof data === "string") {
|
|
148
149
|
json = JSON.parse(data);
|
|
149
150
|
} else if (data instanceof ArrayBuffer) {
|
|
150
|
-
const magic =
|
|
151
|
+
const magic = LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4)));
|
|
151
152
|
if (magic === BINARY_EXTENSION_HEADER_MAGIC) {
|
|
152
153
|
try {
|
|
153
154
|
extensions[EXTENSIONS.KHR_BINARY_GLTF] = new GLTFBinaryExtension(data);
|
|
@@ -158,7 +159,7 @@ class GLTFLoader extends THREE.Loader {
|
|
|
158
159
|
}
|
|
159
160
|
json = JSON.parse(extensions[EXTENSIONS.KHR_BINARY_GLTF].content);
|
|
160
161
|
} else {
|
|
161
|
-
json = JSON.parse(
|
|
162
|
+
json = JSON.parse(LoaderUtils.decodeText(new Uint8Array(data)));
|
|
162
163
|
}
|
|
163
164
|
} else {
|
|
164
165
|
json = data;
|
|
@@ -965,7 +966,7 @@ class GLTFBinaryExtension {
|
|
|
965
966
|
this.body = null;
|
|
966
967
|
const headerView = new DataView(data, 0, BINARY_EXTENSION_HEADER_LENGTH);
|
|
967
968
|
this.header = {
|
|
968
|
-
magic:
|
|
969
|
+
magic: LoaderUtils.decodeText(new Uint8Array(data.slice(0, 4))),
|
|
969
970
|
version: headerView.getUint32(4, true),
|
|
970
971
|
length: headerView.getUint32(8, true)
|
|
971
972
|
};
|
|
@@ -984,7 +985,7 @@ class GLTFBinaryExtension {
|
|
|
984
985
|
chunkIndex += 4;
|
|
985
986
|
if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.JSON) {
|
|
986
987
|
const contentArray = new Uint8Array(data, BINARY_EXTENSION_HEADER_LENGTH + chunkIndex, chunkLength);
|
|
987
|
-
this.content =
|
|
988
|
+
this.content = LoaderUtils.decodeText(contentArray);
|
|
988
989
|
} else if (chunkType === BINARY_EXTENSION_CHUNK_TYPES.BIN) {
|
|
989
990
|
const byteOffset = BINARY_EXTENSION_HEADER_LENGTH + chunkIndex;
|
|
990
991
|
this.body = data.slice(byteOffset, byteOffset + chunkLength);
|