@loaders.gl/3d-tiles 4.4.0-alpha.17 → 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 +73 -38
- 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
|
@@ -4885,6 +4885,16 @@ var __exports__ = (() => {
|
|
|
4885
4885
|
|
|
4886
4886
|
// ../worker-utils/src/lib/library-utils/library-utils.ts
|
|
4887
4887
|
var loadLibraryPromises = {};
|
|
4888
|
+
function extractLoadLibraryOptions(options = {}) {
|
|
4889
|
+
const useLocalLibraries = options.useLocalLibraries ?? options.core?.useLocalLibraries;
|
|
4890
|
+
const CDN = options.CDN ?? options.core?.CDN;
|
|
4891
|
+
const modules = options.modules;
|
|
4892
|
+
return {
|
|
4893
|
+
...useLocalLibraries !== void 0 ? { useLocalLibraries } : {},
|
|
4894
|
+
...CDN !== void 0 ? { CDN } : {},
|
|
4895
|
+
...modules !== void 0 ? { modules } : {}
|
|
4896
|
+
};
|
|
4897
|
+
}
|
|
4888
4898
|
async function loadLibrary(libraryUrl, moduleName = null, options = {}, libraryName = null) {
|
|
4889
4899
|
if (moduleName) {
|
|
4890
4900
|
libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
|
|
@@ -11657,7 +11667,6 @@ var __exports__ = (() => {
|
|
|
11657
11667
|
draco: {
|
|
11658
11668
|
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
11659
11669
|
// 'js' for IE11
|
|
11660
|
-
libraryPath: "libs/",
|
|
11661
11670
|
extraAttributes: {},
|
|
11662
11671
|
attributeNameEntry: void 0
|
|
11663
11672
|
}
|
|
@@ -11669,7 +11678,7 @@ var __exports__ = (() => {
|
|
|
11669
11678
|
};
|
|
11670
11679
|
async function parse(arrayBuffer, options) {
|
|
11671
11680
|
const { draco } = await loadDracoDecoderModule(
|
|
11672
|
-
options
|
|
11681
|
+
extractLoadLibraryOptions(options),
|
|
11673
11682
|
options?.draco?.decoderType || "wasm"
|
|
11674
11683
|
);
|
|
11675
11684
|
const dracoParser = new DracoParser(draco);
|
|
@@ -15275,7 +15284,7 @@ var __exports__ = (() => {
|
|
|
15275
15284
|
"bc7-rgba-unorm",
|
|
15276
15285
|
"bc7-rgba-unorm-srgb"
|
|
15277
15286
|
],
|
|
15278
|
-
WEBGL_compressed_texture_etc1: ["etc1-
|
|
15287
|
+
WEBGL_compressed_texture_etc1: ["etc1-rgb-unorm-webgl"],
|
|
15279
15288
|
WEBGL_compressed_texture_etc: [
|
|
15280
15289
|
"etc2-rgb8unorm",
|
|
15281
15290
|
"etc2-rgb8unorm-srgb",
|
|
@@ -15291,7 +15300,7 @@ var __exports__ = (() => {
|
|
|
15291
15300
|
WEBGL_compressed_texture_pvrtc: [
|
|
15292
15301
|
"pvrtc-rgb4unorm-webgl",
|
|
15293
15302
|
"pvrtc-rgba4unorm-webgl",
|
|
15294
|
-
"pvrtc-
|
|
15303
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15295
15304
|
"pvrtc-rgba2unorm-webgl"
|
|
15296
15305
|
],
|
|
15297
15306
|
WEBGL_compressed_texture_atc: [
|
|
@@ -15391,12 +15400,13 @@ var __exports__ = (() => {
|
|
|
15391
15400
|
}
|
|
15392
15401
|
|
|
15393
15402
|
// ../textures/src/lib/parsers/parse-basis.ts
|
|
15403
|
+
var basisTranscodingLock = Promise.resolve();
|
|
15394
15404
|
var BASIS_FORMAT_TO_OUTPUT_OPTIONS = {
|
|
15395
15405
|
etc1: {
|
|
15396
15406
|
basisFormat: 0,
|
|
15397
15407
|
compressed: true,
|
|
15398
15408
|
format: GL_COMPRESSED_RGB_ETC1_WEBGL,
|
|
15399
|
-
textureFormat: "etc1-
|
|
15409
|
+
textureFormat: "etc1-rgb-unorm-webgl"
|
|
15400
15410
|
},
|
|
15401
15411
|
etc2: {
|
|
15402
15412
|
basisFormat: 1,
|
|
@@ -15498,30 +15508,46 @@ var __exports__ = (() => {
|
|
|
15498
15508
|
var BASIS_FORMATS = Object.freeze(
|
|
15499
15509
|
Object.keys(BASIS_FORMAT_TO_OUTPUT_OPTIONS)
|
|
15500
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
|
+
}
|
|
15501
15524
|
async function parseBasis(data, options = {}) {
|
|
15502
|
-
|
|
15503
|
-
|
|
15504
|
-
|
|
15505
|
-
|
|
15506
|
-
|
|
15507
|
-
|
|
15508
|
-
|
|
15509
|
-
|
|
15510
|
-
switch (options.basis.module) {
|
|
15511
|
-
case "encoder":
|
|
15512
|
-
const fileConstructors = await loadBasisEncoderModule(options?.core || {});
|
|
15513
|
-
switch (options.basis.containerFormat) {
|
|
15514
|
-
case "ktx2":
|
|
15515
|
-
return parseKTX2File(fileConstructors.KTX2File, data, options);
|
|
15516
|
-
case "basis":
|
|
15517
|
-
default:
|
|
15518
|
-
return parseBasisFile(fileConstructors.BasisFile, data, options);
|
|
15519
|
-
}
|
|
15520
|
-
case "transcoder":
|
|
15521
|
-
default:
|
|
15522
|
-
const { BasisFile } = await loadBasisTranscoderModule(options.core || {});
|
|
15525
|
+
const loadLibraryOptions = extractLoadLibraryOptions(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);
|
|
15531
|
+
}
|
|
15532
|
+
const { BasisFile } = await loadBasisTranscoderModule(loadLibraryOptions);
|
|
15523
15533
|
return parseBasisFile(BasisFile, data, options);
|
|
15524
|
-
|
|
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
|
+
});
|
|
15525
15551
|
}
|
|
15526
15552
|
function parseBasisFile(BasisFile, data, options) {
|
|
15527
15553
|
const basisFile = new BasisFile(new Uint8Array(data));
|
|
@@ -15666,7 +15692,7 @@ var __exports__ = (() => {
|
|
|
15666
15692
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15667
15693
|
"pvrtc-rgb4unorm-webgl",
|
|
15668
15694
|
"pvrtc-rgba4unorm-webgl",
|
|
15669
|
-
"pvrtc-
|
|
15695
|
+
"pvrtc-rgb2unorm-webgl",
|
|
15670
15696
|
"pvrtc-rgba2unorm-webgl"
|
|
15671
15697
|
])) {
|
|
15672
15698
|
return {
|
|
@@ -15686,7 +15712,7 @@ var __exports__ = (() => {
|
|
|
15686
15712
|
"eac-rg11snorm"
|
|
15687
15713
|
])) {
|
|
15688
15714
|
return "etc2";
|
|
15689
|
-
} else if (textureFormats2.has("etc1-
|
|
15715
|
+
} else if (textureFormats2.has("etc1-rgb-unorm-webgl")) {
|
|
15690
15716
|
return "etc1";
|
|
15691
15717
|
} else if (hasSupportedTextureFormat(textureFormats2, [
|
|
15692
15718
|
"atc-rgb-unorm-webgl",
|
|
@@ -15722,7 +15748,6 @@ var __exports__ = (() => {
|
|
|
15722
15748
|
options: {
|
|
15723
15749
|
basis: {
|
|
15724
15750
|
format: "auto",
|
|
15725
|
-
libraryPath: "libs/",
|
|
15726
15751
|
containerFormat: "auto",
|
|
15727
15752
|
module: "transcoder"
|
|
15728
15753
|
}
|
|
@@ -15844,16 +15869,26 @@ var __exports__ = (() => {
|
|
|
15844
15869
|
}
|
|
15845
15870
|
|
|
15846
15871
|
// ../gltf/src/lib/gltf-utils/resolve-url.ts
|
|
15847
|
-
function resolveUrl(url, options) {
|
|
15872
|
+
function resolveUrl(url, options, context) {
|
|
15848
15873
|
const absolute = url.startsWith("data:") || url.startsWith("http:") || url.startsWith("https:");
|
|
15849
15874
|
if (absolute) {
|
|
15850
15875
|
return url;
|
|
15851
15876
|
}
|
|
15852
|
-
const baseUrl =
|
|
15877
|
+
const baseUrl = context?.baseUrl || getResolveBaseUrl(options?.core?.baseUrl);
|
|
15853
15878
|
if (!baseUrl) {
|
|
15854
|
-
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;
|
|
15855
15889
|
}
|
|
15856
|
-
|
|
15890
|
+
const slashIndex = baseUrl.lastIndexOf("/");
|
|
15891
|
+
return slashIndex >= 0 ? baseUrl.slice(0, slashIndex + 1) : "";
|
|
15857
15892
|
}
|
|
15858
15893
|
|
|
15859
15894
|
// ../gltf/src/lib/extensions/EXT_meshopt_compression.ts
|
|
@@ -16939,8 +16974,8 @@ var __exports__ = (() => {
|
|
|
16939
16974
|
return gltf;
|
|
16940
16975
|
}
|
|
16941
16976
|
function parseGLTFContainerSync(gltf, data, byteOffset, options) {
|
|
16942
|
-
if (options.core?.
|
|
16943
|
-
gltf.baseUri = options.core?.
|
|
16977
|
+
if (options.core?.baseUrl) {
|
|
16978
|
+
gltf.baseUri = options.core?.baseUrl;
|
|
16944
16979
|
}
|
|
16945
16980
|
if (data instanceof ArrayBuffer && !isGLB(data, byteOffset, options.glb)) {
|
|
16946
16981
|
const textDecoder = new TextDecoder();
|
|
@@ -16977,7 +17012,7 @@ var __exports__ = (() => {
|
|
|
16977
17012
|
if (buffer.uri) {
|
|
16978
17013
|
const { fetch: fetch2 } = context;
|
|
16979
17014
|
assert7(fetch2);
|
|
16980
|
-
const uri = resolveUrl(buffer.uri, options);
|
|
17015
|
+
const uri = resolveUrl(buffer.uri, options, context);
|
|
16981
17016
|
const response = await context?.fetch?.(uri);
|
|
16982
17017
|
const arrayBuffer = await response?.arrayBuffer?.();
|
|
16983
17018
|
gltf.buffers[i] = {
|
|
@@ -17017,7 +17052,7 @@ var __exports__ = (() => {
|
|
|
17017
17052
|
async function loadImage(gltf, image, index, options, context) {
|
|
17018
17053
|
let arrayBuffer;
|
|
17019
17054
|
if (image.uri && !image.hasOwnProperty("bufferView")) {
|
|
17020
|
-
const uri = resolveUrl(image.uri, options);
|
|
17055
|
+
const uri = resolveUrl(image.uri, options, context);
|
|
17021
17056
|
const { fetch: fetch2 } = context;
|
|
17022
17057
|
const response = await fetch2(uri);
|
|
17023
17058
|
arrayBuffer = await response.arrayBuffer();
|