@loaders.gl/3d-tiles 4.4.0-alpha.18 → 4.4.0-alpha.19
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 +59 -33
- 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.19" !== 'undefined' ? "4.4.0-alpha.19" : 'latest';
|
|
9
9
|
/**
|
|
10
10
|
* Loader for 3tz packages
|
|
11
11
|
*/
|
package/dist/dist.dev.js
CHANGED
|
@@ -15284,7 +15284,7 @@ var __exports__ = (() => {
|
|
|
15284
15284
|
"bc7-rgba-unorm",
|
|
15285
15285
|
"bc7-rgba-unorm-srgb"
|
|
15286
15286
|
],
|
|
15287
|
-
WEBGL_compressed_texture_etc1: ["etc1-
|
|
15287
|
+
WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
|
|
15288
15288
|
WEBGL_compressed_texture_etc: [
|
|
15289
15289
|
"etc2-rgb8unorm",
|
|
15290
15290
|
"etc2-rgb8unorm-srgb",
|
|
@@ -15300,7 +15300,7 @@ var __exports__ = (() => {
|
|
|
15300
15300
|
WEBGL_compressed_texture_pvrtc: [
|
|
15301
15301
|
"pvrtc-rgb4unorm-webgl",
|
|
15302
15302
|
"pvrtc-rgba4unorm-webgl",
|
|
15303
|
-
"pvrtc-
|
|
15303
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15304
15304
|
"pvrtc-rgba2unorm-webgl"
|
|
15305
15305
|
],
|
|
15306
15306
|
WEBGL_compressed_texture_atc: [
|
|
@@ -15400,12 +15400,13 @@ var __exports__ = (() => {
|
|
|
15400
15400
|
}
|
|
15401
15401
|
|
|
15402
15402
|
// ../textures/src/lib/parsers/parse-basis.ts
|
|
15403
|
+
var basisTranscodingLock = Promise.resolve();
|
|
15403
15404
|
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
15404
15405
|
etc1: {
|
|
15405
15406
|
basisFormat: 0,
|
|
15406
15407
|
compressed: true,
|
|
15407
15408
|
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
15408
|
-
textureFormat: "etc1-
|
|
15409
|
+
textureFormat: "etc1-rgb-unorm-webgl"
|
|
15409
15410
|
},
|
|
15410
15411
|
etc2: {
|
|
15411
15412
|
basisFormat: 1,
|
|
@@ -15507,31 +15508,46 @@ var __exports__ = (() => {
|
|
|
15507
15508
|
var BASIS_FORMATS = Object.freeze(
|
|
15508
15509
|
Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
|
|
15509
15510
|
);
|
|
15511
|
+
async function withBasisTranscodingLock(transcode) {
|
|
15512
|
+
const previousLock = basisTranscodingLock;
|
|
15513
|
+
let releaseLock;
|
|
15514
|
+
basisTranscodingLock = new Promise((resolve2) => {
|
|
15515
|
+
releaseLock = resolve2;
|
|
15516
|
+
});
|
|
15517
|
+
await previousLock;
|
|
15518
|
+
try {
|
|
15519
|
+
return await transcode();
|
|
15520
|
+
} finally {
|
|
15521
|
+
releaseLock();
|
|
15522
|
+
}
|
|
15523
|
+
}
|
|
15510
15524
|
async function parseBasis(data, options = {}) {
|
|
15511
15525
|
const loadLibraryOptions = extractLoadLibraryOptions(options);
|
|
15512
|
-
|
|
15513
|
-
if (
|
|
15514
|
-
|
|
15515
|
-
|
|
15516
|
-
|
|
15517
|
-
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15518
|
-
return parseBasisFile(BasisFile, data, options);
|
|
15519
|
-
}
|
|
15520
|
-
switch (options.basis.module) {
|
|
15521
|
-
case "encoder":
|
|
15522
|
-
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15523
|
-
switch (options.basis.containerFormat) {
|
|
15524
|
-
case "ktx2":
|
|
15525
|
-
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15526
|
-
case "basis":
|
|
15527
|
-
default:
|
|
15528
|
-
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15526
|
+
return await withBasisTranscodingLock(async () => {
|
|
15527
|
+
if (!options.basis?.containerFormat || options.basis.containerFormat === "auto") {
|
|
15528
|
+
if (isKTX(data)) {
|
|
15529
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15530
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15529
15531
|
}
|
|
15530
|
-
case "transcoder":
|
|
15531
|
-
default:
|
|
15532
15532
|
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15533
15533
|
return parseBasisFile(BasisFile, data, options);
|
|
15534
|
-
|
|
15534
|
+
}
|
|
15535
|
+
switch (options.basis.module) {
|
|
15536
|
+
case "encoder":
|
|
15537
|
+
const fileConstructors = await loadBasisEncoderModule(loadLibraryOptions);
|
|
15538
|
+
switch (options.basis.containerFormat) {
|
|
15539
|
+
case "ktx2":
|
|
15540
|
+
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15541
|
+
case "basis":
|
|
15542
|
+
default:
|
|
15543
|
+
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15544
|
+
}
|
|
15545
|
+
case "transcoder":
|
|
15546
|
+
default:
|
|
15547
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15548
|
+
return parseBasisFile(BasisFile, data, options);
|
|
15549
|
+
}
|
|
15550
|
+
});
|
|
15535
15551
|
}
|
|
15536
15552
|
function parseBasisFile(BasisFile, data, options) {
|
|
15537
15553
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
@@ -15676,7 +15692,7 @@ var __exports__ = (() => {
|
|
|
15676
15692
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15677
15693
|
"pvrtc-rgb4unorm-webgl",
|
|
15678
15694
|
"pvrtc-rgba4unorm-webgl",
|
|
15679
|
-
"pvrtc-
|
|
15695
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15680
15696
|
"pvrtc-rgba2unorm-webgl"
|
|
15681
15697
|
])) {
|
|
15682
15698
|
return {
|
|
@@ -15696,7 +15712,7 @@ var __exports__ = (() => {
|
|
|
15696
15712
|
"eac-rg11snorm"
|
|
15697
15713
|
])) {
|
|
15698
15714
|
return "etc2";
|
|
15699
|
-
} else if (textureFormats2.has("etc1-
|
|
15715
|
+
} else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
|
|
15700
15716
|
return "etc1";
|
|
15701
15717
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15702
15718
|
"atc-rgb-unorm-webgl",
|
|
@@ -15853,16 +15869,26 @@ var __exports__ = (() => {
|
|
|
15853
15869
|
}
|
|
15854
15870
|
|
|
15855
15871
|
// ../gltf/src/lib/gltf-utils/resolve-url.ts
|
|
15856
|
-
function resolveUrl(url, options) {
|
|
15872
|
+
function resolveUrl(url, options, context) {
|
|
15857
15873
|
const absolute = url.startsWith("data:") || url.startsWith("http:") || url.startsWith("https:");
|
|
15858
15874
|
if (absolute) {
|
|
15859
15875
|
return url;
|
|
15860
15876
|
}
|
|
15861
|
-
const baseUrl =
|
|
15877
|
+
const baseUrl = context?.baseUrl || getResolveBaseUrl(options?.core?.baseUrl);
|
|
15862
15878
|
if (!baseUrl) {
|
|
15863
|
-
throw new Error(`'
|
|
15879
|
+
throw new Error(`'baseUrl' must be provided to resolve relative url ${url}`);
|
|
15880
|
+
}
|
|
15881
|
+
return baseUrl.endsWith("/") ? `${baseUrl}${url}` : `${baseUrl}/${url}`;
|
|
15882
|
+
}
|
|
15883
|
+
function getResolveBaseUrl(baseUrl) {
|
|
15884
|
+
if (!baseUrl) {
|
|
15885
|
+
return void 0;
|
|
15886
|
+
}
|
|
15887
|
+
if (baseUrl.endsWith("/")) {
|
|
15888
|
+
return baseUrl;
|
|
15864
15889
|
}
|
|
15865
|
-
|
|
15890
|
+
const slashIndex = baseUrl.lastIndexOf("/");
|
|
15891
|
+
return slashIndex >= 0 ? baseUrl.slice(0, slashIndex + 1) : "";
|
|
15866
15892
|
}
|
|
15867
15893
|
|
|
15868
15894
|
// ../gltf/src/lib/extensions/EXT_meshopt_compression.ts
|
|
@@ -16948,8 +16974,8 @@ var __exports__ = (() => {
|
|
|
16948
16974
|
return gltf;
|
|
16949
16975
|
}
|
|
16950
16976
|
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
16951
|
-
if (options.core?.
|
|
16952
|
-
gltf.baseUri = options.core?.
|
|
16977
|
+
if (options.core?.baseUrl) {
|
|
16978
|
+
gltf.baseUri = options.core?.baseUrl;
|
|
16953
16979
|
}
|
|
16954
16980
|
if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options.glb)) {
|
|
16955
16981
|
const textDecoder = new TextDecoder();
|
|
@@ -16986,7 +17012,7 @@ var __exports__ = (() => {
|
|
|
16986
17012
|
if (buffer.uri) {
|
|
16987
17013
|
const { fetch: fetch2 } = context;
|
|
16988
17014
|
assert7(fetch2);
|
|
16989
|
-
const uri = resolveUrl(buffer.uri, options);
|
|
17015
|
+
const uri = resolveUrl(buffer.uri, options, context);
|
|
16990
17016
|
const response = await context?.fetch?.(uri);
|
|
16991
17017
|
const arrayBuffer = await response?.arrayBuffer?.();
|
|
16992
17018
|
gltf.buffers[i] = {
|
|
@@ -17026,7 +17052,7 @@ var __exports__ = (() => {
|
|
|
17026
17052
|
async function loadImage(gltf, image, index, options, context) {
|
|
17027
17053
|
let arrayBuffer;
|
|
17028
17054
|
if (image.uri && !image.hasOwnProperty("bufferView")) {
|
|
17029
|
-
const uri = resolveUrl(image.uri, options);
|
|
17055
|
+
const uri = resolveUrl(image.uri, options, context);
|
|
17030
17056
|
const { fetch: fetch2 } = context;
|
|
17031
17057
|
const response = await fetch2(uri);
|
|
17032
17058
|
arrayBuffer = await response.arrayBuffer();
|