@loaders.gl/textures 4.4.0-alpha.16 → 4.4.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/README.md +44 -0
- package/dist/basis-loader.d.ts +15 -10
- package/dist/basis-loader.d.ts.map +1 -1
- package/dist/basis-loader.js +0 -1
- package/dist/basis-loader.js.map +1 -1
- package/dist/basis-worker-node.js +333 -193
- package/dist/basis-worker.js +267 -128
- package/dist/compressed-texture-loader.d.ts +0 -4
- package/dist/compressed-texture-loader.d.ts.map +1 -1
- package/dist/compressed-texture-loader.js +0 -1
- package/dist/compressed-texture-loader.js.map +1 -1
- package/dist/compressed-texture-worker.js +1050 -331
- package/dist/crunch-loader.d.ts +1 -5
- package/dist/crunch-loader.d.ts.map +1 -1
- package/dist/crunch-loader.js +1 -3
- package/dist/crunch-loader.js.map +1 -1
- package/dist/crunch-worker.js +153 -86
- package/dist/dist.dev.js +1281 -388
- package/dist/dist.min.js +1 -2
- package/dist/index.cjs +671 -330
- package/dist/index.cjs.map +4 -4
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/dist/ktx2-basis-writer-worker-node.js +14 -3
- package/dist/ktx2-basis-writer-worker.js +13 -3
- package/dist/lib/encoders/encode-ktx2-basis-texture.d.ts.map +1 -1
- package/dist/lib/encoders/encode-ktx2-basis-texture.js +2 -1
- package/dist/lib/encoders/encode-ktx2-basis-texture.js.map +1 -1
- package/dist/lib/gl-extensions.d.ts +164 -58
- package/dist/lib/gl-extensions.d.ts.map +1 -1
- package/dist/lib/gl-extensions.js +175 -66
- package/dist/lib/gl-extensions.js.map +1 -1
- package/dist/lib/parsers/crunch-module-loader.d.ts +2 -2
- package/dist/lib/parsers/crunch-module-loader.d.ts.map +1 -1
- package/dist/lib/parsers/crunch-module-loader.js.map +1 -1
- package/dist/lib/parsers/parse-basis.d.ts +16 -2
- package/dist/lib/parsers/parse-basis.d.ts.map +1 -1
- package/dist/lib/parsers/parse-basis.js +222 -47
- package/dist/lib/parsers/parse-basis.js.map +1 -1
- package/dist/lib/parsers/parse-crunch.d.ts.map +1 -1
- package/dist/lib/parsers/parse-crunch.js +6 -5
- package/dist/lib/parsers/parse-crunch.js.map +1 -1
- package/dist/lib/parsers/parse-dds.d.ts.map +1 -1
- package/dist/lib/parsers/parse-dds.js +7 -7
- package/dist/lib/parsers/parse-dds.js.map +1 -1
- package/dist/lib/parsers/parse-ktx.d.ts.map +1 -1
- package/dist/lib/parsers/parse-ktx.js +7 -0
- package/dist/lib/parsers/parse-ktx.js.map +1 -1
- package/dist/lib/parsers/parse-pvr.d.ts.map +1 -1
- package/dist/lib/parsers/parse-pvr.js +28 -70
- package/dist/lib/parsers/parse-pvr.js.map +1 -1
- package/dist/lib/utils/detect-supported-texture-formats.d.ts +14 -0
- package/dist/lib/utils/detect-supported-texture-formats.d.ts.map +1 -0
- package/dist/lib/utils/detect-supported-texture-formats.js +197 -0
- package/dist/lib/utils/detect-supported-texture-formats.js.map +1 -0
- package/dist/lib/utils/extract-mipmap-images.d.ts +2 -2
- package/dist/lib/utils/extract-mipmap-images.d.ts.map +1 -1
- package/dist/lib/utils/extract-mipmap-images.js +12 -2
- package/dist/lib/utils/extract-mipmap-images.js.map +1 -1
- package/dist/lib/utils/ktx-format-helper.d.ts +2 -1
- package/dist/lib/utils/ktx-format-helper.d.ts.map +1 -1
- package/dist/lib/utils/ktx-format-helper.js +67 -109
- package/dist/lib/utils/ktx-format-helper.js.map +1 -1
- package/dist/lib/utils/texture-format-map.d.ts +3 -0
- package/dist/lib/utils/texture-format-map.d.ts.map +1 -0
- package/dist/lib/utils/texture-format-map.js +71 -0
- package/dist/lib/utils/texture-format-map.js.map +1 -0
- package/dist/lib/utils/version.js +1 -1
- package/dist/npy-worker.js +1 -1
- package/dist/workers/crunch-worker.d.ts +1 -3
- package/dist/workers/crunch-worker.d.ts.map +1 -1
- package/package.json +6 -6
- package/src/basis-loader.ts +19 -9
- package/src/compressed-texture-loader.ts +0 -3
- package/src/crunch-loader.ts +1 -5
- package/src/index.ts +2 -4
- package/src/lib/encoders/encode-ktx2-basis-texture.ts +2 -1
- package/src/lib/gl-extensions.ts +186 -81
- package/src/lib/parsers/crunch-module-loader.ts +4 -4
- package/src/lib/parsers/parse-basis.ts +281 -45
- package/src/lib/parsers/parse-crunch.ts +15 -7
- package/src/lib/parsers/parse-dds.ts +16 -9
- package/src/lib/parsers/parse-ktx.ts +12 -2
- package/src/lib/parsers/parse-pvr.ts +72 -72
- package/src/lib/utils/detect-supported-texture-formats.ts +210 -0
- package/src/lib/utils/extract-mipmap-images.ts +15 -4
- package/src/lib/utils/ktx-format-helper.ts +124 -111
- package/src/lib/utils/texture-format-map.ts +135 -0
- package/dist/lib/utils/texture-formats.d.ts +0 -8
- package/dist/lib/utils/texture-formats.d.ts.map +0 -1
- package/dist/lib/utils/texture-formats.js +0 -51
- package/dist/lib/utils/texture-formats.js.map +0 -1
- package/src/lib/utils/texture-formats.ts +0 -59
package/dist/dist.dev.js
CHANGED
|
@@ -45,13 +45,6 @@ var __exports__ = (() => {
|
|
|
45
45
|
}
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
// (disabled):../worker-utils/src/lib/process-utils/child-process-proxy
|
|
49
|
-
var require_child_process_proxy = __commonJS({
|
|
50
|
-
"(disabled):../worker-utils/src/lib/process-utils/child-process-proxy"() {
|
|
51
|
-
"use strict";
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
|
|
55
48
|
// bundle.ts
|
|
56
49
|
var bundle_exports = {};
|
|
57
50
|
__export(bundle_exports, {
|
|
@@ -64,58 +57,88 @@ var __exports__ = (() => {
|
|
|
64
57
|
CompressedTextureWriter: () => CompressedTextureWriter,
|
|
65
58
|
CrunchLoader: () => CrunchLoader,
|
|
66
59
|
CrunchWorkerLoader: () => CrunchLoader,
|
|
60
|
+
GL_COMPRESSED_R11_EAC: () => GL_COMPRESSED_R11_EAC,
|
|
61
|
+
GL_COMPRESSED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
62
|
+
GL_COMPRESSED_RED_RGTC1_EXT: () => GL_COMPRESSED_RED_RGTC1_EXT,
|
|
63
|
+
GL_COMPRESSED_RG11_EAC: () => GL_COMPRESSED_RG11_EAC,
|
|
64
|
+
GL_COMPRESSED_RGB8_ETC2: () => GL_COMPRESSED_RGB8_ETC2,
|
|
65
|
+
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
66
|
+
GL_COMPRESSED_RGBA8_ETC2_EAC: () => GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
67
|
+
GL_COMPRESSED_RGBA_ASTC_10x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
68
|
+
GL_COMPRESSED_RGBA_ASTC_10x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
69
|
+
GL_COMPRESSED_RGBA_ASTC_10x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
70
|
+
GL_COMPRESSED_RGBA_ASTC_10x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
71
|
+
GL_COMPRESSED_RGBA_ASTC_12x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
72
|
+
GL_COMPRESSED_RGBA_ASTC_12x12_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
73
|
+
GL_COMPRESSED_RGBA_ASTC_4x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
74
|
+
GL_COMPRESSED_RGBA_ASTC_5x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
75
|
+
GL_COMPRESSED_RGBA_ASTC_5x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
76
|
+
GL_COMPRESSED_RGBA_ASTC_6x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
77
|
+
GL_COMPRESSED_RGBA_ASTC_6x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
78
|
+
GL_COMPRESSED_RGBA_ASTC_8x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
79
|
+
GL_COMPRESSED_RGBA_ASTC_8x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
80
|
+
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
81
|
+
GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
|
|
82
|
+
GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
83
|
+
GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: () => GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
84
|
+
GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
85
|
+
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
86
|
+
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
87
|
+
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
88
|
+
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
89
|
+
GL_COMPRESSED_RGB_ATC_WEBGL: () => GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
90
|
+
GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
|
|
91
|
+
GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
|
|
92
|
+
GL_COMPRESSED_RGB_ETC1_WEBGL: () => GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
93
|
+
GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
|
|
94
|
+
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
95
|
+
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
96
|
+
GL_COMPRESSED_SIGNED_R11_EAC: () => GL_COMPRESSED_SIGNED_R11_EAC,
|
|
97
|
+
GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
98
|
+
GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: () => GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
99
|
+
GL_COMPRESSED_SIGNED_RG11_EAC: () => GL_COMPRESSED_SIGNED_RG11_EAC,
|
|
100
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
101
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
102
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
103
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
104
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
105
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
106
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
107
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
108
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
109
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
110
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
111
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
112
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
113
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
114
|
+
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: () => GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
115
|
+
GL_COMPRESSED_SRGB8_ETC2: () => GL_COMPRESSED_SRGB8_ETC2,
|
|
116
|
+
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
117
|
+
GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: () => GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
|
|
118
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
119
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
120
|
+
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
121
|
+
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
67
122
|
GL_EXTENSIONS_CONSTANTS: () => GL_EXTENSIONS_CONSTANTS,
|
|
123
|
+
GL_RGB: () => GL_RGB,
|
|
124
|
+
GL_RGB565: () => GL_RGB565,
|
|
125
|
+
GL_RGB5_A1: () => GL_RGB5_A1,
|
|
126
|
+
GL_RGBA: () => GL_RGBA,
|
|
127
|
+
GL_RGBA4: () => GL_RGBA4,
|
|
128
|
+
GL_RGBA8: () => GL_RGBA8,
|
|
68
129
|
KTX2BasisWriter: () => KTX2BasisWriter,
|
|
69
130
|
KTX2BasisWriterWorker: () => KTX2BasisWriterWorker,
|
|
70
131
|
NPYLoader: () => NPYLoader,
|
|
71
132
|
NPYWorkerLoader: () => NPYWorkerLoader,
|
|
72
|
-
getSupportedGPUTextureFormats: () => getSupportedGPUTextureFormats,
|
|
73
133
|
loadImageTexture: () => loadImageTexture,
|
|
74
134
|
loadImageTextureArray: () => loadImageTextureArray,
|
|
75
|
-
loadImageTextureCube: () => loadImageTextureCube
|
|
76
|
-
selectSupportedBasisFormat: () => selectSupportedBasisFormat
|
|
135
|
+
loadImageTextureCube: () => loadImageTextureCube
|
|
77
136
|
});
|
|
78
137
|
__reExport(bundle_exports, __toESM(require_core(), 1));
|
|
79
138
|
|
|
80
139
|
// src/lib/utils/version.ts
|
|
81
140
|
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
82
141
|
|
|
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
|
-
|
|
119
142
|
// ../worker-utils/src/lib/npm-tag.ts
|
|
120
143
|
var NPM_TAG = "beta";
|
|
121
144
|
|
|
@@ -139,34 +162,44 @@ var __exports__ = (() => {
|
|
|
139
162
|
var VERSION2 = getVersion();
|
|
140
163
|
|
|
141
164
|
// ../worker-utils/src/lib/env-utils/assert.ts
|
|
142
|
-
function
|
|
165
|
+
function assert(condition, message) {
|
|
143
166
|
if (!condition) {
|
|
144
167
|
throw new Error(message || "loaders.gl assertion failed.");
|
|
145
168
|
}
|
|
146
169
|
}
|
|
147
170
|
|
|
148
171
|
// ../worker-utils/src/lib/env-utils/globals.ts
|
|
149
|
-
var
|
|
172
|
+
var globals = {
|
|
150
173
|
self: typeof self !== "undefined" && self,
|
|
151
174
|
window: typeof window !== "undefined" && window,
|
|
152
175
|
global: typeof global !== "undefined" && global,
|
|
153
176
|
document: typeof document !== "undefined" && document
|
|
154
177
|
};
|
|
155
|
-
var
|
|
156
|
-
var
|
|
157
|
-
var
|
|
158
|
-
var
|
|
159
|
-
var
|
|
178
|
+
var self_ = globals.self || globals.window || globals.global || {};
|
|
179
|
+
var window_ = globals.window || globals.self || globals.global || {};
|
|
180
|
+
var global_ = globals.global || globals.self || globals.window || {};
|
|
181
|
+
var document_ = globals.document || {};
|
|
182
|
+
var isBrowser = (
|
|
160
183
|
// @ts-ignore process.browser
|
|
161
184
|
typeof process !== "object" || String(process) !== "[object process]" || process.browser
|
|
162
185
|
);
|
|
163
186
|
var isWorker = typeof importScripts === "function";
|
|
164
187
|
var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
|
|
165
|
-
var
|
|
166
|
-
var
|
|
188
|
+
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
189
|
+
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
167
190
|
|
|
168
191
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
169
192
|
var loadLibraryPromises = {};
|
|
193
|
+
function extractLoadLibraryOptions(options = {}) {
|
|
194
|
+
const useLocalLibraries = options.useLocalLibraries ?? options.core?.useLocalLibraries;
|
|
195
|
+
const CDN = options.CDN ?? options.core?.CDN;
|
|
196
|
+
const modules = options.modules;
|
|
197
|
+
return {
|
|
198
|
+
...useLocalLibraries !== void 0 ? { useLocalLibraries } : {},
|
|
199
|
+
...CDN !== void 0 ? { CDN } : {},
|
|
200
|
+
...modules !== void 0 ? { modules } : {}
|
|
201
|
+
};
|
|
202
|
+
}
|
|
170
203
|
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
|
|
171
204
|
if (moduleName) {
|
|
172
205
|
libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
|
|
@@ -187,11 +220,11 @@ var __exports__ = (() => {
|
|
|
187
220
|
if (modules[libraryName]) {
|
|
188
221
|
return modules[libraryName];
|
|
189
222
|
}
|
|
190
|
-
if (!
|
|
223
|
+
if (!isBrowser) {
|
|
191
224
|
return `modules/${moduleName}/dist/libs/${libraryName}`;
|
|
192
225
|
}
|
|
193
226
|
if (options.CDN) {
|
|
194
|
-
|
|
227
|
+
assert(options.CDN.startsWith("http"));
|
|
195
228
|
return `${options.CDN}/${moduleName}@${VERSION2}/dist/libs/${libraryName}`;
|
|
196
229
|
}
|
|
197
230
|
if (isWorker) {
|
|
@@ -203,7 +236,7 @@ var __exports__ = (() => {
|
|
|
203
236
|
if (libraryUrl.endsWith("wasm")) {
|
|
204
237
|
return await loadAsArrayBuffer(libraryUrl);
|
|
205
238
|
}
|
|
206
|
-
if (!
|
|
239
|
+
if (!isBrowser) {
|
|
207
240
|
const { requireFromFile } = globalThis.loaders || {};
|
|
208
241
|
try {
|
|
209
242
|
const result = await requireFromFile?.(libraryUrl);
|
|
@@ -229,7 +262,7 @@ var __exports__ = (() => {
|
|
|
229
262
|
return loadLibraryFromString(scriptSource, libraryUrl);
|
|
230
263
|
}
|
|
231
264
|
function loadLibraryFromString(scriptSource, id) {
|
|
232
|
-
if (!
|
|
265
|
+
if (!isBrowser) {
|
|
233
266
|
const { requireFromString } = globalThis.loaders || {};
|
|
234
267
|
return requireFromString?.(scriptSource, id);
|
|
235
268
|
}
|
|
@@ -249,7 +282,7 @@ var __exports__ = (() => {
|
|
|
249
282
|
}
|
|
250
283
|
async function loadAsArrayBuffer(url) {
|
|
251
284
|
const { readFileAsArrayBuffer } = globalThis.loaders || {};
|
|
252
|
-
if (
|
|
285
|
+
if (isBrowser || !readFileAsArrayBuffer || url.startsWith("http")) {
|
|
253
286
|
const response = await fetch(url);
|
|
254
287
|
return await response.arrayBuffer();
|
|
255
288
|
}
|
|
@@ -264,7 +297,7 @@ var __exports__ = (() => {
|
|
|
264
297
|
}
|
|
265
298
|
async function loadAsText(url) {
|
|
266
299
|
const { readFileAsText } = globalThis.loaders || {};
|
|
267
|
-
if (
|
|
300
|
+
if (isBrowser || !readFileAsText || url.startsWith("http")) {
|
|
268
301
|
const response = await fetch(url);
|
|
269
302
|
return await response.text();
|
|
270
303
|
}
|
|
@@ -278,8 +311,592 @@ var __exports__ = (() => {
|
|
|
278
311
|
}
|
|
279
312
|
}
|
|
280
313
|
|
|
281
|
-
// ../worker-utils/src/
|
|
282
|
-
var
|
|
314
|
+
// ../worker-utils/src/lib/process-utils/child-process-proxy.browser.ts
|
|
315
|
+
var ChildProcessProxy = class {
|
|
316
|
+
constructor() {
|
|
317
|
+
throw new Error("ChildProcessProxy is not available in browser environments");
|
|
318
|
+
}
|
|
319
|
+
async start(props) {
|
|
320
|
+
return await Promise.resolve({});
|
|
321
|
+
}
|
|
322
|
+
async stop() {
|
|
323
|
+
return await Promise.resolve();
|
|
324
|
+
}
|
|
325
|
+
async exit() {
|
|
326
|
+
return await Promise.resolve();
|
|
327
|
+
}
|
|
328
|
+
};
|
|
329
|
+
|
|
330
|
+
// ../loader-utils/src/lib/env-utils/assert.ts
|
|
331
|
+
function assert2(condition, message) {
|
|
332
|
+
if (!condition) {
|
|
333
|
+
throw new Error(message || "loader assertion failed.");
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
// ../loader-utils/src/lib/env-utils/globals.ts
|
|
338
|
+
var globals2 = {
|
|
339
|
+
self: typeof self !== "undefined" && self,
|
|
340
|
+
window: typeof window !== "undefined" && window,
|
|
341
|
+
global: typeof global !== "undefined" && global,
|
|
342
|
+
document: typeof document !== "undefined" && document
|
|
343
|
+
};
|
|
344
|
+
var self_2 = globals2.self || globals2.window || globals2.global || {};
|
|
345
|
+
var window_2 = globals2.window || globals2.self || globals2.global || {};
|
|
346
|
+
var global_2 = globals2.global || globals2.self || globals2.window || {};
|
|
347
|
+
var document_2 = globals2.document || {};
|
|
348
|
+
var isBrowser2 = (
|
|
349
|
+
// @ts-ignore process does not exist on browser
|
|
350
|
+
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
351
|
+
);
|
|
352
|
+
var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
353
|
+
var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
|
|
354
|
+
|
|
355
|
+
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
|
|
356
|
+
var window_3 = globalThis;
|
|
357
|
+
var document_3 = globalThis.document || {};
|
|
358
|
+
var process_ = globalThis.process || {};
|
|
359
|
+
var console_ = globalThis.console;
|
|
360
|
+
var navigator_ = globalThis.navigator || {};
|
|
361
|
+
|
|
362
|
+
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
|
|
363
|
+
function isElectron(mockUserAgent) {
|
|
364
|
+
if (typeof window !== "undefined" && window.process?.type === "renderer") {
|
|
365
|
+
return true;
|
|
366
|
+
}
|
|
367
|
+
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
|
|
368
|
+
return true;
|
|
369
|
+
}
|
|
370
|
+
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
|
|
371
|
+
const userAgent = mockUserAgent || realUserAgent;
|
|
372
|
+
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
|
|
376
|
+
function isBrowser3() {
|
|
377
|
+
const isNode = (
|
|
378
|
+
// @ts-expect-error
|
|
379
|
+
typeof process === "object" && String(process) === "[object process]" && !process?.browser
|
|
380
|
+
);
|
|
381
|
+
return !isNode || isElectron();
|
|
382
|
+
}
|
|
383
|
+
|
|
384
|
+
// ../../node_modules/@probe.gl/env/dist/index.js
|
|
385
|
+
var VERSION3 = true ? "4.1.1" : "untranspiled source";
|
|
386
|
+
|
|
387
|
+
// ../../node_modules/@probe.gl/log/dist/utils/assert.js
|
|
388
|
+
function assert3(condition, message) {
|
|
389
|
+
if (!condition) {
|
|
390
|
+
throw new Error(message || "Assertion failed");
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
|
|
394
|
+
// ../../node_modules/@probe.gl/log/dist/loggers/log-utils.js
|
|
395
|
+
function normalizeLogLevel(logLevel) {
|
|
396
|
+
if (!logLevel) {
|
|
397
|
+
return 0;
|
|
398
|
+
}
|
|
399
|
+
let resolvedLevel;
|
|
400
|
+
switch (typeof logLevel) {
|
|
401
|
+
case "number":
|
|
402
|
+
resolvedLevel = logLevel;
|
|
403
|
+
break;
|
|
404
|
+
case "object":
|
|
405
|
+
resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
|
|
406
|
+
break;
|
|
407
|
+
default:
|
|
408
|
+
return 0;
|
|
409
|
+
}
|
|
410
|
+
assert3(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
|
|
411
|
+
return resolvedLevel;
|
|
412
|
+
}
|
|
413
|
+
function normalizeArguments(opts) {
|
|
414
|
+
const { logLevel, message } = opts;
|
|
415
|
+
opts.logLevel = normalizeLogLevel(logLevel);
|
|
416
|
+
const args = opts.args ? Array.from(opts.args) : [];
|
|
417
|
+
while (args.length && args.shift() !== message) {
|
|
418
|
+
}
|
|
419
|
+
switch (typeof logLevel) {
|
|
420
|
+
case "string":
|
|
421
|
+
case "function":
|
|
422
|
+
if (message !== void 0) {
|
|
423
|
+
args.unshift(message);
|
|
424
|
+
}
|
|
425
|
+
opts.message = logLevel;
|
|
426
|
+
break;
|
|
427
|
+
case "object":
|
|
428
|
+
Object.assign(opts, logLevel);
|
|
429
|
+
break;
|
|
430
|
+
default:
|
|
431
|
+
}
|
|
432
|
+
if (typeof opts.message === "function") {
|
|
433
|
+
opts.message = opts.message();
|
|
434
|
+
}
|
|
435
|
+
const messageType = typeof opts.message;
|
|
436
|
+
assert3(messageType === "string" || messageType === "object");
|
|
437
|
+
return Object.assign(opts, { args }, opts.opts);
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
// ../../node_modules/@probe.gl/log/dist/loggers/base-log.js
|
|
441
|
+
var noop = () => {
|
|
442
|
+
};
|
|
443
|
+
var BaseLog = class {
|
|
444
|
+
constructor({ level = 0 } = {}) {
|
|
445
|
+
this.userData = {};
|
|
446
|
+
this._onceCache = /* @__PURE__ */ new Set();
|
|
447
|
+
this._level = level;
|
|
448
|
+
}
|
|
449
|
+
set level(newLevel) {
|
|
450
|
+
this.setLevel(newLevel);
|
|
451
|
+
}
|
|
452
|
+
get level() {
|
|
453
|
+
return this.getLevel();
|
|
454
|
+
}
|
|
455
|
+
setLevel(level) {
|
|
456
|
+
this._level = level;
|
|
457
|
+
return this;
|
|
458
|
+
}
|
|
459
|
+
getLevel() {
|
|
460
|
+
return this._level;
|
|
461
|
+
}
|
|
462
|
+
// Unconditional logging
|
|
463
|
+
warn(message, ...args) {
|
|
464
|
+
return this._log("warn", 0, message, args, { once: true });
|
|
465
|
+
}
|
|
466
|
+
error(message, ...args) {
|
|
467
|
+
return this._log("error", 0, message, args);
|
|
468
|
+
}
|
|
469
|
+
// Conditional logging
|
|
470
|
+
log(logLevel, message, ...args) {
|
|
471
|
+
return this._log("log", logLevel, message, args);
|
|
472
|
+
}
|
|
473
|
+
info(logLevel, message, ...args) {
|
|
474
|
+
return this._log("info", logLevel, message, args);
|
|
475
|
+
}
|
|
476
|
+
once(logLevel, message, ...args) {
|
|
477
|
+
return this._log("once", logLevel, message, args, { once: true });
|
|
478
|
+
}
|
|
479
|
+
_log(type, logLevel, message, args, options = {}) {
|
|
480
|
+
const normalized = normalizeArguments({
|
|
481
|
+
logLevel,
|
|
482
|
+
message,
|
|
483
|
+
args: this._buildArgs(logLevel, message, args),
|
|
484
|
+
opts: options
|
|
485
|
+
});
|
|
486
|
+
return this._createLogFunction(type, normalized, options);
|
|
487
|
+
}
|
|
488
|
+
_buildArgs(logLevel, message, args) {
|
|
489
|
+
return [logLevel, message, ...args];
|
|
490
|
+
}
|
|
491
|
+
_createLogFunction(type, normalized, options) {
|
|
492
|
+
if (!this._shouldLog(normalized.logLevel)) {
|
|
493
|
+
return noop;
|
|
494
|
+
}
|
|
495
|
+
const tag = this._getOnceTag(options.tag ?? normalized.tag ?? normalized.message);
|
|
496
|
+
if ((options.once || normalized.once) && tag !== void 0) {
|
|
497
|
+
if (this._onceCache.has(tag)) {
|
|
498
|
+
return noop;
|
|
499
|
+
}
|
|
500
|
+
this._onceCache.add(tag);
|
|
501
|
+
}
|
|
502
|
+
return this._emit(type, normalized);
|
|
503
|
+
}
|
|
504
|
+
_shouldLog(logLevel) {
|
|
505
|
+
return this.getLevel() >= normalizeLogLevel(logLevel);
|
|
506
|
+
}
|
|
507
|
+
_getOnceTag(tag) {
|
|
508
|
+
if (tag === void 0) {
|
|
509
|
+
return void 0;
|
|
510
|
+
}
|
|
511
|
+
try {
|
|
512
|
+
return typeof tag === "string" ? tag : String(tag);
|
|
513
|
+
} catch {
|
|
514
|
+
return void 0;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
};
|
|
518
|
+
|
|
519
|
+
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
|
|
520
|
+
function getStorage(type) {
|
|
521
|
+
try {
|
|
522
|
+
const storage = window[type];
|
|
523
|
+
const x = "__storage_test__";
|
|
524
|
+
storage.setItem(x, x);
|
|
525
|
+
storage.removeItem(x);
|
|
526
|
+
return storage;
|
|
527
|
+
} catch (e) {
|
|
528
|
+
return null;
|
|
529
|
+
}
|
|
530
|
+
}
|
|
531
|
+
var LocalStorage = class {
|
|
532
|
+
constructor(id, defaultConfig, type = "sessionStorage") {
|
|
533
|
+
this.storage = getStorage(type);
|
|
534
|
+
this.id = id;
|
|
535
|
+
this.config = defaultConfig;
|
|
536
|
+
this._loadConfiguration();
|
|
537
|
+
}
|
|
538
|
+
getConfiguration() {
|
|
539
|
+
return this.config;
|
|
540
|
+
}
|
|
541
|
+
setConfiguration(configuration) {
|
|
542
|
+
Object.assign(this.config, configuration);
|
|
543
|
+
if (this.storage) {
|
|
544
|
+
const serialized = JSON.stringify(this.config);
|
|
545
|
+
this.storage.setItem(this.id, serialized);
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
// Get config from persistent store, if available
|
|
549
|
+
_loadConfiguration() {
|
|
550
|
+
let configuration = {};
|
|
551
|
+
if (this.storage) {
|
|
552
|
+
const serializedConfiguration = this.storage.getItem(this.id);
|
|
553
|
+
configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
|
|
554
|
+
}
|
|
555
|
+
Object.assign(this.config, configuration);
|
|
556
|
+
return this;
|
|
557
|
+
}
|
|
558
|
+
};
|
|
559
|
+
|
|
560
|
+
// ../../node_modules/@probe.gl/log/dist/utils/formatters.js
|
|
561
|
+
function formatTime(ms) {
|
|
562
|
+
let formatted;
|
|
563
|
+
if (ms < 10) {
|
|
564
|
+
formatted = `${ms.toFixed(2)}ms`;
|
|
565
|
+
} else if (ms < 100) {
|
|
566
|
+
formatted = `${ms.toFixed(1)}ms`;
|
|
567
|
+
} else if (ms < 1e3) {
|
|
568
|
+
formatted = `${ms.toFixed(0)}ms`;
|
|
569
|
+
} else {
|
|
570
|
+
formatted = `${(ms / 1e3).toFixed(2)}s`;
|
|
571
|
+
}
|
|
572
|
+
return formatted;
|
|
573
|
+
}
|
|
574
|
+
function leftPad(string, length = 8) {
|
|
575
|
+
const padLength = Math.max(length - string.length, 0);
|
|
576
|
+
return `${" ".repeat(padLength)}${string}`;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
// ../../node_modules/@probe.gl/log/dist/utils/color.js
|
|
580
|
+
var COLOR;
|
|
581
|
+
(function(COLOR2) {
|
|
582
|
+
COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
|
|
583
|
+
COLOR2[COLOR2["RED"] = 31] = "RED";
|
|
584
|
+
COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
|
|
585
|
+
COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
|
|
586
|
+
COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
|
|
587
|
+
COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
|
|
588
|
+
COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
|
|
589
|
+
COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
|
|
590
|
+
COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
|
|
591
|
+
COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
|
|
592
|
+
COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
|
|
593
|
+
COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
|
|
594
|
+
COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
|
|
595
|
+
COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
|
|
596
|
+
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
|
|
597
|
+
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
|
|
598
|
+
})(COLOR || (COLOR = {}));
|
|
599
|
+
var BACKGROUND_INCREMENT = 10;
|
|
600
|
+
function getColor(color) {
|
|
601
|
+
if (typeof color !== "string") {
|
|
602
|
+
return color;
|
|
603
|
+
}
|
|
604
|
+
color = color.toUpperCase();
|
|
605
|
+
return COLOR[color] || COLOR.WHITE;
|
|
606
|
+
}
|
|
607
|
+
function addColor(string, color, background) {
|
|
608
|
+
if (!isBrowser3 && typeof string === "string") {
|
|
609
|
+
if (color) {
|
|
610
|
+
const colorCode = getColor(color);
|
|
611
|
+
string = `\x1B[${colorCode}m${string}\x1B[39m`;
|
|
612
|
+
}
|
|
613
|
+
if (background) {
|
|
614
|
+
const colorCode = getColor(background);
|
|
615
|
+
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
|
|
616
|
+
}
|
|
617
|
+
}
|
|
618
|
+
return string;
|
|
619
|
+
}
|
|
620
|
+
|
|
621
|
+
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
|
|
622
|
+
function autobind(obj, predefined = ["constructor"]) {
|
|
623
|
+
const proto = Object.getPrototypeOf(obj);
|
|
624
|
+
const propNames = Object.getOwnPropertyNames(proto);
|
|
625
|
+
const object = obj;
|
|
626
|
+
for (const key of propNames) {
|
|
627
|
+
const value = object[key];
|
|
628
|
+
if (typeof value === "function") {
|
|
629
|
+
if (!predefined.find((name) => key === name)) {
|
|
630
|
+
object[key] = value.bind(obj);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
|
|
637
|
+
function getHiResTimestamp() {
|
|
638
|
+
let timestamp;
|
|
639
|
+
if (isBrowser3() && window_3.performance) {
|
|
640
|
+
timestamp = window_3?.performance?.now?.();
|
|
641
|
+
} else if ("hrtime" in process_) {
|
|
642
|
+
const timeParts = process_?.hrtime?.();
|
|
643
|
+
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
|
|
644
|
+
} else {
|
|
645
|
+
timestamp = Date.now();
|
|
646
|
+
}
|
|
647
|
+
return timestamp;
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// ../../node_modules/@probe.gl/log/dist/loggers/probe-log.js
|
|
651
|
+
var originalConsole = {
|
|
652
|
+
debug: isBrowser3() ? console.debug || console.log : console.log,
|
|
653
|
+
log: console.log,
|
|
654
|
+
info: console.info,
|
|
655
|
+
warn: console.warn,
|
|
656
|
+
error: console.error
|
|
657
|
+
};
|
|
658
|
+
var DEFAULT_LOG_CONFIGURATION = {
|
|
659
|
+
enabled: true,
|
|
660
|
+
level: 0
|
|
661
|
+
};
|
|
662
|
+
var ProbeLog = class extends BaseLog {
|
|
663
|
+
constructor({ id } = { id: "" }) {
|
|
664
|
+
super({ level: 0 });
|
|
665
|
+
this.VERSION = VERSION3;
|
|
666
|
+
this._startTs = getHiResTimestamp();
|
|
667
|
+
this._deltaTs = getHiResTimestamp();
|
|
668
|
+
this.userData = {};
|
|
669
|
+
this.LOG_THROTTLE_TIMEOUT = 0;
|
|
670
|
+
this.id = id;
|
|
671
|
+
this.userData = {};
|
|
672
|
+
this._storage = new LocalStorage(`__probe-${this.id}__`, { [this.id]: DEFAULT_LOG_CONFIGURATION });
|
|
673
|
+
this.timeStamp(`${this.id} started`);
|
|
674
|
+
autobind(this);
|
|
675
|
+
Object.seal(this);
|
|
676
|
+
}
|
|
677
|
+
isEnabled() {
|
|
678
|
+
return this._getConfiguration().enabled;
|
|
679
|
+
}
|
|
680
|
+
getLevel() {
|
|
681
|
+
return this._getConfiguration().level;
|
|
682
|
+
}
|
|
683
|
+
/** @return milliseconds, with fractions */
|
|
684
|
+
getTotal() {
|
|
685
|
+
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
|
|
686
|
+
}
|
|
687
|
+
/** @return milliseconds, with fractions */
|
|
688
|
+
getDelta() {
|
|
689
|
+
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
|
|
690
|
+
}
|
|
691
|
+
/** @deprecated use logLevel */
|
|
692
|
+
set priority(newPriority) {
|
|
693
|
+
this.level = newPriority;
|
|
694
|
+
}
|
|
695
|
+
/** @deprecated use logLevel */
|
|
696
|
+
get priority() {
|
|
697
|
+
return this.level;
|
|
698
|
+
}
|
|
699
|
+
/** @deprecated use logLevel */
|
|
700
|
+
getPriority() {
|
|
701
|
+
return this.level;
|
|
702
|
+
}
|
|
703
|
+
// Configure
|
|
704
|
+
enable(enabled = true) {
|
|
705
|
+
this._updateConfiguration({ enabled });
|
|
706
|
+
return this;
|
|
707
|
+
}
|
|
708
|
+
setLevel(level) {
|
|
709
|
+
this._updateConfiguration({ level });
|
|
710
|
+
return this;
|
|
711
|
+
}
|
|
712
|
+
/** return the current status of the setting */
|
|
713
|
+
get(setting) {
|
|
714
|
+
return this._getConfiguration()[setting];
|
|
715
|
+
}
|
|
716
|
+
// update the status of the setting
|
|
717
|
+
set(setting, value) {
|
|
718
|
+
this._updateConfiguration({ [setting]: value });
|
|
719
|
+
}
|
|
720
|
+
/** Logs the current settings as a table */
|
|
721
|
+
settings() {
|
|
722
|
+
if (console.table) {
|
|
723
|
+
console.table(this._storage.config);
|
|
724
|
+
} else {
|
|
725
|
+
console.log(this._storage.config);
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
// Unconditional logging
|
|
729
|
+
assert(condition, message) {
|
|
730
|
+
if (!condition) {
|
|
731
|
+
throw new Error(message || "Assertion failed");
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
warn(message, ...args) {
|
|
735
|
+
return this._log("warn", 0, message, args, {
|
|
736
|
+
method: originalConsole.warn,
|
|
737
|
+
once: true
|
|
738
|
+
});
|
|
739
|
+
}
|
|
740
|
+
error(message, ...args) {
|
|
741
|
+
return this._log("error", 0, message, args, {
|
|
742
|
+
method: originalConsole.error
|
|
743
|
+
});
|
|
744
|
+
}
|
|
745
|
+
/** Print a deprecation warning */
|
|
746
|
+
deprecated(oldUsage, newUsage) {
|
|
747
|
+
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
|
|
748
|
+
}
|
|
749
|
+
/** Print a removal warning */
|
|
750
|
+
removed(oldUsage, newUsage) {
|
|
751
|
+
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
|
|
752
|
+
}
|
|
753
|
+
probe(logLevel, message, ...args) {
|
|
754
|
+
return this._log("log", logLevel, message, args, {
|
|
755
|
+
method: originalConsole.log,
|
|
756
|
+
time: true,
|
|
757
|
+
once: true
|
|
758
|
+
});
|
|
759
|
+
}
|
|
760
|
+
log(logLevel, message, ...args) {
|
|
761
|
+
return this._log("log", logLevel, message, args, {
|
|
762
|
+
method: originalConsole.debug
|
|
763
|
+
});
|
|
764
|
+
}
|
|
765
|
+
info(logLevel, message, ...args) {
|
|
766
|
+
return this._log("info", logLevel, message, args, { method: console.info });
|
|
767
|
+
}
|
|
768
|
+
once(logLevel, message, ...args) {
|
|
769
|
+
return this._log("once", logLevel, message, args, {
|
|
770
|
+
method: originalConsole.debug || originalConsole.info,
|
|
771
|
+
once: true
|
|
772
|
+
});
|
|
773
|
+
}
|
|
774
|
+
/** Logs an object as a table */
|
|
775
|
+
table(logLevel, table, columns) {
|
|
776
|
+
if (table) {
|
|
777
|
+
return this._log("table", logLevel, table, columns && [columns] || [], {
|
|
778
|
+
method: console.table || noop,
|
|
779
|
+
tag: getTableHeader(table)
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
return noop;
|
|
783
|
+
}
|
|
784
|
+
time(logLevel, message) {
|
|
785
|
+
return this._log("time", logLevel, message, [], {
|
|
786
|
+
method: console.time ? console.time : console.info
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
timeEnd(logLevel, message) {
|
|
790
|
+
return this._log("time", logLevel, message, [], {
|
|
791
|
+
method: console.timeEnd ? console.timeEnd : console.info
|
|
792
|
+
});
|
|
793
|
+
}
|
|
794
|
+
timeStamp(logLevel, message) {
|
|
795
|
+
return this._log("time", logLevel, message, [], {
|
|
796
|
+
method: console.timeStamp || noop
|
|
797
|
+
});
|
|
798
|
+
}
|
|
799
|
+
group(logLevel, message, opts = { collapsed: false }) {
|
|
800
|
+
const method = (opts.collapsed ? console.groupCollapsed : console.group) || console.info;
|
|
801
|
+
return this._log("group", logLevel, message, [], { method });
|
|
802
|
+
}
|
|
803
|
+
groupCollapsed(logLevel, message, opts = {}) {
|
|
804
|
+
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
|
|
805
|
+
}
|
|
806
|
+
groupEnd(logLevel) {
|
|
807
|
+
return this._log("groupEnd", logLevel, "", [], {
|
|
808
|
+
method: console.groupEnd || noop
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
// EXPERIMENTAL
|
|
812
|
+
withGroup(logLevel, message, func) {
|
|
813
|
+
this.group(logLevel, message)();
|
|
814
|
+
try {
|
|
815
|
+
func();
|
|
816
|
+
} finally {
|
|
817
|
+
this.groupEnd(logLevel)();
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
trace() {
|
|
821
|
+
if (console.trace) {
|
|
822
|
+
console.trace();
|
|
823
|
+
}
|
|
824
|
+
}
|
|
825
|
+
_shouldLog(logLevel) {
|
|
826
|
+
return this.isEnabled() && super._shouldLog(logLevel);
|
|
827
|
+
}
|
|
828
|
+
_emit(_type, normalized) {
|
|
829
|
+
const method = normalized.method;
|
|
830
|
+
assert3(method);
|
|
831
|
+
normalized.total = this.getTotal();
|
|
832
|
+
normalized.delta = this.getDelta();
|
|
833
|
+
this._deltaTs = getHiResTimestamp();
|
|
834
|
+
const message = decorateMessage(this.id, normalized.message, normalized);
|
|
835
|
+
return method.bind(console, message, ...normalized.args);
|
|
836
|
+
}
|
|
837
|
+
_getConfiguration() {
|
|
838
|
+
if (!this._storage.config[this.id]) {
|
|
839
|
+
this._updateConfiguration(DEFAULT_LOG_CONFIGURATION);
|
|
840
|
+
}
|
|
841
|
+
return this._storage.config[this.id];
|
|
842
|
+
}
|
|
843
|
+
_updateConfiguration(configuration) {
|
|
844
|
+
const currentConfiguration = this._storage.config[this.id] || {
|
|
845
|
+
...DEFAULT_LOG_CONFIGURATION
|
|
846
|
+
};
|
|
847
|
+
this._storage.setConfiguration({
|
|
848
|
+
[this.id]: { ...currentConfiguration, ...configuration }
|
|
849
|
+
});
|
|
850
|
+
}
|
|
851
|
+
};
|
|
852
|
+
ProbeLog.VERSION = VERSION3;
|
|
853
|
+
function decorateMessage(id, message, opts) {
|
|
854
|
+
if (typeof message === "string") {
|
|
855
|
+
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
|
|
856
|
+
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
|
|
857
|
+
message = addColor(message, opts.color, opts.background);
|
|
858
|
+
}
|
|
859
|
+
return message;
|
|
860
|
+
}
|
|
861
|
+
function getTableHeader(table) {
|
|
862
|
+
for (const key in table) {
|
|
863
|
+
for (const title in table[key]) {
|
|
864
|
+
return title || "untitled";
|
|
865
|
+
}
|
|
866
|
+
}
|
|
867
|
+
return "empty";
|
|
868
|
+
}
|
|
869
|
+
|
|
870
|
+
// ../../node_modules/@probe.gl/log/dist/init.js
|
|
871
|
+
globalThis.probe = {};
|
|
872
|
+
|
|
873
|
+
// ../../node_modules/@probe.gl/log/dist/index.js
|
|
874
|
+
var dist_default = new ProbeLog({ id: "@probe.gl/log" });
|
|
875
|
+
|
|
876
|
+
// ../loader-utils/src/lib/log-utils/log.ts
|
|
877
|
+
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
878
|
+
var version = VERSION4[0] >= "0" && VERSION4[0] <= "9" ? `v${VERSION4}` : "";
|
|
879
|
+
function createLog() {
|
|
880
|
+
const log2 = new ProbeLog({ id: "loaders.gl" });
|
|
881
|
+
globalThis.loaders ||= {};
|
|
882
|
+
globalThis.loaders.log = log2;
|
|
883
|
+
globalThis.loaders.version = version;
|
|
884
|
+
globalThis.probe ||= {};
|
|
885
|
+
globalThis.probe.loaders = log2;
|
|
886
|
+
return log2;
|
|
887
|
+
}
|
|
888
|
+
var log = createLog();
|
|
889
|
+
|
|
890
|
+
// ../loader-utils/src/lib/module-utils/js-module-utils.ts
|
|
891
|
+
function registerJSModules(modules) {
|
|
892
|
+
globalThis.loaders ||= {};
|
|
893
|
+
globalThis.loaders.modules ||= {};
|
|
894
|
+
Object.assign(globalThis.loaders.modules, modules);
|
|
895
|
+
}
|
|
896
|
+
function getJSModuleOrNull(name) {
|
|
897
|
+
const module = globalThis.loaders?.modules?.[name];
|
|
898
|
+
return module || null;
|
|
899
|
+
}
|
|
283
900
|
|
|
284
901
|
// ../loader-utils/src/lib/path-utils/file-aliases.ts
|
|
285
902
|
var pathPrefix = "";
|
|
@@ -375,104 +992,269 @@ var __exports__ = (() => {
|
|
|
375
992
|
}
|
|
376
993
|
|
|
377
994
|
// src/lib/gl-extensions.ts
|
|
995
|
+
var GL_RGB = 6407;
|
|
996
|
+
var GL_RGBA = 6408;
|
|
997
|
+
var GL_RGBA4 = 32854;
|
|
998
|
+
var GL_RGB5_A1 = 32855;
|
|
999
|
+
var GL_RGBA8 = 32856;
|
|
1000
|
+
var GL_RGB565 = 36194;
|
|
1001
|
+
var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
|
|
1002
|
+
var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777;
|
|
1003
|
+
var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
|
|
1004
|
+
var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
|
|
1005
|
+
var GL_COMPRESSED_R11_EAC = 37488;
|
|
1006
|
+
var GL_COMPRESSED_SIGNED_R11_EAC = 37489;
|
|
1007
|
+
var GL_COMPRESSED_RG11_EAC = 37490;
|
|
1008
|
+
var GL_COMPRESSED_SIGNED_RG11_EAC = 37491;
|
|
1009
|
+
var GL_COMPRESSED_RGB8_ETC2 = 37492;
|
|
1010
|
+
var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
|
|
1011
|
+
var GL_COMPRESSED_SRGB8_ETC2 = 37494;
|
|
1012
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37495;
|
|
1013
|
+
var GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37496;
|
|
1014
|
+
var GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37497;
|
|
1015
|
+
var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
|
|
1016
|
+
var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841;
|
|
1017
|
+
var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
|
|
1018
|
+
var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843;
|
|
1019
|
+
var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
|
|
1020
|
+
var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
|
|
1021
|
+
var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987;
|
|
1022
|
+
var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
|
|
1023
|
+
var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
|
|
1024
|
+
var GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 37809;
|
|
1025
|
+
var GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 37810;
|
|
1026
|
+
var GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 37811;
|
|
1027
|
+
var GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 37812;
|
|
1028
|
+
var GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 37813;
|
|
1029
|
+
var GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 37814;
|
|
1030
|
+
var GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 37815;
|
|
1031
|
+
var GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 37816;
|
|
1032
|
+
var GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 37817;
|
|
1033
|
+
var GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 37818;
|
|
1034
|
+
var GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 37819;
|
|
1035
|
+
var GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 37820;
|
|
1036
|
+
var GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 37821;
|
|
1037
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840;
|
|
1038
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841;
|
|
1039
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842;
|
|
1040
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843;
|
|
1041
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844;
|
|
1042
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845;
|
|
1043
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846;
|
|
1044
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847;
|
|
1045
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848;
|
|
1046
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849;
|
|
1047
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850;
|
|
1048
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851;
|
|
1049
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852;
|
|
1050
|
+
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853;
|
|
1051
|
+
var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
|
|
1052
|
+
var GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284;
|
|
1053
|
+
var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
|
|
1054
|
+
var GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286;
|
|
1055
|
+
var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
|
|
1056
|
+
var GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493;
|
|
1057
|
+
var GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494;
|
|
1058
|
+
var GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495;
|
|
1059
|
+
var GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916;
|
|
1060
|
+
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917;
|
|
1061
|
+
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918;
|
|
1062
|
+
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919;
|
|
378
1063
|
var GL_EXTENSIONS_CONSTANTS = {
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
1064
|
+
RGB: GL_RGB,
|
|
1065
|
+
RGBA: GL_RGBA,
|
|
1066
|
+
RGBA4: GL_RGBA4,
|
|
1067
|
+
RGB5_A1: GL_RGB5_A1,
|
|
1068
|
+
RGBA8: GL_RGBA8,
|
|
1069
|
+
RGB565: GL_RGB565,
|
|
1070
|
+
COMPRESSED_RGB_S3TC_DXT1_EXT: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
1071
|
+
COMPRESSED_RGBA_S3TC_DXT1_EXT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
1072
|
+
COMPRESSED_RGBA_S3TC_DXT3_EXT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
1073
|
+
COMPRESSED_RGBA_S3TC_DXT5_EXT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
1074
|
+
COMPRESSED_R11_EAC: GL_COMPRESSED_R11_EAC,
|
|
1075
|
+
COMPRESSED_SIGNED_R11_EAC: GL_COMPRESSED_SIGNED_R11_EAC,
|
|
1076
|
+
COMPRESSED_RG11_EAC: GL_COMPRESSED_RG11_EAC,
|
|
1077
|
+
COMPRESSED_SIGNED_RG11_EAC: GL_COMPRESSED_SIGNED_RG11_EAC,
|
|
1078
|
+
COMPRESSED_RGB8_ETC2: GL_COMPRESSED_RGB8_ETC2,
|
|
1079
|
+
COMPRESSED_RGBA8_ETC2_EAC: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
1080
|
+
COMPRESSED_SRGB8_ETC2: GL_COMPRESSED_SRGB8_ETC2,
|
|
1081
|
+
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
1082
|
+
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
1083
|
+
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
1084
|
+
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
1085
|
+
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
|
|
1086
|
+
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
1087
|
+
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
1088
|
+
COMPRESSED_RGB_ETC1_WEBGL: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
1089
|
+
COMPRESSED_RGB_ATC_WEBGL: GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
1090
|
+
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
|
|
1091
|
+
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
1092
|
+
COMPRESSED_RGBA_ASTC_4x4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
1093
|
+
COMPRESSED_RGBA_ASTC_5x4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
1094
|
+
COMPRESSED_RGBA_ASTC_5x5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
1095
|
+
COMPRESSED_RGBA_ASTC_6x5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
1096
|
+
COMPRESSED_RGBA_ASTC_6x6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
1097
|
+
COMPRESSED_RGBA_ASTC_8x5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
1098
|
+
COMPRESSED_RGBA_ASTC_8x6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
1099
|
+
COMPRESSED_RGBA_ASTC_8x8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
1100
|
+
COMPRESSED_RGBA_ASTC_10x5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
1101
|
+
COMPRESSED_RGBA_ASTC_10x6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
1102
|
+
COMPRESSED_RGBA_ASTC_10x8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
1103
|
+
COMPRESSED_RGBA_ASTC_10x10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
1104
|
+
COMPRESSED_RGBA_ASTC_12x10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
1105
|
+
COMPRESSED_RGBA_ASTC_12x12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
1106
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
1107
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
1108
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
1109
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
1110
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
1111
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
1112
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
1113
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
1114
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
1115
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
1116
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
1117
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
1118
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
1119
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
1120
|
+
COMPRESSED_RED_RGTC1_EXT: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
1121
|
+
COMPRESSED_SIGNED_RED_RGTC1_EXT: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
1122
|
+
COMPRESSED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
1123
|
+
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
1124
|
+
COMPRESSED_RGBA_BPTC_UNORM_EXT: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
1125
|
+
COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
|
|
1126
|
+
COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
|
|
1127
|
+
COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
|
|
1128
|
+
COMPRESSED_SRGB_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
1129
|
+
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
1130
|
+
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
1131
|
+
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
1132
|
+
// Deprecated legacy aliases with non-standard ASTC casing.
|
|
1133
|
+
COMPRESSED_RGBA_ASTC_4X4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
1134
|
+
COMPRESSED_RGBA_ASTC_5X4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
1135
|
+
COMPRESSED_RGBA_ASTC_5X5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
1136
|
+
COMPRESSED_RGBA_ASTC_6X5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
1137
|
+
COMPRESSED_RGBA_ASTC_6X6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
1138
|
+
COMPRESSED_RGBA_ASTC_8X5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
1139
|
+
COMPRESSED_RGBA_ASTC_8X6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
1140
|
+
COMPRESSED_RGBA_ASTC_8X8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
1141
|
+
COMPRESSED_RGBA_ASTC_10X5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
1142
|
+
COMPRESSED_RGBA_ASTC_10X6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
1143
|
+
COMPRESSED_RGBA_ASTC_10X8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
1144
|
+
COMPRESSED_RGBA_ASTC_10X10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
1145
|
+
COMPRESSED_RGBA_ASTC_12X10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
1146
|
+
COMPRESSED_RGBA_ASTC_12X12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
1147
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
1148
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
1149
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
1150
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
1151
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
1152
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
1153
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
1154
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
1155
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
1156
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
1157
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
1158
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
1159
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
1160
|
+
COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR
|
|
445
1161
|
};
|
|
446
1162
|
|
|
447
|
-
// src/lib/utils/texture-formats.ts
|
|
1163
|
+
// src/lib/utils/detect-supported-texture-formats.ts
|
|
448
1164
|
var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
|
|
449
|
-
var
|
|
1165
|
+
var WEBGL_TEXTURE_FORMATS = {
|
|
450
1166
|
/* eslint-disable camelcase */
|
|
451
|
-
WEBGL_compressed_texture_s3tc:
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
1167
|
+
WEBGL_compressed_texture_s3tc: [
|
|
1168
|
+
"bc1-rgb-unorm-webgl",
|
|
1169
|
+
"bc1-rgba-unorm",
|
|
1170
|
+
"bc2-rgba-unorm",
|
|
1171
|
+
"bc3-rgba-unorm"
|
|
1172
|
+
],
|
|
1173
|
+
WEBGL_compressed_texture_s3tc_srgb: [
|
|
1174
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
1175
|
+
"bc1-rgba-unorm-srgb",
|
|
1176
|
+
"bc2-rgba-unorm-srgb",
|
|
1177
|
+
"bc3-rgba-unorm-srgb"
|
|
1178
|
+
],
|
|
1179
|
+
EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
|
|
1180
|
+
EXT_texture_compression_bptc: [
|
|
1181
|
+
"bc6h-rgb-ufloat",
|
|
1182
|
+
"bc6h-rgb-float",
|
|
1183
|
+
"bc7-rgba-unorm",
|
|
1184
|
+
"bc7-rgba-unorm-srgb"
|
|
1185
|
+
],
|
|
1186
|
+
WEBGL_compressed_texture_etc1: ["etc1-rbg-unorm-webgl"],
|
|
1187
|
+
WEBGL_compressed_texture_etc: [
|
|
1188
|
+
"etc2-rgb8unorm",
|
|
1189
|
+
"etc2-rgb8unorm-srgb",
|
|
1190
|
+
"etc2-rgb8a1unorm",
|
|
1191
|
+
"etc2-rgb8a1unorm-srgb",
|
|
1192
|
+
"etc2-rgba8unorm",
|
|
1193
|
+
"etc2-rgba8unorm-srgb",
|
|
1194
|
+
"eac-r11unorm",
|
|
1195
|
+
"eac-r11snorm",
|
|
1196
|
+
"eac-rg11unorm",
|
|
1197
|
+
"eac-rg11snorm"
|
|
1198
|
+
],
|
|
1199
|
+
WEBGL_compressed_texture_pvrtc: [
|
|
1200
|
+
"pvrtc-rgb4unorm-webgl",
|
|
1201
|
+
"pvrtc-rgba4unorm-webgl",
|
|
1202
|
+
"pvrtc-rbg2unorm-webgl",
|
|
1203
|
+
"pvrtc-rgba2unorm-webgl"
|
|
1204
|
+
],
|
|
1205
|
+
WEBGL_compressed_texture_atc: [
|
|
1206
|
+
"atc-rgb-unorm-webgl",
|
|
1207
|
+
"atc-rgba-unorm-webgl",
|
|
1208
|
+
"atc-rgbai-unorm-webgl"
|
|
1209
|
+
],
|
|
1210
|
+
WEBGL_compressed_texture_astc: [
|
|
1211
|
+
"astc-4x4-unorm",
|
|
1212
|
+
"astc-4x4-unorm-srgb",
|
|
1213
|
+
"astc-5x4-unorm",
|
|
1214
|
+
"astc-5x4-unorm-srgb",
|
|
1215
|
+
"astc-5x5-unorm",
|
|
1216
|
+
"astc-5x5-unorm-srgb",
|
|
1217
|
+
"astc-6x5-unorm",
|
|
1218
|
+
"astc-6x5-unorm-srgb",
|
|
1219
|
+
"astc-6x6-unorm",
|
|
1220
|
+
"astc-6x6-unorm-srgb",
|
|
1221
|
+
"astc-8x5-unorm",
|
|
1222
|
+
"astc-8x5-unorm-srgb",
|
|
1223
|
+
"astc-8x6-unorm",
|
|
1224
|
+
"astc-8x6-unorm-srgb",
|
|
1225
|
+
"astc-8x8-unorm",
|
|
1226
|
+
"astc-8x8-unorm-srgb",
|
|
1227
|
+
"astc-10x5-unorm",
|
|
1228
|
+
"astc-10x5-unorm-srgb",
|
|
1229
|
+
"astc-10x6-unorm",
|
|
1230
|
+
"astc-10x6-unorm-srgb",
|
|
1231
|
+
"astc-10x8-unorm",
|
|
1232
|
+
"astc-10x8-unorm-srgb",
|
|
1233
|
+
"astc-10x10-unorm",
|
|
1234
|
+
"astc-10x10-unorm-srgb",
|
|
1235
|
+
"astc-12x10-unorm",
|
|
1236
|
+
"astc-12x10-unorm-srgb",
|
|
1237
|
+
"astc-12x12-unorm",
|
|
1238
|
+
"astc-12x12-unorm-srgb"
|
|
1239
|
+
]
|
|
459
1240
|
/* eslint-enable camelcase */
|
|
460
1241
|
};
|
|
461
|
-
var
|
|
462
|
-
function
|
|
463
|
-
if (!
|
|
1242
|
+
var textureFormats = null;
|
|
1243
|
+
function detectSupportedTextureFormats(gl) {
|
|
1244
|
+
if (!textureFormats) {
|
|
464
1245
|
gl = gl || getWebGLContext() || void 0;
|
|
465
|
-
|
|
1246
|
+
textureFormats = /* @__PURE__ */ new Set();
|
|
466
1247
|
for (const prefix of BROWSER_PREFIXES) {
|
|
467
|
-
for (const extension in
|
|
1248
|
+
for (const extension in WEBGL_TEXTURE_FORMATS) {
|
|
468
1249
|
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
469
|
-
const
|
|
470
|
-
|
|
1250
|
+
for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
|
|
1251
|
+
textureFormats.add(textureFormat);
|
|
1252
|
+
}
|
|
471
1253
|
}
|
|
472
1254
|
}
|
|
473
1255
|
}
|
|
474
1256
|
}
|
|
475
|
-
return
|
|
1257
|
+
return textureFormats;
|
|
476
1258
|
}
|
|
477
1259
|
function getWebGLContext() {
|
|
478
1260
|
try {
|
|
@@ -732,23 +1514,100 @@ var __exports__ = (() => {
|
|
|
732
1514
|
return container;
|
|
733
1515
|
}
|
|
734
1516
|
|
|
1517
|
+
// src/lib/utils/texture-format-map.ts
|
|
1518
|
+
var WEBGL_TO_TEXTURE_FORMAT = {
|
|
1519
|
+
[GL_COMPRESSED_RGB_S3TC_DXT1_EXT]: "bc1-rgb-unorm-webgl",
|
|
1520
|
+
[GL_COMPRESSED_SRGB_S3TC_DXT1_EXT]: "bc1-rgb-unorm-srgb-webgl",
|
|
1521
|
+
[GL_COMPRESSED_RGBA_S3TC_DXT1_EXT]: "bc1-rgba-unorm",
|
|
1522
|
+
[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT]: "bc1-rgba-unorm-srgb",
|
|
1523
|
+
[GL_COMPRESSED_RGBA_S3TC_DXT3_EXT]: "bc2-rgba-unorm",
|
|
1524
|
+
[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT]: "bc2-rgba-unorm-srgb",
|
|
1525
|
+
[GL_COMPRESSED_RGBA_S3TC_DXT5_EXT]: "bc3-rgba-unorm",
|
|
1526
|
+
[GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT]: "bc3-rgba-unorm-srgb",
|
|
1527
|
+
[GL_COMPRESSED_RED_RGTC1_EXT]: "bc4-r-unorm",
|
|
1528
|
+
[GL_COMPRESSED_SIGNED_RED_RGTC1_EXT]: "bc4-r-snorm",
|
|
1529
|
+
[GL_COMPRESSED_RED_GREEN_RGTC2_EXT]: "bc5-rg-unorm",
|
|
1530
|
+
[GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT]: "bc5-rg-snorm",
|
|
1531
|
+
[GL_COMPRESSED_RGB8_ETC2]: "etc2-rgb8unorm",
|
|
1532
|
+
[GL_COMPRESSED_SRGB8_ETC2]: "etc2-rgb8unorm-srgb",
|
|
1533
|
+
[GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2]: "etc2-rgb8a1unorm",
|
|
1534
|
+
[GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2]: "etc2-rgb8a1unorm-srgb",
|
|
1535
|
+
[GL_COMPRESSED_RGBA8_ETC2_EAC]: "etc2-rgba8unorm",
|
|
1536
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC]: "etc2-rgba8unorm-srgb",
|
|
1537
|
+
[GL_COMPRESSED_R11_EAC]: "eac-r11unorm",
|
|
1538
|
+
[GL_COMPRESSED_SIGNED_R11_EAC]: "eac-r11snorm",
|
|
1539
|
+
[GL_COMPRESSED_RG11_EAC]: "eac-rg11unorm",
|
|
1540
|
+
[GL_COMPRESSED_SIGNED_RG11_EAC]: "eac-rg11snorm",
|
|
1541
|
+
[GL_COMPRESSED_RGBA_ASTC_4x4_KHR]: "astc-4x4-unorm",
|
|
1542
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR]: "astc-4x4-unorm-srgb",
|
|
1543
|
+
[GL_COMPRESSED_RGBA_ASTC_5x4_KHR]: "astc-5x4-unorm",
|
|
1544
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR]: "astc-5x4-unorm-srgb",
|
|
1545
|
+
[GL_COMPRESSED_RGBA_ASTC_5x5_KHR]: "astc-5x5-unorm",
|
|
1546
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR]: "astc-5x5-unorm-srgb",
|
|
1547
|
+
[GL_COMPRESSED_RGBA_ASTC_6x5_KHR]: "astc-6x5-unorm",
|
|
1548
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR]: "astc-6x5-unorm-srgb",
|
|
1549
|
+
[GL_COMPRESSED_RGBA_ASTC_6x6_KHR]: "astc-6x6-unorm",
|
|
1550
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR]: "astc-6x6-unorm-srgb",
|
|
1551
|
+
[GL_COMPRESSED_RGBA_ASTC_8x5_KHR]: "astc-8x5-unorm",
|
|
1552
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR]: "astc-8x5-unorm-srgb",
|
|
1553
|
+
[GL_COMPRESSED_RGBA_ASTC_8x6_KHR]: "astc-8x6-unorm",
|
|
1554
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR]: "astc-8x6-unorm-srgb",
|
|
1555
|
+
[GL_COMPRESSED_RGBA_ASTC_8x8_KHR]: "astc-8x8-unorm",
|
|
1556
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR]: "astc-8x8-unorm-srgb",
|
|
1557
|
+
[GL_COMPRESSED_RGBA_ASTC_10x5_KHR]: "astc-10x5-unorm",
|
|
1558
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR]: "astc-10x5-unorm-srgb",
|
|
1559
|
+
[GL_COMPRESSED_RGBA_ASTC_10x6_KHR]: "astc-10x6-unorm",
|
|
1560
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR]: "astc-10x6-unorm-srgb",
|
|
1561
|
+
[GL_COMPRESSED_RGBA_ASTC_10x8_KHR]: "astc-10x8-unorm",
|
|
1562
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR]: "astc-10x8-unorm-srgb",
|
|
1563
|
+
[GL_COMPRESSED_RGBA_ASTC_10x10_KHR]: "astc-10x10-unorm",
|
|
1564
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR]: "astc-10x10-unorm-srgb",
|
|
1565
|
+
[GL_COMPRESSED_RGBA_ASTC_12x10_KHR]: "astc-12x10-unorm",
|
|
1566
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR]: "astc-12x10-unorm-srgb",
|
|
1567
|
+
[GL_COMPRESSED_RGBA_ASTC_12x12_KHR]: "astc-12x12-unorm",
|
|
1568
|
+
[GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]: "astc-12x12-unorm-srgb",
|
|
1569
|
+
[GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG]: "pvrtc-rgb4unorm-webgl",
|
|
1570
|
+
[GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG]: "pvrtc-rgba4unorm-webgl",
|
|
1571
|
+
[GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG]: "pvrtc-rbg2unorm-webgl",
|
|
1572
|
+
[GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG]: "pvrtc-rgba2unorm-webgl",
|
|
1573
|
+
[GL_COMPRESSED_RGB_ETC1_WEBGL]: "etc1-rbg-unorm-webgl",
|
|
1574
|
+
[GL_COMPRESSED_RGB_ATC_WEBGL]: "atc-rgb-unorm-webgl",
|
|
1575
|
+
[GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL]: "atc-rgba-unorm-webgl",
|
|
1576
|
+
[GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL]: "atc-rgbai-unorm-webgl"
|
|
1577
|
+
};
|
|
1578
|
+
function getTextureFormatFromWebGLFormat(format) {
|
|
1579
|
+
if (format === void 0) {
|
|
1580
|
+
return void 0;
|
|
1581
|
+
}
|
|
1582
|
+
return WEBGL_TO_TEXTURE_FORMAT[format];
|
|
1583
|
+
}
|
|
1584
|
+
|
|
735
1585
|
// src/lib/utils/extract-mipmap-images.ts
|
|
736
1586
|
function extractMipmapImages(data, options) {
|
|
737
1587
|
const images = new Array(options.mipMapLevels);
|
|
1588
|
+
const format = options.internalFormat;
|
|
1589
|
+
const textureFormat = format === void 0 ? void 0 : getTextureFormatFromWebGLFormat(format);
|
|
738
1590
|
let levelWidth = options.width;
|
|
739
1591
|
let levelHeight = options.height;
|
|
740
1592
|
let offset = 0;
|
|
741
1593
|
for (let i = 0; i < options.mipMapLevels; ++i) {
|
|
742
1594
|
const levelSize = getLevelSize(options, levelWidth, levelHeight, data, i);
|
|
743
1595
|
const levelData = getLevelData(data, i, offset, levelSize);
|
|
744
|
-
|
|
1596
|
+
const image = {
|
|
1597
|
+
shape: "texture-level",
|
|
745
1598
|
compressed: true,
|
|
746
|
-
format: options.internalFormat,
|
|
747
1599
|
data: levelData,
|
|
748
1600
|
width: levelWidth,
|
|
749
1601
|
height: levelHeight,
|
|
750
1602
|
levelSize
|
|
751
1603
|
};
|
|
1604
|
+
if (format !== void 0) {
|
|
1605
|
+
image.format = format;
|
|
1606
|
+
}
|
|
1607
|
+
if (textureFormat) {
|
|
1608
|
+
image.textureFormat = textureFormat;
|
|
1609
|
+
}
|
|
1610
|
+
images[i] = image;
|
|
752
1611
|
levelWidth = Math.max(1, levelWidth >> 1);
|
|
753
1612
|
levelHeight = Math.max(1, levelHeight >> 1);
|
|
754
1613
|
offset += levelSize;
|
|
@@ -770,114 +1629,72 @@ var __exports__ = (() => {
|
|
|
770
1629
|
|
|
771
1630
|
// src/lib/utils/ktx-format-helper.ts
|
|
772
1631
|
var VULKAN_TO_WEBGL_FORMAT_MAP = {
|
|
773
|
-
131:
|
|
774
|
-
132:
|
|
775
|
-
133:
|
|
776
|
-
134:
|
|
777
|
-
135:
|
|
778
|
-
136:
|
|
779
|
-
137:
|
|
780
|
-
138:
|
|
781
|
-
139:
|
|
782
|
-
140:
|
|
783
|
-
141:
|
|
784
|
-
142:
|
|
785
|
-
147:
|
|
786
|
-
148:
|
|
787
|
-
149:
|
|
788
|
-
150:
|
|
789
|
-
151:
|
|
790
|
-
152:
|
|
791
|
-
153:
|
|
792
|
-
154:
|
|
793
|
-
155:
|
|
794
|
-
156:
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
// @ts-ignore
|
|
840
|
-
179: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
841
|
-
// @ts-ignore
|
|
842
|
-
180: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
843
|
-
// @ts-ignore
|
|
844
|
-
181: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
845
|
-
// @ts-ignore
|
|
846
|
-
182: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
847
|
-
// @ts-ignore
|
|
848
|
-
183: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
849
|
-
// @ts-ignore
|
|
850
|
-
184: GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
851
|
-
1000054e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
852
|
-
1000054001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
853
|
-
// @ts-ignore
|
|
854
|
-
1000066e3: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
855
|
-
// @ts-ignore
|
|
856
|
-
1000066001: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
857
|
-
// @ts-ignore
|
|
858
|
-
1000066002: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
859
|
-
// @ts-ignore
|
|
860
|
-
1000066003: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
861
|
-
// @ts-ignore
|
|
862
|
-
1000066004: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
863
|
-
// @ts-ignore
|
|
864
|
-
1000066005: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
865
|
-
// @ts-ignore
|
|
866
|
-
1000066006: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
867
|
-
// @ts-ignore
|
|
868
|
-
1000066007: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
869
|
-
// @ts-ignore
|
|
870
|
-
1000066008: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
871
|
-
// @ts-ignore
|
|
872
|
-
1000066009: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
873
|
-
// @ts-ignore
|
|
874
|
-
1000066010: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
875
|
-
// @ts-ignore
|
|
876
|
-
1000066011: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
877
|
-
// @ts-ignore
|
|
878
|
-
1000066012: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
879
|
-
// @ts-ignore
|
|
880
|
-
1000066013: GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
1632
|
+
131: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
1633
|
+
132: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
|
|
1634
|
+
133: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
|
|
1635
|
+
134: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
|
|
1636
|
+
135: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
1637
|
+
136: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
|
|
1638
|
+
137: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
1639
|
+
138: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
|
|
1640
|
+
139: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
1641
|
+
140: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
|
|
1642
|
+
141: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
1643
|
+
142: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
|
|
1644
|
+
147: GL_COMPRESSED_RGB8_ETC2,
|
|
1645
|
+
148: GL_COMPRESSED_SRGB8_ETC2,
|
|
1646
|
+
149: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
1647
|
+
150: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
|
|
1648
|
+
151: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
1649
|
+
152: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
|
|
1650
|
+
153: GL_COMPRESSED_R11_EAC,
|
|
1651
|
+
154: GL_COMPRESSED_SIGNED_R11_EAC,
|
|
1652
|
+
155: GL_COMPRESSED_RG11_EAC,
|
|
1653
|
+
156: GL_COMPRESSED_SIGNED_RG11_EAC,
|
|
1654
|
+
157: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
1655
|
+
158: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
|
|
1656
|
+
159: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
1657
|
+
160: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
|
|
1658
|
+
161: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
1659
|
+
162: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
|
|
1660
|
+
163: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
1661
|
+
164: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
|
|
1662
|
+
165: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
1663
|
+
166: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
|
|
1664
|
+
167: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
1665
|
+
168: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
|
|
1666
|
+
169: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
1667
|
+
170: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
|
|
1668
|
+
171: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
1669
|
+
172: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
|
|
1670
|
+
173: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
1671
|
+
174: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
|
|
1672
|
+
175: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
1673
|
+
176: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
|
|
1674
|
+
177: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
1675
|
+
178: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
|
|
1676
|
+
179: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
1677
|
+
180: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
|
|
1678
|
+
181: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
1679
|
+
182: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
|
|
1680
|
+
183: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
|
|
1681
|
+
184: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
|
|
1682
|
+
1000054e3: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
|
|
1683
|
+
1000054001: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
1684
|
+
1000066e3: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
1685
|
+
1000066001: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
|
|
1686
|
+
1000066002: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
|
|
1687
|
+
1000066003: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
|
|
1688
|
+
1000066004: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
|
|
1689
|
+
1000066005: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
|
|
1690
|
+
1000066006: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
|
|
1691
|
+
1000066007: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
|
|
1692
|
+
1000066008: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
|
|
1693
|
+
1000066009: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
|
|
1694
|
+
1000066010: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
|
|
1695
|
+
1000066011: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
|
|
1696
|
+
1000066012: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
|
|
1697
|
+
1000066013: GL_COMPRESSED_RGBA_ASTC_12x12_KHR
|
|
881
1698
|
};
|
|
882
1699
|
function mapVkFormatToWebGL(vkFormat) {
|
|
883
1700
|
return VULKAN_TO_WEBGL_FORMAT_MAP[vkFormat];
|
|
@@ -922,6 +1739,11 @@ var __exports__ = (() => {
|
|
|
922
1739
|
const width = ktx.pixelWidth;
|
|
923
1740
|
const height = ktx.pixelHeight;
|
|
924
1741
|
const internalFormat = mapVkFormatToWebGL(ktx.vkFormat);
|
|
1742
|
+
if (internalFormat === void 0) {
|
|
1743
|
+
log.warn(
|
|
1744
|
+
`KTX2 container vkFormat ${ktx.vkFormat} does not map to a known WebGL format; returning texture levels without format metadata.`
|
|
1745
|
+
)();
|
|
1746
|
+
}
|
|
925
1747
|
return extractMipmapImages(ktx.levels, {
|
|
926
1748
|
mipMapLevels,
|
|
927
1749
|
width,
|
|
@@ -932,61 +1754,126 @@ var __exports__ = (() => {
|
|
|
932
1754
|
}
|
|
933
1755
|
|
|
934
1756
|
// src/lib/parsers/parse-basis.ts
|
|
935
|
-
var
|
|
1757
|
+
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
936
1758
|
etc1: {
|
|
937
1759
|
basisFormat: 0,
|
|
938
1760
|
compressed: true,
|
|
939
|
-
format:
|
|
1761
|
+
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
1762
|
+
textureFormat: "etc1-rbg-unorm-webgl"
|
|
1763
|
+
},
|
|
1764
|
+
etc2: {
|
|
1765
|
+
basisFormat: 1,
|
|
1766
|
+
compressed: true,
|
|
1767
|
+
format: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
1768
|
+
textureFormat: "etc2-rgba8unorm"
|
|
940
1769
|
},
|
|
941
|
-
etc2: { basisFormat: 1, compressed: true },
|
|
942
1770
|
bc1: {
|
|
943
1771
|
basisFormat: 2,
|
|
944
1772
|
compressed: true,
|
|
945
|
-
format:
|
|
1773
|
+
format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
1774
|
+
textureFormat: "bc1-rgb-unorm-webgl"
|
|
946
1775
|
},
|
|
947
1776
|
bc3: {
|
|
948
1777
|
basisFormat: 3,
|
|
949
1778
|
compressed: true,
|
|
950
|
-
format:
|
|
1779
|
+
format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
1780
|
+
textureFormat: "bc3-rgba-unorm"
|
|
1781
|
+
},
|
|
1782
|
+
bc4: {
|
|
1783
|
+
basisFormat: 4,
|
|
1784
|
+
compressed: true,
|
|
1785
|
+
format: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
1786
|
+
textureFormat: "bc4-r-unorm"
|
|
1787
|
+
},
|
|
1788
|
+
bc5: {
|
|
1789
|
+
basisFormat: 5,
|
|
1790
|
+
compressed: true,
|
|
1791
|
+
format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
1792
|
+
textureFormat: "bc5-rg-unorm"
|
|
1793
|
+
},
|
|
1794
|
+
"bc7-m6-opaque-only": {
|
|
1795
|
+
basisFormat: 6,
|
|
1796
|
+
compressed: true,
|
|
1797
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
1798
|
+
textureFormat: "bc7-rgba-unorm"
|
|
1799
|
+
},
|
|
1800
|
+
"bc7-m5": {
|
|
1801
|
+
basisFormat: 7,
|
|
1802
|
+
compressed: true,
|
|
1803
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
1804
|
+
textureFormat: "bc7-rgba-unorm"
|
|
951
1805
|
},
|
|
952
|
-
bc4: { basisFormat: 4, compressed: true },
|
|
953
|
-
bc5: { basisFormat: 5, compressed: true },
|
|
954
|
-
"bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
|
|
955
|
-
"bc7-m5": { basisFormat: 7, compressed: true },
|
|
956
1806
|
"pvrtc1-4-rgb": {
|
|
957
1807
|
basisFormat: 8,
|
|
958
1808
|
compressed: true,
|
|
959
|
-
format:
|
|
1809
|
+
format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
1810
|
+
textureFormat: "pvrtc-rgb4unorm-webgl"
|
|
960
1811
|
},
|
|
961
1812
|
"pvrtc1-4-rgba": {
|
|
962
1813
|
basisFormat: 9,
|
|
963
1814
|
compressed: true,
|
|
964
|
-
format:
|
|
1815
|
+
format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
1816
|
+
textureFormat: "pvrtc-rgba4unorm-webgl"
|
|
965
1817
|
},
|
|
966
1818
|
"astc-4x4": {
|
|
967
1819
|
basisFormat: 10,
|
|
968
1820
|
compressed: true,
|
|
969
|
-
format:
|
|
1821
|
+
format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
1822
|
+
textureFormat: "astc-4x4-unorm"
|
|
1823
|
+
},
|
|
1824
|
+
"atc-rgb": {
|
|
1825
|
+
basisFormat: 11,
|
|
1826
|
+
compressed: true,
|
|
1827
|
+
format: GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
1828
|
+
textureFormat: "atc-rgb-unorm-webgl"
|
|
1829
|
+
},
|
|
1830
|
+
"atc-rgba-interpolated-alpha": {
|
|
1831
|
+
basisFormat: 12,
|
|
1832
|
+
compressed: true,
|
|
1833
|
+
format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
1834
|
+
textureFormat: "atc-rgbai-unorm-webgl"
|
|
1835
|
+
},
|
|
1836
|
+
rgba32: {
|
|
1837
|
+
basisFormat: 13,
|
|
1838
|
+
compressed: false,
|
|
1839
|
+
format: GL_RGBA8,
|
|
1840
|
+
textureFormat: "rgba8unorm"
|
|
1841
|
+
},
|
|
1842
|
+
rgb565: {
|
|
1843
|
+
basisFormat: 14,
|
|
1844
|
+
compressed: false,
|
|
1845
|
+
format: GL_RGB565,
|
|
1846
|
+
textureFormat: "rgb565unorm-webgl"
|
|
970
1847
|
},
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
1848
|
+
bgr565: {
|
|
1849
|
+
basisFormat: 15,
|
|
1850
|
+
compressed: false,
|
|
1851
|
+
format: GL_RGB565,
|
|
1852
|
+
textureFormat: "rgb565unorm-webgl"
|
|
1853
|
+
},
|
|
1854
|
+
rgba4444: {
|
|
1855
|
+
basisFormat: 16,
|
|
1856
|
+
compressed: false,
|
|
1857
|
+
format: GL_RGBA4,
|
|
1858
|
+
textureFormat: "rgba4unorm-webgl"
|
|
1859
|
+
}
|
|
977
1860
|
};
|
|
1861
|
+
var BASIS_FORMATS = Object.freeze(
|
|
1862
|
+
Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
|
|
1863
|
+
);
|
|
978
1864
|
async function parseBasis(data, options = {}) {
|
|
1865
|
+
const loadLibraryOptions = extractLoadLibraryOptions(options);
|
|
979
1866
|
if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
|
|
980
1867
|
if (isKTX(data)) {
|
|
981
|
-
const fileConstructors = await loadBasisEncoderModule(
|
|
1868
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
982
1869
|
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
983
1870
|
}
|
|
984
|
-
const { BasisFile } = await loadBasisTranscoderModule(
|
|
1871
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
985
1872
|
return parseBasisFile(BasisFile, data, options);
|
|
986
1873
|
}
|
|
987
1874
|
switch (options.basis.module) {
|
|
988
1875
|
case "encoder":
|
|
989
|
-
const fileConstructors = await loadBasisEncoderModule(
|
|
1876
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
990
1877
|
switch (options.basis.containerFormat) {
|
|
991
1878
|
case "ktx2":
|
|
992
1879
|
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
@@ -996,7 +1883,7 @@ var __exports__ = (() => {
|
|
|
996
1883
|
}
|
|
997
1884
|
case "transcoder":
|
|
998
1885
|
default:
|
|
999
|
-
const { BasisFile } = await loadBasisTranscoderModule(
|
|
1886
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
1000
1887
|
return parseBasisFile(BasisFile, data, options);
|
|
1001
1888
|
}
|
|
1002
1889
|
}
|
|
@@ -1028,7 +1915,7 @@ var __exports__ = (() => {
|
|
|
1028
1915
|
const hasAlpha = basisFile.getHasAlpha(
|
|
1029
1916
|
/* imageIndex, levelIndex */
|
|
1030
1917
|
);
|
|
1031
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
|
|
1918
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
|
|
1032
1919
|
const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
|
|
1033
1920
|
const decodedData = new Uint8Array(decodedSize);
|
|
1034
1921
|
if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
|
|
@@ -1036,11 +1923,13 @@ var __exports__ = (() => {
|
|
|
1036
1923
|
}
|
|
1037
1924
|
return {
|
|
1038
1925
|
// standard loaders.gl image category payload
|
|
1926
|
+
shape: "texture-level",
|
|
1039
1927
|
width,
|
|
1040
1928
|
height,
|
|
1041
1929
|
data: decodedData,
|
|
1042
1930
|
compressed,
|
|
1043
|
-
format,
|
|
1931
|
+
...format !== void 0 ? { format } : {},
|
|
1932
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
1044
1933
|
// Additional fields
|
|
1045
1934
|
// Add levelSize field.
|
|
1046
1935
|
hasAlpha
|
|
@@ -1065,7 +1954,7 @@ var __exports__ = (() => {
|
|
|
1065
1954
|
}
|
|
1066
1955
|
function transcodeKTX2Image(ktx2File, levelIndex, options) {
|
|
1067
1956
|
const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
|
|
1068
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
|
|
1957
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
|
|
1069
1958
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
|
|
1070
1959
|
levelIndex,
|
|
1071
1960
|
0,
|
|
@@ -1088,48 +1977,98 @@ var __exports__ = (() => {
|
|
|
1088
1977
|
}
|
|
1089
1978
|
return {
|
|
1090
1979
|
// standard loaders.gl image category payload
|
|
1980
|
+
shape: "texture-level",
|
|
1091
1981
|
width,
|
|
1092
1982
|
height,
|
|
1093
1983
|
data: decodedData,
|
|
1094
1984
|
compressed,
|
|
1985
|
+
...format !== void 0 ? { format } : {},
|
|
1986
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
1095
1987
|
// Additional fields
|
|
1096
1988
|
levelSize: decodedSize,
|
|
1097
|
-
hasAlpha: alphaFlag
|
|
1098
|
-
format
|
|
1989
|
+
hasAlpha: alphaFlag
|
|
1099
1990
|
};
|
|
1100
1991
|
}
|
|
1101
1992
|
function getBasisOptions(options, hasAlpha) {
|
|
1102
|
-
let format = options.basis?.format;
|
|
1993
|
+
let format = options.basis?.format || "auto";
|
|
1103
1994
|
if (format === "auto") {
|
|
1104
|
-
format = selectSupportedBasisFormat();
|
|
1995
|
+
format = options.basis?.supportedTextureFormats ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
|
|
1105
1996
|
}
|
|
1106
1997
|
if (typeof format === "object") {
|
|
1107
1998
|
format = hasAlpha ? format.alpha : format.noAlpha;
|
|
1108
1999
|
}
|
|
1109
|
-
|
|
1110
|
-
|
|
2000
|
+
const normalizedFormat = format.toLowerCase();
|
|
2001
|
+
const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
|
|
2002
|
+
if (!basisOutputOptions) {
|
|
2003
|
+
throw new Error(`Unknown Basis format ${format}`);
|
|
2004
|
+
}
|
|
2005
|
+
return basisOutputOptions;
|
|
1111
2006
|
}
|
|
1112
|
-
function selectSupportedBasisFormat() {
|
|
1113
|
-
const
|
|
1114
|
-
if (
|
|
2007
|
+
function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
|
|
2008
|
+
const textureFormats2 = new Set(supportedTextureFormats);
|
|
2009
|
+
if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
|
|
1115
2010
|
return "astc-4x4";
|
|
1116
|
-
} else if (
|
|
2011
|
+
} else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
|
|
2012
|
+
return {
|
|
2013
|
+
alpha: "bc7-m5",
|
|
2014
|
+
noAlpha: "bc7-m6-opaque-only"
|
|
2015
|
+
};
|
|
2016
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
2017
|
+
"bc1-rgb-unorm-webgl",
|
|
2018
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
2019
|
+
"bc1-rgba-unorm",
|
|
2020
|
+
"bc1-rgba-unorm-srgb",
|
|
2021
|
+
"bc2-rgba-unorm",
|
|
2022
|
+
"bc2-rgba-unorm-srgb",
|
|
2023
|
+
"bc3-rgba-unorm",
|
|
2024
|
+
"bc3-rgba-unorm-srgb"
|
|
2025
|
+
])) {
|
|
1117
2026
|
return {
|
|
1118
2027
|
alpha: "bc3",
|
|
1119
2028
|
noAlpha: "bc1"
|
|
1120
2029
|
};
|
|
1121
|
-
} else if (
|
|
2030
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
2031
|
+
"pvrtc-rgb4unorm-webgl",
|
|
2032
|
+
"pvrtc-rgba4unorm-webgl",
|
|
2033
|
+
"pvrtc-rbg2unorm-webgl",
|
|
2034
|
+
"pvrtc-rgba2unorm-webgl"
|
|
2035
|
+
])) {
|
|
1122
2036
|
return {
|
|
1123
2037
|
alpha: "pvrtc1-4-rgba",
|
|
1124
2038
|
noAlpha: "pvrtc1-4-rgb"
|
|
1125
2039
|
};
|
|
1126
|
-
} else if (
|
|
1127
|
-
|
|
1128
|
-
|
|
2040
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
2041
|
+
"etc2-rgb8unorm",
|
|
2042
|
+
"etc2-rgb8unorm-srgb",
|
|
2043
|
+
"etc2-rgb8a1unorm",
|
|
2044
|
+
"etc2-rgb8a1unorm-srgb",
|
|
2045
|
+
"etc2-rgba8unorm",
|
|
2046
|
+
"etc2-rgba8unorm-srgb",
|
|
2047
|
+
"eac-r11unorm",
|
|
2048
|
+
"eac-r11snorm",
|
|
2049
|
+
"eac-rg11unorm",
|
|
2050
|
+
"eac-rg11snorm"
|
|
2051
|
+
])) {
|
|
1129
2052
|
return "etc2";
|
|
2053
|
+
} else if (textureFormats2.has("etc1-rbg-unorm-webgl")) {
|
|
2054
|
+
return "etc1";
|
|
2055
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
2056
|
+
"atc-rgb-unorm-webgl",
|
|
2057
|
+
"atc-rgba-unorm-webgl",
|
|
2058
|
+
"atc-rgbai-unorm-webgl"
|
|
2059
|
+
])) {
|
|
2060
|
+
return {
|
|
2061
|
+
alpha: "atc-rgba-interpolated-alpha",
|
|
2062
|
+
noAlpha: "atc-rgb"
|
|
2063
|
+
};
|
|
1130
2064
|
}
|
|
1131
2065
|
return "rgb565";
|
|
1132
2066
|
}
|
|
2067
|
+
function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
|
|
2068
|
+
return candidateTextureFormats.some(
|
|
2069
|
+
(textureFormat) => supportedTextureFormats.has(textureFormat)
|
|
2070
|
+
);
|
|
2071
|
+
}
|
|
1133
2072
|
|
|
1134
2073
|
// src/basis-loader.ts
|
|
1135
2074
|
var BasisWorkerLoader = {
|
|
@@ -1147,7 +2086,6 @@ var __exports__ = (() => {
|
|
|
1147
2086
|
options: {
|
|
1148
2087
|
basis: {
|
|
1149
2088
|
format: "auto",
|
|
1150
|
-
libraryPath: "libs/",
|
|
1151
2089
|
containerFormat: "auto",
|
|
1152
2090
|
module: "transcoder"
|
|
1153
2091
|
}
|
|
@@ -1174,12 +2112,12 @@ var __exports__ = (() => {
|
|
|
1174
2112
|
DDPF_FOURCC: 4
|
|
1175
2113
|
};
|
|
1176
2114
|
var DDS_PIXEL_FORMATS = {
|
|
1177
|
-
DXT1:
|
|
1178
|
-
DXT3:
|
|
1179
|
-
DXT5:
|
|
1180
|
-
"ATC ":
|
|
1181
|
-
ATCA:
|
|
1182
|
-
ATCI:
|
|
2115
|
+
DXT1: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
2116
|
+
DXT3: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
|
|
2117
|
+
DXT5: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
2118
|
+
"ATC ": GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
2119
|
+
ATCA: GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
|
|
2120
|
+
ATCI: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL
|
|
1183
2121
|
};
|
|
1184
2122
|
var getATCLevelSize = getDxt1LevelSize;
|
|
1185
2123
|
var getATCALevelSize = getDxtXLevelSize;
|
|
@@ -1200,14 +2138,14 @@ var __exports__ = (() => {
|
|
|
1200
2138
|
function parseDDS(data) {
|
|
1201
2139
|
const header = new Int32Array(data, 0, DDS_CONSTANTS.HEADER_LENGTH);
|
|
1202
2140
|
const pixelFormatNumber = header[DDS_CONSTANTS.HEADER_PF_FOURCC_INDEX];
|
|
1203
|
-
|
|
2141
|
+
assert2(
|
|
1204
2142
|
Boolean(header[DDS_CONSTANTS.HEADER_PF_FLAGS_INDEX] & DDS_CONSTANTS.DDPF_FOURCC),
|
|
1205
2143
|
"DDS: Unsupported format, must contain a FourCC code"
|
|
1206
2144
|
);
|
|
1207
2145
|
const fourCC = int32ToFourCC(pixelFormatNumber);
|
|
1208
2146
|
const internalFormat = DDS_PIXEL_FORMATS[fourCC];
|
|
1209
2147
|
const sizeFunction = DDS_SIZE_FUNCTIONS[fourCC];
|
|
1210
|
-
|
|
2148
|
+
assert2(internalFormat && sizeFunction, `DDS: Unknown pixel format ${pixelFormatNumber}`);
|
|
1211
2149
|
let mipMapLevels = 1;
|
|
1212
2150
|
if (header[DDS_CONSTANTS.HEADER_FLAGS_INDEX] & DDS_CONSTANTS.DDSD_MIPMAPCOUNT) {
|
|
1213
2151
|
mipMapLevels = Math.max(1, header[DDS_CONSTANTS.MIPMAPCOUNT_INDEX]);
|
|
@@ -1254,75 +2192,33 @@ var __exports__ = (() => {
|
|
|
1254
2192
|
METADATA_SIZE_INDEX: 12
|
|
1255
2193
|
};
|
|
1256
2194
|
var PVR_PIXEL_FORMATS = {
|
|
1257
|
-
0: [
|
|
1258
|
-
1: [
|
|
1259
|
-
2: [
|
|
1260
|
-
3: [
|
|
1261
|
-
6: [
|
|
1262
|
-
7: [
|
|
1263
|
-
9: [
|
|
1264
|
-
11: [
|
|
1265
|
-
22: [
|
|
1266
|
-
23: [
|
|
1267
|
-
24: [
|
|
1268
|
-
25: [
|
|
1269
|
-
26: [
|
|
1270
|
-
27: [
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
],
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
],
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
],
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR
|
|
1285
|
-
],
|
|
1286
|
-
31: [
|
|
1287
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_6X6_KHR,
|
|
1288
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR
|
|
1289
|
-
],
|
|
1290
|
-
32: [
|
|
1291
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X5_KHR,
|
|
1292
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR
|
|
1293
|
-
],
|
|
1294
|
-
33: [
|
|
1295
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X6_KHR,
|
|
1296
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR
|
|
1297
|
-
],
|
|
1298
|
-
34: [
|
|
1299
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_8X8_KHR,
|
|
1300
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR
|
|
1301
|
-
],
|
|
1302
|
-
35: [
|
|
1303
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X5_KHR,
|
|
1304
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR
|
|
1305
|
-
],
|
|
1306
|
-
36: [
|
|
1307
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X6_KHR,
|
|
1308
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR
|
|
1309
|
-
],
|
|
1310
|
-
37: [
|
|
1311
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X8_KHR,
|
|
1312
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR
|
|
1313
|
-
],
|
|
1314
|
-
38: [
|
|
1315
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_10X10_KHR,
|
|
1316
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR
|
|
1317
|
-
],
|
|
1318
|
-
39: [
|
|
1319
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X10_KHR,
|
|
1320
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR
|
|
1321
|
-
],
|
|
1322
|
-
40: [
|
|
1323
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_RGBA_ASTC_12X12_KHR,
|
|
1324
|
-
GL_EXTENSIONS_CONSTANTS.COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR
|
|
1325
|
-
]
|
|
2195
|
+
0: [GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG],
|
|
2196
|
+
1: [GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG],
|
|
2197
|
+
2: [GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG],
|
|
2198
|
+
3: [GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG],
|
|
2199
|
+
6: [GL_COMPRESSED_RGB_ETC1_WEBGL],
|
|
2200
|
+
7: [GL_COMPRESSED_RGB_S3TC_DXT1_EXT],
|
|
2201
|
+
9: [GL_COMPRESSED_RGBA_S3TC_DXT3_EXT],
|
|
2202
|
+
11: [GL_COMPRESSED_RGBA_S3TC_DXT5_EXT],
|
|
2203
|
+
22: [GL_COMPRESSED_RGB8_ETC2],
|
|
2204
|
+
23: [GL_COMPRESSED_RGBA8_ETC2_EAC],
|
|
2205
|
+
24: [GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2],
|
|
2206
|
+
25: [GL_COMPRESSED_R11_EAC],
|
|
2207
|
+
26: [GL_COMPRESSED_RG11_EAC],
|
|
2208
|
+
27: [GL_COMPRESSED_RGBA_ASTC_4x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR],
|
|
2209
|
+
28: [GL_COMPRESSED_RGBA_ASTC_5x4_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR],
|
|
2210
|
+
29: [GL_COMPRESSED_RGBA_ASTC_5x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR],
|
|
2211
|
+
30: [GL_COMPRESSED_RGBA_ASTC_6x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR],
|
|
2212
|
+
31: [GL_COMPRESSED_RGBA_ASTC_6x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR],
|
|
2213
|
+
32: [GL_COMPRESSED_RGBA_ASTC_8x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR],
|
|
2214
|
+
33: [GL_COMPRESSED_RGBA_ASTC_8x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR],
|
|
2215
|
+
34: [GL_COMPRESSED_RGBA_ASTC_8x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR],
|
|
2216
|
+
35: [GL_COMPRESSED_RGBA_ASTC_10x5_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR],
|
|
2217
|
+
36: [GL_COMPRESSED_RGBA_ASTC_10x6_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR],
|
|
2218
|
+
37: [GL_COMPRESSED_RGBA_ASTC_10x8_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR],
|
|
2219
|
+
38: [GL_COMPRESSED_RGBA_ASTC_10x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR],
|
|
2220
|
+
39: [GL_COMPRESSED_RGBA_ASTC_12x10_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR],
|
|
2221
|
+
40: [GL_COMPRESSED_RGBA_ASTC_12x12_KHR, GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR]
|
|
1326
2222
|
};
|
|
1327
2223
|
var PVR_SIZE_FUNCTIONS = {
|
|
1328
2224
|
0: pvrtc2bppSize,
|
|
@@ -1355,8 +2251,8 @@ var __exports__ = (() => {
|
|
|
1355
2251
|
};
|
|
1356
2252
|
function isPVR(data) {
|
|
1357
2253
|
const header = new Uint32Array(data, 0, PVR_CONSTANTS.HEADER_LENGTH);
|
|
1358
|
-
const
|
|
1359
|
-
return
|
|
2254
|
+
const version2 = header[PVR_CONSTANTS.MAGIC_NUMBER_INDEX];
|
|
2255
|
+
return version2 === PVR_CONSTANTS.MAGIC_NUMBER || version2 === PVR_CONSTANTS.MAGIC_NUMBER_EXTRA;
|
|
1360
2256
|
}
|
|
1361
2257
|
function parsePVR(data) {
|
|
1362
2258
|
const header = new Uint32Array(data, 0, PVR_CONSTANTS.HEADER_LENGTH);
|
|
@@ -1475,7 +2371,6 @@ var __exports__ = (() => {
|
|
|
1475
2371
|
binary: true,
|
|
1476
2372
|
options: {
|
|
1477
2373
|
"compressed-texture": {
|
|
1478
|
-
libraryPath: "libs/",
|
|
1479
2374
|
useBasis: false
|
|
1480
2375
|
}
|
|
1481
2376
|
}
|
|
@@ -1514,9 +2409,7 @@ var __exports__ = (() => {
|
|
|
1514
2409
|
mimeTypes: ["image/crn", "image/x-crn", "application/octet-stream"],
|
|
1515
2410
|
binary: true,
|
|
1516
2411
|
options: {
|
|
1517
|
-
crunch: {
|
|
1518
|
-
libraryPath: "libs/"
|
|
1519
|
-
}
|
|
2412
|
+
crunch: {}
|
|
1520
2413
|
}
|
|
1521
2414
|
};
|
|
1522
2415
|
|
|
@@ -1624,7 +2517,7 @@ var __exports__ = (() => {
|
|
|
1624
2517
|
"--output",
|
|
1625
2518
|
outputUrl
|
|
1626
2519
|
];
|
|
1627
|
-
const childProcess = new
|
|
2520
|
+
const childProcess = new ChildProcessProxy();
|
|
1628
2521
|
await childProcess.start({
|
|
1629
2522
|
command: "npx",
|
|
1630
2523
|
arguments: args,
|
|
@@ -1665,7 +2558,7 @@ var __exports__ = (() => {
|
|
|
1665
2558
|
encodeUASTC = false,
|
|
1666
2559
|
mipmaps = false
|
|
1667
2560
|
} = options?.["ktx2-basis-writer"] || {};
|
|
1668
|
-
const { BasisEncoder } = await loadBasisEncoderModule(options
|
|
2561
|
+
const { BasisEncoder } = await loadBasisEncoderModule(extractLoadLibraryOptions(options));
|
|
1669
2562
|
const basisEncoder = new BasisEncoder();
|
|
1670
2563
|
try {
|
|
1671
2564
|
const basisFileData = new Uint8Array(image.width * image.height * 4);
|
|
@@ -1709,14 +2602,14 @@ var __exports__ = (() => {
|
|
|
1709
2602
|
};
|
|
1710
2603
|
|
|
1711
2604
|
// ../images/src/lib/utils/version.ts
|
|
1712
|
-
var
|
|
2605
|
+
var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
1713
2606
|
|
|
1714
2607
|
// ../images/src/lib/category-api/image-type.ts
|
|
1715
2608
|
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
1716
2609
|
var IMAGE_SUPPORTED = typeof Image !== "undefined";
|
|
1717
2610
|
var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
|
|
1718
2611
|
var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
|
|
1719
|
-
var DATA_SUPPORTED =
|
|
2612
|
+
var DATA_SUPPORTED = isBrowser2 ? true : NODE_IMAGE_SUPPORTED;
|
|
1720
2613
|
function isImageTypeSupported(type) {
|
|
1721
2614
|
switch (type) {
|
|
1722
2615
|
case "auto":
|
|
@@ -2047,7 +2940,7 @@ var __exports__ = (() => {
|
|
|
2047
2940
|
async function parseToNodeImage(arrayBuffer, options) {
|
|
2048
2941
|
const { mimeType } = getBinaryImageMetadata(arrayBuffer) || {};
|
|
2049
2942
|
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
2050
|
-
|
|
2943
|
+
assert2(parseImageNode2);
|
|
2051
2944
|
return await parseImageNode2(arrayBuffer, mimeType);
|
|
2052
2945
|
}
|
|
2053
2946
|
|
|
@@ -2070,7 +2963,7 @@ var __exports__ = (() => {
|
|
|
2070
2963
|
image = await parseToNodeImage(arrayBuffer, options);
|
|
2071
2964
|
break;
|
|
2072
2965
|
default:
|
|
2073
|
-
|
|
2966
|
+
assert2(false);
|
|
2074
2967
|
}
|
|
2075
2968
|
if (imageType === "data") {
|
|
2076
2969
|
image = getImageData(image);
|
|
@@ -2114,7 +3007,7 @@ var __exports__ = (() => {
|
|
|
2114
3007
|
id: "image",
|
|
2115
3008
|
module: "images",
|
|
2116
3009
|
name: "Images",
|
|
2117
|
-
version:
|
|
3010
|
+
version: VERSION5,
|
|
2118
3011
|
mimeTypes: MIME_TYPES,
|
|
2119
3012
|
extensions: EXTENSIONS,
|
|
2120
3013
|
parse: parseImage,
|
|
@@ -2194,7 +3087,7 @@ var __exports__ = (() => {
|
|
|
2194
3087
|
mipLevels = getMipLevels({ width, height });
|
|
2195
3088
|
urls.push(url);
|
|
2196
3089
|
}
|
|
2197
|
-
|
|
3090
|
+
assert2(mipLevels > 0);
|
|
2198
3091
|
for (let mipLevel = urls.length; mipLevel < mipLevels; ++mipLevel) {
|
|
2199
3092
|
const url = generateUrl(getUrl, options, { ...urlOptions, lod: mipLevel });
|
|
2200
3093
|
urls.push(url);
|