@loaders.gl/3d-tiles 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/dist/3d-tiles-archive-loader.js +1 -1
- package/dist/dist.dev.js +251 -123
- package/dist/dist.min.js +1 -1
- package/dist/index.cjs +2 -2
- package/dist/lib/utils/version.js +1 -1
- package/package.json +11 -11
|
@@ -5,7 +5,7 @@ import { DataViewReadableFile } from '@loaders.gl/zip';
|
|
|
5
5
|
import { parse3DTilesArchive as parse3DTilesArchiveFromProvider } from "./3d-tiles-archive/3d-tiles-archive-parser.js";
|
|
6
6
|
// __VERSION__ is injected by babel-plugin-version-inline
|
|
7
7
|
// @ts-ignore TS2304: Cannot find name '__VERSION__'.
|
|
8
|
-
const VERSION = typeof "4.4.0-alpha.
|
|
8
|
+
const VERSION = typeof "4.4.0-alpha.17" !== 'undefined' ? "4.4.0-alpha.17" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Loader for 3tz packages
|
|
11
11
|
*/
|
package/dist/dist.dev.js
CHANGED
|
@@ -15236,104 +15236,117 @@ var __exports__ = (() => {
|
|
|
15236
15236
|
}
|
|
15237
15237
|
|
|
15238
15238
|
// ../textures/src/lib/gl-extensions.ts
|
|
15239
|
-
var
|
|
15240
|
-
|
|
15241
|
-
|
|
15242
|
-
|
|
15243
|
-
|
|
15244
|
-
|
|
15245
|
-
|
|
15246
|
-
|
|
15247
|
-
|
|
15248
|
-
|
|
15249
|
-
|
|
15250
|
-
|
|
15251
|
-
|
|
15252
|
-
|
|
15253
|
-
|
|
15254
|
-
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
|
|
15255
|
-
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
|
|
15256
|
-
// WEBGL_compressed_texture_pvrtc
|
|
15257
|
-
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
|
|
15258
|
-
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
|
|
15259
|
-
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
|
|
15260
|
-
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
|
|
15261
|
-
// WEBGL_compressed_texture_etc1
|
|
15262
|
-
COMPRESSED_RGB_ETC1_WEBGL: 36196,
|
|
15263
|
-
// WEBGL_compressed_texture_atc
|
|
15264
|
-
COMPRESSED_RGB_ATC_WEBGL: 35986,
|
|
15265
|
-
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
|
|
15266
|
-
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
|
|
15267
|
-
// WEBGL_compressed_texture_astc
|
|
15268
|
-
COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
|
|
15269
|
-
COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
|
|
15270
|
-
COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
|
|
15271
|
-
COMPRESSED_RGBA_ASTC_6X5_KHR: 37811,
|
|
15272
|
-
COMPRESSED_RGBA_ASTC_6X6_KHR: 37812,
|
|
15273
|
-
COMPRESSED_RGBA_ASTC_8X5_KHR: 37813,
|
|
15274
|
-
COMPRESSED_RGBA_ASTC_8X6_KHR: 37814,
|
|
15275
|
-
COMPRESSED_RGBA_ASTC_8X8_KHR: 37815,
|
|
15276
|
-
COMPRESSED_RGBA_ASTC_10X5_KHR: 37816,
|
|
15277
|
-
COMPRESSED_RGBA_ASTC_10X6_KHR: 37817,
|
|
15278
|
-
COMPRESSED_RGBA_ASTC_10X8_KHR: 37818,
|
|
15279
|
-
COMPRESSED_RGBA_ASTC_10X10_KHR: 37819,
|
|
15280
|
-
COMPRESSED_RGBA_ASTC_12X10_KHR: 37820,
|
|
15281
|
-
COMPRESSED_RGBA_ASTC_12X12_KHR: 37821,
|
|
15282
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_4X4_KHR: 37840,
|
|
15283
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_5X4_KHR: 37841,
|
|
15284
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_5X5_KHR: 37842,
|
|
15285
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_6X5_KHR: 37843,
|
|
15286
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_6X6_KHR: 37844,
|
|
15287
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X5_KHR: 37845,
|
|
15288
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X6_KHR: 37846,
|
|
15289
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_8X8_KHR: 37847,
|
|
15290
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X5_KHR: 37848,
|
|
15291
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X6_KHR: 37849,
|
|
15292
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X8_KHR: 37850,
|
|
15293
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
|
|
15294
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
|
|
15295
|
-
COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
|
|
15296
|
-
// EXT_texture_compression_rgtc
|
|
15297
|
-
COMPRESSED_RED_RGTC1_EXT: 36283,
|
|
15298
|
-
COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
|
|
15299
|
-
COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
|
|
15300
|
-
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
|
|
15301
|
-
// WEBGL_compressed_texture_s3tc_srgb
|
|
15302
|
-
COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
|
|
15303
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
|
|
15304
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
|
|
15305
|
-
COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT: 35919
|
|
15306
|
-
};
|
|
15239
|
+
var GL_RGBA4 = 32854;
|
|
15240
|
+
var GL_RGBA8 = 32856;
|
|
15241
|
+
var GL_RGB565 = 36194;
|
|
15242
|
+
var GL_COMPRESSED_RGB_S3TC_DXT1_EXT = 33776;
|
|
15243
|
+
var GL_COMPRESSED_RGBA_S3TC_DXT5_EXT = 33779;
|
|
15244
|
+
var GL_COMPRESSED_RGBA8_ETC2_EAC = 37493;
|
|
15245
|
+
var GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG = 35840;
|
|
15246
|
+
var GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG = 35842;
|
|
15247
|
+
var GL_COMPRESSED_RGB_ETC1_WEBGL = 36196;
|
|
15248
|
+
var GL_COMPRESSED_RGB_ATC_WEBGL = 35986;
|
|
15249
|
+
var GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 34798;
|
|
15250
|
+
var GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 37808;
|
|
15251
|
+
var GL_COMPRESSED_RED_RGTC1_EXT = 36283;
|
|
15252
|
+
var GL_COMPRESSED_RED_GREEN_RGTC2_EXT = 36285;
|
|
15253
|
+
var GL_COMPRESSED_RGBA_BPTC_UNORM_EXT = 36492;
|
|
15307
15254
|
|
|
15308
|
-
// ../textures/src/lib/utils/texture-formats.ts
|
|
15255
|
+
// ../textures/src/lib/utils/detect-supported-texture-formats.ts
|
|
15309
15256
|
var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
|
|
15310
|
-
var
|
|
15257
|
+
var WEBGL_TEXTURE_FORMATS = {
|
|
15311
15258
|
/* eslint-disable camelcase */
|
|
15312
|
-
WEBGL_compressed_texture_s3tc:
|
|
15313
|
-
|
|
15314
|
-
|
|
15315
|
-
|
|
15316
|
-
|
|
15317
|
-
|
|
15318
|
-
|
|
15319
|
-
|
|
15259
|
+
WEBGL_compressed_texture_s3tc: [
|
|
15260
|
+
"bc1-rgb-unorm-webgl",
|
|
15261
|
+
"bc1-rgba-unorm",
|
|
15262
|
+
"bc2-rgba-unorm",
|
|
15263
|
+
"bc3-rgba-unorm"
|
|
15264
|
+
],
|
|
15265
|
+
WEBGL_compressed_texture_s3tc_srgb: [
|
|
15266
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
15267
|
+
"bc1-rgba-unorm-srgb",
|
|
15268
|
+
"bc2-rgba-unorm-srgb",
|
|
15269
|
+
"bc3-rgba-unorm-srgb"
|
|
15270
|
+
],
|
|
15271
|
+
EXT_texture_compression_rgtc: ["bc4-r-unorm", "bc4-r-snorm", "bc5-rg-unorm", "bc5-rg-snorm"],
|
|
15272
|
+
EXT_texture_compression_bptc: [
|
|
15273
|
+
"bc6h-rgb-ufloat",
|
|
15274
|
+
"bc6h-rgb-float",
|
|
15275
|
+
"bc7-rgba-unorm",
|
|
15276
|
+
"bc7-rgba-unorm-srgb"
|
|
15277
|
+
],
|
|
15278
|
+
WEBGL_compressed_texture_etc1: ["etc1-rbg-unorm-webgl"],
|
|
15279
|
+
WEBGL_compressed_texture_etc: [
|
|
15280
|
+
"etc2-rgb8unorm",
|
|
15281
|
+
"etc2-rgb8unorm-srgb",
|
|
15282
|
+
"etc2-rgb8a1unorm",
|
|
15283
|
+
"etc2-rgb8a1unorm-srgb",
|
|
15284
|
+
"etc2-rgba8unorm",
|
|
15285
|
+
"etc2-rgba8unorm-srgb",
|
|
15286
|
+
"eac-r11unorm",
|
|
15287
|
+
"eac-r11snorm",
|
|
15288
|
+
"eac-rg11unorm",
|
|
15289
|
+
"eac-rg11snorm"
|
|
15290
|
+
],
|
|
15291
|
+
WEBGL_compressed_texture_pvrtc: [
|
|
15292
|
+
"pvrtc-rgb4unorm-webgl",
|
|
15293
|
+
"pvrtc-rgba4unorm-webgl",
|
|
15294
|
+
"pvrtc-rbg2unorm-webgl",
|
|
15295
|
+
"pvrtc-rgba2unorm-webgl"
|
|
15296
|
+
],
|
|
15297
|
+
WEBGL_compressed_texture_atc: [
|
|
15298
|
+
"atc-rgb-unorm-webgl",
|
|
15299
|
+
"atc-rgba-unorm-webgl",
|
|
15300
|
+
"atc-rgbai-unorm-webgl"
|
|
15301
|
+
],
|
|
15302
|
+
WEBGL_compressed_texture_astc: [
|
|
15303
|
+
"astc-4x4-unorm",
|
|
15304
|
+
"astc-4x4-unorm-srgb",
|
|
15305
|
+
"astc-5x4-unorm",
|
|
15306
|
+
"astc-5x4-unorm-srgb",
|
|
15307
|
+
"astc-5x5-unorm",
|
|
15308
|
+
"astc-5x5-unorm-srgb",
|
|
15309
|
+
"astc-6x5-unorm",
|
|
15310
|
+
"astc-6x5-unorm-srgb",
|
|
15311
|
+
"astc-6x6-unorm",
|
|
15312
|
+
"astc-6x6-unorm-srgb",
|
|
15313
|
+
"astc-8x5-unorm",
|
|
15314
|
+
"astc-8x5-unorm-srgb",
|
|
15315
|
+
"astc-8x6-unorm",
|
|
15316
|
+
"astc-8x6-unorm-srgb",
|
|
15317
|
+
"astc-8x8-unorm",
|
|
15318
|
+
"astc-8x8-unorm-srgb",
|
|
15319
|
+
"astc-10x5-unorm",
|
|
15320
|
+
"astc-10x5-unorm-srgb",
|
|
15321
|
+
"astc-10x6-unorm",
|
|
15322
|
+
"astc-10x6-unorm-srgb",
|
|
15323
|
+
"astc-10x8-unorm",
|
|
15324
|
+
"astc-10x8-unorm-srgb",
|
|
15325
|
+
"astc-10x10-unorm",
|
|
15326
|
+
"astc-10x10-unorm-srgb",
|
|
15327
|
+
"astc-12x10-unorm",
|
|
15328
|
+
"astc-12x10-unorm-srgb",
|
|
15329
|
+
"astc-12x12-unorm",
|
|
15330
|
+
"astc-12x12-unorm-srgb"
|
|
15331
|
+
]
|
|
15320
15332
|
/* eslint-enable camelcase */
|
|
15321
15333
|
};
|
|
15322
|
-
var
|
|
15323
|
-
function
|
|
15324
|
-
if (!
|
|
15334
|
+
var textureFormats = null;
|
|
15335
|
+
function detectSupportedTextureFormats(gl) {
|
|
15336
|
+
if (!textureFormats) {
|
|
15325
15337
|
gl = gl || getWebGLContext() || void 0;
|
|
15326
|
-
|
|
15338
|
+
textureFormats = /* @__PURE__ */ new Set();
|
|
15327
15339
|
for (const prefix of BROWSER_PREFIXES) {
|
|
15328
|
-
for (const extension in
|
|
15340
|
+
for (const extension in WEBGL_TEXTURE_FORMATS) {
|
|
15329
15341
|
if (gl && gl.getExtension(`${prefix}${extension}`)) {
|
|
15330
|
-
const
|
|
15331
|
-
|
|
15342
|
+
for (const textureFormat of WEBGL_TEXTURE_FORMATS[extension]) {
|
|
15343
|
+
textureFormats.add(textureFormat);
|
|
15344
|
+
}
|
|
15332
15345
|
}
|
|
15333
15346
|
}
|
|
15334
15347
|
}
|
|
15335
15348
|
}
|
|
15336
|
-
return
|
|
15349
|
+
return textureFormats;
|
|
15337
15350
|
}
|
|
15338
15351
|
function getWebGLContext() {
|
|
15339
15352
|
try {
|
|
@@ -15378,49 +15391,113 @@ var __exports__ = (() => {
|
|
|
15378
15391
|
}
|
|
15379
15392
|
|
|
15380
15393
|
// ../textures/src/lib/parsers/parse-basis.ts
|
|
15381
|
-
var
|
|
15394
|
+
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
15382
15395
|
etc1: {
|
|
15383
15396
|
basisFormat: 0,
|
|
15384
15397
|
compressed: true,
|
|
15385
|
-
format:
|
|
15398
|
+
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
15399
|
+
textureFormat: "etc1-rbg-unorm-webgl"
|
|
15400
|
+
},
|
|
15401
|
+
etc2: {
|
|
15402
|
+
basisFormat: 1,
|
|
15403
|
+
compressed: true,
|
|
15404
|
+
format: GL_COMPRESSED_RGBA8_ETC2_EAC,
|
|
15405
|
+
textureFormat: "etc2-rgba8unorm"
|
|
15386
15406
|
},
|
|
15387
|
-
etc2: { basisFormat: 1, compressed: true },
|
|
15388
15407
|
bc1: {
|
|
15389
15408
|
basisFormat: 2,
|
|
15390
15409
|
compressed: true,
|
|
15391
|
-
format:
|
|
15410
|
+
format: GL_COMPRESSED_RGB_S3TC_DXT1_EXT,
|
|
15411
|
+
textureFormat: "bc1-rgb-unorm-webgl"
|
|
15392
15412
|
},
|
|
15393
15413
|
bc3: {
|
|
15394
15414
|
basisFormat: 3,
|
|
15395
15415
|
compressed: true,
|
|
15396
|
-
format:
|
|
15416
|
+
format: GL_COMPRESSED_RGBA_S3TC_DXT5_EXT,
|
|
15417
|
+
textureFormat: "bc3-rgba-unorm"
|
|
15418
|
+
},
|
|
15419
|
+
bc4: {
|
|
15420
|
+
basisFormat: 4,
|
|
15421
|
+
compressed: true,
|
|
15422
|
+
format: GL_COMPRESSED_RED_RGTC1_EXT,
|
|
15423
|
+
textureFormat: "bc4-r-unorm"
|
|
15424
|
+
},
|
|
15425
|
+
bc5: {
|
|
15426
|
+
basisFormat: 5,
|
|
15427
|
+
compressed: true,
|
|
15428
|
+
format: GL_COMPRESSED_RED_GREEN_RGTC2_EXT,
|
|
15429
|
+
textureFormat: "bc5-rg-unorm"
|
|
15430
|
+
},
|
|
15431
|
+
"bc7-m6-opaque-only": {
|
|
15432
|
+
basisFormat: 6,
|
|
15433
|
+
compressed: true,
|
|
15434
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
15435
|
+
textureFormat: "bc7-rgba-unorm"
|
|
15436
|
+
},
|
|
15437
|
+
"bc7-m5": {
|
|
15438
|
+
basisFormat: 7,
|
|
15439
|
+
compressed: true,
|
|
15440
|
+
format: GL_COMPRESSED_RGBA_BPTC_UNORM_EXT,
|
|
15441
|
+
textureFormat: "bc7-rgba-unorm"
|
|
15397
15442
|
},
|
|
15398
|
-
bc4: { basisFormat: 4, compressed: true },
|
|
15399
|
-
bc5: { basisFormat: 5, compressed: true },
|
|
15400
|
-
"bc7-m6-opaque-only": { basisFormat: 6, compressed: true },
|
|
15401
|
-
"bc7-m5": { basisFormat: 7, compressed: true },
|
|
15402
15443
|
"pvrtc1-4-rgb": {
|
|
15403
15444
|
basisFormat: 8,
|
|
15404
15445
|
compressed: true,
|
|
15405
|
-
format:
|
|
15446
|
+
format: GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG,
|
|
15447
|
+
textureFormat: "pvrtc-rgb4unorm-webgl"
|
|
15406
15448
|
},
|
|
15407
15449
|
"pvrtc1-4-rgba": {
|
|
15408
15450
|
basisFormat: 9,
|
|
15409
15451
|
compressed: true,
|
|
15410
|
-
format:
|
|
15452
|
+
format: GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG,
|
|
15453
|
+
textureFormat: "pvrtc-rgba4unorm-webgl"
|
|
15411
15454
|
},
|
|
15412
15455
|
"astc-4x4": {
|
|
15413
15456
|
basisFormat: 10,
|
|
15414
15457
|
compressed: true,
|
|
15415
|
-
format:
|
|
15458
|
+
format: GL_COMPRESSED_RGBA_ASTC_4x4_KHR,
|
|
15459
|
+
textureFormat: "astc-4x4-unorm"
|
|
15416
15460
|
},
|
|
15417
|
-
"atc-rgb": {
|
|
15418
|
-
|
|
15419
|
-
|
|
15420
|
-
|
|
15421
|
-
|
|
15422
|
-
|
|
15461
|
+
"atc-rgb": {
|
|
15462
|
+
basisFormat: 11,
|
|
15463
|
+
compressed: true,
|
|
15464
|
+
format: GL_COMPRESSED_RGB_ATC_WEBGL,
|
|
15465
|
+
textureFormat: "atc-rgb-unorm-webgl"
|
|
15466
|
+
},
|
|
15467
|
+
"atc-rgba-interpolated-alpha": {
|
|
15468
|
+
basisFormat: 12,
|
|
15469
|
+
compressed: true,
|
|
15470
|
+
format: GL_COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL,
|
|
15471
|
+
textureFormat: "atc-rgbai-unorm-webgl"
|
|
15472
|
+
},
|
|
15473
|
+
rgba32: {
|
|
15474
|
+
basisFormat: 13,
|
|
15475
|
+
compressed: false,
|
|
15476
|
+
format: GL_RGBA8,
|
|
15477
|
+
textureFormat: "rgba8unorm"
|
|
15478
|
+
},
|
|
15479
|
+
rgb565: {
|
|
15480
|
+
basisFormat: 14,
|
|
15481
|
+
compressed: false,
|
|
15482
|
+
format: GL_RGB565,
|
|
15483
|
+
textureFormat: "rgb565unorm-webgl"
|
|
15484
|
+
},
|
|
15485
|
+
bgr565: {
|
|
15486
|
+
basisFormat: 15,
|
|
15487
|
+
compressed: false,
|
|
15488
|
+
format: GL_RGB565,
|
|
15489
|
+
textureFormat: "rgb565unorm-webgl"
|
|
15490
|
+
},
|
|
15491
|
+
rgba4444: {
|
|
15492
|
+
basisFormat: 16,
|
|
15493
|
+
compressed: false,
|
|
15494
|
+
format: GL_RGBA4,
|
|
15495
|
+
textureFormat: "rgba4unorm-webgl"
|
|
15496
|
+
}
|
|
15423
15497
|
};
|
|
15498
|
+
var BASIS_FORMATS = Object.freeze(
|
|
15499
|
+
Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
|
|
15500
|
+
);
|
|
15424
15501
|
async function parseBasis(data, options = {}) {
|
|
15425
15502
|
if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
|
|
15426
15503
|
if (isKTX(data)) {
|
|
@@ -15474,7 +15551,7 @@ var __exports__ = (() => {
|
|
|
15474
15551
|
const hasAlpha = basisFile.getHasAlpha(
|
|
15475
15552
|
/* imageIndex, levelIndex */
|
|
15476
15553
|
);
|
|
15477
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, hasAlpha);
|
|
15554
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, hasAlpha);
|
|
15478
15555
|
const decodedSize = basisFile.getImageTranscodedSizeInBytes(imageIndex, levelIndex, basisFormat);
|
|
15479
15556
|
const decodedData = new Uint8Array(decodedSize);
|
|
15480
15557
|
if (!basisFile.transcodeImage(decodedData, imageIndex, levelIndex, basisFormat, 0, 0)) {
|
|
@@ -15482,11 +15559,13 @@ var __exports__ = (() => {
|
|
|
15482
15559
|
}
|
|
15483
15560
|
return {
|
|
15484
15561
|
// standard loaders.gl image category payload
|
|
15562
|
+
shape: "texture-level",
|
|
15485
15563
|
width,
|
|
15486
15564
|
height,
|
|
15487
15565
|
data: decodedData,
|
|
15488
15566
|
compressed,
|
|
15489
|
-
format,
|
|
15567
|
+
...format !== void 0 ? { format } : {},
|
|
15568
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
15490
15569
|
// Additional fields
|
|
15491
15570
|
// Add levelSize field.
|
|
15492
15571
|
hasAlpha
|
|
@@ -15511,7 +15590,7 @@ var __exports__ = (() => {
|
|
|
15511
15590
|
}
|
|
15512
15591
|
function transcodeKTX2Image(ktx2File, levelIndex, options) {
|
|
15513
15592
|
const { alphaFlag, height, width } = ktx2File.getImageLevelInfo(levelIndex, 0, 0);
|
|
15514
|
-
const { compressed, format, basisFormat } = getBasisOptions(options, alphaFlag);
|
|
15593
|
+
const { compressed, format, basisFormat, textureFormat } = getBasisOptions(options, alphaFlag);
|
|
15515
15594
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(
|
|
15516
15595
|
levelIndex,
|
|
15517
15596
|
0,
|
|
@@ -15534,48 +15613,98 @@ var __exports__ = (() => {
|
|
|
15534
15613
|
}
|
|
15535
15614
|
return {
|
|
15536
15615
|
// standard loaders.gl image category payload
|
|
15616
|
+
shape: "texture-level",
|
|
15537
15617
|
width,
|
|
15538
15618
|
height,
|
|
15539
15619
|
data: decodedData,
|
|
15540
15620
|
compressed,
|
|
15621
|
+
...format !== void 0 ? { format } : {},
|
|
15622
|
+
...textureFormat !== void 0 ? { textureFormat } : {},
|
|
15541
15623
|
// Additional fields
|
|
15542
15624
|
levelSize: decodedSize,
|
|
15543
|
-
hasAlpha: alphaFlag
|
|
15544
|
-
format
|
|
15625
|
+
hasAlpha: alphaFlag
|
|
15545
15626
|
};
|
|
15546
15627
|
}
|
|
15547
15628
|
function getBasisOptions(options, hasAlpha) {
|
|
15548
|
-
let format = options.basis?.format;
|
|
15629
|
+
let format = options.basis?.format || "auto";
|
|
15549
15630
|
if (format === "auto") {
|
|
15550
|
-
format = selectSupportedBasisFormat();
|
|
15631
|
+
format = options.basis?.supportedTextureFormats ? selectSupportedBasisFormat(options.basis.supportedTextureFormats) : selectSupportedBasisFormat();
|
|
15551
15632
|
}
|
|
15552
15633
|
if (typeof format === "object") {
|
|
15553
15634
|
format = hasAlpha ? format.alpha : format.noAlpha;
|
|
15554
15635
|
}
|
|
15555
|
-
|
|
15556
|
-
|
|
15636
|
+
const normalizedFormat = format.toLowerCase();
|
|
15637
|
+
const basisOutputOptions = BASIS_FORMAT_TO_OUTPUT_OPTIONS[normalizedFormat];
|
|
15638
|
+
if (!basisOutputOptions) {
|
|
15639
|
+
throw new Error(`Unknown Basis format ${format}`);
|
|
15640
|
+
}
|
|
15641
|
+
return basisOutputOptions;
|
|
15557
15642
|
}
|
|
15558
|
-
function selectSupportedBasisFormat() {
|
|
15559
|
-
const
|
|
15560
|
-
if (
|
|
15643
|
+
function selectSupportedBasisFormat(supportedTextureFormats = detectSupportedTextureFormats()) {
|
|
15644
|
+
const textureFormats2 = new Set(supportedTextureFormats);
|
|
15645
|
+
if (hasSupportedTextureFormat(textureFormats2, ["astc-4x4-unorm", "astc-4x4-unorm-srgb"])) {
|
|
15561
15646
|
return "astc-4x4";
|
|
15562
|
-
} else if (
|
|
15647
|
+
} else if (hasSupportedTextureFormat(textureFormats2, ["bc7-rgba-unorm", "bc7-rgba-unorm-srgb"])) {
|
|
15648
|
+
return {
|
|
15649
|
+
alpha: "bc7-m5",
|
|
15650
|
+
noAlpha: "bc7-m6-opaque-only"
|
|
15651
|
+
};
|
|
15652
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15653
|
+
"bc1-rgb-unorm-webgl",
|
|
15654
|
+
"bc1-rgb-unorm-srgb-webgl",
|
|
15655
|
+
"bc1-rgba-unorm",
|
|
15656
|
+
"bc1-rgba-unorm-srgb",
|
|
15657
|
+
"bc2-rgba-unorm",
|
|
15658
|
+
"bc2-rgba-unorm-srgb",
|
|
15659
|
+
"bc3-rgba-unorm",
|
|
15660
|
+
"bc3-rgba-unorm-srgb"
|
|
15661
|
+
])) {
|
|
15563
15662
|
return {
|
|
15564
15663
|
alpha: "bc3",
|
|
15565
15664
|
noAlpha: "bc1"
|
|
15566
15665
|
};
|
|
15567
|
-
} else if (
|
|
15666
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15667
|
+
"pvrtc-rgb4unorm-webgl",
|
|
15668
|
+
"pvrtc-rgba4unorm-webgl",
|
|
15669
|
+
"pvrtc-rbg2unorm-webgl",
|
|
15670
|
+
"pvrtc-rgba2unorm-webgl"
|
|
15671
|
+
])) {
|
|
15568
15672
|
return {
|
|
15569
15673
|
alpha: "pvrtc1-4-rgba",
|
|
15570
15674
|
noAlpha: "pvrtc1-4-rgb"
|
|
15571
15675
|
};
|
|
15572
|
-
} else if (
|
|
15573
|
-
|
|
15574
|
-
|
|
15676
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15677
|
+
"etc2-rgb8unorm",
|
|
15678
|
+
"etc2-rgb8unorm-srgb",
|
|
15679
|
+
"etc2-rgb8a1unorm",
|
|
15680
|
+
"etc2-rgb8a1unorm-srgb",
|
|
15681
|
+
"etc2-rgba8unorm",
|
|
15682
|
+
"etc2-rgba8unorm-srgb",
|
|
15683
|
+
"eac-r11unorm",
|
|
15684
|
+
"eac-r11snorm",
|
|
15685
|
+
"eac-rg11unorm",
|
|
15686
|
+
"eac-rg11snorm"
|
|
15687
|
+
])) {
|
|
15575
15688
|
return "etc2";
|
|
15689
|
+
} else if (textureFormats2.has("etc1-rbg-unorm-webgl")) {
|
|
15690
|
+
return "etc1";
|
|
15691
|
+
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15692
|
+
"atc-rgb-unorm-webgl",
|
|
15693
|
+
"atc-rgba-unorm-webgl",
|
|
15694
|
+
"atc-rgbai-unorm-webgl"
|
|
15695
|
+
])) {
|
|
15696
|
+
return {
|
|
15697
|
+
alpha: "atc-rgba-interpolated-alpha",
|
|
15698
|
+
noAlpha: "atc-rgb"
|
|
15699
|
+
};
|
|
15576
15700
|
}
|
|
15577
15701
|
return "rgb565";
|
|
15578
15702
|
}
|
|
15703
|
+
function hasSupportedTextureFormat(supportedTextureFormats, candidateTextureFormats) {
|
|
15704
|
+
return candidateTextureFormats.some(
|
|
15705
|
+
(textureFormat) => supportedTextureFormats.has(textureFormat)
|
|
15706
|
+
);
|
|
15707
|
+
}
|
|
15579
15708
|
|
|
15580
15709
|
// ../textures/src/basis-loader.ts
|
|
15581
15710
|
var BasisWorkerLoader = {
|
|
@@ -16904,8 +17033,7 @@ var __exports__ = (() => {
|
|
|
16904
17033
|
const strictOptions = options;
|
|
16905
17034
|
const gltfOptions = {
|
|
16906
17035
|
...strictOptions,
|
|
16907
|
-
core: { ...strictOptions?.core, mimeType: image.mimeType }
|
|
16908
|
-
basis: strictOptions.basis || { format: selectSupportedBasisFormat() }
|
|
17036
|
+
core: { ...strictOptions?.core, mimeType: image.mimeType }
|
|
16909
17037
|
};
|
|
16910
17038
|
let parsedImage = await parseFromContext(
|
|
16911
17039
|
arrayBuffer,
|