@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/basis-worker.js
CHANGED
|
@@ -1,37 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
(() => {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
-
});
|
|
3
|
+
// ../loader-utils/src/lib/module-utils/js-module-utils.ts
|
|
4
|
+
function registerJSModules(modules) {
|
|
5
|
+
globalThis.loaders ||= {};
|
|
6
|
+
globalThis.loaders.modules ||= {};
|
|
7
|
+
Object.assign(globalThis.loaders.modules, modules);
|
|
8
|
+
}
|
|
9
|
+
function getJSModuleOrNull(name) {
|
|
10
|
+
const module = globalThis.loaders?.modules?.[name];
|
|
11
|
+
return module || null;
|
|
12
|
+
}
|
|
35
13
|
|
|
36
14
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
37
15
|
function getVersion() {
|
|
@@ -43,7 +21,7 @@
|
|
|
43
21
|
);
|
|
44
22
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
45
23
|
} else {
|
|
46
|
-
globalThis._loadersgl_.version = "4.2.0-alpha.
|
|
24
|
+
globalThis._loadersgl_.version = "4.2.0-alpha.6";
|
|
47
25
|
}
|
|
48
26
|
}
|
|
49
27
|
return globalThis._loadersgl_.version;
|
|
@@ -136,7 +114,9 @@
|
|
|
136
114
|
}
|
|
137
115
|
getParentPort().then((parentPort2) => {
|
|
138
116
|
if (parentPort2) {
|
|
139
|
-
parentPort2.on("message",
|
|
117
|
+
parentPort2.on("message", (message) => {
|
|
118
|
+
handleMessage(message);
|
|
119
|
+
});
|
|
140
120
|
parentPort2.on("exit", () => console.debug("Node worker closing"));
|
|
141
121
|
} else {
|
|
142
122
|
globalThis.onmessage = handleMessage;
|
|
@@ -194,7 +174,6 @@
|
|
|
194
174
|
}
|
|
195
175
|
|
|
196
176
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
197
|
-
var node = __toESM(require_require_utils(), 1);
|
|
198
177
|
var loadLibraryPromises = {};
|
|
199
178
|
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
|
|
200
179
|
if (moduleName) {
|
|
@@ -231,7 +210,8 @@
|
|
|
231
210
|
}
|
|
232
211
|
if (!isBrowser) {
|
|
233
212
|
try {
|
|
234
|
-
|
|
213
|
+
const { requireFromFile } = globalThis.loaders || {};
|
|
214
|
+
return await requireFromFile?.(libraryUrl);
|
|
235
215
|
} catch (error) {
|
|
236
216
|
console.error(error);
|
|
237
217
|
return null;
|
|
@@ -245,7 +225,8 @@
|
|
|
245
225
|
}
|
|
246
226
|
function loadLibraryFromString(scriptSource, id) {
|
|
247
227
|
if (!isBrowser) {
|
|
248
|
-
|
|
228
|
+
const { requireFromString } = globalThis.loaders || {};
|
|
229
|
+
return requireFromString?.(scriptSource, id);
|
|
249
230
|
}
|
|
250
231
|
if (isWorker) {
|
|
251
232
|
eval.call(globalThis, scriptSource);
|
|
@@ -262,18 +243,20 @@
|
|
|
262
243
|
return null;
|
|
263
244
|
}
|
|
264
245
|
async function loadAsArrayBuffer(url) {
|
|
265
|
-
|
|
246
|
+
const { readFileAsArrayBuffer } = globalThis.loaders || {};
|
|
247
|
+
if (isBrowser || !readFileAsArrayBuffer || url.startsWith("http")) {
|
|
266
248
|
const response = await fetch(url);
|
|
267
249
|
return await response.arrayBuffer();
|
|
268
250
|
}
|
|
269
|
-
return await (
|
|
251
|
+
return await readFileAsArrayBuffer(url);
|
|
270
252
|
}
|
|
271
253
|
async function loadAsText(url) {
|
|
272
|
-
|
|
254
|
+
const { readFileAsText } = globalThis.loaders || {};
|
|
255
|
+
if (isBrowser || !readFileAsText || url.startsWith("http")) {
|
|
273
256
|
const response = await fetch(url);
|
|
274
257
|
return await response.text();
|
|
275
258
|
}
|
|
276
|
-
return await (
|
|
259
|
+
return await readFileAsText(url);
|
|
277
260
|
}
|
|
278
261
|
|
|
279
262
|
// ../loader-utils/src/lib/worker-loader-utils/create-loader-worker.ts
|
|
@@ -358,7 +341,7 @@
|
|
|
358
341
|
}
|
|
359
342
|
|
|
360
343
|
// src/lib/utils/version.ts
|
|
361
|
-
var VERSION2 = true ? "4.2.0-alpha.
|
|
344
|
+
var VERSION2 = true ? "4.2.0-alpha.6" : "latest";
|
|
362
345
|
|
|
363
346
|
// src/lib/parsers/basis-module-loader.ts
|
|
364
347
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -373,11 +356,12 @@
|
|
|
373
356
|
};
|
|
374
357
|
var loadBasisTranscoderPromise;
|
|
375
358
|
async function loadBasisTranscoderModule(options) {
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
359
|
+
registerJSModules(options.modules);
|
|
360
|
+
const basis = getJSModuleOrNull("basis");
|
|
361
|
+
if (basis) {
|
|
362
|
+
return basis;
|
|
379
363
|
}
|
|
380
|
-
loadBasisTranscoderPromise
|
|
364
|
+
loadBasisTranscoderPromise ||= loadBasisTranscoder(options);
|
|
381
365
|
return await loadBasisTranscoderPromise;
|
|
382
366
|
}
|
|
383
367
|
async function loadBasisTranscoder(options) {
|
|
@@ -809,6 +793,8 @@
|
|
|
809
793
|
|
|
810
794
|
// src/basis-loader.ts
|
|
811
795
|
var BasisWorkerLoader = {
|
|
796
|
+
dataType: null,
|
|
797
|
+
batchType: null,
|
|
812
798
|
name: "Basis",
|
|
813
799
|
id: "basis",
|
|
814
800
|
module: "textures",
|
|
@@ -821,12 +807,9 @@
|
|
|
821
807
|
options: {
|
|
822
808
|
basis: {
|
|
823
809
|
format: "auto",
|
|
824
|
-
// gl context doesn't exist on a worker thread
|
|
825
810
|
libraryPath: "libs/",
|
|
826
811
|
containerFormat: "auto",
|
|
827
|
-
// 'basis' || 'ktx2' || 'auto'
|
|
828
812
|
module: "transcoder"
|
|
829
|
-
// 'transcoder' || 'encoder'
|
|
830
813
|
}
|
|
831
814
|
}
|
|
832
815
|
};
|
|
@@ -1,16 +1,55 @@
|
|
|
1
|
-
|
|
2
|
-
export type
|
|
1
|
+
/** Options for the CompressedTextureLoader */
|
|
2
|
+
export type CompressedTextureLoaderOptions = {
|
|
3
3
|
'compressed-texture'?: {
|
|
4
|
+
/** @deprecated Specify path to libraries */
|
|
4
5
|
libraryPath?: string;
|
|
6
|
+
/** Whether to use Basis decoding */
|
|
5
7
|
useBasis?: boolean;
|
|
8
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
9
|
+
workerUrl?: string;
|
|
6
10
|
};
|
|
7
11
|
};
|
|
8
12
|
/**
|
|
9
13
|
* Worker Loader for KTX, DDS, and PVR texture container formats
|
|
10
14
|
*/
|
|
11
|
-
export declare const CompressedTextureWorkerLoader:
|
|
15
|
+
export declare const CompressedTextureWorkerLoader: {
|
|
16
|
+
readonly dataType: any;
|
|
17
|
+
readonly batchType: never;
|
|
18
|
+
readonly name: "Texture Containers";
|
|
19
|
+
readonly id: "compressed-texture";
|
|
20
|
+
readonly module: "textures";
|
|
21
|
+
readonly version: any;
|
|
22
|
+
readonly worker: true;
|
|
23
|
+
readonly extensions: ["ktx", "ktx2", "dds", "pvr"];
|
|
24
|
+
readonly mimeTypes: ["image/ktx2", "image/ktx", "image/vnd-ms.dds", "image/x-dds", "application/octet-stream"];
|
|
25
|
+
readonly binary: true;
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly 'compressed-texture': {
|
|
28
|
+
readonly libraryPath: "libs/";
|
|
29
|
+
readonly useBasis: false;
|
|
30
|
+
};
|
|
31
|
+
};
|
|
32
|
+
};
|
|
12
33
|
/**
|
|
13
34
|
* Loader for KTX, DDS, and PVR texture container formats
|
|
14
35
|
*/
|
|
15
|
-
export declare const CompressedTextureLoader:
|
|
36
|
+
export declare const CompressedTextureLoader: {
|
|
37
|
+
readonly parse: (arrayBuffer: ArrayBuffer, options?: CompressedTextureLoaderOptions) => Promise<import("@loaders.gl/schema").TextureLevel[]>;
|
|
38
|
+
readonly dataType: any;
|
|
39
|
+
readonly batchType: never;
|
|
40
|
+
readonly name: "Texture Containers";
|
|
41
|
+
readonly id: "compressed-texture";
|
|
42
|
+
readonly module: "textures";
|
|
43
|
+
readonly version: any;
|
|
44
|
+
readonly worker: true;
|
|
45
|
+
readonly extensions: ["ktx", "ktx2", "dds", "pvr"];
|
|
46
|
+
readonly mimeTypes: ["image/ktx2", "image/ktx", "image/vnd-ms.dds", "image/x-dds", "application/octet-stream"];
|
|
47
|
+
readonly binary: true;
|
|
48
|
+
readonly options: {
|
|
49
|
+
readonly 'compressed-texture': {
|
|
50
|
+
readonly libraryPath: "libs/";
|
|
51
|
+
readonly useBasis: false;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
};
|
|
16
55
|
//# sourceMappingURL=compressed-texture-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressed-texture-loader.d.ts","sourceRoot":"","sources":["../src/compressed-texture-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compressed-texture-loader.d.ts","sourceRoot":"","sources":["../src/compressed-texture-loader.ts"],"names":[],"mappings":"AASA,8CAA8C;AAC9C,MAAM,MAAM,8BAA8B,GAAG;IAC3C,oBAAoB,CAAC,EAAE;QACrB,4CAA4C;QAC5C,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,oCAAoC;QACpC,QAAQ,CAAC,EAAE,OAAO,CAAC;QACnB,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,6BAA6B;;;;;;;;;;;;;;;;;CA6B6B,CAAC;AAExE;;GAEG;AACH,eAAO,MAAM,uBAAuB;kCAEP,WAAW,YAAY,8BAA8B;;;;;;;;;;;;;;;;;CAkBD,CAAC"}
|
|
@@ -8,6 +8,8 @@ import parseBasis from "./lib/parsers/parse-basis.js";
|
|
|
8
8
|
* Worker Loader for KTX, DDS, and PVR texture container formats
|
|
9
9
|
*/
|
|
10
10
|
export const CompressedTextureWorkerLoader = {
|
|
11
|
+
dataType: null,
|
|
12
|
+
batchType: null,
|
|
11
13
|
name: 'Texture Containers',
|
|
12
14
|
id: 'compressed-texture',
|
|
13
15
|
module: 'textures',
|
|
@@ -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,7 +348,7 @@
|
|
|
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
|
// ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
|
|
371
354
|
var t = new Uint8Array([0]);
|
|
@@ -1035,11 +1018,12 @@
|
|
|
1035
1018
|
};
|
|
1036
1019
|
var loadBasisTranscoderPromise;
|
|
1037
1020
|
async function loadBasisTranscoderModule(options) {
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1021
|
+
registerJSModules(options.modules);
|
|
1022
|
+
const basis = getJSModuleOrNull("basis");
|
|
1023
|
+
if (basis) {
|
|
1024
|
+
return basis;
|
|
1041
1025
|
}
|
|
1042
|
-
loadBasisTranscoderPromise
|
|
1026
|
+
loadBasisTranscoderPromise ||= loadBasisTranscoder(options);
|
|
1043
1027
|
return await loadBasisTranscoderPromise;
|
|
1044
1028
|
}
|
|
1045
1029
|
async function loadBasisTranscoder(options) {
|
|
@@ -1340,6 +1324,8 @@
|
|
|
1340
1324
|
|
|
1341
1325
|
// src/compressed-texture-loader.ts
|
|
1342
1326
|
var CompressedTextureWorkerLoader = {
|
|
1327
|
+
dataType: null,
|
|
1328
|
+
batchType: null,
|
|
1343
1329
|
name: "Texture Containers",
|
|
1344
1330
|
id: "compressed-texture",
|
|
1345
1331
|
module: "textures",
|
|
@@ -1,6 +1,10 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { WriterOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import { encodeImageURLToCompressedTextureURL } from "./lib/encoders/encode-texture.js";
|
|
3
|
+
/** Compressed Texture writer options */
|
|
2
4
|
export type CompressedTextureWriterOptions = WriterOptions & {
|
|
5
|
+
/** @deprecated current working directory */
|
|
3
6
|
cwd?: string;
|
|
7
|
+
/** Compressed Texture writer options */
|
|
4
8
|
texture?: {
|
|
5
9
|
format: string;
|
|
6
10
|
compression: string;
|
|
@@ -13,5 +17,23 @@ export type CompressedTextureWriterOptions = WriterOptions & {
|
|
|
13
17
|
/**
|
|
14
18
|
* DDS Texture Container Exporter
|
|
15
19
|
*/
|
|
16
|
-
export declare const CompressedTextureWriter:
|
|
20
|
+
export declare const CompressedTextureWriter: {
|
|
21
|
+
readonly name: "DDS Texture Container";
|
|
22
|
+
readonly id: "dds";
|
|
23
|
+
readonly module: "textures";
|
|
24
|
+
readonly version: any;
|
|
25
|
+
readonly extensions: ["dds"];
|
|
26
|
+
readonly options: {
|
|
27
|
+
readonly texture: {
|
|
28
|
+
readonly format: "auto";
|
|
29
|
+
readonly compression: "auto";
|
|
30
|
+
readonly quality: "auto";
|
|
31
|
+
readonly mipmap: false;
|
|
32
|
+
readonly flipY: false;
|
|
33
|
+
readonly toolFlags: "";
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
readonly encodeURLtoURL: typeof encodeImageURLToCompressedTextureURL;
|
|
37
|
+
readonly encode: () => never;
|
|
38
|
+
};
|
|
17
39
|
//# sourceMappingURL=compressed-texture-writer.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compressed-texture-writer.d.ts","sourceRoot":"","sources":["../src/compressed-texture-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"compressed-texture-writer.d.ts","sourceRoot":"","sources":["../src/compressed-texture-writer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAoB,aAAa,EAAC,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAC,oCAAoC,EAAC,yCAAsC;AAEnF,wCAAwC;AACxC,MAAM,MAAM,8BAA8B,GAAG,aAAa,GAAG;IAC3D,4CAA4C;IAC5C,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,wCAAwC;IACxC,OAAO,CAAC,EAAE;QACR,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,OAAO,CAAC;QAChB,KAAK,EAAE,OAAO,CAAC;QACf,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,uBAAuB;;;;;;;;;;;;;;;;;;CAuBoD,CAAC"}
|
|
@@ -27,11 +27,3 @@ export const CompressedTextureWriter = {
|
|
|
27
27
|
throw new Error('Not implemented');
|
|
28
28
|
}
|
|
29
29
|
};
|
|
30
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
31
|
-
// export const _TypecheckCompressedTextureWriter: typeof CompressedTextureWriter & {
|
|
32
|
-
// encodeURLtoURL: (
|
|
33
|
-
// inputUrl: string,
|
|
34
|
-
// outputUrl: string,
|
|
35
|
-
// options?: CompressedTextureWriterOptions
|
|
36
|
-
// ) => Promise<string>;
|
|
37
|
-
// } = CompressedTextureWriter;
|
package/dist/crunch-loader.d.ts
CHANGED
|
@@ -1,13 +1,34 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
2
|
import type { TextureLevel } from '@loaders.gl/schema';
|
|
3
|
+
/** CrunchLoader options */
|
|
3
4
|
export type CrunchLoaderOptions = LoaderOptions & {
|
|
5
|
+
/** CrunchLoader options */
|
|
4
6
|
crunch?: {
|
|
7
|
+
/** @deprecated Specify where to load the Crunch decoder library */
|
|
5
8
|
libraryPath?: string;
|
|
9
|
+
/** Override the URL to the worker bundle (by default loads from unpkg.com) */
|
|
10
|
+
workerUrl?: string;
|
|
6
11
|
};
|
|
7
12
|
};
|
|
8
13
|
/**
|
|
9
14
|
* Worker loader for the Crunch compressed texture container format
|
|
10
15
|
* @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader
|
|
11
16
|
*/
|
|
12
|
-
export declare const CrunchLoader:
|
|
17
|
+
export declare const CrunchLoader: {
|
|
18
|
+
readonly dataType: TextureLevel[];
|
|
19
|
+
readonly batchType: never;
|
|
20
|
+
readonly id: "crunch";
|
|
21
|
+
readonly name: "Crunch";
|
|
22
|
+
readonly module: "textures";
|
|
23
|
+
readonly version: any;
|
|
24
|
+
readonly worker: true;
|
|
25
|
+
readonly extensions: ["crn"];
|
|
26
|
+
readonly mimeTypes: ["image/crn", "image/x-crn", "application/octet-stream"];
|
|
27
|
+
readonly binary: true;
|
|
28
|
+
readonly options: {
|
|
29
|
+
readonly crunch: {
|
|
30
|
+
readonly libraryPath: "libs/";
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
};
|
|
13
34
|
//# sourceMappingURL=crunch-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crunch-loader.d.ts","sourceRoot":"","sources":["../src/crunch-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"crunch-loader.d.ts","sourceRoot":"","sources":["../src/crunch-loader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAS,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAGrD,2BAA2B;AAC3B,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,2BAA2B;IAC3B,MAAM,CAAC,EAAE;QACP,mEAAmE;QACnE,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,8EAA8E;QAC9E,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;CAiB8C,CAAC"}
|
package/dist/crunch-loader.js
CHANGED
|
@@ -7,6 +7,8 @@ import { VERSION } from "./lib/utils/version.js";
|
|
|
7
7
|
* @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader
|
|
8
8
|
*/
|
|
9
9
|
export const CrunchLoader = {
|
|
10
|
+
dataType: null,
|
|
11
|
+
batchType: null,
|
|
10
12
|
id: 'crunch',
|
|
11
13
|
name: 'Crunch',
|
|
12
14
|
module: 'textures',
|