@loaders.gl/textures
Version:
Framework-independent loaders for compressed and super compressed (basis) textures
1,295 lines (1,260 loc) • 151 kB
JavaScript
(function webpackUniversalModuleDefinition(root, factory) {
if (typeof exports === 'object' && typeof module === 'object')
module.exports = factory();
else if (typeof define === 'function' && define.amd) define([], factory);
else if (typeof exports === 'object') exports['loaders'] = factory();
else root['loaders'] = factory();})(globalThis, function () {
"use strict";
var __exports__ = (() => {
var __create = Object.create;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __getProtoOf = Object.getPrototypeOf;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __commonJS = (cb, mod) => function __require() {
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
};
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
// If the importer is in node compatibility mode or this is not an ESM
// file that has been converted to a CommonJS file using a Babel-
// compatible transform (i.e. "__esModule" has not been set), then set
// "default" to the CommonJS "module.exports" for node compatibility.
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
mod
));
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// external-global-plugin:@loaders.gl/core
var require_core = __commonJS({
"external-global-plugin:@loaders.gl/core"(exports, module) {
module.exports = globalThis.loaders;
}
});
// bundle.ts
var bundle_exports = {};
__export(bundle_exports, {
BASIS_EXTERNAL_LIBRARIES: () => BASIS_EXTERNAL_LIBRARIES,
BasisLoader: () => BasisLoader,
BasisWorkerLoader: () => BasisWorkerLoader,
CRUNCH_EXTERNAL_LIBRARIES: () => CRUNCH_EXTERNAL_LIBRARIES,
CompressedTextureLoader: () => CompressedTextureLoader,
CompressedTextureWorkerLoader: () => CompressedTextureWorkerLoader,
CompressedTextureWriter: () => CompressedTextureWriter,
CrunchLoader: () => CrunchLoader,
CrunchWorkerLoader: () => CrunchLoader,
GL_COMPRESSED_R11_EAC: () => GL_COMPRESSED_R11_EAC,
GL_COMPRESSED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
GL_COMPRESSED_RED_RGTC1_EXT: () => GL_COMPRESSED_RED_RGTC1_EXT,
GL_COMPRESSED_RG11_EAC: () => GL_COMPRESSED_RG11_EAC,
GL_COMPRESSED_RGB8_ETC2: () => GL_COMPRESSED_RGB8_ETC2,
GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_RGBA8_ETC2_EAC: () => GL_COMPRESSED_RGBA8_ETC2_EAC,
GL_COMPRESSED_RGBA_ASTC_10x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
GL_COMPRESSED_RGBA_ASTC_10x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
GL_COMPRESSED_RGBA_ASTC_10x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
GL_COMPRESSED_RGBA_ASTC_10x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
GL_COMPRESSED_RGBA_ASTC_12x10_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
GL_COMPRESSED_RGBA_ASTC_12x12_KHR: () => GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
GL_COMPRESSED_RGBA_ASTC_4x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
GL_COMPRESSED_RGBA_ASTC_5x4_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
GL_COMPRESSED_RGBA_ASTC_5x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
GL_COMPRESSED_RGBA_ASTC_6x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
GL_COMPRESSED_RGBA_ASTC_6x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
GL_COMPRESSED_RGBA_ASTC_8x5_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
GL_COMPRESSED_RGBA_ASTC_8x6_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
GL_COMPRESSED_RGBA_ASTC_8x8_KHR: () => GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: () => GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
GL_COMPRESSED_RGBA_BPTC_UNORM_EXT: () => GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
GL_COMPRESSED_RGBA_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
GL_COMPRESSED_RGBA_S3TC_DXT3_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
GL_COMPRESSED_RGBA_S3TC_DXT5_EXT: () => GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
GL_COMPRESSED_RGB_ATC_WEBGL: () => GL_COMPRESSED_RGB_ATC_WEBGL,
GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: () => GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
GL_COMPRESSED_RGB_ETC1_WEBGL: () => GL_COMPRESSED_RGB_ETC1_WEBGL,
GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG: () => GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
GL_COMPRESSED_RGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
GL_COMPRESSED_SIGNED_R11_EAC: () => GL_COMPRESSED_SIGNED_R11_EAC,
GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: () => GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
GL_COMPRESSED_SIGNED_RED_RGTC1_EXT: () => GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
GL_COMPRESSED_SIGNED_RG11_EAC: () => GL_COMPRESSED_SIGNED_RG11_EAC,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: () => GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: () => GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
GL_COMPRESSED_SRGB8_ETC2: () => GL_COMPRESSED_SRGB8_ETC2,
GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: () => GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: () => GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: () => GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
GL_COMPRESSED_SRGB_S3TC_DXT1_EXT: () => GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
GL_EXTENSIONS_CONSTANTS: () => GL_EXTENSIONS_CONSTANTS,
GL_RGB: () => GL_RGB,
GL_RGB565: () => GL_RGB565,
GL_RGB5_A1: () => GL_RGB5_A1,
GL_RGBA: () => GL_RGBA,
GL_RGBA32F: () => GL_RGBA32F,
GL_RGBA4: () => GL_RGBA4,
GL_RGBA8: () => GL_RGBA8,
KTX2BasisWriter: () => KTX2BasisWriter,
KTX2BasisWriterWorker: () => KTX2BasisWriterWorker,
NPYLoader: () => NPYLoader,
NPYWorkerLoader: () => NPYWorkerLoader,
RadianceHDRLoader: () => RadianceHDRLoader,
TextureArrayLoader: () => TextureArrayLoader,
TextureCubeArrayLoader: () => TextureCubeArrayLoader,
TextureCubeLoader: () => TextureCubeLoader,
TextureLoader: () => TextureLoader,
loadImageTexture: () => loadImageTexture,
loadImageTextureArray: () => loadImageTextureArray,
loadImageTextureCube: () => loadImageTextureCube
});
__reExport(bundle_exports, __toESM(require_core(), 1));
// src/lib/utils/version.ts
var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
// ../worker-utils/src/lib/npm-tag.ts
var NPM_TAG = "latest";
// ../worker-utils/src/lib/env-utils/version.ts
var warningIssued = false;
function getVersion() {
if (!globalThis._loadersgl_?.version) {
globalThis._loadersgl_ = globalThis._loadersgl_ || {};
if (typeof __VERSION__ === "undefined" && !warningIssued) {
console.warn(
"loaders.gl: The __VERSION__ variable is not injected using babel plugin. Latest unstable workers would be fetched from the CDN."
);
globalThis._loadersgl_.version = NPM_TAG;
warningIssued = true;
} else {
globalThis._loadersgl_.version = __VERSION__;
}
}
return globalThis._loadersgl_.version;
}
var VERSION2 = getVersion();
// ../worker-utils/src/lib/env-utils/assert.ts
function assert(condition, message) {
if (!condition) {
throw new Error(message || "loaders.gl assertion failed.");
}
}
// ../worker-utils/src/lib/env-utils/globals.ts
var globals = {
self: typeof self !== "undefined" && self,
window: typeof window !== "undefined" && window,
global: typeof global !== "undefined" && global,
document: typeof document !== "undefined" && document
};
var self_ = globals.self || globals.window || globals.global || {};
var window_ = globals.window || globals.self || globals.global || {};
var global_ = globals.global || globals.self || globals.window || {};
var document_ = globals.document || {};
var isBrowser = (
// @ts-ignore process.browser
typeof process !== "object" || String(process) !== "[object process]" || process.browser
);
var isWorker = typeof importScripts === "function";
var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
var nodeVersion = matches && parseFloat(matches[1]) || 0;
// ../worker-utils/src/lib/library-utils/library-utils.ts
var loadLibraryPromises = {};
function extractLoadLibraryOptions(options = {}) {
const useLocalLibraries = options.useLocalLibraries ?? options.core?.useLocalLibraries;
const CDN = options.CDN ?? options.core?.CDN;
const modules = options.modules;
return {
...useLocalLibraries !== void 0 ? { useLocalLibraries } : {},
...CDN !== void 0 ? { CDN } : {},
...modules !== void 0 ? { modules } : {}
};
}
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
if (moduleName) {
libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
}
loadLibraryPromises[libraryUrl] = // eslint-disable-next-line @typescript-eslint/no-misused-promises
loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
return await loadLibraryPromises[libraryUrl];
}
function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
if (options?.core) {
throw new Error("loadLibrary: options.core must be pre-normalized");
}
if (!options.useLocalLibraries && library.startsWith("http")) {
return library;
}
libraryName = libraryName || library;
const modules = options.modules || {};
if (modules[libraryName]) {
return modules[libraryName];
}
if (!isBrowser) {
return `modules/${moduleName}/dist/libs/${libraryName}`;
}
if (options.CDN) {
assert(options.CDN.startsWith("http"));
return `${options.CDN}/${moduleName}@${VERSION2}/dist/libs/${libraryName}`;
}
if (isWorker) {
return `../src/libs/${libraryName}`;
}
return `modules/${moduleName}/src/libs/${libraryName}`;
}
async function loadLibraryFromFile(libraryUrl) {
if (libraryUrl.endsWith("wasm")) {
return await loadAsArrayBuffer(libraryUrl);
}
if (!isBrowser) {
const { requireFromFile } = globalThis.loaders || {};
try {
const result = await requireFromFile?.(libraryUrl);
if (result || !libraryUrl.includes("/dist/libs/")) {
return result;
}
return await requireFromFile?.(libraryUrl.replace("/dist/libs/", "/src/libs/"));
} catch (error) {
if (libraryUrl.includes("/dist/libs/")) {
try {
return await requireFromFile?.(libraryUrl.replace("/dist/libs/", "/src/libs/"));
} catch {
}
}
console.error(error);
return null;
}
}
if (isWorker) {
return importScripts(libraryUrl);
}
const scriptSource = await loadAsText(libraryUrl);
return loadLibraryFromString(scriptSource, libraryUrl);
}
function loadLibraryFromString(scriptSource, id) {
if (!isBrowser) {
const { requireFromString } = globalThis.loaders || {};
return requireFromString?.(scriptSource, id);
}
if (isWorker) {
eval.call(globalThis, scriptSource);
return null;
}
const script = document.createElement("script");
script.id = id;
try {
script.appendChild(document.createTextNode(scriptSource));
} catch (e) {
script.text = scriptSource;
}
document.body.appendChild(script);
return null;
}
async function loadAsArrayBuffer(url) {
const { readFileAsArrayBuffer } = globalThis.loaders || {};
if (isBrowser || !readFileAsArrayBuffer || url.startsWith("http")) {
const response = await fetch(url);
return await response.arrayBuffer();
}
try {
return await readFileAsArrayBuffer(url);
} catch {
if (url.includes("/dist/libs/")) {
return await readFileAsArrayBuffer(url.replace("/dist/libs/", "/src/libs/"));
}
throw new Error(`Failed to load ArrayBuffer from ${url}`);
}
}
async function loadAsText(url) {
const { readFileAsText } = globalThis.loaders || {};
if (isBrowser || !readFileAsText || url.startsWith("http")) {
const response = await fetch(url);
return await response.text();
}
try {
return await readFileAsText(url);
} catch {
if (url.includes("/dist/libs/")) {
return await readFileAsText(url.replace("/dist/libs/", "/src/libs/"));
}
throw new Error(`Failed to load text from ${url}`);
}
}
// ../worker-utils/src/lib/process-utils/child-process-proxy.browser.ts
var ChildProcessProxy = class {
constructor() {
throw new Error("ChildProcessProxy is not available in browser environments");
}
async start(props) {
return await Promise.resolve({});
}
async stop() {
return await Promise.resolve();
}
async exit() {
return await Promise.resolve();
}
};
// ../loader-utils/src/loader-types.ts
async function parseFromContext(data, loaders, options, context) {
return context._parse(data, loaders, options, context);
}
// ../loader-utils/src/lib/env-utils/assert.ts
function assert2(condition, message) {
if (!condition) {
throw new Error(message || "loader assertion failed.");
}
}
// ../loader-utils/src/lib/env-utils/globals.ts
var globals2 = {
self: typeof self !== "undefined" && self,
window: typeof window !== "undefined" && window,
global: typeof global !== "undefined" && global,
document: typeof document !== "undefined" && document
};
var self_2 = globals2.self || globals2.window || globals2.global || {};
var window_2 = globals2.window || globals2.self || globals2.global || {};
var global_2 = globals2.global || globals2.self || globals2.window || {};
var document_2 = globals2.document || {};
var isBrowser2 = (
// @ts-ignore process does not exist on browser
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
);
var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
var nodeVersion2 = matches2 && parseFloat(matches2[1]) || 0;
// ../../node_modules/@probe.gl/env/dist/lib/globals.js
var window_3 = globalThis;
var document_3 = globalThis.document || {};
var process_ = globalThis.process || {};
var console_ = globalThis.console;
var navigator_ = globalThis.navigator || {};
// ../../node_modules/@probe.gl/env/dist/lib/is-electron.js
function isElectron(mockUserAgent) {
if (typeof window !== "undefined" && window.process?.type === "renderer") {
return true;
}
if (typeof process !== "undefined" && Boolean(process.versions?.["electron"])) {
return true;
}
const realUserAgent = typeof navigator !== "undefined" && navigator.userAgent;
const userAgent = mockUserAgent || realUserAgent;
return Boolean(userAgent && userAgent.indexOf("Electron") >= 0);
}
// ../../node_modules/@probe.gl/env/dist/lib/is-browser.js
function isBrowser3() {
const isNode = (
// @ts-expect-error
typeof process === "object" && String(process) === "[object process]" && !process?.browser
);
return !isNode || isElectron();
}
// ../../node_modules/@probe.gl/env/dist/index.js
var VERSION3 = true ? "4.1.1" : "untranspiled source";
// ../../node_modules/@probe.gl/log/dist/utils/assert.js
function assert3(condition, message) {
if (!condition) {
throw new Error(message || "Assertion failed");
}
}
// ../../node_modules/@probe.gl/log/dist/loggers/log-utils.js
function normalizeLogLevel(logLevel) {
if (!logLevel) {
return 0;
}
let resolvedLevel;
switch (typeof logLevel) {
case "number":
resolvedLevel = logLevel;
break;
case "object":
resolvedLevel = logLevel.logLevel || logLevel.priority || 0;
break;
default:
return 0;
}
assert3(Number.isFinite(resolvedLevel) && resolvedLevel >= 0);
return resolvedLevel;
}
function normalizeArguments(opts) {
const { logLevel, message } = opts;
opts.logLevel = normalizeLogLevel(logLevel);
const args = opts.args ? Array.from(opts.args) : [];
while (args.length && args.shift() !== message) {
}
switch (typeof logLevel) {
case "string":
case "function":
if (message !== void 0) {
args.unshift(message);
}
opts.message = logLevel;
break;
case "object":
Object.assign(opts, logLevel);
break;
default:
}
if (typeof opts.message === "function") {
opts.message = opts.message();
}
const messageType = typeof opts.message;
assert3(messageType === "string" || messageType === "object");
return Object.assign(opts, { args }, opts.opts);
}
// ../../node_modules/@probe.gl/log/dist/loggers/base-log.js
var noop = () => {
};
var BaseLog = class {
constructor({ level = 0 } = {}) {
this.userData = {};
this._onceCache = /* @__PURE__ */ new Set();
this._level = level;
}
set level(newLevel) {
this.setLevel(newLevel);
}
get level() {
return this.getLevel();
}
setLevel(level) {
this._level = level;
return this;
}
getLevel() {
return this._level;
}
// Unconditional logging
warn(message, ...args) {
return this._log("warn", 0, message, args, { once: true });
}
error(message, ...args) {
return this._log("error", 0, message, args);
}
// Conditional logging
log(logLevel, message, ...args) {
return this._log("log", logLevel, message, args);
}
info(logLevel, message, ...args) {
return this._log("info", logLevel, message, args);
}
once(logLevel, message, ...args) {
return this._log("once", logLevel, message, args, { once: true });
}
_log(type, logLevel, message, args, options = {}) {
const normalized = normalizeArguments({
logLevel,
message,
args: this._buildArgs(logLevel, message, args),
opts: options
});
return this._createLogFunction(type, normalized, options);
}
_buildArgs(logLevel, message, args) {
return [logLevel, message, ...args];
}
_createLogFunction(type, normalized, options) {
if (!this._shouldLog(normalized.logLevel)) {
return noop;
}
const tag = this._getOnceTag(options.tag ?? normalized.tag ?? normalized.message);
if ((options.once || normalized.once) && tag !== void 0) {
if (this._onceCache.has(tag)) {
return noop;
}
this._onceCache.add(tag);
}
return this._emit(type, normalized);
}
_shouldLog(logLevel) {
return this.getLevel() >= normalizeLogLevel(logLevel);
}
_getOnceTag(tag) {
if (tag === void 0) {
return void 0;
}
try {
return typeof tag === "string" ? tag : String(tag);
} catch {
return void 0;
}
}
};
// ../../node_modules/@probe.gl/log/dist/utils/local-storage.js
function getStorage(type) {
try {
const storage = window[type];
const x = "__storage_test__";
storage.setItem(x, x);
storage.removeItem(x);
return storage;
} catch (e) {
return null;
}
}
var LocalStorage = class {
constructor(id, defaultConfig, type = "sessionStorage") {
this.storage = getStorage(type);
this.id = id;
this.config = defaultConfig;
this._loadConfiguration();
}
getConfiguration() {
return this.config;
}
setConfiguration(configuration) {
Object.assign(this.config, configuration);
if (this.storage) {
const serialized = JSON.stringify(this.config);
this.storage.setItem(this.id, serialized);
}
}
// Get config from persistent store, if available
_loadConfiguration() {
let configuration = {};
if (this.storage) {
const serializedConfiguration = this.storage.getItem(this.id);
configuration = serializedConfiguration ? JSON.parse(serializedConfiguration) : {};
}
Object.assign(this.config, configuration);
return this;
}
};
// ../../node_modules/@probe.gl/log/dist/utils/formatters.js
function formatTime(ms) {
let formatted;
if (ms < 10) {
formatted = `${ms.toFixed(2)}ms`;
} else if (ms < 100) {
formatted = `${ms.toFixed(1)}ms`;
} else if (ms < 1e3) {
formatted = `${ms.toFixed(0)}ms`;
} else {
formatted = `${(ms / 1e3).toFixed(2)}s`;
}
return formatted;
}
function leftPad(string, length = 8) {
const padLength = Math.max(length - string.length, 0);
return `${" ".repeat(padLength)}${string}`;
}
// ../../node_modules/@probe.gl/log/dist/utils/color.js
var COLOR;
(function(COLOR2) {
COLOR2[COLOR2["BLACK"] = 30] = "BLACK";
COLOR2[COLOR2["RED"] = 31] = "RED";
COLOR2[COLOR2["GREEN"] = 32] = "GREEN";
COLOR2[COLOR2["YELLOW"] = 33] = "YELLOW";
COLOR2[COLOR2["BLUE"] = 34] = "BLUE";
COLOR2[COLOR2["MAGENTA"] = 35] = "MAGENTA";
COLOR2[COLOR2["CYAN"] = 36] = "CYAN";
COLOR2[COLOR2["WHITE"] = 37] = "WHITE";
COLOR2[COLOR2["BRIGHT_BLACK"] = 90] = "BRIGHT_BLACK";
COLOR2[COLOR2["BRIGHT_RED"] = 91] = "BRIGHT_RED";
COLOR2[COLOR2["BRIGHT_GREEN"] = 92] = "BRIGHT_GREEN";
COLOR2[COLOR2["BRIGHT_YELLOW"] = 93] = "BRIGHT_YELLOW";
COLOR2[COLOR2["BRIGHT_BLUE"] = 94] = "BRIGHT_BLUE";
COLOR2[COLOR2["BRIGHT_MAGENTA"] = 95] = "BRIGHT_MAGENTA";
COLOR2[COLOR2["BRIGHT_CYAN"] = 96] = "BRIGHT_CYAN";
COLOR2[COLOR2["BRIGHT_WHITE"] = 97] = "BRIGHT_WHITE";
})(COLOR || (COLOR = {}));
var BACKGROUND_INCREMENT = 10;
function getColor(color) {
if (typeof color !== "string") {
return color;
}
color = color.toUpperCase();
return COLOR[color] || COLOR.WHITE;
}
function addColor(string, color, background) {
if (!isBrowser3 && typeof string === "string") {
if (color) {
const colorCode = getColor(color);
string = `\x1B[${colorCode}m${string}\x1B[39m`;
}
if (background) {
const colorCode = getColor(background);
string = `\x1B[${colorCode + BACKGROUND_INCREMENT}m${string}\x1B[49m`;
}
}
return string;
}
// ../../node_modules/@probe.gl/log/dist/utils/autobind.js
function autobind(obj, predefined = ["constructor"]) {
const proto = Object.getPrototypeOf(obj);
const propNames = Object.getOwnPropertyNames(proto);
const object = obj;
for (const key of propNames) {
const value = object[key];
if (typeof value === "function") {
if (!predefined.find((name) => key === name)) {
object[key] = value.bind(obj);
}
}
}
}
// ../../node_modules/@probe.gl/log/dist/utils/hi-res-timestamp.js
function getHiResTimestamp() {
let timestamp;
if (isBrowser3() && window_3.performance) {
timestamp = window_3?.performance?.now?.();
} else if ("hrtime" in process_) {
const timeParts = process_?.hrtime?.();
timestamp = timeParts[0] * 1e3 + timeParts[1] / 1e6;
} else {
timestamp = Date.now();
}
return timestamp;
}
// ../../node_modules/@probe.gl/log/dist/loggers/probe-log.js
var originalConsole = {
debug: isBrowser3() ? console.debug || console.log : console.log,
log: console.log,
info: console.info,
warn: console.warn,
error: console.error
};
var DEFAULT_LOG_CONFIGURATION = {
enabled: true,
level: 0
};
var ProbeLog = class extends BaseLog {
constructor({ id } = { id: "" }) {
super({ level: 0 });
this.VERSION = VERSION3;
this._startTs = getHiResTimestamp();
this._deltaTs = getHiResTimestamp();
this.userData = {};
this.LOG_THROTTLE_TIMEOUT = 0;
this.id = id;
this.userData = {};
this._storage = new LocalStorage(`__probe-${this.id}__`, { [this.id]: DEFAULT_LOG_CONFIGURATION });
this.timeStamp(`${this.id} started`);
autobind(this);
Object.seal(this);
}
isEnabled() {
return this._getConfiguration().enabled;
}
getLevel() {
return this._getConfiguration().level;
}
/** @return milliseconds, with fractions */
getTotal() {
return Number((getHiResTimestamp() - this._startTs).toPrecision(10));
}
/** @return milliseconds, with fractions */
getDelta() {
return Number((getHiResTimestamp() - this._deltaTs).toPrecision(10));
}
/** @deprecated use logLevel */
set priority(newPriority) {
this.level = newPriority;
}
/** @deprecated use logLevel */
get priority() {
return this.level;
}
/** @deprecated use logLevel */
getPriority() {
return this.level;
}
// Configure
enable(enabled = true) {
this._updateConfiguration({ enabled });
return this;
}
setLevel(level) {
this._updateConfiguration({ level });
return this;
}
/** return the current status of the setting */
get(setting) {
return this._getConfiguration()[setting];
}
// update the status of the setting
set(setting, value) {
this._updateConfiguration({ [setting]: value });
}
/** Logs the current settings as a table */
settings() {
if (console.table) {
console.table(this._storage.config);
} else {
console.log(this._storage.config);
}
}
// Unconditional logging
assert(condition, message) {
if (!condition) {
throw new Error(message || "Assertion failed");
}
}
warn(message, ...args) {
return this._log("warn", 0, message, args, {
method: originalConsole.warn,
once: true
});
}
error(message, ...args) {
return this._log("error", 0, message, args, {
method: originalConsole.error
});
}
/** Print a deprecation warning */
deprecated(oldUsage, newUsage) {
return this.warn(`\`${oldUsage}\` is deprecated and will be removed in a later version. Use \`${newUsage}\` instead`);
}
/** Print a removal warning */
removed(oldUsage, newUsage) {
return this.error(`\`${oldUsage}\` has been removed. Use \`${newUsage}\` instead`);
}
probe(logLevel, message, ...args) {
return this._log("log", logLevel, message, args, {
method: originalConsole.log,
time: true,
once: true
});
}
log(logLevel, message, ...args) {
return this._log("log", logLevel, message, args, {
method: originalConsole.debug
});
}
info(logLevel, message, ...args) {
return this._log("info", logLevel, message, args, { method: console.info });
}
once(logLevel, message, ...args) {
return this._log("once", logLevel, message, args, {
method: originalConsole.debug || originalConsole.info,
once: true
});
}
/** Logs an object as a table */
table(logLevel, table, columns) {
if (table) {
return this._log("table", logLevel, table, columns && [columns] || [], {
method: console.table || noop,
tag: getTableHeader(table)
});
}
return noop;
}
time(logLevel, message) {
return this._log("time", logLevel, message, [], {
method: console.time ? console.time : console.info
});
}
timeEnd(logLevel, message) {
return this._log("time", logLevel, message, [], {
method: console.timeEnd ? console.timeEnd : console.info
});
}
timeStamp(logLevel, message) {
return this._log("time", logLevel, message, [], {
method: console.timeStamp || noop
});
}
group(logLevel, message, opts = { collapsed: false }) {
const method = (opts.collapsed ? console.groupCollapsed : console.group) || console.info;
return this._log("group", logLevel, message, [], { method });
}
groupCollapsed(logLevel, message, opts = {}) {
return this.group(logLevel, message, Object.assign({}, opts, { collapsed: true }));
}
groupEnd(logLevel) {
return this._log("groupEnd", logLevel, "", [], {
method: console.groupEnd || noop
});
}
// EXPERIMENTAL
withGroup(logLevel, message, func) {
this.group(logLevel, message)();
try {
func();
} finally {
this.groupEnd(logLevel)();
}
}
trace() {
if (console.trace) {
console.trace();
}
}
_shouldLog(logLevel) {
return this.isEnabled() && super._shouldLog(logLevel);
}
_emit(_type, normalized) {
const method = normalized.method;
assert3(method);
normalized.total = this.getTotal();
normalized.delta = this.getDelta();
this._deltaTs = getHiResTimestamp();
const message = decorateMessage(this.id, normalized.message, normalized);
return method.bind(console, message, ...normalized.args);
}
_getConfiguration() {
if (!this._storage.config[this.id]) {
this._updateConfiguration(DEFAULT_LOG_CONFIGURATION);
}
return this._storage.config[this.id];
}
_updateConfiguration(configuration) {
const currentConfiguration = this._storage.config[this.id] || {
...DEFAULT_LOG_CONFIGURATION
};
this._storage.setConfiguration({
[this.id]: { ...currentConfiguration, ...configuration }
});
}
};
ProbeLog.VERSION = VERSION3;
function decorateMessage(id, message, opts) {
if (typeof message === "string") {
const time = opts.time ? leftPad(formatTime(opts.total)) : "";
message = opts.time ? `${id}: ${time} ${message}` : `${id}: ${message}`;
message = addColor(message, opts.color, opts.background);
}
return message;
}
function getTableHeader(table) {
for (const key in table) {
for (const title in table[key]) {
return title || "untitled";
}
}
return "empty";
}
// ../../node_modules/@probe.gl/log/dist/init.js
globalThis.probe = {};
// ../../node_modules/@probe.gl/log/dist/index.js
var dist_default = new ProbeLog({ id: "@probe.gl/log" });
// ../loader-utils/src/lib/log-utils/log.ts
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
var version = VERSION4[0] >= "0" && VERSION4[0] <= "9" ? `v${VERSION4}` : "";
function createLog() {
const log2 = new ProbeLog({ id: "loaders.gl" });
globalThis.loaders ||= {};
globalThis.loaders.log = log2;
globalThis.loaders.version = version;
globalThis.probe ||= {};
globalThis.probe.loaders = log2;
return log2;
}
var log = createLog();
// ../loader-utils/src/lib/module-utils/js-module-utils.ts
function registerJSModules(modules) {
globalThis.loaders ||= {};
globalThis.loaders.modules ||= {};
Object.assign(globalThis.loaders.modules, modules);
}
function getJSModuleOrNull(name) {
const module = globalThis.loaders?.modules?.[name];
return module || null;
}
// ../loader-utils/src/lib/path-utils/file-aliases.ts
var pathPrefix = "";
var fileAliases = {};
function resolvePath(filename2) {
for (const alias in fileAliases) {
if (filename2.startsWith(alias)) {
const replacement = fileAliases[alias];
filename2 = filename2.replace(alias, replacement);
}
}
if (!filename2.startsWith("http://") && !filename2.startsWith("https://")) {
filename2 = `${pathPrefix}${filename2}`;
}
return filename2;
}
// ../loader-utils/src/lib/path-utils/path.ts
var path_exports = {};
__export(path_exports, {
dirname: () => dirname,
filename: () => filename,
join: () => join,
resolve: () => resolve
});
// ../loader-utils/src/lib/path-utils/get-cwd.ts
function getCWD() {
if (typeof process !== "undefined" && typeof process.cwd !== "undefined") {
return process.cwd();
}
const pathname = window.location?.pathname;
return pathname?.slice(0, pathname.lastIndexOf("/") + 1) || "";
}
// ../loader-utils/src/lib/path-utils/path.ts
function filename(url) {
const slashIndex = url ? url.lastIndexOf("/") : -1;
return slashIndex >= 0 ? url.substr(slashIndex + 1) : url;
}
function dirname(url) {
const slashIndex = url ? url.lastIndexOf("/") : -1;
return slashIndex >= 0 ? url.substr(0, slashIndex) : "";
}
function join(...parts) {
const separator = "/";
parts = parts.map((part, index) => {
if (index) {
part = part.replace(new RegExp(`^${separator}`), "");
}
if (index !== parts.length - 1) {
part = part.replace(new RegExp(`${separator}$`), "");
}
return part;
});
return parts.join(separator);
}
function resolve(...components) {
const paths = [];
for (let _i = 0; _i < components.length; _i++) {
paths[_i] = components[_i];
}
let resolvedPath = "";
let resolvedAbsolute = false;
let cwd;
for (let i = paths.length - 1; i >= -1 && !resolvedAbsolute; i--) {
let path;
if (i >= 0) {
path = paths[i];
} else {
if (cwd === void 0) {
cwd = getCWD();
}
path = cwd;
}
if (path.length === 0) {
continue;
}
resolvedPath = `${path}/${resolvedPath}`;
resolvedAbsolute = path.charCodeAt(0) === SLASH;
}
resolvedPath = normalizeStringPosix(resolvedPath, !resolvedAbsolute);
if (resolvedAbsolute) {
return `/${resolvedPath}`;
} else if (resolvedPath.length > 0) {
return resolvedPath;
}
return ".";
}
var SLASH = 47;
var DOT = 46;
function normalizeStringPosix(path, allowAboveRoot) {
let res = "";
let lastSlash = -1;
let dots = 0;
let code;
let isAboveRoot = false;
for (let i = 0; i <= path.length; ++i) {
if (i < path.length) {
code = path.charCodeAt(i);
} else if (code === SLASH) {
break;
} else {
code = SLASH;
}
if (code === SLASH) {
if (lastSlash === i - 1 || dots === 1) {
} else if (lastSlash !== i - 1 && dots === 2) {
if (res.length < 2 || !isAboveRoot || res.charCodeAt(res.length - 1) !== DOT || res.charCodeAt(res.length - 2) !== DOT) {
if (res.length > 2) {
const start = res.length - 1;
let j = start;
for (; j >= 0; --j) {
if (res.charCodeAt(j) === SLASH) {
break;
}
}
if (j !== start) {
res = j === -1 ? "" : res.slice(0, j);
lastSlash = i;
dots = 0;
isAboveRoot = false;
continue;
}
} else if (res.length === 2 || res.length === 1) {
res = "";
lastSlash = i;
dots = 0;
isAboveRoot = false;
continue;
}
}
if (allowAboveRoot) {
if (res.length > 0) {
res += "/..";
} else {
res = "..";
}
isAboveRoot = true;
}
} else {
const slice = path.slice(lastSlash + 1, i);
if (res.length > 0) {
res += `/${slice}`;
} else {
res = slice;
}
isAboveRoot = false;
}
lastSlash = i;
dots = 0;
} else if (code === DOT && dots !== -1) {
++dots;
} else {
dots = -1;
}
}
return res;
}
// src/lib/parsers/basis-module-loader.ts
var BASIS_EXTERNAL_LIBRARIES = {
/** Basis transcoder, javascript wrapper part */
TRANSCODER: "basis_transcoder.js",
/** Basis transcoder, compiled web assembly part */
TRANSCODER_WASM: "basis_transcoder.wasm",
/** Basis encoder, javascript wrapper part */
ENCODER: "basis_encoder.js",
/** Basis encoder, compiled web assembly part */
ENCODER_WASM: "basis_encoder.wasm"
};
var loadBasisTranscoderPromise;
async function loadBasisTranscoderModule(options) {
registerJSModules(options.modules);
const basis = getJSModuleOrNull("basis");
if (basis) {
return basis;
}
loadBasisTranscoderPromise ||= loadBasisTranscoder(options);
return await loadBasisTranscoderPromise;
}
async function loadBasisTranscoder(options) {
let BASIS = null;
let wasmBinary = null;
[BASIS, wasmBinary] = await Promise.all([
await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER, "textures", options),
await loadLibrary(BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, "textures", options)
]);
BASIS = BASIS || globalThis.BASIS;
return await initializeBasisTranscoderModule(BASIS, wasmBinary);
}
function initializeBasisTranscoderModule(BasisModule, wasmBinary) {
const options = {};
if (wasmBinary) {
options.wasmBinary = wasmBinary;
}
return new Promise((resolve2) => {
BasisModule(options).then((module) => {
const { BasisFile, initializeBasis } = module;
initializeBasis();
resolve2({ BasisFile });
});
});
}
var loadBasisEncoderPromise;
async function loadBasisEncoderModule(options) {
const modules = options.modules || {};
if (modules.basisEncoder) {
return modules.basisEncoder;
}
loadBasisEncoderPromise = loadBasisEncoderPromise || loadBasisEncoder(options);
return await loadBasisEncoderPromise;
}
async function loadBasisEncoder(options) {
let BASIS_ENCODER = null;
let wasmBinary = null;
[BASIS_ENCODER, wasmBinary] = await Promise.all([
await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER, "textures", options),
await loadLibrary(BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, "textures", options)
]);
BASIS_ENCODER = BASIS_ENCODER || globalThis.BASIS;
return await initializeBasisEncoderModule(BASIS_ENCODER, wasmBinary);
}
function initializeBasisEncoderModule(BasisEncoderModule, wasmBinary) {
const options = {};
if (wasmBinary) {
options.wasmBinary = wasmBinary;
}
return new Promise((resolve2) => {
BasisEncoderModule(options).then((module) => {
const { BasisFile, KTX2File, initializeBasis, BasisEncoder } = module;
initializeBasis();
resolve2({ BasisFile, KTX2File, BasisEncoder });
});
});
}
// src/lib/gl-extensions.ts
var GL_RGB = 6407;
var GL_RGBA = 6408;
var GL_RGBA4 = 32854;
var GL_RGB5_A1 = 32855;
var GL_RGBA8 = 32856;
var GL_RGB565 = 36194;
var GL_RGBA32F = 34836;
var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
var GL_COMPRESSED_RGBA_S3TC_DXT1_EXT = 33777;
var GL_COMPRESSED_RGBA_S3TC_DXT3_EXT = 33778;
var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
var GL_COMPRESSED_R11_EAC = 37488;
var GL_COMPRESSED_SIGNED_R11_EAC = 37489;
var GL_COMPRESSED_RG11_EAC = 37490;
var GL_COMPRESSED_SIGNED_RG11_EAC = 37491;
var GL_COMPRESSED_RGB8_ETC2 = 37492;
var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
var GL_COMPRESSED_SRGB8_ETC2 = 37494;
var GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 37495;
var GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37496;
var GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 37497;
var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
var GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG = 35841;
var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
var GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG = 35843;
var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
var GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 35987;
var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
var GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 37809;
var GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 37810;
var GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 37811;
var GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 37812;
var GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 37813;
var GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 37814;
var GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 37815;
var GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 37816;
var GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 37817;
var GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 37818;
var GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 37819;
var GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 37820;
var GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 37821;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 37840;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 37841;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 37842;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 37843;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 37844;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 37845;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 37846;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 37847;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 37848;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 37849;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 37850;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 37851;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 37852;
var GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 37853;
var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
var GL_COMPRESSED_SIGNED_RED_RGTC1_EXT = 36284;
var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
var GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT = 36286;
var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
var GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT = 36493;
var GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT = 36494;
var GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT = 36495;
var GL_COMPRESSED_SRGB_S3TC_DXT1_EXT = 35916;
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT = 35917;
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT = 35918;
var GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT = 35919;
var GL_EXTENSIONS_CONSTANTS = {
RGB: GL_RGB,
RGBA: GL_RGBA,
RGBA4: GL_RGBA4,
RGB5_A1: GL_RGB5_A1,
RGBA8: GL_RGBA8,
RGB565: GL_RGB565,
RGBA32F: GL_RGBA32F,
COMPRESSED_RGB_S3TC_DXT1_EXT: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
COMPRESSED_RGBA_S3TC_DXT1_EXT: GL_COMPRESSED_RGBA_S3TC_DXT1_EXT,
COMPRESSED_RGBA_S3TC_DXT3_EXT: GL_COMPRESSED_RGBA_S3TC_DXT3_EXT,
COMPRESSED_RGBA_S3TC_DXT5_EXT: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
COMPRESSED_R11_EAC: GL_COMPRESSED_R11_EAC,
COMPRESSED_SIGNED_R11_EAC: GL_COMPRESSED_SIGNED_R11_EAC,
COMPRESSED_RG11_EAC: GL_COMPRESSED_RG11_EAC,
COMPRESSED_SIGNED_RG11_EAC: GL_COMPRESSED_SIGNED_RG11_EAC,
COMPRESSED_RGB8_ETC2: GL_COMPRESSED_RGB8_ETC2,
COMPRESSED_RGBA8_ETC2_EAC: GL_COMPRESSED_RGBA8_ETC2_EAC,
COMPRESSED_SRGB8_ETC2: GL_COMPRESSED_SRGB8_ETC2,
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC,
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2,
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2,
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG,
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG,
COMPRESSED_RGB_ETC1_WEBGL: GL_COMPRESSED_RGB_ETC1_WEBGL,
COMPRESSED_RGB_ATC_WEBGL: GL_COMPRESSED_RGB_ATC_WEBGL,
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL,
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
COMPRESSED_RGBA_ASTC_4x4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
COMPRESSED_RGBA_ASTC_5x4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
COMPRESSED_RGBA_ASTC_5x5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
COMPRESSED_RGBA_ASTC_6x5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
COMPRESSED_RGBA_ASTC_6x6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
COMPRESSED_RGBA_ASTC_8x5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
COMPRESSED_RGBA_ASTC_8x6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR,
COMPRESSED_RGBA_ASTC_8x8_KHR: GL_COMPRESSED_RGBA_ASTC_8x8_KHR,
COMPRESSED_RGBA_ASTC_10x5_KHR: GL_COMPRESSED_RGBA_ASTC_10x5_KHR,
COMPRESSED_RGBA_ASTC_10x6_KHR: GL_COMPRESSED_RGBA_ASTC_10x6_KHR,
COMPRESSED_RGBA_ASTC_10x8_KHR: GL_COMPRESSED_RGBA_ASTC_10x8_KHR,
COMPRESSED_RGBA_ASTC_10x10_KHR: GL_COMPRESSED_RGBA_ASTC_10x10_KHR,
COMPRESSED_RGBA_ASTC_12x10_KHR: GL_COMPRESSED_RGBA_ASTC_12x10_KHR,
COMPRESSED_RGBA_ASTC_12x12_KHR: GL_COMPRESSED_RGBA_ASTC_12x12_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR,
COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR: GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR,
COMPRESSED_RED_RGTC1_EXT: GL_COMPRESSED_RED_RGTC1_EXT,
COMPRESSED_SIGNED_RED_RGTC1_EXT: GL_COMPRESSED_SIGNED_RED_RGTC1_EXT,
COMPRESSED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: GL_COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT,
COMPRESSED_RGBA_BPTC_UNORM_EXT: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT: GL_COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT,
COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT,
COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT: GL_COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT,
COMPRESSED_SRGB_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_S3TC_DXT1_EXT,
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT,
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT,
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT,
// Deprecated legacy aliases with non-standard ASTC casing.
COMPRESSED_RGBA_ASTC_4X4_KHR: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
COMPRESSED_RGBA_ASTC_5X4_KHR: GL_COMPRESSED_RGBA_ASTC_5x4_KHR,
COMPRESSED_RGBA_ASTC_5X5_KHR: GL_COMPRESSED_RGBA_ASTC_5x5_KHR,
COMPRESSED_RGBA_ASTC_6X5_KHR: GL_COMPRESSED_RGBA_ASTC_6x5_KHR,
COMPRESSED_RGBA_ASTC_6X6_KHR: GL_COMPRESSED_RGBA_ASTC_6x6_KHR,
COMPRESSED_RGBA_ASTC_8X5_KHR: GL_COMPRESSED_RGBA_ASTC_8x5_KHR,
COMPRESSED_RGBA_ASTC_8X6_KHR: GL_COMPRESSED_RGBA_ASTC_8x6_KHR