@loaders.gl/textures 4.2.0-alpha.5 → 4.2.0-beta.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/basis-loader.d.ts +61 -3
- package/dist/basis-loader.d.ts.map +1 -1
- package/dist/basis-loader.js +5 -3
- package/dist/basis-worker-node.js +348 -335
- package/dist/basis-worker.js +32 -49
- package/dist/compressed-texture-loader.d.ts +43 -4
- package/dist/compressed-texture-loader.d.ts.map +1 -1
- package/dist/compressed-texture-loader.js +2 -0
- package/dist/compressed-texture-worker.js +33 -47
- package/dist/compressed-texture-writer.d.ts +24 -2
- package/dist/compressed-texture-writer.d.ts.map +1 -1
- package/dist/compressed-texture-writer.js +0 -8
- package/dist/crunch-loader.d.ts +23 -2
- package/dist/crunch-loader.d.ts.map +1 -1
- package/dist/crunch-loader.js +2 -0
- package/dist/crunch-worker.js +33 -47
- package/dist/dist.dev.js +96 -81
- package/dist/dist.min.js +2 -2
- package/dist/index.cjs +23 -15
- package/dist/index.cjs.map +3 -3
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +329 -328
- package/dist/ktx2-basis-writer-worker.js +15 -43
- package/dist/ktx2-basis-writer.d.ts +18 -3
- package/dist/ktx2-basis-writer.d.ts.map +1 -1
- package/dist/lib/parsers/basis-module-loader.d.ts.map +1 -1
- package/dist/lib/parsers/basis-module-loader.js +6 -4
- package/dist/lib/parsers/crunch-module-loader.d.ts +2 -1
- package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -1
- package/dist/lib/parsers/crunch-module-loader.js +6 -4
- package/dist/lib/utils/version.js +1 -1
- package/dist/npy-loader.d.ts +40 -5
- package/dist/npy-loader.d.ts.map +1 -1
- package/dist/npy-loader.js +2 -0
- package/dist/npy-worker.js +6 -2
- package/dist/workers/crunch-worker.d.ts +15 -17
- package/dist/workers/crunch-worker.d.ts.map +1 -1
- package/package.json +7 -9
- package/src/basis-loader.ts +27 -7
- package/src/compressed-texture-loader.ts +14 -6
- package/src/compressed-texture-writer.ts +5 -15
- package/src/crunch-loader.ts +10 -2
- package/src/index.ts +10 -1
- package/src/ktx2-basis-writer.ts +2 -2
- package/src/lib/parsers/basis-module-loader.ts +6 -4
- package/src/lib/parsers/crunch-module-loader.ts +8 -6
- package/src/npy-loader.ts +13 -5
package/dist/crunch-worker.js
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
-
var __create = Object.create;
|
|
4
|
-
var __defProp = Object.defineProperty;
|
|
5
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
10
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
|
|
29
|
-
// (disabled):../worker-utils/src/lib/node/require-utils.node
|
|
30
|
-
var require_require_utils = __commonJS({
|
|
31
|
-
"(disabled):../worker-utils/src/lib/node/require-utils.node"() {
|
|
32
|
-
"use strict";
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
3
|
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
37
4
|
function assert(condition, message) {
|
|
38
5
|
if (!condition) {
|
|
@@ -40,6 +7,17 @@
|
|
|
40
7
|
}
|
|
41
8
|
}
|
|
42
9
|
|
|
10
|
+
// ../loader-utils/src/lib/module-utils/js-module-utils.ts
|
|
11
|
+
function registerJSModules(modules) {
|
|
12
|
+
globalThis.loaders ||= {};
|
|
13
|
+
globalThis.loaders.modules ||= {};
|
|
14
|
+
Object.assign(globalThis.loaders.modules, modules);
|
|
15
|
+
}
|
|
16
|
+
function getJSModuleOrNull(name) {
|
|
17
|
+
const module = globalThis.loaders?.modules?.[name];
|
|
18
|
+
return module || null;
|
|
19
|
+
}
|
|
20
|
+
|
|
43
21
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
44
22
|
function getVersion() {
|
|
45
23
|
if (!globalThis._loadersgl_?.version) {
|
|
@@ -50,7 +28,7 @@
|
|
|
50
28
|
);
|
|
51
29
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
52
30
|
} else {
|
|
53
|
-
globalThis._loadersgl_.version = "4.2.0-alpha.
|
|
31
|
+
globalThis._loadersgl_.version = "4.2.0-alpha.6";
|
|
54
32
|
}
|
|
55
33
|
}
|
|
56
34
|
return globalThis._loadersgl_.version;
|
|
@@ -143,7 +121,9 @@
|
|
|
143
121
|
}
|
|
144
122
|
getParentPort().then((parentPort2) => {
|
|
145
123
|
if (parentPort2) {
|
|
146
|
-
parentPort2.on("message",
|
|
124
|
+
parentPort2.on("message", (message) => {
|
|
125
|
+
handleMessage(message);
|
|
126
|
+
});
|
|
147
127
|
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
148
128
|
} else {
|
|
149
129
|
globalThis.onmessage = handleMessage;
|
|
@@ -201,7 +181,6 @@
|
|
|
201
181
|
}
|
|
202
182
|
|
|
203
183
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
204
|
-
var node = __toESM(require_require_utils(), 1);
|
|
205
184
|
var loadLibraryPromises = {};
|
|
206
185
|
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
|
|
207
186
|
if (moduleName) {
|
|
@@ -238,7 +217,8 @@
|
|
|
238
217
|
}
|
|
239
218
|
if (!isBrowser) {
|
|
240
219
|
try {
|
|
241
|
-
|
|
220
|
+
const { requireFromFile } = globalThis.loaders || {};
|
|
221
|
+
return await requireFromFile?.(libraryUrl);
|
|
242
222
|
} catch (error) {
|
|
243
223
|
console.error(error);
|
|
244
224
|
return null;
|
|
@@ -252,7 +232,8 @@
|
|
|
252
232
|
}
|
|
253
233
|
function loadLibraryFromString(scriptSource, id) {
|
|
254
234
|
if (!isBrowser) {
|
|
255
|
-
|
|
235
|
+
const { requireFromString } = globalThis.loaders || {};
|
|
236
|
+
return requireFromString?.(scriptSource, id);
|
|
256
237
|
}
|
|
257
238
|
if (isWorker) {
|
|
258
239
|
eval.call(globalThis, scriptSource);
|
|
@@ -269,18 +250,20 @@
|
|
|
269
250
|
return null;
|
|
270
251
|
}
|
|
271
252
|
async function loadAsArrayBuffer(url) {
|
|
272
|
-
|
|
253
|
+
const { readFileAsArrayBuffer } = globalThis.loaders || {};
|
|
254
|
+
if (isBrowser || !readFileAsArrayBuffer || url.startsWith("http")) {
|
|
273
255
|
const response = await fetch(url);
|
|
274
256
|
return await response.arrayBuffer();
|
|
275
257
|
}
|
|
276
|
-
return await (
|
|
258
|
+
return await readFileAsArrayBuffer(url);
|
|
277
259
|
}
|
|
278
260
|
async function loadAsText(url) {
|
|
279
|
-
|
|
261
|
+
const { readFileAsText } = globalThis.loaders || {};
|
|
262
|
+
if (isBrowser || !readFileAsText || url.startsWith("http")) {
|
|
280
263
|
const response = await fetch(url);
|
|
281
264
|
return await response.text();
|
|
282
265
|
}
|
|
283
|
-
return await (
|
|
266
|
+
return await readFileAsText(url);
|
|
284
267
|
}
|
|
285
268
|
|
|
286
269
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
@@ -365,10 +348,12 @@
|
|
|
365
348
|
}
|
|
366
349
|
|
|
367
350
|
// src/lib/utils/version.ts
|
|
368
|
-
var VERSION2 = true ? "4.2.0-alpha.
|
|
351
|
+
var VERSION2 = true ? "4.2.0-alpha.6" : "latest";
|
|
369
352
|
|
|
370
353
|
// src/crunch-loader.ts
|
|
371
354
|
var CrunchLoader = {
|
|
355
|
+
dataType: null,
|
|
356
|
+
batchType: null,
|
|
372
357
|
id: "crunch",
|
|
373
358
|
name: "Crunch",
|
|
374
359
|
module: "textures",
|
|
@@ -390,9 +375,10 @@
|
|
|
390
375
|
DECODER: "crunch.js"
|
|
391
376
|
};
|
|
392
377
|
async function loadCrunchModule(options) {
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
378
|
+
registerJSModules(options.modules);
|
|
379
|
+
const crunch = getJSModuleOrNull("crunch");
|
|
380
|
+
if (crunch) {
|
|
381
|
+
return crunch;
|
|
396
382
|
}
|
|
397
383
|
return loadCrunch(options);
|
|
398
384
|
}
|
|
@@ -402,7 +388,7 @@
|
|
|
402
388
|
return crunchModule;
|
|
403
389
|
}
|
|
404
390
|
let loadCrunchDecoder = await loadLibrary(CRUNCH_EXTERNAL_LIBRARIES.DECODER, "textures", options);
|
|
405
|
-
loadCrunchDecoder
|
|
391
|
+
loadCrunchDecoder ||= globalThis.LoadCrunchDecoder;
|
|
406
392
|
crunchModule = loadCrunchDecoder();
|
|
407
393
|
return crunchModule;
|
|
408
394
|
}
|
package/dist/dist.dev.js
CHANGED
|
@@ -45,13 +45,6 @@ var __exports__ = (() => {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
// (disabled):../worker-utils/src/lib/node/require-utils.node
|
|
49
|
-
var require_require_utils = __commonJS({
|
|
50
|
-
"(disabled):../worker-utils/src/lib/node/require-utils.node"() {
|
|
51
|
-
"use strict";
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
48
|
// (disabled):../worker-utils/src/lib/process-utils/child-process-proxy
|
|
56
49
|
var require_child_process_proxy = __commonJS({
|
|
57
50
|
"(disabled):../worker-utils/src/lib/process-utils/child-process-proxy"() {
|
|
@@ -87,6 +80,42 @@ var __exports__ = (() => {
|
|
|
87
80
|
// src/lib/utils/version.ts
|
|
88
81
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
89
82
|
|
|
83
|
+
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
84
|
+
function assert(condition, message) {
|
|
85
|
+
if (!condition) {
|
|
86
|
+
throw new Error(message || "loader assertion failed.");
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
// ../loader-utils/src/lib/env-utils/globals.ts
|
|
91
|
+
var globals = {
|
|
92
|
+
self: typeof self !== "undefined" && self,
|
|
93
|
+
window: typeof window !== "undefined" && window,
|
|
94
|
+
global: typeof global !== "undefined" && global,
|
|
95
|
+
document: typeof document !== "undefined" && document
|
|
96
|
+
};
|
|
97
|
+
var self_ = globals.self || globals.window || globals.global || {};
|
|
98
|
+
var window_ = globals.window || globals.self || globals.global || {};
|
|
99
|
+
var global_ = globals.global || globals.self || globals.window || {};
|
|
100
|
+
var document_ = globals.document || {};
|
|
101
|
+
var isBrowser = (
|
|
102
|
+
// @ts-ignore process does not exist on browser
|
|
103
|
+
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
104
|
+
);
|
|
105
|
+
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
106
|
+
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
107
|
+
|
|
108
|
+
// ../loader-utils/src/lib/module-utils/js-module-utils.ts
|
|
109
|
+
function registerJSModules(modules) {
|
|
110
|
+
globalThis.loaders ||= {};
|
|
111
|
+
globalThis.loaders.modules ||= {};
|
|
112
|
+
Object.assign(globalThis.loaders.modules, modules);
|
|
113
|
+
}
|
|
114
|
+
function getJSModuleOrNull(name) {
|
|
115
|
+
const module = globalThis.loaders?.modules?.[name];
|
|
116
|
+
return module || null;
|
|
117
|
+
}
|
|
118
|
+
|
|
90
119
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
91
120
|
var NPM_TAG = "latest";
|
|
92
121
|
function getVersion() {
|
|
@@ -106,34 +135,33 @@ var __exports__ = (() => {
|
|
|
106
135
|
var VERSION2 = getVersion();
|
|
107
136
|
|
|
108
137
|
// ../worker-utils/src/lib/env-utils/assert.ts
|
|
109
|
-
function
|
|
138
|
+
function assert2(condition, message) {
|
|
110
139
|
if (!condition) {
|
|
111
140
|
throw new Error(message || "loaders.gl assertion failed.");
|
|
112
141
|
}
|
|
113
142
|
}
|
|
114
143
|
|
|
115
144
|
// ../worker-utils/src/lib/env-utils/globals.ts
|
|
116
|
-
var
|
|
145
|
+
var globals2 = {
|
|
117
146
|
self: typeof self !== "undefined" && self,
|
|
118
147
|
window: typeof window !== "undefined" && window,
|
|
119
148
|
global: typeof global !== "undefined" && global,
|
|
120
149
|
document: typeof document !== "undefined" && document
|
|
121
150
|
};
|
|
122
|
-
var
|
|
123
|
-
var
|
|
124
|
-
var
|
|
125
|
-
var
|
|
126
|
-
var
|
|
151
|
+
var self_2 = globals2.self || globals2.window || globals2.global || {};
|
|
152
|
+
var window_2 = globals2.window || globals2.self || globals2.global || {};
|
|
153
|
+
var global_2 = globals2.global || globals2.self || globals2.window || {};
|
|
154
|
+
var document_2 = globals2.document || {};
|
|
155
|
+
var isBrowser2 = (
|
|
127
156
|
// @ts-ignore process.browser
|
|
128
157
|
typeof process !== "object" || String(process) !== "[object process]" || process.browser
|
|
129
158
|
);
|
|
130
159
|
var isWorker = typeof importScripts === "function";
|
|
131
160
|
var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
|
|
132
|
-
var
|
|
133
|
-
var
|
|
161
|
+
var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
162
|
+
var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
|
|
134
163
|
|
|
135
164
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
136
|
-
var node = __toESM(require_require_utils(), 1);
|
|
137
165
|
var loadLibraryPromises = {};
|
|
138
166
|
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
|
|
139
167
|
if (moduleName) {
|
|
@@ -152,11 +180,11 @@ var __exports__ = (() => {
|
|
|
152
180
|
if (modules[libraryName]) {
|
|
153
181
|
return modules[libraryName];
|
|
154
182
|
}
|
|
155
|
-
if (!
|
|
183
|
+
if (!isBrowser2) {
|
|
156
184
|
return `modules/${moduleName}/dist/libs/${libraryName}`;
|
|
157
185
|
}
|
|
158
186
|
if (options.CDN) {
|
|
159
|
-
|
|
187
|
+
assert2(options.CDN.startsWith("http"));
|
|
160
188
|
return `${options.CDN}/${moduleName}@${VERSION2}/dist/libs/${libraryName}`;
|
|
161
189
|
}
|
|
162
190
|
if (isWorker) {
|
|
@@ -168,9 +196,10 @@ var __exports__ = (() => {
|
|
|
168
196
|
if (libraryUrl.endsWith("wasm")) {
|
|
169
197
|
return await loadAsArrayBuffer(libraryUrl);
|
|
170
198
|
}
|
|
171
|
-
if (!
|
|
199
|
+
if (!isBrowser2) {
|
|
172
200
|
try {
|
|
173
|
-
|
|
201
|
+
const { requireFromFile } = globalThis.loaders || {};
|
|
202
|
+
return await requireFromFile?.(libraryUrl);
|
|
174
203
|
} catch (error) {
|
|
175
204
|
console.error(error);
|
|
176
205
|
return null;
|
|
@@ -183,8 +212,9 @@ var __exports__ = (() => {
|
|
|
183
212
|
return loadLibraryFromString(scriptSource, libraryUrl);
|
|
184
213
|
}
|
|
185
214
|
function loadLibraryFromString(scriptSource, id) {
|
|
186
|
-
if (!
|
|
187
|
-
|
|
215
|
+
if (!isBrowser2) {
|
|
216
|
+
const { requireFromString } = globalThis.loaders || {};
|
|
217
|
+
return requireFromString?.(scriptSource, id);
|
|
188
218
|
}
|
|
189
219
|
if (isWorker) {
|
|
190
220
|
eval.call(globalThis, scriptSource);
|
|
@@ -201,23 +231,41 @@ var __exports__ = (() => {
|
|
|
201
231
|
return null;
|
|
202
232
|
}
|
|
203
233
|
async function loadAsArrayBuffer(url) {
|
|
204
|
-
|
|
234
|
+
const { readFileAsArrayBuffer } = globalThis.loaders || {};
|
|
235
|
+
if (isBrowser2 || !readFileAsArrayBuffer || url.startsWith("http")) {
|
|
205
236
|
const response = await fetch(url);
|
|
206
237
|
return await response.arrayBuffer();
|
|
207
238
|
}
|
|
208
|
-
return await (
|
|
239
|
+
return await readFileAsArrayBuffer(url);
|
|
209
240
|
}
|
|
210
241
|
async function loadAsText(url) {
|
|
211
|
-
|
|
242
|
+
const { readFileAsText } = globalThis.loaders || {};
|
|
243
|
+
if (isBrowser2 || !readFileAsText || url.startsWith("http")) {
|
|
212
244
|
const response = await fetch(url);
|
|
213
245
|
return await response.text();
|
|
214
246
|
}
|
|
215
|
-
return await (
|
|
247
|
+
return await readFileAsText(url);
|
|
216
248
|
}
|
|
217
249
|
|
|
218
250
|
// ../worker-utils/src/index.ts
|
|
219
251
|
var import_child_process_proxy = __toESM(require_child_process_proxy(), 1);
|
|
220
252
|
|
|
253
|
+
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
254
|
+
var pathPrefix = "";
|
|
255
|
+
var fileAliases = {};
|
|
256
|
+
function resolvePath(filename) {
|
|
257
|
+
for (const alias in fileAliases) {
|
|
258
|
+
if (filename.startsWith(alias)) {
|
|
259
|
+
const replacement = fileAliases[alias];
|
|
260
|
+
filename = filename.replace(alias, replacement);
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
if (!filename.startsWith("http://") && !filename.startsWith("https://")) {
|
|
264
|
+
filename = `${pathPrefix}${filename}`;
|
|
265
|
+
}
|
|
266
|
+
return filename;
|
|
267
|
+
}
|
|
268
|
+
|
|
221
269
|
// src/lib/parsers/basis-module-loader.ts
|
|
222
270
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
223
271
|
/** Basis transcoder, javascript wrapper part */
|
|
@@ -231,11 +279,12 @@ var __exports__ = (() => {
|
|
|
231
279
|
};
|
|
232
280
|
var loadBasisTranscoderPromise;
|
|
233
281
|
async function loadBasisTranscoderModule(options) {
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
282
|
+
registerJSModules(options.modules);
|
|
283
|
+
const basis = getJSModuleOrNull("basis");
|
|
284
|
+
if (basis) {
|
|
285
|
+
return basis;
|
|
237
286
|
}
|
|
238
|
-
loadBasisTranscoderPromise
|
|
287
|
+
loadBasisTranscoderPromise ||= loadBasisTranscoder(options);
|
|
239
288
|
return await loadBasisTranscoderPromise;
|
|
240
289
|
}
|
|
241
290
|
async function loadBasisTranscoder(options) {
|
|
@@ -901,6 +950,8 @@ var __exports__ = (() => {
|
|
|
901
950
|
|
|
902
951
|
// src/basis-loader.ts
|
|
903
952
|
var BasisWorkerLoader = {
|
|
953
|
+
dataType: null,
|
|
954
|
+
batchType: null,
|
|
904
955
|
name: "Basis",
|
|
905
956
|
id: "basis",
|
|
906
957
|
module: "textures",
|
|
@@ -913,12 +964,9 @@ var __exports__ = (() => {
|
|
|
913
964
|
options: {
|
|
914
965
|
basis: {
|
|
915
966
|
format: "auto",
|
|
916
|
-
// gl context doesn't exist on a worker thread
|
|
917
967
|
libraryPath: "libs/",
|
|
918
968
|
containerFormat: "auto",
|
|
919
|
-
// 'basis' || 'ktx2' || 'auto'
|
|
920
969
|
module: "transcoder"
|
|
921
|
-
// 'transcoder' || 'encoder'
|
|
922
970
|
}
|
|
923
971
|
}
|
|
924
972
|
};
|
|
@@ -927,47 +975,6 @@ var __exports__ = (() => {
|
|
|
927
975
|
parse: parseBasis
|
|
928
976
|
};
|
|
929
977
|
|
|
930
|
-
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
931
|
-
function assert2(condition, message) {
|
|
932
|
-
if (!condition) {
|
|
933
|
-
throw new Error(message || "loader assertion failed.");
|
|
934
|
-
}
|
|
935
|
-
}
|
|
936
|
-
|
|
937
|
-
// ../loader-utils/src/lib/env-utils/globals.ts
|
|
938
|
-
var globals2 = {
|
|
939
|
-
self: typeof self !== "undefined" && self,
|
|
940
|
-
window: typeof window !== "undefined" && window,
|
|
941
|
-
global: typeof global !== "undefined" && global,
|
|
942
|
-
document: typeof document !== "undefined" && document
|
|
943
|
-
};
|
|
944
|
-
var self_2 = globals2.self || globals2.window || globals2.global || {};
|
|
945
|
-
var window_2 = globals2.window || globals2.self || globals2.global || {};
|
|
946
|
-
var global_2 = globals2.global || globals2.self || globals2.window || {};
|
|
947
|
-
var document_2 = globals2.document || {};
|
|
948
|
-
var isBrowser2 = (
|
|
949
|
-
// @ts-ignore process does not exist on browser
|
|
950
|
-
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
951
|
-
);
|
|
952
|
-
var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
953
|
-
var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
|
|
954
|
-
|
|
955
|
-
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
956
|
-
var pathPrefix = "";
|
|
957
|
-
var fileAliases = {};
|
|
958
|
-
function resolvePath(filename) {
|
|
959
|
-
for (const alias in fileAliases) {
|
|
960
|
-
if (filename.startsWith(alias)) {
|
|
961
|
-
const replacement = fileAliases[alias];
|
|
962
|
-
filename = filename.replace(alias, replacement);
|
|
963
|
-
}
|
|
964
|
-
}
|
|
965
|
-
if (!filename.startsWith("http://") && !filename.startsWith("https://")) {
|
|
966
|
-
filename = `${pathPrefix}${filename}`;
|
|
967
|
-
}
|
|
968
|
-
return filename;
|
|
969
|
-
}
|
|
970
|
-
|
|
971
978
|
// src/lib/parsers/parse-dds.ts
|
|
972
979
|
var DDS_CONSTANTS = {
|
|
973
980
|
MAGIC_NUMBER: 542327876,
|
|
@@ -1010,14 +1017,14 @@ var __exports__ = (() => {
|
|
|
1010
1017
|
function parseDDS(data) {
|
|
1011
1018
|
const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);
|
|
1012
1019
|
const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];
|
|
1013
|
-
|
|
1020
|
+
assert(
|
|
1014
1021
|
Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC),
|
|
1015
1022
|
"DDS: Unsupported format, must contain a FourCC code"
|
|
1016
1023
|
);
|
|
1017
1024
|
const fourCC = int32ToFourCC(pixelFormatNumber);
|
|
1018
1025
|
const internalFormat = DDS_PIXEL_FORMATS[fourCC];
|
|
1019
1026
|
const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];
|
|
1020
|
-
|
|
1027
|
+
assert(internalFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
|
|
1021
1028
|
let mipMapLevels = 1;
|
|
1022
1029
|
if (header[DDS_CONSTANTS.HEADER_FLAGS_INDEX] & DDS_CONSTANTS.DDSD_MIPMAPCOUNT) {
|
|
1023
1030
|
mipMapLevels = Math.max(1, header[DDS_CONSTANTS.MIPMAPCOUNT_INDEX]);
|
|
@@ -1260,6 +1267,8 @@ var __exports__ = (() => {
|
|
|
1260
1267
|
|
|
1261
1268
|
// src/compressed-texture-loader.ts
|
|
1262
1269
|
var CompressedTextureWorkerLoader = {
|
|
1270
|
+
dataType: null,
|
|
1271
|
+
batchType: null,
|
|
1263
1272
|
name: "Texture Containers",
|
|
1264
1273
|
id: "compressed-texture",
|
|
1265
1274
|
module: "textures",
|
|
@@ -1311,6 +1320,8 @@ var __exports__ = (() => {
|
|
|
1311
1320
|
|
|
1312
1321
|
// src/crunch-loader.ts
|
|
1313
1322
|
var CrunchLoader = {
|
|
1323
|
+
dataType: null,
|
|
1324
|
+
batchType: null,
|
|
1314
1325
|
id: "crunch",
|
|
1315
1326
|
name: "Crunch",
|
|
1316
1327
|
module: "textures",
|
|
@@ -1388,6 +1399,8 @@ var __exports__ = (() => {
|
|
|
1388
1399
|
// src/npy-loader.ts
|
|
1389
1400
|
var NPY_MAGIC_NUMBER = new Uint8Array([147, 78, 85, 77, 80, 89]);
|
|
1390
1401
|
var NPYWorkerLoader = {
|
|
1402
|
+
dataType: null,
|
|
1403
|
+
batchType: null,
|
|
1391
1404
|
name: "NPY",
|
|
1392
1405
|
id: "npy",
|
|
1393
1406
|
module: "textures",
|
|
@@ -1518,7 +1531,7 @@ var __exports__ = (() => {
|
|
|
1518
1531
|
var IMAGE_SUPPORTED = typeof Image !== "undefined";
|
|
1519
1532
|
var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
|
|
1520
1533
|
var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
|
|
1521
|
-
var DATA_SUPPORTED =
|
|
1534
|
+
var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
|
|
1522
1535
|
function isImageTypeSupported(type) {
|
|
1523
1536
|
switch (type) {
|
|
1524
1537
|
case "auto":
|
|
@@ -1845,7 +1858,7 @@ var __exports__ = (() => {
|
|
|
1845
1858
|
async function parseToNodeImage(arrayBuffer, options) {
|
|
1846
1859
|
const { mimeType } = getBinaryImageMetadata(arrayBuffer) || {};
|
|
1847
1860
|
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
1848
|
-
|
|
1861
|
+
assert(parseImageNode2);
|
|
1849
1862
|
return await parseImageNode2(arrayBuffer, mimeType);
|
|
1850
1863
|
}
|
|
1851
1864
|
|
|
@@ -1868,7 +1881,7 @@ var __exports__ = (() => {
|
|
|
1868
1881
|
image = await parseToNodeImage(arrayBuffer, options);
|
|
1869
1882
|
break;
|
|
1870
1883
|
default:
|
|
1871
|
-
|
|
1884
|
+
assert(false);
|
|
1872
1885
|
}
|
|
1873
1886
|
if (imageType === "data") {
|
|
1874
1887
|
image = getImageData(image);
|
|
@@ -1907,6 +1920,8 @@ var __exports__ = (() => {
|
|
|
1907
1920
|
// imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
|
|
1908
1921
|
};
|
|
1909
1922
|
var ImageLoader = {
|
|
1923
|
+
dataType: null,
|
|
1924
|
+
batchType: null,
|
|
1910
1925
|
id: "image",
|
|
1911
1926
|
module: "images",
|
|
1912
1927
|
name: "Images",
|
|
@@ -1990,7 +2005,7 @@ var __exports__ = (() => {
|
|
|
1990
2005
|
mipLevels = getMipLevels({ width, height });
|
|
1991
2006
|
urls.push(url);
|
|
1992
2007
|
}
|
|
1993
|
-
|
|
2008
|
+
assert(mipLevels > 0);
|
|
1994
2009
|
for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
|
|
1995
2010
|
const url = generateUrl(getUrl, options, { ...urlOptions, lod: mipLevel });
|
|
1996
2011
|
urls.push(url);
|