@loaders.gl/gltf 4.0.0-alpha.17 → 4.0.0-alpha.18
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/dist.min.js
CHANGED
|
@@ -149,8 +149,7 @@
|
|
|
149
149
|
}
|
|
150
150
|
async function loadLibraryFromFile(libraryUrl) {
|
|
151
151
|
if (libraryUrl.endsWith("wasm")) {
|
|
152
|
-
|
|
153
|
-
return await response2.arrayBuffer();
|
|
152
|
+
return await loadAsArrayBuffer(libraryUrl);
|
|
154
153
|
}
|
|
155
154
|
if (!isBrowser2) {
|
|
156
155
|
try {
|
|
@@ -162,8 +161,7 @@
|
|
|
162
161
|
if (isWorker) {
|
|
163
162
|
return importScripts(libraryUrl);
|
|
164
163
|
}
|
|
165
|
-
const
|
|
166
|
-
const scriptSource = await response.text();
|
|
164
|
+
const scriptSource = await loadAsText(libraryUrl);
|
|
167
165
|
return loadLibraryFromString(scriptSource, libraryUrl);
|
|
168
166
|
}
|
|
169
167
|
function loadLibraryFromString(scriptSource, id) {
|
|
@@ -184,6 +182,20 @@
|
|
|
184
182
|
document.body.appendChild(script);
|
|
185
183
|
return null;
|
|
186
184
|
}
|
|
185
|
+
async function loadAsArrayBuffer(url) {
|
|
186
|
+
if (!node.readFileAsArrayBuffer || url.startsWith("http")) {
|
|
187
|
+
const response = await fetch(url);
|
|
188
|
+
return await response.arrayBuffer();
|
|
189
|
+
}
|
|
190
|
+
return await node.readFileAsArrayBuffer(url);
|
|
191
|
+
}
|
|
192
|
+
async function loadAsText(url) {
|
|
193
|
+
if (!node.readFileAsText || url.startsWith("http")) {
|
|
194
|
+
const response = await fetch(url);
|
|
195
|
+
return await response.text();
|
|
196
|
+
}
|
|
197
|
+
return await node.readFileAsText(url);
|
|
198
|
+
}
|
|
187
199
|
var node, LATEST, VERSION3, loadLibraryPromises;
|
|
188
200
|
var init_library_utils = __esm({
|
|
189
201
|
"../worker-utils/src/lib/library-utils/library-utils.ts"() {
|
|
@@ -841,15 +853,15 @@
|
|
|
841
853
|
});
|
|
842
854
|
|
|
843
855
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
844
|
-
async function
|
|
856
|
+
async function loadBasisTranscoderModule(options) {
|
|
845
857
|
const modules = options.modules || {};
|
|
846
858
|
if (modules.basis) {
|
|
847
859
|
return modules.basis;
|
|
848
860
|
}
|
|
849
|
-
loadBasisTranscoderPromise = loadBasisTranscoderPromise ||
|
|
861
|
+
loadBasisTranscoderPromise = loadBasisTranscoderPromise || loadBasisTranscoder(options);
|
|
850
862
|
return await loadBasisTranscoderPromise;
|
|
851
863
|
}
|
|
852
|
-
async function
|
|
864
|
+
async function loadBasisTranscoder(options) {
|
|
853
865
|
let BASIS = null;
|
|
854
866
|
let wasmBinary = null;
|
|
855
867
|
[BASIS, wasmBinary] = await Promise.all([
|
|
@@ -857,9 +869,9 @@
|
|
|
857
869
|
await loadLibrary("basis_transcoder.wasm", "textures", options)
|
|
858
870
|
]);
|
|
859
871
|
BASIS = BASIS || globalThis.BASIS;
|
|
860
|
-
return await
|
|
872
|
+
return await initializeBasisTranscoderModule(BASIS, wasmBinary);
|
|
861
873
|
}
|
|
862
|
-
function
|
|
874
|
+
function initializeBasisTranscoderModule(BasisModule, wasmBinary) {
|
|
863
875
|
const options = {};
|
|
864
876
|
if (wasmBinary) {
|
|
865
877
|
options.wasmBinary = wasmBinary;
|
|
@@ -1081,7 +1093,7 @@
|
|
|
1081
1093
|
const fileConstructors = await loadBasisEncoderModule(options);
|
|
1082
1094
|
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
1083
1095
|
}
|
|
1084
|
-
const { BasisFile } = await
|
|
1096
|
+
const { BasisFile } = await loadBasisTranscoderModule(options);
|
|
1085
1097
|
return parseBasisFile(BasisFile, data, options);
|
|
1086
1098
|
}
|
|
1087
1099
|
switch (options.basis.module) {
|
|
@@ -1096,7 +1108,7 @@
|
|
|
1096
1108
|
}
|
|
1097
1109
|
case "transcoder":
|
|
1098
1110
|
default:
|
|
1099
|
-
const { BasisFile } = await
|
|
1111
|
+
const { BasisFile } = await loadBasisTranscoderModule(options);
|
|
1100
1112
|
return parseBasisFile(BasisFile, data, options);
|
|
1101
1113
|
}
|
|
1102
1114
|
}
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.VERSION = void 0;
|
|
7
|
-
var VERSION = typeof "4.0.0-alpha.
|
|
7
|
+
var VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = typeof "4.0.0-alpha.
|
|
1
|
+
export const VERSION = typeof "4.0.0-alpha.18" !== 'undefined' ? "4.0.0-alpha.18" : 'latest';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/gltf",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.18",
|
|
4
4
|
"description": "Framework-independent loader for the glTF format",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -34,11 +34,11 @@
|
|
|
34
34
|
"build-bundle": "esbuild src/bundle.ts --bundle --outfile=dist/dist.min.js"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@loaders.gl/draco": "4.0.0-alpha.
|
|
38
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
39
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
40
|
-
"@loaders.gl/textures": "4.0.0-alpha.
|
|
37
|
+
"@loaders.gl/draco": "4.0.0-alpha.18",
|
|
38
|
+
"@loaders.gl/images": "4.0.0-alpha.18",
|
|
39
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.18",
|
|
40
|
+
"@loaders.gl/textures": "4.0.0-alpha.18",
|
|
41
41
|
"@math.gl/core": "^3.5.1"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce"
|
|
44
44
|
}
|