@loaders.gl/textures 4.0.0-alpha.23 → 4.0.0-alpha.24
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 +2 -2
- package/dist/basis-worker.js +2 -2
- package/dist/compressed-texture-worker.js +2 -2
- package/dist/crunch-loader.d.ts +9 -2
- package/dist/crunch-loader.d.ts.map +1 -1
- package/dist/crunch-worker.js +2 -2
- package/dist/es5/crunch-loader.js.map +1 -1
- package/dist/es5/lib/utils/version.js +1 -1
- package/dist/esm/crunch-loader.js.map +1 -1
- package/dist/esm/lib/utils/version.js +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +2 -2
- package/dist/ktx2-basis-writer-worker.js +2 -2
- package/dist/npy-worker.js +1 -1
- package/dist/workers/crunch-worker.d.ts +3 -3
- package/package.json +7 -7
- package/src/crunch-loader.ts +10 -4
- package/dist/basis-loader.js +0 -37
- package/dist/bundle.js +0 -5
- package/dist/compressed-texture-loader.js +0 -63
- package/dist/compressed-texture-writer.js +0 -34
- package/dist/crunch-loader.js +0 -23
- package/dist/index.js +0 -57
- package/dist/ktx2-basis-writer.js +0 -28
- package/dist/lib/encoders/encode-ktx.js +0 -10
- package/dist/lib/encoders/encode-ktx2-basis-texture.js +0 -41
- package/dist/lib/encoders/encode-texture.js +0 -27
- package/dist/lib/gl-extensions.js +0 -72
- package/dist/lib/parsers/basis-module-loader.js +0 -118
- package/dist/lib/parsers/crunch-module-loader.js +0 -39
- package/dist/lib/parsers/parse-basis.js +0 -245
- package/dist/lib/parsers/parse-compressed-texture.js +0 -26
- package/dist/lib/parsers/parse-crunch.js +0 -106
- package/dist/lib/parsers/parse-dds.js +0 -108
- package/dist/lib/parsers/parse-ktx.js +0 -46
- package/dist/lib/parsers/parse-npy.js +0 -81
- package/dist/lib/parsers/parse-pvr.js +0 -250
- package/dist/lib/texture-api/async-deep-map.js +0 -41
- package/dist/lib/texture-api/deep-load.js +0 -15
- package/dist/lib/texture-api/generate-url.js +0 -17
- package/dist/lib/texture-api/load-image-array.js +0 -21
- package/dist/lib/texture-api/load-image-cube.js +0 -47
- package/dist/lib/texture-api/load-image.js +0 -43
- package/dist/lib/texture-api/texture-api-types.js +0 -3
- package/dist/lib/utils/extract-mipmap-images.js +0 -50
- package/dist/lib/utils/ktx-format-helper.js +0 -125
- package/dist/lib/utils/texture-formats.js +0 -51
- package/dist/lib/utils/version.js +0 -8
- package/dist/npy-loader.js +0 -31
- package/dist/types.js +0 -1
- package/dist/workers/basis-worker-node.js +0 -7
- package/dist/workers/basis-worker.js +0 -5
- package/dist/workers/compressed-texture-worker.js +0 -6
- package/dist/workers/crunch-worker.js +0 -14
- package/dist/workers/ktx2-basis-writer-worker-node.js +0 -28
- package/dist/workers/ktx2-basis-writer-worker.js +0 -26
- package/dist/workers/npy-worker.js +0 -5
|
@@ -63302,7 +63302,7 @@ if (!("allSettled" in Promise)) {
|
|
|
63302
63302
|
}
|
|
63303
63303
|
|
|
63304
63304
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
63305
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
63305
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
63306
63306
|
if (false) {
|
|
63307
63307
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
63308
63308
|
}
|
|
@@ -63659,7 +63659,7 @@ async function parseData({
|
|
|
63659
63659
|
}
|
|
63660
63660
|
|
|
63661
63661
|
// src/lib/utils/version.ts
|
|
63662
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
63662
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
63663
63663
|
|
|
63664
63664
|
// src/lib/parsers/basis-module-loader.ts
|
|
63665
63665
|
var BASIS_EXTERNAL_LIBRARIES = {
|
package/dist/basis-worker.js
CHANGED
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
31
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
31
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
32
32
|
if (false) {
|
|
33
33
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
34
34
|
}
|
|
@@ -330,7 +330,7 @@
|
|
|
330
330
|
}
|
|
331
331
|
|
|
332
332
|
// src/lib/utils/version.ts
|
|
333
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
333
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
334
334
|
|
|
335
335
|
// src/lib/parsers/basis-module-loader.ts
|
|
336
336
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
38
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
38
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
39
39
|
if (false) {
|
|
40
40
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
41
41
|
}
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
// src/lib/utils/version.ts
|
|
340
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
340
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
341
341
|
|
|
342
342
|
// ../../node_modules/ktx-parse/dist/ktx-parse.modern.js
|
|
343
343
|
var t = new Uint8Array([0]);
|
package/dist/crunch-loader.d.ts
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
import type { Loader } from '@loaders.gl/loader-utils';
|
|
1
|
+
import type { Loader, LoaderOptions } from '@loaders.gl/loader-utils';
|
|
2
|
+
import type { TextureLevel } from '@loaders.gl/schema';
|
|
3
|
+
export type CrunchLoaderOptions = LoaderOptions & {
|
|
4
|
+
crunch?: {
|
|
5
|
+
libraryPath?: string;
|
|
6
|
+
};
|
|
7
|
+
};
|
|
2
8
|
/**
|
|
3
9
|
* Worker loader for the Crunch compressed texture container format
|
|
10
|
+
* @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader
|
|
4
11
|
*/
|
|
5
|
-
export declare const CrunchLoader: Loader
|
|
12
|
+
export declare const CrunchLoader: Loader<TextureLevel[], never, CrunchLoaderOptions>;
|
|
6
13
|
//# sourceMappingURL=crunch-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crunch-loader.d.ts","sourceRoot":"","sources":["../src/crunch-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,0BAA0B,CAAC;AAGrD
|
|
1
|
+
{"version":3,"file":"crunch-loader.d.ts","sourceRoot":"","sources":["../src/crunch-loader.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,EAAE,aAAa,EAAC,MAAM,0BAA0B,CAAC;AACpE,OAAO,KAAK,EAAC,YAAY,EAAC,MAAM,oBAAoB,CAAC;AAGrD,MAAM,MAAM,mBAAmB,GAAG,aAAa,GAAG;IAChD,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,EAAE,KAAK,EAAE,mBAAmB,CAc3E,CAAC"}
|
package/dist/crunch-worker.js
CHANGED
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
38
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
38
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
39
39
|
if (false) {
|
|
40
40
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
41
41
|
}
|
|
@@ -337,7 +337,7 @@
|
|
|
337
337
|
}
|
|
338
338
|
|
|
339
339
|
// src/lib/utils/version.ts
|
|
340
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
340
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
341
341
|
|
|
342
342
|
// src/crunch-loader.ts
|
|
343
343
|
var CrunchLoader = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crunch-loader.js","names":["_version","require","CrunchLoader","id","name","module","version","VERSION","worker","extensions","mimeTypes","binary","options","crunch","libraryPath","exports"],"sources":["../../src/crunch-loader.ts"],"sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\n\n/**\n * Worker loader for the Crunch compressed texture container format\n */\nexport const CrunchLoader: Loader = {\n id: 'crunch',\n name: 'Crunch',\n module: 'textures',\n version: VERSION,\n worker: true,\n extensions: ['crn'],\n mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],\n binary: true,\n options: {\n crunch: {\n libraryPath: 'libs/'\n }\n }\n};\n
|
|
1
|
+
{"version":3,"file":"crunch-loader.js","names":["_version","require","CrunchLoader","id","name","module","version","VERSION","worker","extensions","mimeTypes","binary","options","crunch","libraryPath","exports"],"sources":["../../src/crunch-loader.ts"],"sourcesContent":["import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {TextureLevel} from '@loaders.gl/schema';\nimport {VERSION} from './lib/utils/version';\n\nexport type CrunchLoaderOptions = LoaderOptions & {\n crunch?: {\n libraryPath?: string;\n };\n};\n\n/**\n * Worker loader for the Crunch compressed texture container format\n * @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader\n */\nexport const CrunchLoader: Loader<TextureLevel[], never, CrunchLoaderOptions> = {\n id: 'crunch',\n name: 'Crunch',\n module: 'textures',\n version: VERSION,\n worker: true,\n extensions: ['crn'],\n mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],\n binary: true,\n options: {\n crunch: {\n libraryPath: 'libs/'\n }\n }\n};\n"],"mappings":";;;;;;AAEA,IAAAA,QAAA,GAAAC,OAAA;AAYO,IAAMC,YAAgE,GAAG;EAC9EC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,UAAU;EAClBC,OAAO,EAAEC,gBAAO;EAChBC,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,0BAA0B,CAAC;EACnEC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE;IACPC,MAAM,EAAE;MACNC,WAAW,EAAE;IACf;EACF;AACF,CAAC;AAACC,OAAA,CAAAb,YAAA,GAAAA,YAAA"}
|
|
@@ -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.24" !== 'undefined' ? "4.0.0-alpha.24" : 'beta';
|
|
8
8
|
exports.VERSION = VERSION;
|
|
9
9
|
//# sourceMappingURL=version.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"crunch-loader.js","names":["VERSION","CrunchLoader","id","name","module","version","worker","extensions","mimeTypes","binary","options","crunch","libraryPath"],"sources":["../../src/crunch-loader.ts"],"sourcesContent":["import type {Loader} from '@loaders.gl/loader-utils';\nimport {VERSION} from './lib/utils/version';\n\n/**\n * Worker loader for the Crunch compressed texture container format\n */\nexport const CrunchLoader: Loader = {\n id: 'crunch',\n name: 'Crunch',\n module: 'textures',\n version: VERSION,\n worker: true,\n extensions: ['crn'],\n mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],\n binary: true,\n options: {\n crunch: {\n libraryPath: 'libs/'\n }\n }\n};\n
|
|
1
|
+
{"version":3,"file":"crunch-loader.js","names":["VERSION","CrunchLoader","id","name","module","version","worker","extensions","mimeTypes","binary","options","crunch","libraryPath"],"sources":["../../src/crunch-loader.ts"],"sourcesContent":["import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';\nimport type {TextureLevel} from '@loaders.gl/schema';\nimport {VERSION} from './lib/utils/version';\n\nexport type CrunchLoaderOptions = LoaderOptions & {\n crunch?: {\n libraryPath?: string;\n };\n};\n\n/**\n * Worker loader for the Crunch compressed texture container format\n * @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader\n */\nexport const CrunchLoader: Loader<TextureLevel[], never, CrunchLoaderOptions> = {\n id: 'crunch',\n name: 'Crunch',\n module: 'textures',\n version: VERSION,\n worker: true,\n extensions: ['crn'],\n mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],\n binary: true,\n options: {\n crunch: {\n libraryPath: 'libs/'\n }\n }\n};\n"],"mappings":"AAEA,SAAQA,OAAO,QAAO,qBAAqB;AAY3C,OAAO,MAAMC,YAAgE,GAAG;EAC9EC,EAAE,EAAE,QAAQ;EACZC,IAAI,EAAE,QAAQ;EACdC,MAAM,EAAE,UAAU;EAClBC,OAAO,EAAEL,OAAO;EAChBM,MAAM,EAAE,IAAI;EACZC,UAAU,EAAE,CAAC,KAAK,CAAC;EACnBC,SAAS,EAAE,CAAC,WAAW,EAAE,aAAa,EAAE,0BAA0B,CAAC;EACnEC,MAAM,EAAE,IAAI;EACZC,OAAO,EAAE;IACPC,MAAM,EAAE;MACNC,WAAW,EAAE;IACf;EACF;AACF,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = typeof "4.0.0-alpha.
|
|
1
|
+
export const VERSION = typeof "4.0.0-alpha.24" !== 'undefined' ? "4.0.0-alpha.24" : 'beta';
|
|
2
2
|
//# sourceMappingURL=version.js.map
|
|
@@ -63127,7 +63127,7 @@ if (!("allSettled" in Promise)) {
|
|
|
63127
63127
|
}
|
|
63128
63128
|
|
|
63129
63129
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
63130
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
63130
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
63131
63131
|
if (false) {
|
|
63132
63132
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
63133
63133
|
}
|
|
@@ -63406,7 +63406,7 @@ async function loadAsText(url) {
|
|
|
63406
63406
|
}
|
|
63407
63407
|
|
|
63408
63408
|
// src/lib/utils/version.ts
|
|
63409
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
63409
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
63410
63410
|
|
|
63411
63411
|
// src/lib/parsers/basis-module-loader.ts
|
|
63412
63412
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -28,7 +28,7 @@
|
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
// ../worker-utils/src/lib/env-utils/version.ts
|
|
31
|
-
var VERSION = true ? "4.0.0-alpha.
|
|
31
|
+
var VERSION = true ? "4.0.0-alpha.24" : DEFAULT_VERSION;
|
|
32
32
|
if (false) {
|
|
33
33
|
console.error("loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN.");
|
|
34
34
|
}
|
|
@@ -250,7 +250,7 @@
|
|
|
250
250
|
}
|
|
251
251
|
|
|
252
252
|
// src/lib/utils/version.ts
|
|
253
|
-
var VERSION3 = true ? "4.0.0-alpha.
|
|
253
|
+
var VERSION3 = true ? "4.0.0-alpha.24" : "beta";
|
|
254
254
|
|
|
255
255
|
// src/lib/parsers/basis-module-loader.ts
|
|
256
256
|
var BASIS_EXTERNAL_LIBRARIES = {
|
package/dist/npy-worker.js
CHANGED
|
@@ -4,9 +4,9 @@ import { parseCrunch } from '../lib/parsers/parse-crunch';
|
|
|
4
4
|
*/
|
|
5
5
|
export declare const CrunchLoaderWithParser: {
|
|
6
6
|
parse: typeof parseCrunch;
|
|
7
|
-
dataType?:
|
|
8
|
-
batchType?:
|
|
9
|
-
options: import("
|
|
7
|
+
dataType?: import("@loaders.gl/schema").TextureLevel[] | undefined;
|
|
8
|
+
batchType?: undefined;
|
|
9
|
+
options: import("../crunch-loader").CrunchLoaderOptions;
|
|
10
10
|
deprecatedOptions?: Record<string, string | Record<string, string>> | undefined;
|
|
11
11
|
name: string;
|
|
12
12
|
id: string;
|
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.24",
|
|
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.24",
|
|
49
|
+
"@loaders.gl/loader-utils": "4.0.0-alpha.24",
|
|
50
|
+
"@loaders.gl/schema": "4.0.0-alpha.24",
|
|
51
|
+
"@loaders.gl/worker-utils": "4.0.0-alpha.24",
|
|
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.24"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "97a8990595c132fb14e3445a8768d9f4cb98ff05"
|
|
59
59
|
}
|
package/src/crunch-loader.ts
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
|
-
import type {Loader} from '@loaders.gl/loader-utils';
|
|
1
|
+
import type {Loader, LoaderOptions} from '@loaders.gl/loader-utils';
|
|
2
|
+
import type {TextureLevel} from '@loaders.gl/schema';
|
|
2
3
|
import {VERSION} from './lib/utils/version';
|
|
3
4
|
|
|
5
|
+
export type CrunchLoaderOptions = LoaderOptions & {
|
|
6
|
+
crunch?: {
|
|
7
|
+
libraryPath?: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
|
|
4
11
|
/**
|
|
5
12
|
* Worker loader for the Crunch compressed texture container format
|
|
13
|
+
* @note We avoid bundling crunch - it is a rare format and large lib, so we only offer worker loader
|
|
6
14
|
*/
|
|
7
|
-
export const CrunchLoader: Loader = {
|
|
15
|
+
export const CrunchLoader: Loader<TextureLevel[], never, CrunchLoaderOptions> = {
|
|
8
16
|
id: 'crunch',
|
|
9
17
|
name: 'Crunch',
|
|
10
18
|
module: 'textures',
|
|
@@ -19,5 +27,3 @@ export const CrunchLoader: Loader = {
|
|
|
19
27
|
}
|
|
20
28
|
}
|
|
21
29
|
};
|
|
22
|
-
|
|
23
|
-
// We avoid bundling crunch - rare format, only offer worker loader
|
package/dist/basis-loader.js
DELETED
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.BasisLoader = exports.BasisWorkerLoader = void 0;
|
|
7
|
-
const version_1 = require("./lib/utils/version");
|
|
8
|
-
const parse_basis_1 = __importDefault(require("./lib/parsers/parse-basis"));
|
|
9
|
-
/**
|
|
10
|
-
* Worker loader for Basis super compressed textures
|
|
11
|
-
*/
|
|
12
|
-
exports.BasisWorkerLoader = {
|
|
13
|
-
name: 'Basis',
|
|
14
|
-
id: 'basis',
|
|
15
|
-
module: 'textures',
|
|
16
|
-
version: version_1.VERSION,
|
|
17
|
-
worker: true,
|
|
18
|
-
extensions: ['basis', 'ktx2'],
|
|
19
|
-
mimeTypes: ['application/octet-stream', 'image/ktx2'],
|
|
20
|
-
tests: ['sB'],
|
|
21
|
-
binary: true,
|
|
22
|
-
options: {
|
|
23
|
-
basis: {
|
|
24
|
-
format: 'auto',
|
|
25
|
-
libraryPath: 'libs/',
|
|
26
|
-
containerFormat: 'auto',
|
|
27
|
-
module: 'transcoder' // 'transcoder' || 'encoder'
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
/**
|
|
32
|
-
* Loader for Basis super compressed textures
|
|
33
|
-
*/
|
|
34
|
-
exports.BasisLoader = {
|
|
35
|
-
...exports.BasisWorkerLoader,
|
|
36
|
-
parse: parse_basis_1.default
|
|
37
|
-
};
|
package/dist/bundle.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.CompressedTextureLoader = exports.CompressedTextureWorkerLoader = void 0;
|
|
7
|
-
const version_1 = require("./lib/utils/version");
|
|
8
|
-
const parse_compressed_texture_1 = require("./lib/parsers/parse-compressed-texture");
|
|
9
|
-
const parse_basis_1 = __importDefault(require("./lib/parsers/parse-basis"));
|
|
10
|
-
/**
|
|
11
|
-
* Worker Loader for KTX, DDS, and PVR texture container formats
|
|
12
|
-
*/
|
|
13
|
-
exports.CompressedTextureWorkerLoader = {
|
|
14
|
-
name: 'Texture Containers',
|
|
15
|
-
id: 'compressed-texture',
|
|
16
|
-
module: 'textures',
|
|
17
|
-
version: version_1.VERSION,
|
|
18
|
-
worker: true,
|
|
19
|
-
extensions: [
|
|
20
|
-
'ktx',
|
|
21
|
-
'ktx2',
|
|
22
|
-
'dds',
|
|
23
|
-
'pvr' // WEBGL_compressed_texture_pvrtc
|
|
24
|
-
],
|
|
25
|
-
mimeTypes: [
|
|
26
|
-
'image/ktx2',
|
|
27
|
-
'image/ktx',
|
|
28
|
-
'image/vnd-ms.dds',
|
|
29
|
-
'image/x-dds',
|
|
30
|
-
'application/octet-stream'
|
|
31
|
-
],
|
|
32
|
-
binary: true,
|
|
33
|
-
options: {
|
|
34
|
-
'compressed-texture': {
|
|
35
|
-
libraryPath: 'libs/',
|
|
36
|
-
useBasis: false
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
};
|
|
40
|
-
/**
|
|
41
|
-
* Loader for KTX, DDS, and PVR texture container formats
|
|
42
|
-
*/
|
|
43
|
-
exports.CompressedTextureLoader = {
|
|
44
|
-
...exports.CompressedTextureWorkerLoader,
|
|
45
|
-
parse: async (arrayBuffer, options) => {
|
|
46
|
-
if (options?.['compressed-texture']?.useBasis) {
|
|
47
|
-
// @ts-expect-error TODO not allowed to modify inputs
|
|
48
|
-
options.basis = {
|
|
49
|
-
format: {
|
|
50
|
-
alpha: 'BC3',
|
|
51
|
-
noAlpha: 'BC1'
|
|
52
|
-
},
|
|
53
|
-
// @ts-expect-error TODO not allowed to modify inputs
|
|
54
|
-
...options.basis,
|
|
55
|
-
containerFormat: 'ktx2',
|
|
56
|
-
module: 'encoder'
|
|
57
|
-
};
|
|
58
|
-
const result = await (0, parse_basis_1.default)(arrayBuffer, options);
|
|
59
|
-
return result[0];
|
|
60
|
-
}
|
|
61
|
-
return (0, parse_compressed_texture_1.parseCompressedTexture)(arrayBuffer);
|
|
62
|
-
}
|
|
63
|
-
};
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CompressedTextureWriter = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
const encode_texture_1 = require("./lib/encoders/encode-texture");
|
|
6
|
-
/**
|
|
7
|
-
* DDS Texture Container Exporter
|
|
8
|
-
*/
|
|
9
|
-
exports.CompressedTextureWriter = {
|
|
10
|
-
name: 'DDS Texture Container',
|
|
11
|
-
id: 'dds',
|
|
12
|
-
module: 'textures',
|
|
13
|
-
version: version_1.VERSION,
|
|
14
|
-
extensions: ['dds'],
|
|
15
|
-
options: {
|
|
16
|
-
texture: {
|
|
17
|
-
format: 'auto',
|
|
18
|
-
compression: 'auto',
|
|
19
|
-
quality: 'auto',
|
|
20
|
-
mipmap: false,
|
|
21
|
-
flipY: false,
|
|
22
|
-
toolFlags: ''
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
encodeURLtoURL: encode_texture_1.encodeImageURLToCompressedTextureURL
|
|
26
|
-
};
|
|
27
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
28
|
-
// export const _TypecheckCompressedTextureWriter: typeof CompressedTextureWriter & {
|
|
29
|
-
// encodeURLtoURL: (
|
|
30
|
-
// inputUrl: string,
|
|
31
|
-
// outputUrl: string,
|
|
32
|
-
// options?: CompressedTextureWriterOptions
|
|
33
|
-
// ) => Promise<string>;
|
|
34
|
-
// } = CompressedTextureWriter;
|
package/dist/crunch-loader.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CrunchLoader = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
/**
|
|
6
|
-
* Worker loader for the Crunch compressed texture container format
|
|
7
|
-
*/
|
|
8
|
-
exports.CrunchLoader = {
|
|
9
|
-
id: 'crunch',
|
|
10
|
-
name: 'Crunch',
|
|
11
|
-
module: 'textures',
|
|
12
|
-
version: version_1.VERSION,
|
|
13
|
-
worker: true,
|
|
14
|
-
extensions: ['crn'],
|
|
15
|
-
mimeTypes: ['image/crn', 'image/x-crn', 'application/octet-stream'],
|
|
16
|
-
binary: true,
|
|
17
|
-
options: {
|
|
18
|
-
crunch: {
|
|
19
|
-
libraryPath: 'libs/'
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
// We avoid bundling crunch - rare format, only offer worker loader
|
package/dist/index.js
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.CrunchWorkerLoader = exports.getSupportedGPUTextureFormats = exports.selectSupportedBasisFormat = exports.GL_EXTENSIONS_CONSTANTS = exports.loadImageTextureCube = exports.loadImageTextureArray = exports.loadImageTexture = exports.KTX2BasisWriterWorker = exports.KTX2BasisWriter = exports.CompressedTextureWriter = exports.CRUNCH_EXTERNAL_LIBRARIES = exports.BASIS_EXTERNAL_LIBRARIES = exports.NPYWorkerLoader = exports.NPYLoader = exports.CrunchLoader = exports.CompressedTextureWorkerLoader = exports.CompressedTextureLoader = exports.BasisWorkerLoader = exports.BasisLoader = void 0;
|
|
4
|
-
const version_1 = require("./lib/utils/version");
|
|
5
|
-
// Loaders
|
|
6
|
-
var basis_loader_1 = require("./basis-loader");
|
|
7
|
-
Object.defineProperty(exports, "BasisLoader", { enumerable: true, get: function () { return basis_loader_1.BasisLoader; } });
|
|
8
|
-
Object.defineProperty(exports, "BasisWorkerLoader", { enumerable: true, get: function () { return basis_loader_1.BasisWorkerLoader; } });
|
|
9
|
-
var compressed_texture_loader_1 = require("./compressed-texture-loader");
|
|
10
|
-
Object.defineProperty(exports, "CompressedTextureLoader", { enumerable: true, get: function () { return compressed_texture_loader_1.CompressedTextureLoader; } });
|
|
11
|
-
Object.defineProperty(exports, "CompressedTextureWorkerLoader", { enumerable: true, get: function () { return compressed_texture_loader_1.CompressedTextureWorkerLoader; } });
|
|
12
|
-
var crunch_loader_1 = require("./crunch-loader");
|
|
13
|
-
Object.defineProperty(exports, "CrunchLoader", { enumerable: true, get: function () { return crunch_loader_1.CrunchLoader; } });
|
|
14
|
-
var npy_loader_1 = require("./npy-loader");
|
|
15
|
-
Object.defineProperty(exports, "NPYLoader", { enumerable: true, get: function () { return npy_loader_1.NPYLoader; } });
|
|
16
|
-
Object.defineProperty(exports, "NPYWorkerLoader", { enumerable: true, get: function () { return npy_loader_1.NPYWorkerLoader; } });
|
|
17
|
-
// Module constants
|
|
18
|
-
var basis_module_loader_1 = require("./lib/parsers/basis-module-loader");
|
|
19
|
-
Object.defineProperty(exports, "BASIS_EXTERNAL_LIBRARIES", { enumerable: true, get: function () { return basis_module_loader_1.BASIS_EXTERNAL_LIBRARIES; } });
|
|
20
|
-
var crunch_module_loader_1 = require("./lib/parsers/crunch-module-loader");
|
|
21
|
-
Object.defineProperty(exports, "CRUNCH_EXTERNAL_LIBRARIES", { enumerable: true, get: function () { return crunch_module_loader_1.CRUNCH_EXTERNAL_LIBRARIES; } });
|
|
22
|
-
// Writers
|
|
23
|
-
var compressed_texture_writer_1 = require("./compressed-texture-writer");
|
|
24
|
-
Object.defineProperty(exports, "CompressedTextureWriter", { enumerable: true, get: function () { return compressed_texture_writer_1.CompressedTextureWriter; } });
|
|
25
|
-
var ktx2_basis_writer_1 = require("./ktx2-basis-writer");
|
|
26
|
-
Object.defineProperty(exports, "KTX2BasisWriter", { enumerable: true, get: function () { return ktx2_basis_writer_1.KTX2BasisWriter; } });
|
|
27
|
-
exports.KTX2BasisWriterWorker = {
|
|
28
|
-
name: 'Basis Universal Supercompressed GPU Texture',
|
|
29
|
-
id: 'ktx2-basis-writer',
|
|
30
|
-
module: 'textures',
|
|
31
|
-
version: version_1.VERSION,
|
|
32
|
-
extensions: ['ktx2'],
|
|
33
|
-
worker: true,
|
|
34
|
-
options: {
|
|
35
|
-
useSRGB: false,
|
|
36
|
-
qualityLevel: 10,
|
|
37
|
-
encodeUASTC: false,
|
|
38
|
-
mipmaps: false
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
|
-
// Texture Loading API
|
|
42
|
-
var load_image_1 = require("./lib/texture-api/load-image");
|
|
43
|
-
Object.defineProperty(exports, "loadImageTexture", { enumerable: true, get: function () { return load_image_1.loadImageTexture; } });
|
|
44
|
-
var load_image_array_1 = require("./lib/texture-api/load-image-array");
|
|
45
|
-
Object.defineProperty(exports, "loadImageTextureArray", { enumerable: true, get: function () { return load_image_array_1.loadImageTextureArray; } });
|
|
46
|
-
var load_image_cube_1 = require("./lib/texture-api/load-image-cube");
|
|
47
|
-
Object.defineProperty(exports, "loadImageTextureCube", { enumerable: true, get: function () { return load_image_cube_1.loadImageTextureCube; } });
|
|
48
|
-
// Utilities
|
|
49
|
-
var gl_extensions_1 = require("./lib/gl-extensions");
|
|
50
|
-
Object.defineProperty(exports, "GL_EXTENSIONS_CONSTANTS", { enumerable: true, get: function () { return gl_extensions_1.GL_EXTENSIONS_CONSTANTS; } });
|
|
51
|
-
var parse_basis_1 = require("./lib/parsers/parse-basis");
|
|
52
|
-
Object.defineProperty(exports, "selectSupportedBasisFormat", { enumerable: true, get: function () { return parse_basis_1.selectSupportedBasisFormat; } });
|
|
53
|
-
var texture_formats_1 = require("./lib/utils/texture-formats");
|
|
54
|
-
Object.defineProperty(exports, "getSupportedGPUTextureFormats", { enumerable: true, get: function () { return texture_formats_1.getSupportedGPUTextureFormats; } });
|
|
55
|
-
// DEPRECATED
|
|
56
|
-
var crunch_loader_2 = require("./crunch-loader");
|
|
57
|
-
Object.defineProperty(exports, "CrunchWorkerLoader", { enumerable: true, get: function () { return crunch_loader_2.CrunchLoader; } });
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// loaders.gl, MIT license
|
|
3
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports._TypecheckKTX2TextureWriter = exports.KTX2BasisWriter = void 0;
|
|
5
|
-
const version_1 = require("./lib/utils/version");
|
|
6
|
-
const encode_ktx2_basis_texture_1 = require("./lib/encoders/encode-ktx2-basis-texture");
|
|
7
|
-
/**
|
|
8
|
-
* Basis Universal Supercompressed GPU Texture.
|
|
9
|
-
* Spec - https://github.com/Esri/i3s-spec/blob/master/docs/1.8/textureSetDefinitionFormat.cmn.md
|
|
10
|
-
*/
|
|
11
|
-
exports.KTX2BasisWriter = {
|
|
12
|
-
name: 'Basis Universal Supercompressed GPU Texture',
|
|
13
|
-
id: 'ktx2-basis-writer',
|
|
14
|
-
module: 'textures',
|
|
15
|
-
version: version_1.VERSION,
|
|
16
|
-
extensions: ['ktx2'],
|
|
17
|
-
options: {
|
|
18
|
-
['ktx2-basis-writer']: {
|
|
19
|
-
useSRGB: false,
|
|
20
|
-
qualityLevel: 10,
|
|
21
|
-
encodeUASTC: false,
|
|
22
|
-
mipmaps: false
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
encode: encode_ktx2_basis_texture_1.encodeKTX2BasisTexture
|
|
26
|
-
};
|
|
27
|
-
// TYPE TESTS - TODO find a better way than exporting junk
|
|
28
|
-
exports._TypecheckKTX2TextureWriter = exports.KTX2BasisWriter;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeKTX = void 0;
|
|
4
|
-
const ktx_parse_1 = require("ktx-parse");
|
|
5
|
-
function encodeKTX(texture) {
|
|
6
|
-
const ktx = (0, ktx_parse_1.read)(texture);
|
|
7
|
-
// post process
|
|
8
|
-
return ktx;
|
|
9
|
-
}
|
|
10
|
-
exports.encodeKTX = encodeKTX;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeKTX2BasisTexture = void 0;
|
|
4
|
-
const basis_module_loader_1 = require("../parsers/basis-module-loader");
|
|
5
|
-
/**
|
|
6
|
-
* Encodes image to Basis Universal Supercompressed GPU Texture.
|
|
7
|
-
* Code example is taken from here - https://github.com/BinomialLLC/basis_universal/blob/master/webgl/ktx2_encode_test/index.html#L279
|
|
8
|
-
* BasisEncoder API - https://github.com/BinomialLLC/basis_universal/blob/master/webgl/transcoder/basis_wrappers.cpp#L1712
|
|
9
|
-
* @param image
|
|
10
|
-
* @param options
|
|
11
|
-
*/
|
|
12
|
-
async function encodeKTX2BasisTexture(image, options = {}) {
|
|
13
|
-
// TODO remove default values after writer options will be normalized like it done in load module.
|
|
14
|
-
const { useSRGB = false, qualityLevel = 10, encodeUASTC = false, mipmaps = false } = options?.['ktx2-basis-writer'] || {};
|
|
15
|
-
const { BasisEncoder } = await (0, basis_module_loader_1.loadBasisEncoderModule)(options);
|
|
16
|
-
const basisEncoder = new BasisEncoder();
|
|
17
|
-
try {
|
|
18
|
-
const basisFileData = new Uint8Array(image.width * image.height * 4);
|
|
19
|
-
basisEncoder.setCreateKTX2File(true);
|
|
20
|
-
basisEncoder.setKTX2UASTCSupercompression(true);
|
|
21
|
-
basisEncoder.setKTX2SRGBTransferFunc(true);
|
|
22
|
-
basisEncoder.setSliceSourceImage(0, image.data, image.width, image.height, false);
|
|
23
|
-
basisEncoder.setPerceptual(useSRGB);
|
|
24
|
-
basisEncoder.setMipSRGB(useSRGB);
|
|
25
|
-
basisEncoder.setQualityLevel(qualityLevel);
|
|
26
|
-
basisEncoder.setUASTC(encodeUASTC);
|
|
27
|
-
basisEncoder.setMipGen(mipmaps);
|
|
28
|
-
const numOutputBytes = basisEncoder.encode(basisFileData);
|
|
29
|
-
const actualKTX2FileData = basisFileData.subarray(0, numOutputBytes).buffer;
|
|
30
|
-
return actualKTX2FileData;
|
|
31
|
-
}
|
|
32
|
-
catch (error) {
|
|
33
|
-
// eslint-disable-next-line no-console
|
|
34
|
-
console.error('Basis Universal Supercompressed GPU Texture encoder Error: ', error);
|
|
35
|
-
throw error;
|
|
36
|
-
}
|
|
37
|
-
finally {
|
|
38
|
-
basisEncoder.delete();
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
exports.encodeKTX2BasisTexture = encodeKTX2BasisTexture;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encodeImageURLToCompressedTextureURL = void 0;
|
|
4
|
-
const worker_utils_1 = require("@loaders.gl/worker-utils");
|
|
5
|
-
/*
|
|
6
|
-
* @see https://github.com/TimvanScherpenzeel/texture-compressor
|
|
7
|
-
*/
|
|
8
|
-
async function encodeImageURLToCompressedTextureURL(inputUrl, outputUrl, options) {
|
|
9
|
-
// prettier-ignore
|
|
10
|
-
const args = [
|
|
11
|
-
// Note: our actual executable is `npx`, so `texture-compressor` is an argument
|
|
12
|
-
'texture-compressor',
|
|
13
|
-
'--type', 's3tc',
|
|
14
|
-
'--compression', 'DXT1',
|
|
15
|
-
'--quality', 'normal',
|
|
16
|
-
'--input', inputUrl,
|
|
17
|
-
'--output', outputUrl
|
|
18
|
-
];
|
|
19
|
-
const childProcess = new worker_utils_1.ChildProcessProxy();
|
|
20
|
-
await childProcess.start({
|
|
21
|
-
command: 'npx',
|
|
22
|
-
arguments: args,
|
|
23
|
-
spawn: options
|
|
24
|
-
});
|
|
25
|
-
return outputUrl;
|
|
26
|
-
}
|
|
27
|
-
exports.encodeImageURLToCompressedTextureURL = encodeImageURLToCompressedTextureURL;
|