@loaders.gl/textures 4.0.0-alpha.16 → 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/basis-worker-node.js +47 -52
- package/dist/basis-worker.js +26 -14
- package/dist/compressed-texture-worker.js +26 -14
- package/dist/crunch-worker.js +18 -6
- package/dist/dist.min.js +23 -11
- package/dist/es5/lib/parsers/basis-module-loader.js +15 -15
- package/dist/es5/lib/parsers/basis-module-loader.js.map +1 -1
- package/dist/es5/lib/parsers/parse-basis.js +7 -7
- package/dist/es5/lib/parsers/parse-basis.js.map +1 -1
- package/dist/es5/lib/texture-api/deep-load.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/lib/parsers/basis-module-loader.js +6 -6
- package/dist/esm/lib/parsers/basis-module-loader.js.map +1 -1
- package/dist/esm/lib/parsers/parse-basis.js +3 -3
- package/dist/esm/lib/parsers/parse-basis.js.map +1 -1
- package/dist/esm/lib/texture-api/deep-load.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +40 -45
- package/dist/ktx2-basis-writer-worker.js +19 -7
- package/dist/lib/parsers/basis-module-loader.d.ts +1 -1
- package/dist/lib/parsers/basis-module-loader.d.ts.map +1 -1
- package/dist/lib/parsers/basis-module-loader.js +7 -7
- package/dist/lib/parsers/parse-basis.js +2 -2
- package/dist/lib/texture-api/deep-load.d.ts.map +1 -1
- package/dist/lib/texture-api/deep-load.js +0 -1
- package/dist/npy-worker.js +1 -1
- package/package.json +7 -7
- package/src/lib/parsers/basis-module-loader.ts +5 -5
- package/src/lib/parsers/parse-basis.ts +3 -3
- package/src/lib/texture-api/deep-load.ts +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"basis-module-loader.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/basis-module-loader.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAsB,
|
|
1
|
+
{"version":3,"file":"basis-module-loader.d.ts","sourceRoot":"","sources":["../../../src/lib/parsers/basis-module-loader.ts"],"names":[],"mappings":"AAYA;;;;GAIG;AACH,wBAAsB,yBAAyB,CAAC,OAAO,KAAA,gBAQtD;AA+CD;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,OAAO,KAAA,gBAQnD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.loadBasisEncoderModule = exports.
|
|
3
|
+
exports.loadBasisEncoderModule = exports.loadBasisTranscoderModule = void 0;
|
|
4
4
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
5
5
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
6
6
|
const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
|
|
@@ -14,21 +14,21 @@ let loadBasisTranscoderPromise;
|
|
|
14
14
|
* @param options
|
|
15
15
|
* @returns {BasisFile} promise
|
|
16
16
|
*/
|
|
17
|
-
async function
|
|
17
|
+
async function loadBasisTranscoderModule(options) {
|
|
18
18
|
const modules = options.modules || {};
|
|
19
19
|
if (modules.basis) {
|
|
20
20
|
return modules.basis;
|
|
21
21
|
}
|
|
22
|
-
loadBasisTranscoderPromise = loadBasisTranscoderPromise ||
|
|
22
|
+
loadBasisTranscoderPromise = loadBasisTranscoderPromise || loadBasisTranscoder(options);
|
|
23
23
|
return await loadBasisTranscoderPromise;
|
|
24
24
|
}
|
|
25
|
-
exports.
|
|
25
|
+
exports.loadBasisTranscoderModule = loadBasisTranscoderModule;
|
|
26
26
|
/**
|
|
27
27
|
* Loads wasm transcoder module
|
|
28
28
|
* @param options
|
|
29
29
|
* @returns {BasisFile} promise
|
|
30
30
|
*/
|
|
31
|
-
async function
|
|
31
|
+
async function loadBasisTranscoder(options) {
|
|
32
32
|
let BASIS = null;
|
|
33
33
|
let wasmBinary = null;
|
|
34
34
|
[BASIS, wasmBinary] = await Promise.all([
|
|
@@ -38,7 +38,7 @@ async function loadBasisTrascoder(options) {
|
|
|
38
38
|
// Depends on how import happened...
|
|
39
39
|
// @ts-ignore TS2339: Property does not exist on type
|
|
40
40
|
BASIS = BASIS || globalThis.BASIS;
|
|
41
|
-
return await
|
|
41
|
+
return await initializeBasisTranscoderModule(BASIS, wasmBinary);
|
|
42
42
|
}
|
|
43
43
|
/**
|
|
44
44
|
* Initialize wasm transcoder module
|
|
@@ -46,7 +46,7 @@ async function loadBasisTrascoder(options) {
|
|
|
46
46
|
* @param wasmBinary - wasm part of the module
|
|
47
47
|
* @returns {BasisFile} promise
|
|
48
48
|
*/
|
|
49
|
-
function
|
|
49
|
+
function initializeBasisTranscoderModule(BasisModule, wasmBinary) {
|
|
50
50
|
const options = {};
|
|
51
51
|
if (wasmBinary) {
|
|
52
52
|
options.wasmBinary = wasmBinary;
|
|
@@ -60,7 +60,7 @@ async function parseBasis(data, options) {
|
|
|
60
60
|
const fileConstructors = await (0, basis_module_loader_1.loadBasisEncoderModule)(options);
|
|
61
61
|
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
62
62
|
}
|
|
63
|
-
const { BasisFile } = await (0, basis_module_loader_1.
|
|
63
|
+
const { BasisFile } = await (0, basis_module_loader_1.loadBasisTranscoderModule)(options);
|
|
64
64
|
return parseBasisFile(BasisFile, data, options);
|
|
65
65
|
}
|
|
66
66
|
switch (options.basis.module) {
|
|
@@ -75,7 +75,7 @@ async function parseBasis(data, options) {
|
|
|
75
75
|
}
|
|
76
76
|
case 'transcoder':
|
|
77
77
|
default:
|
|
78
|
-
const { BasisFile } = await (0, basis_module_loader_1.
|
|
78
|
+
const { BasisFile } = await (0, basis_module_loader_1.loadBasisTranscoderModule)(options);
|
|
79
79
|
return parseBasisFile(BasisFile, data, options);
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deep-load.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/deep-load.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAErF,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,oBAEhF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,
|
|
1
|
+
{"version":3,"file":"deep-load.d.ts","sourceRoot":"","sources":["../../../src/lib/texture-api/deep-load.ts"],"names":[],"mappings":"AAGA,MAAM,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;AAC9C,MAAM,MAAM,IAAI,GAAG,CAAC,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAErF,wBAAsB,QAAQ,CAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,oBAEhF;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,WAAW,GAAG,OAAO,CAAC,GAAG,CAAC,CAI7F"}
|
|
@@ -8,7 +8,6 @@ async function deepLoad(urlTree, load, options) {
|
|
|
8
8
|
}
|
|
9
9
|
exports.deepLoad = deepLoad;
|
|
10
10
|
async function shallowLoad(url, load, options) {
|
|
11
|
-
// console.error('loading', url);
|
|
12
11
|
const response = await fetch(url, options.fetch);
|
|
13
12
|
const arrayBuffer = await response.arrayBuffer();
|
|
14
13
|
return await load(arrayBuffer, options);
|
package/dist/npy-worker.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/textures",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.18",
|
|
4
4
|
"description": "Framework-independent loaders for compressed and super compressed (basis) textures ",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"publishConfig": {
|
|
@@ -45,15 +45,15 @@
|
|
|
45
45
|
"build-crunch-worker": "esbuild src/workers/crunch-worker.ts --outfile=dist/crunch-worker.js --target=esnext --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@loaders.gl/images": "4.0.0-alpha.
|
|
49
|
-
"@loaders.gl/loader-utils": "4.0.0-alpha.
|
|
50
|
-
"@loaders.gl/schema": "4.0.0-alpha.
|
|
51
|
-
"@loaders.gl/worker-utils": "4.0.0-alpha.
|
|
48
|
+
"@loaders.gl/images": "4.0.0-alpha.18",
|
|
49
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.18",
|
|
50
|
+
"@loaders.gl/schema": "4.0.0-alpha.18",
|
|
51
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.18",
|
|
52
52
|
"ktx-parse": "^0.0.4",
|
|
53
53
|
"texture-compressor": "^1.0.2"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"@loaders.gl/polyfills": "4.0.0-alpha.
|
|
56
|
+
"@loaders.gl/polyfills": "4.0.0-alpha.18"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce"
|
|
59
59
|
}
|
|
@@ -15,13 +15,13 @@ let loadBasisTranscoderPromise;
|
|
|
15
15
|
* @param options
|
|
16
16
|
* @returns {BasisFile} promise
|
|
17
17
|
*/
|
|
18
|
-
export async function
|
|
18
|
+
export async function loadBasisTranscoderModule(options) {
|
|
19
19
|
const modules = options.modules || {};
|
|
20
20
|
if (modules.basis) {
|
|
21
21
|
return modules.basis;
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
-
loadBasisTranscoderPromise = loadBasisTranscoderPromise ||
|
|
24
|
+
loadBasisTranscoderPromise = loadBasisTranscoderPromise || loadBasisTranscoder(options);
|
|
25
25
|
return await loadBasisTranscoderPromise;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -30,7 +30,7 @@ export async function loadBasisTrascoderModule(options) {
|
|
|
30
30
|
* @param options
|
|
31
31
|
* @returns {BasisFile} promise
|
|
32
32
|
*/
|
|
33
|
-
async function
|
|
33
|
+
async function loadBasisTranscoder(options) {
|
|
34
34
|
let BASIS = null;
|
|
35
35
|
let wasmBinary = null;
|
|
36
36
|
|
|
@@ -42,7 +42,7 @@ async function loadBasisTrascoder(options) {
|
|
|
42
42
|
// Depends on how import happened...
|
|
43
43
|
// @ts-ignore TS2339: Property does not exist on type
|
|
44
44
|
BASIS = BASIS || globalThis.BASIS;
|
|
45
|
-
return await
|
|
45
|
+
return await initializeBasisTranscoderModule(BASIS, wasmBinary);
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/**
|
|
@@ -51,7 +51,7 @@ async function loadBasisTrascoder(options) {
|
|
|
51
51
|
* @param wasmBinary - wasm part of the module
|
|
52
52
|
* @returns {BasisFile} promise
|
|
53
53
|
*/
|
|
54
|
-
function
|
|
54
|
+
function initializeBasisTranscoderModule(BasisModule, wasmBinary) {
|
|
55
55
|
const options: {wasmBinary?} = {};
|
|
56
56
|
|
|
57
57
|
if (wasmBinary) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable indent */
|
|
2
2
|
import type {TextureLevel} from '@loaders.gl/schema';
|
|
3
|
-
import {loadBasisEncoderModule,
|
|
3
|
+
import {loadBasisEncoderModule, loadBasisTranscoderModule} from './basis-module-loader';
|
|
4
4
|
import {GL_EXTENSIONS_CONSTANTS} from '../gl-extensions';
|
|
5
5
|
import {getSupportedGPUTextureFormats} from '../utils/texture-formats';
|
|
6
6
|
import {isKTX} from './parse-ktx';
|
|
@@ -86,7 +86,7 @@ export default async function parseBasis(data: ArrayBuffer, options): Promise<Te
|
|
|
86
86
|
const fileConstructors = await loadBasisEncoderModule(options);
|
|
87
87
|
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
88
88
|
}
|
|
89
|
-
const {BasisFile} = await
|
|
89
|
+
const {BasisFile} = await loadBasisTranscoderModule(options);
|
|
90
90
|
return parseBasisFile(BasisFile, data, options);
|
|
91
91
|
}
|
|
92
92
|
switch (options.basis.module) {
|
|
@@ -101,7 +101,7 @@ export default async function parseBasis(data: ArrayBuffer, options): Promise<Te
|
|
|
101
101
|
}
|
|
102
102
|
case 'transcoder':
|
|
103
103
|
default:
|
|
104
|
-
const {BasisFile} = await
|
|
104
|
+
const {BasisFile} = await loadBasisTranscoderModule(options);
|
|
105
105
|
return parseBasisFile(BasisFile, data, options);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
@@ -9,7 +9,6 @@ export async function deepLoad(urlTree: unknown, load: Load, options: LoadOption
|
|
|
9
9
|
}
|
|
10
10
|
|
|
11
11
|
export async function shallowLoad(url: string, load: Load, options: LoadOptions): Promise<any> {
|
|
12
|
-
// console.error('loading', url);
|
|
13
12
|
const response = await fetch(url, options.fetch);
|
|
14
13
|
const arrayBuffer = await response.arrayBuffer();
|
|
15
14
|
return await load(arrayBuffer, options);
|