@loaders.gl/textures 4.4.0-alpha.16 → 4.4.0-alpha.17
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 +17 -8
- package/dist/basis-loader.d.ts.map +1 -1
- package/dist/basis-loader.js.map +1 -1
- package/dist/basis-worker-node.js +317 -188
- package/dist/basis-worker.js +252 -123
- package/dist/compressed-texture-worker.js +1035 -326
- package/dist/crunch-worker.js +141 -82
- package/dist/dist.dev.js +1220 -334
- package/dist/dist.min.js +1 -2
- package/dist/index.cjs +657 -317
- 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 +2 -2
- package/dist/ktx2-basis-writer-worker.js +2 -2
- 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/parse-basis.d.ts +16 -1
- package/dist/lib/parsers/parse-basis.d.ts.map +1 -1
- package/dist/lib/parsers/parse-basis.js +216 -43
- 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 +4 -4
- 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/package.json +6 -6
- package/src/basis-loader.ts +21 -8
- package/src/index.ts +2 -4
- package/src/lib/gl-extensions.ts +186 -81
- package/src/lib/parsers/parse-basis.ts +274 -40
- package/src/lib/parsers/parse-crunch.ts +13 -6
- 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
|
@@ -23879,31 +23879,31 @@ var require_private_key = __commonJS({
|
|
|
23879
23879
|
var InvalidAlgorithmError = errs.InvalidAlgorithmError;
|
|
23880
23880
|
var KeyParseError = errs.KeyParseError;
|
|
23881
23881
|
var KeyEncryptedError = errs.KeyEncryptedError;
|
|
23882
|
-
var
|
|
23883
|
-
|
|
23884
|
-
|
|
23885
|
-
|
|
23886
|
-
|
|
23887
|
-
|
|
23888
|
-
|
|
23889
|
-
|
|
23890
|
-
|
|
23891
|
-
|
|
23892
|
-
|
|
23882
|
+
var formats = {};
|
|
23883
|
+
formats["auto"] = require_auto();
|
|
23884
|
+
formats["pem"] = require_pem();
|
|
23885
|
+
formats["pkcs1"] = require_pkcs1();
|
|
23886
|
+
formats["pkcs8"] = require_pkcs8();
|
|
23887
|
+
formats["rfc4253"] = require_rfc4253();
|
|
23888
|
+
formats["ssh-private"] = require_ssh_private();
|
|
23889
|
+
formats["openssh"] = formats["ssh-private"];
|
|
23890
|
+
formats["ssh"] = formats["ssh-private"];
|
|
23891
|
+
formats["dnssec"] = require_dnssec();
|
|
23892
|
+
formats["putty"] = require_putty();
|
|
23893
23893
|
function PrivateKey(opts) {
|
|
23894
23894
|
assert3.object(opts, "options");
|
|
23895
23895
|
Key.call(this, opts);
|
|
23896
23896
|
this._pubCache = void 0;
|
|
23897
23897
|
}
|
|
23898
23898
|
util.inherits(PrivateKey, Key);
|
|
23899
|
-
PrivateKey.formats =
|
|
23899
|
+
PrivateKey.formats = formats;
|
|
23900
23900
|
PrivateKey.prototype.toBuffer = function(format, options) {
|
|
23901
23901
|
if (format === void 0)
|
|
23902
23902
|
format = "pkcs1";
|
|
23903
23903
|
assert3.string(format, "format");
|
|
23904
|
-
assert3.object(
|
|
23904
|
+
assert3.object(formats[format], "formats[format]");
|
|
23905
23905
|
assert3.optionalObject(options, "options");
|
|
23906
|
-
return
|
|
23906
|
+
return formats[format].write(this, options);
|
|
23907
23907
|
};
|
|
23908
23908
|
PrivateKey.prototype.hash = function(algo, type) {
|
|
23909
23909
|
return this.toPublic().hash(algo, type);
|
|
@@ -24014,9 +24014,9 @@ var require_private_key = __commonJS({
|
|
|
24014
24014
|
assert3.optionalString(options.filename, "options.filename");
|
|
24015
24015
|
if (options.filename === void 0)
|
|
24016
24016
|
options.filename = "(unnamed)";
|
|
24017
|
-
assert3.object(
|
|
24017
|
+
assert3.object(formats[format], "formats[format]");
|
|
24018
24018
|
try {
|
|
24019
|
-
var k2 =
|
|
24019
|
+
var k2 = formats[format].read(data, options);
|
|
24020
24020
|
assert3.ok(k2 instanceof PrivateKey, "key is not a private key");
|
|
24021
24021
|
if (!k2.comment)
|
|
24022
24022
|
k2.comment = options.filename;
|
|
@@ -25385,10 +25385,10 @@ var require_certificate = __commonJS({
|
|
|
25385
25385
|
var Key = require_key();
|
|
25386
25386
|
var PrivateKey = require_private_key();
|
|
25387
25387
|
var Identity = require_identity();
|
|
25388
|
-
var
|
|
25389
|
-
|
|
25390
|
-
|
|
25391
|
-
|
|
25388
|
+
var formats = {};
|
|
25389
|
+
formats["openssh"] = require_openssh_cert();
|
|
25390
|
+
formats["x509"] = require_x509();
|
|
25391
|
+
formats["pem"] = require_x509_pem();
|
|
25392
25392
|
var CertificateParseError = errs.CertificateParseError;
|
|
25393
25393
|
var InvalidAlgorithmError = errs.InvalidAlgorithmError;
|
|
25394
25394
|
function Certificate(opts) {
|
|
@@ -25431,14 +25431,14 @@ var require_certificate = __commonJS({
|
|
|
25431
25431
|
this.validUntil = opts.validUntil;
|
|
25432
25432
|
this.purposes = opts.purposes;
|
|
25433
25433
|
}
|
|
25434
|
-
Certificate.formats =
|
|
25434
|
+
Certificate.formats = formats;
|
|
25435
25435
|
Certificate.prototype.toBuffer = function(format, options) {
|
|
25436
25436
|
if (format === void 0)
|
|
25437
25437
|
format = "x509";
|
|
25438
25438
|
assert3.string(format, "format");
|
|
25439
|
-
assert3.object(
|
|
25439
|
+
assert3.object(formats[format], "formats[format]");
|
|
25440
25440
|
assert3.optionalObject(options, "options");
|
|
25441
|
-
return
|
|
25441
|
+
return formats[format].write(this, options);
|
|
25442
25442
|
};
|
|
25443
25443
|
Certificate.prototype.toString = function(format, options) {
|
|
25444
25444
|
if (format === void 0)
|
|
@@ -25516,18 +25516,18 @@ var require_certificate = __commonJS({
|
|
|
25516
25516
|
return this.issuerKey.fingerprint("sha512").matches(issuerKey);
|
|
25517
25517
|
}
|
|
25518
25518
|
var fmt = Object.keys(this.signatures)[0];
|
|
25519
|
-
var valid =
|
|
25519
|
+
var valid = formats[fmt].verify(this, issuerKey);
|
|
25520
25520
|
if (valid)
|
|
25521
25521
|
this.issuerKey = issuerKey;
|
|
25522
25522
|
return valid;
|
|
25523
25523
|
};
|
|
25524
25524
|
Certificate.prototype.signWith = function(key) {
|
|
25525
25525
|
utils.assertCompatible(key, PrivateKey, [1, 2], "key");
|
|
25526
|
-
var fmts = Object.keys(
|
|
25526
|
+
var fmts = Object.keys(formats);
|
|
25527
25527
|
var didOne = false;
|
|
25528
25528
|
for (var i2 = 0; i2 < fmts.length; ++i2) {
|
|
25529
25529
|
if (fmts[i2] !== "pem") {
|
|
25530
|
-
var ret =
|
|
25530
|
+
var ret = formats[fmts[i2]].sign(this, key);
|
|
25531
25531
|
if (ret === true)
|
|
25532
25532
|
didOne = true;
|
|
25533
25533
|
}
|
|
@@ -25708,9 +25708,9 @@ var require_certificate = __commonJS({
|
|
|
25708
25708
|
assert3.optionalString(options.filename, "options.filename");
|
|
25709
25709
|
if (options.filename === void 0)
|
|
25710
25710
|
options.filename = "(unnamed)";
|
|
25711
|
-
assert3.object(
|
|
25711
|
+
assert3.object(formats[format], "formats[format]");
|
|
25712
25712
|
try {
|
|
25713
|
-
var k2 =
|
|
25713
|
+
var k2 = formats[format].read(data, options);
|
|
25714
25714
|
return k2;
|
|
25715
25715
|
} catch (e2) {
|
|
25716
25716
|
throw new CertificateParseError(options.filename, format, e2);
|
|
@@ -25941,18 +25941,18 @@ var require_key = __commonJS({
|
|
|
25941
25941
|
}
|
|
25942
25942
|
var InvalidAlgorithmError = errs.InvalidAlgorithmError;
|
|
25943
25943
|
var KeyParseError = errs.KeyParseError;
|
|
25944
|
-
var
|
|
25945
|
-
|
|
25946
|
-
|
|
25947
|
-
|
|
25948
|
-
|
|
25949
|
-
|
|
25950
|
-
|
|
25951
|
-
|
|
25952
|
-
|
|
25953
|
-
|
|
25954
|
-
|
|
25955
|
-
|
|
25944
|
+
var formats = {};
|
|
25945
|
+
formats["auto"] = require_auto();
|
|
25946
|
+
formats["pem"] = require_pem();
|
|
25947
|
+
formats["pkcs1"] = require_pkcs1();
|
|
25948
|
+
formats["pkcs8"] = require_pkcs8();
|
|
25949
|
+
formats["rfc4253"] = require_rfc4253();
|
|
25950
|
+
formats["ssh"] = require_ssh();
|
|
25951
|
+
formats["ssh-private"] = require_ssh_private();
|
|
25952
|
+
formats["openssh"] = formats["ssh-private"];
|
|
25953
|
+
formats["dnssec"] = require_dnssec();
|
|
25954
|
+
formats["putty"] = require_putty();
|
|
25955
|
+
formats["ppk"] = formats["putty"];
|
|
25956
25956
|
function Key(opts) {
|
|
25957
25957
|
assert3.object(opts, "options");
|
|
25958
25958
|
assert3.arrayOfObject(opts.parts, "options.parts");
|
|
@@ -25989,19 +25989,19 @@ var require_key = __commonJS({
|
|
|
25989
25989
|
}
|
|
25990
25990
|
this.size = sz;
|
|
25991
25991
|
}
|
|
25992
|
-
Key.formats =
|
|
25992
|
+
Key.formats = formats;
|
|
25993
25993
|
Key.prototype.toBuffer = function(format, options) {
|
|
25994
25994
|
if (format === void 0)
|
|
25995
25995
|
format = "ssh";
|
|
25996
25996
|
assert3.string(format, "format");
|
|
25997
|
-
assert3.object(
|
|
25997
|
+
assert3.object(formats[format], "formats[format]");
|
|
25998
25998
|
assert3.optionalObject(options, "options");
|
|
25999
25999
|
if (format === "rfc4253") {
|
|
26000
26000
|
if (this._rfc4253Cache === void 0)
|
|
26001
|
-
this._rfc4253Cache =
|
|
26001
|
+
this._rfc4253Cache = formats["rfc4253"].write(this);
|
|
26002
26002
|
return this._rfc4253Cache;
|
|
26003
26003
|
}
|
|
26004
|
-
return
|
|
26004
|
+
return formats[format].write(this, options);
|
|
26005
26005
|
};
|
|
26006
26006
|
Key.prototype.toString = function(format, options) {
|
|
26007
26007
|
return this.toBuffer(format, options).toString();
|
|
@@ -26021,7 +26021,7 @@ var require_key = __commonJS({
|
|
|
26021
26021
|
if (type === "ssh") {
|
|
26022
26022
|
buf = this.toBuffer("rfc4253");
|
|
26023
26023
|
} else if (type === "spki") {
|
|
26024
|
-
buf =
|
|
26024
|
+
buf = formats.pkcs8.pkcs8ToBuffer(this);
|
|
26025
26025
|
} else {
|
|
26026
26026
|
throw new Error("Hash type " + type + " not supported");
|
|
26027
26027
|
}
|
|
@@ -26126,9 +26126,9 @@ var require_key = __commonJS({
|
|
|
26126
26126
|
assert3.optionalString(options.filename, "options.filename");
|
|
26127
26127
|
if (options.filename === void 0)
|
|
26128
26128
|
options.filename = "(unnamed)";
|
|
26129
|
-
assert3.object(
|
|
26129
|
+
assert3.object(formats[format], "formats[format]");
|
|
26130
26130
|
try {
|
|
26131
|
-
var k2 =
|
|
26131
|
+
var k2 = formats[format].read(data, options);
|
|
26132
26132
|
if (k2 instanceof PrivateKey)
|
|
26133
26133
|
k2 = k2.toPublic();
|
|
26134
26134
|
if (!k2.comment)
|
|
@@ -38148,7 +38148,7 @@ var require_stringify2 = __commonJS({
|
|
|
38148
38148
|
"../../node_modules/request/node_modules/qs/lib/stringify.js"(exports, module2) {
|
|
38149
38149
|
"use strict";
|
|
38150
38150
|
var utils = require_utils3();
|
|
38151
|
-
var
|
|
38151
|
+
var formats = require_formats();
|
|
38152
38152
|
var arrayPrefixGenerators = {
|
|
38153
38153
|
brackets: function brackets(prefix) {
|
|
38154
38154
|
return prefix + "[]";
|
|
@@ -38263,11 +38263,11 @@ var require_stringify2 = __commonJS({
|
|
|
38263
38263
|
var serializeDate = typeof options.serializeDate === "function" ? options.serializeDate : defaults.serializeDate;
|
|
38264
38264
|
var encodeValuesOnly = typeof options.encodeValuesOnly === "boolean" ? options.encodeValuesOnly : defaults.encodeValuesOnly;
|
|
38265
38265
|
if (typeof options.format === "undefined") {
|
|
38266
|
-
options.format =
|
|
38267
|
-
} else if (!Object.prototype.hasOwnProperty.call(
|
|
38266
|
+
options.format = formats["default"];
|
|
38267
|
+
} else if (!Object.prototype.hasOwnProperty.call(formats.formatters, options.format)) {
|
|
38268
38268
|
throw new TypeError("Unknown format option provided.");
|
|
38269
38269
|
}
|
|
38270
|
-
var formatter =
|
|
38270
|
+
var formatter = formats.formatters[options.format];
|
|
38271
38271
|
var objKeys;
|
|
38272
38272
|
var filter;
|
|
38273
38273
|
if (typeof options.filter === "function") {
|
|
@@ -38460,9 +38460,9 @@ var require_lib4 = __commonJS({
|
|
|
38460
38460
|
"use strict";
|
|
38461
38461
|
var stringify = require_stringify2();
|
|
38462
38462
|
var parse = require_parse();
|
|
38463
|
-
var
|
|
38463
|
+
var formats = require_formats();
|
|
38464
38464
|
module2.exports = {
|
|
38465
|
-
formats
|
|
38465
|
+
formats,
|
|
38466
38466
|
parse,
|
|
38467
38467
|
stringify
|
|
38468
38468
|
};
|
|
@@ -40755,7 +40755,7 @@ var require_compile2 = __commonJS({
|
|
|
40755
40755
|
var compilation = this._compilations[c2.index];
|
|
40756
40756
|
if (c2.compiling)
|
|
40757
40757
|
return compilation.callValidate = callValidate;
|
|
40758
|
-
var
|
|
40758
|
+
var formats = this._formats;
|
|
40759
40759
|
var RULES = this.RULES;
|
|
40760
40760
|
try {
|
|
40761
40761
|
var v2 = localCompile(schema, root, localRefs, baseId);
|
|
@@ -40805,7 +40805,7 @@ var require_compile2 = __commonJS({
|
|
|
40805
40805
|
useDefault,
|
|
40806
40806
|
useCustomRule,
|
|
40807
40807
|
opts,
|
|
40808
|
-
formats
|
|
40808
|
+
formats,
|
|
40809
40809
|
logger: self2.logger,
|
|
40810
40810
|
self: self2
|
|
40811
40811
|
});
|
|
@@ -40831,7 +40831,7 @@ var require_compile2 = __commonJS({
|
|
|
40831
40831
|
validate = makeValidate(
|
|
40832
40832
|
self2,
|
|
40833
40833
|
RULES,
|
|
40834
|
-
|
|
40834
|
+
formats,
|
|
40835
40835
|
root,
|
|
40836
40836
|
refVal,
|
|
40837
40837
|
defaults,
|
|
@@ -41065,12 +41065,12 @@ var require_formats2 = __commonJS({
|
|
|
41065
41065
|
var JSON_POINTER = /^(?:\/(?:[^~/]|~0|~1)*)*$/;
|
|
41066
41066
|
var JSON_POINTER_URI_FRAGMENT = /^#(?:\/(?:[a-z0-9_\-.!$&'()*+,;:=@]|%[0-9a-f]{2}|~0|~1)*)*$/i;
|
|
41067
41067
|
var RELATIVE_JSON_POINTER = /^(?:0|[1-9][0-9]*)(?:#|(?:\/(?:[^~/]|~0|~1)*)*)$/;
|
|
41068
|
-
module2.exports =
|
|
41069
|
-
function
|
|
41068
|
+
module2.exports = formats;
|
|
41069
|
+
function formats(mode) {
|
|
41070
41070
|
mode = mode == "full" ? "full" : "fast";
|
|
41071
|
-
return util.copy(
|
|
41071
|
+
return util.copy(formats[mode]);
|
|
41072
41072
|
}
|
|
41073
|
-
|
|
41073
|
+
formats.fast = {
|
|
41074
41074
|
// date: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
41075
41075
|
date: /^\d\d\d\d-[0-1]\d-[0-3]\d$/,
|
|
41076
41076
|
// date-time: http://tools.ietf.org/html/rfc3339#section-5.6
|
|
@@ -41100,7 +41100,7 @@ var require_formats2 = __commonJS({
|
|
|
41100
41100
|
// relative JSON-pointer: http://tools.ietf.org/html/draft-luff-relative-json-pointer-00
|
|
41101
41101
|
"relative-json-pointer": RELATIVE_JSON_POINTER
|
|
41102
41102
|
};
|
|
41103
|
-
|
|
41103
|
+
formats.full = {
|
|
41104
41104
|
date,
|
|
41105
41105
|
time,
|
|
41106
41106
|
"date-time": date_time,
|
|
@@ -44530,7 +44530,7 @@ var require_ajv = __commonJS({
|
|
|
44530
44530
|
var Cache = require_cache();
|
|
44531
44531
|
var SchemaObject = require_schema_obj();
|
|
44532
44532
|
var stableStringify = require_fast_json_stable_stringify();
|
|
44533
|
-
var
|
|
44533
|
+
var formats = require_formats2();
|
|
44534
44534
|
var rules = require_rules();
|
|
44535
44535
|
var $dataMetaSchema = require_data();
|
|
44536
44536
|
var util = require_util3();
|
|
@@ -44567,7 +44567,7 @@ var require_ajv = __commonJS({
|
|
|
44567
44567
|
this._schemas = {};
|
|
44568
44568
|
this._refs = {};
|
|
44569
44569
|
this._fragments = {};
|
|
44570
|
-
this._formats =
|
|
44570
|
+
this._formats = formats(opts.format);
|
|
44571
44571
|
this._cache = opts.cache || new Cache();
|
|
44572
44572
|
this._loadingSchemas = {};
|
|
44573
44573
|
this._compilations = [];
|
|
@@ -50494,7 +50494,7 @@ function getVersion() {
|
|
|
50494
50494
|
globalThis._loadersgl_.version = NPM_TAG;
|
|
50495
50495
|
warningIssued = true;
|
|
50496
50496
|
} else {
|
|
50497
|
-
globalThis._loadersgl_.version = "4.4.0-alpha.
|
|
50497
|
+
globalThis._loadersgl_.version = "4.4.0-alpha.17";
|
|
50498
50498
|
}
|
|
50499
50499
|
}
|
|
50500
50500
|
return globalThis._loadersgl_.version;
|
|
@@ -54228,7 +54228,7 @@ if (nodeVersion2 < 18) {
|
|
|
54228
54228
|
}
|
|
54229
54229
|
|
|
54230
54230
|
// src/lib/utils/version.ts
|
|
54231
|
-
var VERSION2 = true ? "4.4.0-alpha.
|
|
54231
|
+
var VERSION2 = true ? "4.4.0-alpha.17" : "latest";
|
|
54232
54232
|
|
|
54233
54233
|
// src/lib/parsers/basis-module-loader.ts
|
|
54234
54234
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
@@ -54308,104 +54308,117 @@ function initializeBasisEncoderModule(BasisEncoderModule, wasmBinary) {
|
|
|
54308
54308
|
}
|
|
54309
54309
|
|
|
54310
54310
|
// src/lib/gl-extensions.ts
|
|
54311
|
-
var
|
|
54312
|
-
|
|
54313
|
-
|
|
54314
|
-
|
|
54315
|
-
|
|
54316
|
-
|
|
54317
|
-
|
|
54318
|
-
|
|
54319
|
-
|
|
54320
|
-
|
|
54321
|
-
|
|
54322
|
-
|
|
54323
|
-
|
|
54324
|
-
|
|
54325
|
-
|
|
54326
|
-
|
|
54327
|
-
|
|
54328
|
-
// WEBGL_compressed_texture_pvrtc
|
|
54329
|
-
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
|
|
54330
|
-
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
|
|
54331
|
-
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
|
|
54332
|
-
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
|
|
54333
|
-
// WEBGL_compressed_texture_etc1
|
|
54334
|
-
COMPRESSED_RGB_ETC1_WEBGL: 36196,
|
|
54335
|
-
// WEBGL_compressed_texture_atc
|
|
54336
|
-
COMPRESSED_RGB_ATC_WEBGL: 35986,
|
|
54337
|
-
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
|
|
54338
|
-
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
|
|
54339
|
-
// WEBGL_compressed_texture_astc
|
|
54340
|
-
COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
|
|
54341
|
-
COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
|
|
54342
|
-
COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
|
|
54343
|
-
COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,
|
|
54344
|
-
COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,
|
|
54345
|
-
COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,
|
|
54346
|
-
COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,
|
|
54347
|
-
COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,
|
|
54348
|
-
COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,
|
|
54349
|
-
COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,
|
|
54350
|
-
COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,
|
|
54351
|
-
COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,
|
|
54352
|
-
COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,
|
|
54353
|
-
COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,
|
|
54354
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,
|
|
54355
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,
|
|
54356
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,
|
|
54357
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,
|
|
54358
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,
|
|
54359
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,
|
|
54360
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,
|
|
54361
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,
|
|
54362
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,
|
|
54363
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,
|
|
54364
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,
|
|
54365
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
|
|
54366
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
|
|
54367
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
|
|
54368
|
-
// EXT_texture_compression_rgtc
|
|
54369
|
-
COMPRESSED_RED_RGTC1_EXT: 36283,
|
|
54370
|
-
COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
|
|
54371
|
-
COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
|
|
54372
|
-
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
|
|
54373
|
-
// WEBGL_compressed_texture_s3tc_srgb
|
|
54374
|
-
COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
|
|
54375
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
|
|
54376
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
|
|
54377
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
|
|
54378
|
-
};
|
|
54379
|
-
|
|
54380
|
-
// src/lib/utils/texture-formats.ts
|
|
54311
|
+
var GL_RGBA4 = 32854;
|
|
54312
|
+
var GL_RGBA8 = 32856;
|
|
54313
|
+
var GL_RGB565 = 36194;
|
|
54314
|
+
var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
|
|
54315
|
+
var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
|
|
54316
|
+
var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
|
|
54317
|
+
var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
|
|
54318
|
+
var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
|
|
54319
|
+
var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
|
|
54320
|
+
var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
|
|
54321
|
+
var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
|
|
54322
|
+
var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
|
|
54323
|
+
var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
|
|
54324
|
+
var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
|
|
54325
|
+
var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
|
|
54326
|
+
|
|
54327
|
+
// src/lib/utils/detect-supported-texture-formats.ts
|
|
54381
54328
|
var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
|
|
54382
|
-
var
|
|
54329
|
+
var WEBGL_TEXTURE_FORMATS = {
|
|
54383
54330
|
/* eslint-disable camelcase */
|
|
54384
|
-
WEBGL_compressed_texture_s3tc:
|
|
54385
|
-
|
|
54386
|
-
|
|
54387
|
-
|
|
54388
|
-
|
|
54389
|
-
|
|
54390
|
-
|
|
54391
|
-
|
|
54331
|
+
WEBGL_compressed_texture_s3tc: [
|
|
54332
|
+
"bc1-rgb-unorm-webgl",
|
|
54333
|
+
"bc1-rgba-unorm",
|
|
54334
|
+
"bc2-rgba-unorm",
|
|
54335
|
+
"bc3-rgba-unorm"
|
|
54336
|
+
],
|
|
54337
|
+
WEBGL_compressed_texture_s3tc_srgb: [
|
|
54338
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
54339
|
+
"bc1-rgba-unorm-srgb",
|
|
54340
|
+
"bc2-rgba-unorm-srgb",
|
|
54341
|
+
"bc3-rgba-unorm-srgb"
|
|
54342
|
+
],
|
|
54343
|
+
EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
|
|
54344
|
+
EXT_texture_compression_bptc: [
|
|
54345
|
+
"bc6h-rgb-ufloat",
|
|
54346
|
+
"bc6h-rgb-float",
|
|
54347
|
+
"bc7-rgba-unorm",
|
|
54348
|
+
"bc7-rgba-unorm-srgb"
|
|
54349
|
+
],
|
|
54350
|
+
WEBGL_compressed_texture_etc1: ["etc1-rbg-unorm-webgl"],
|
|
54351
|
+
WEBGL_compressed_texture_etc: [
|
|
54352
|
+
"etc2-rgb8unorm",
|
|
54353
|
+
"etc2-rgb8unorm-srgb",
|
|
54354
|
+
"etc2-rgb8a1unorm",
|
|
54355
|
+
"etc2-rgb8a1unorm-srgb",
|
|
54356
|
+
"etc2-rgba8unorm",
|
|
54357
|
+
"etc2-rgba8unorm-srgb",
|
|
54358
|
+
"eac-r11unorm",
|
|
54359
|
+
"eac-r11snorm",
|
|
54360
|
+
"eac-rg11unorm",
|
|
54361
|
+
"eac-rg11snorm"
|
|
54362
|
+
],
|
|
54363
|
+
WEBGL_compressed_texture_pvrtc: [
|
|
54364
|
+
"pvrtc-rgb4unorm-webgl",
|
|
54365
|
+
"pvrtc-rgba4unorm-webgl",
|
|
54366
|
+
"pvrtc-rbg2unorm-webgl",
|
|
54367
|
+
"pvrtc-rgba2unorm-webgl"
|
|
54368
|
+
],
|
|
54369
|
+
WEBGL_compressed_texture_atc: [
|
|
54370
|
+
"atc-rgb-unorm-webgl",
|
|
54371
|
+
"atc-rgba-unorm-webgl",
|
|
54372
|
+
"atc-rgbai-unorm-webgl"
|
|
54373
|
+
],
|
|
54374
|
+
WEBGL_compressed_texture_astc: [
|
|
54375
|
+
"astc-4x4-unorm",
|
|
54376
|
+
"astc-4x4-unorm-srgb",
|
|
54377
|
+
"astc-5x4-unorm",
|
|
54378
|
+
"astc-5x4-unorm-srgb",
|
|
54379
|
+
"astc-5x5-unorm",
|
|
54380
|
+
"astc-5x5-unorm-srgb",
|
|
54381
|
+
"astc-6x5-unorm",
|
|
54382
|
+
"astc-6x5-unorm-srgb",
|
|
54383
|
+
"astc-6x6-unorm",
|
|
54384
|
+
"astc-6x6-unorm-srgb",
|
|
54385
|
+
"astc-8x5-unorm",
|
|
54386
|
+
"astc-8x5-unorm-srgb",
|
|
54387
|
+
"astc-8x6-unorm",
|
|
54388
|
+
"astc-8x6-unorm-srgb",
|
|
54389
|
+
"astc-8x8-unorm",
|
|
54390
|
+
"astc-8x8-unorm-srgb",
|
|
54391
|
+
"astc-10x5-unorm",
|
|
54392
|
+
"astc-10x5-unorm-srgb",
|
|
54393
|
+
"astc-10x6-unorm",
|
|
54394
|
+
"astc-10x6-unorm-srgb",
|
|
54395
|
+
"astc-10x8-unorm",
|
|
54396
|
+
"astc-10x8-unorm-srgb",
|
|
54397
|
+
"astc-10x10-unorm",
|
|
54398
|
+
"astc-10x10-unorm-srgb",
|
|
54399
|
+
"astc-12x10-unorm",
|
|
54400
|
+
"astc-12x10-unorm-srgb",
|
|
54401
|
+
"astc-12x12-unorm",
|
|
54402
|
+
"astc-12x12-unorm-srgb"
|
|
54403
|
+
]
|
|
54392
54404
|
/* eslint-enable camelcase */
|
|
54393
54405
|
};
|
|
54394
|
-
var
|
|
54395
|
-
function
|
|
54396
|
-
if (!
|
|
54406
|
+
var textureFormats = null;
|
|
54407
|
+
function detectSupportedTextureFormats(gl) {
|
|
54408
|
+
if (!textureFormats) {
|
|
54397
54409
|
gl = gl || getWebGLContext() || void 0;
|
|
54398
|
-
|
|
54410
|
+
textureFormats = /* @__PURE__ */ new Set();
|
|
54399
54411
|
for (const prefix of BROWSER_PREFIXES) {
|
|
54400
|
-
for (const extension in
|
|
54412
|
+
for (const extension in WEBGL_TEXTURE_FORMATS) {
|
|
54401
54413
|
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
54402
|
-
const
|
|
54403
|
-
|
|
54414
|
+
for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
|
|
54415
|
+
textureFormats.add(textureFormat);
|
|
54416
|
+
}
|
|
54404
54417
|
}
|
|
54405
54418
|
}
|
|
54406
54419
|
}
|
|
54407
54420
|
}
|
|
54408
|
-
return
|
|
54421
|
+
return textureFormats;
|
|
54409
54422
|
}
|
|
54410
54423
|
function getWebGLContext() {
|
|
54411
54424
|
try {
|
|
@@ -54450,49 +54463,113 @@ function isKTX(data) {
|
|
|
54450
54463
|
}
|
|
54451
54464
|
|
|
54452
54465
|
// src/lib/parsers/parse-basis.ts
|
|
54453
|
-
var
|
|
54466
|
+
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
54454
54467
|
etc1: {
|
|
54455
54468
|
basisFormat: 0,
|
|
54456
54469
|
compressed: true,
|
|
54457
|
-
format:
|
|
54470
|
+
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
54471
|
+
textureFormat: "etc1-rbg-unorm-webgl"
|
|
54472
|
+
},
|
|
54473
|
+
etc2: {
|
|
54474
|
+
basisFormat: 1,
|
|
54475
|
+
compressed: true,
|
|
54476
|
+
format: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
54477
|
+
textureFormat: "etc2-rgba8unorm"
|
|
54458
54478
|
},
|
|
54459
|
-
etc2: { basisFormat: 1, compressed: true },
|
|
54460
54479
|
bc1: {
|
|
54461
54480
|
basisFormat: 2,
|
|
54462
54481
|
compressed: true,
|
|
54463
|
-
format:
|
|
54482
|
+
format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
54483
|
+
textureFormat: "bc1-rgb-unorm-webgl"
|
|
54464
54484
|
},
|
|
54465
54485
|
bc3: {
|
|
54466
54486
|
basisFormat: 3,
|
|
54467
54487
|
compressed: true,
|
|
54468
|
-
format:
|
|
54488
|
+
format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
54489
|
+
textureFormat: "bc3-rgba-unorm"
|
|
54490
|
+
},
|
|
54491
|
+
bc4: {
|
|
54492
|
+
basisFormat: 4,
|
|
54493
|
+
compressed: true,
|
|
54494
|
+
format: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
54495
|
+
textureFormat: "bc4-r-unorm"
|
|
54496
|
+
},
|
|
54497
|
+
bc5: {
|
|
54498
|
+
basisFormat: 5,
|
|
54499
|
+
compressed: true,
|
|
54500
|
+
format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
54501
|
+
textureFormat: "bc5-rg-unorm"
|
|
54502
|
+
},
|
|
54503
|
+
"bc7-m6-opaque-only": {
|
|
54504
|
+
basisFormat: 6,
|
|
54505
|
+
compressed: true,
|
|
54506
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
54507
|
+
textureFormat: "bc7-rgba-unorm"
|
|
54508
|
+
},
|
|
54509
|
+
"bc7-m5": {
|
|
54510
|
+
basisFormat: 7,
|
|
54511
|
+
compressed: true,
|
|
54512
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
54513
|
+
textureFormat: "bc7-rgba-unorm"
|
|
54469
54514
|
},
|
|
54470
|
-
bc4: { basisFormat: 4, compressed: true },
|
|
54471
|
-
bc5: { basisFormat: 5, compressed: true },
|
|
54472
|
-
"bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
|
|
54473
|
-
"bc7-m5": { basisFormat: 7, compressed: true },
|
|
54474
54515
|
"pvrtc1-4-rgb": {
|
|
54475
54516
|
basisFormat: 8,
|
|
54476
54517
|
compressed: true,
|
|
54477
|
-
format:
|
|
54518
|
+
format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
54519
|
+
textureFormat: "pvrtc-rgb4unorm-webgl"
|
|
54478
54520
|
},
|
|
54479
54521
|
"pvrtc1-4-rgba": {
|
|
54480
54522
|
basisFormat: 9,
|
|
54481
54523
|
compressed: true,
|
|
54482
|
-
format:
|
|
54524
|
+
format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
54525
|
+
textureFormat: "pvrtc-rgba4unorm-webgl"
|
|
54483
54526
|
},
|
|
54484
54527
|
"astc-4x4": {
|
|
54485
54528
|
basisFormat: 10,
|
|
54486
54529
|
compressed: true,
|
|
54487
|
-
format:
|
|
54530
|
+
format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
54531
|
+
textureFormat: "astc-4x4-unorm"
|
|
54532
|
+
},
|
|
54533
|
+
"atc-rgb": {
|
|
54534
|
+
basisFormat: 11,
|
|
54535
|
+
compressed: true,
|
|
54536
|
+
format: GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
54537
|
+
textureFormat: "atc-rgb-unorm-webgl"
|
|
54538
|
+
},
|
|
54539
|
+
"atc-rgba-interpolated-alpha": {
|
|
54540
|
+
basisFormat: 12,
|
|
54541
|
+
compressed: true,
|
|
54542
|
+
format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
54543
|
+
textureFormat: "atc-rgbai-unorm-webgl"
|
|
54544
|
+
},
|
|
54545
|
+
rgba32: {
|
|
54546
|
+
basisFormat: 13,
|
|
54547
|
+
compressed: false,
|
|
54548
|
+
format: GL_RGBA8,
|
|
54549
|
+
textureFormat: "rgba8unorm"
|
|
54550
|
+
},
|
|
54551
|
+
rgb565: {
|
|
54552
|
+
basisFormat: 14,
|
|
54553
|
+
compressed: false,
|
|
54554
|
+
format: GL_RGB565,
|
|
54555
|
+
textureFormat: "rgb565unorm-webgl"
|
|
54556
|
+
},
|
|
54557
|
+
bgr565: {
|
|
54558
|
+
basisFormat: 15,
|
|
54559
|
+
compressed: false,
|
|
54560
|
+
format: GL_RGB565,
|
|
54561
|
+
textureFormat: "rgb565unorm-webgl"
|
|
54488
54562
|
},
|
|
54489
|
-
|
|
54490
|
-
|
|
54491
|
-
|
|
54492
|
-
|
|
54493
|
-
|
|
54494
|
-
|
|
54563
|
+
rgba4444: {
|
|
54564
|
+
basisFormat: 16,
|
|
54565
|
+
compressed: false,
|
|
54566
|
+
format: GL_RGBA4,
|
|
54567
|
+
textureFormat: "rgba4unorm-webgl"
|
|
54568
|
+
}
|
|
54495
54569
|
};
|
|
54570
|
+
var BASIS_FORMATS = Object.freeze(
|
|
54571
|
+
Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
|
|
54572
|
+
);
|
|
54496
54573
|
async function parseBasis(data, options = {}) {
|
|
54497
54574
|
var _a;
|
|
54498
54575
|
if (!((_a = options.basis) == null ? void 0 : _a.containerFormat) || options.basis.containerFormat === "auto") {
|
|
@@ -54547,7 +54624,7 @@ function transcodeImage(basisFile, imageIndex, levelIndex, options) {
|
|
|
54547
54624
|
const hasAlpha = basisFile.getHasAlpha(
|
|
54548
54625
|
/* imageIndex, levelIndex */
|
|
54549
54626
|
);
|
|
54550
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
|
|
54627
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
|
|
54551
54628
|
const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
|
|
54552
54629
|
const decodedData = new Uint8Array(decodedSize);
|
|
54553
54630
|
if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
|
|
@@ -54555,11 +54632,13 @@ function transcodeImage(basisFile, imageIndex, levelIndex, options) {
|
|
|
54555
54632
|
}
|
|
54556
54633
|
return {
|
|
54557
54634
|
// standard loaders.gl image category payload
|
|
54635
|
+
shape: "texture-level",
|
|
54558
54636
|
width,
|
|
54559
54637
|
height,
|
|
54560
54638
|
data: decodedData,
|
|
54561
54639
|
compressed,
|
|
54562
|
-
format,
|
|
54640
|
+
...format !== void 0 ? { format } : {},
|
|
54641
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
54563
54642
|
// Additional fields
|
|
54564
54643
|
// Add levelSize field.
|
|
54565
54644
|
hasAlpha
|
|
@@ -54584,7 +54663,7 @@ function parseKTX2File(KTX2File, data, options) {
|
|
|
54584
54663
|
}
|
|
54585
54664
|
function transcodeKTX2Image(ktx2File, levelIndex, options) {
|
|
54586
54665
|
const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
|
|
54587
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
|
|
54666
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
|
|
54588
54667
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
|
|
54589
54668
|
levelIndex,
|
|
54590
54669
|
0,
|
|
@@ -54607,49 +54686,99 @@ function transcodeKTX2Image(ktx2File, levelIndex, options) {
|
|
|
54607
54686
|
}
|
|
54608
54687
|
return {
|
|
54609
54688
|
// standard loaders.gl image category payload
|
|
54689
|
+
shape: "texture-level",
|
|
54610
54690
|
width,
|
|
54611
54691
|
height,
|
|
54612
54692
|
data: decodedData,
|
|
54613
54693
|
compressed,
|
|
54694
|
+
...format !== void 0 ? { format } : {},
|
|
54695
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
54614
54696
|
// Additional fields
|
|
54615
54697
|
levelSize: decodedSize,
|
|
54616
|
-
hasAlpha: alphaFlag
|
|
54617
|
-
format
|
|
54698
|
+
hasAlpha: alphaFlag
|
|
54618
54699
|
};
|
|
54619
54700
|
}
|
|
54620
54701
|
function getBasisOptions(options, hasAlpha) {
|
|
54621
|
-
var _a;
|
|
54622
|
-
let format = (_a = options.basis) == null ? void 0 : _a.format;
|
|
54702
|
+
var _a, _b;
|
|
54703
|
+
let format = ((_a = options.basis) == null ? void 0 : _a.format) || "auto";
|
|
54623
54704
|
if (format === "auto") {
|
|
54624
|
-
format = selectSupportedBasisFormat();
|
|
54705
|
+
format = ((_b = options.basis) == null ? void 0 : _b.supportedTextureFormats) ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
|
|
54625
54706
|
}
|
|
54626
54707
|
if (typeof format === "object") {
|
|
54627
54708
|
format = hasAlpha ? format.alpha : format.noAlpha;
|
|
54628
54709
|
}
|
|
54629
|
-
|
|
54630
|
-
|
|
54710
|
+
const normalizedFormat = format.toLowerCase();
|
|
54711
|
+
const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
|
|
54712
|
+
if (!basisOutputOptions) {
|
|
54713
|
+
throw new Error(`Unknown Basis format ${format}`);
|
|
54714
|
+
}
|
|
54715
|
+
return basisOutputOptions;
|
|
54631
54716
|
}
|
|
54632
|
-
function selectSupportedBasisFormat() {
|
|
54633
|
-
const
|
|
54634
|
-
if (
|
|
54717
|
+
function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
|
|
54718
|
+
const textureFormats2 = new Set(supportedTextureFormats);
|
|
54719
|
+
if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
|
|
54635
54720
|
return "astc-4x4";
|
|
54636
|
-
} else if (
|
|
54721
|
+
} else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
|
|
54722
|
+
return {
|
|
54723
|
+
alpha: "bc7-m5",
|
|
54724
|
+
noAlpha: "bc7-m6-opaque-only"
|
|
54725
|
+
};
|
|
54726
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
54727
|
+
"bc1-rgb-unorm-webgl",
|
|
54728
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
54729
|
+
"bc1-rgba-unorm",
|
|
54730
|
+
"bc1-rgba-unorm-srgb",
|
|
54731
|
+
"bc2-rgba-unorm",
|
|
54732
|
+
"bc2-rgba-unorm-srgb",
|
|
54733
|
+
"bc3-rgba-unorm",
|
|
54734
|
+
"bc3-rgba-unorm-srgb"
|
|
54735
|
+
])) {
|
|
54637
54736
|
return {
|
|
54638
54737
|
alpha: "bc3",
|
|
54639
54738
|
noAlpha: "bc1"
|
|
54640
54739
|
};
|
|
54641
|
-
} else if (
|
|
54740
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
54741
|
+
"pvrtc-rgb4unorm-webgl",
|
|
54742
|
+
"pvrtc-rgba4unorm-webgl",
|
|
54743
|
+
"pvrtc-rbg2unorm-webgl",
|
|
54744
|
+
"pvrtc-rgba2unorm-webgl"
|
|
54745
|
+
])) {
|
|
54642
54746
|
return {
|
|
54643
54747
|
alpha: "pvrtc1-4-rgba",
|
|
54644
54748
|
noAlpha: "pvrtc1-4-rgb"
|
|
54645
54749
|
};
|
|
54646
|
-
} else if (
|
|
54647
|
-
|
|
54648
|
-
|
|
54750
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
54751
|
+
"etc2-rgb8unorm",
|
|
54752
|
+
"etc2-rgb8unorm-srgb",
|
|
54753
|
+
"etc2-rgb8a1unorm",
|
|
54754
|
+
"etc2-rgb8a1unorm-srgb",
|
|
54755
|
+
"etc2-rgba8unorm",
|
|
54756
|
+
"etc2-rgba8unorm-srgb",
|
|
54757
|
+
"eac-r11unorm",
|
|
54758
|
+
"eac-r11snorm",
|
|
54759
|
+
"eac-rg11unorm",
|
|
54760
|
+
"eac-rg11snorm"
|
|
54761
|
+
])) {
|
|
54649
54762
|
return "etc2";
|
|
54763
|
+
} else if (textureFormats2.has("etc1-rbg-unorm-webgl")) {
|
|
54764
|
+
return "etc1";
|
|
54765
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
54766
|
+
"atc-rgb-unorm-webgl",
|
|
54767
|
+
"atc-rgba-unorm-webgl",
|
|
54768
|
+
"atc-rgbai-unorm-webgl"
|
|
54769
|
+
])) {
|
|
54770
|
+
return {
|
|
54771
|
+
alpha: "atc-rgba-interpolated-alpha",
|
|
54772
|
+
noAlpha: "atc-rgb"
|
|
54773
|
+
};
|
|
54650
54774
|
}
|
|
54651
54775
|
return "rgb565";
|
|
54652
54776
|
}
|
|
54777
|
+
function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
|
|
54778
|
+
return candidateTextureFormats.some(
|
|
54779
|
+
(textureFormat) => supportedTextureFormats.has(textureFormat)
|
|
54780
|
+
);
|
|
54781
|
+
}
|
|
54653
54782
|
|
|
54654
54783
|
// src/basis-loader.ts
|
|
54655
54784
|
var BasisWorkerLoader = {
|