@loaders.gl/3d-tiles 4.0.0-beta.3 → 4.0.0-beta.5
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/dist.dev.js +31 -704
- package/package.json +9 -9
package/dist/dist.dev.js
CHANGED
|
@@ -4297,10 +4297,7 @@ var __exports__ = (() => {
|
|
|
4297
4297
|
var window_ = globals.window || globals.self || globals.global || {};
|
|
4298
4298
|
var global_ = globals.global || globals.self || globals.window || {};
|
|
4299
4299
|
var document_ = globals.document || {};
|
|
4300
|
-
var isBrowser = (
|
|
4301
|
-
// @ts-ignore process does not exist on browser
|
|
4302
|
-
Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser)
|
|
4303
|
-
);
|
|
4300
|
+
var isBrowser = Boolean(typeof process !== "object" || String(process) !== "[object process]" || process.browser);
|
|
4304
4301
|
var matches = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
4305
4302
|
var nodeVersion = matches && parseFloat(matches[1]) || 0;
|
|
4306
4303
|
|
|
@@ -4338,10 +4335,7 @@ var __exports__ = (() => {
|
|
|
4338
4335
|
var window_2 = globals2.window || globals2.self || globals2.global || {};
|
|
4339
4336
|
var global_2 = globals2.global || globals2.self || globals2.window || {};
|
|
4340
4337
|
var document_2 = globals2.document || {};
|
|
4341
|
-
var isBrowser2 = (
|
|
4342
|
-
// @ts-ignore process.browser
|
|
4343
|
-
typeof process !== "object" || String(process) !== "[object process]" || process.browser
|
|
4344
|
-
);
|
|
4338
|
+
var isBrowser2 = typeof process !== "object" || String(process) !== "[object process]" || process.browser;
|
|
4345
4339
|
var isWorker = typeof importScripts === "function";
|
|
4346
4340
|
var isMobile = typeof window !== "undefined" && typeof window.orientation !== "undefined";
|
|
4347
4341
|
var matches2 = typeof process !== "undefined" && process.version && /v([0-9]*)/.exec(process.version);
|
|
@@ -4354,8 +4348,7 @@ var __exports__ = (() => {
|
|
|
4354
4348
|
if (moduleName) {
|
|
4355
4349
|
libraryUrl = getLibraryUrl(libraryUrl, moduleName, options, libraryName);
|
|
4356
4350
|
}
|
|
4357
|
-
loadLibraryPromises[libraryUrl] =
|
|
4358
|
-
loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
|
|
4351
|
+
loadLibraryPromises[libraryUrl] = loadLibraryPromises[libraryUrl] || loadLibraryFromFile(libraryUrl);
|
|
4359
4352
|
return await loadLibraryPromises[libraryUrl];
|
|
4360
4353
|
}
|
|
4361
4354
|
function getLibraryUrl(library, moduleName, options = {}, libraryName = null) {
|
|
@@ -4402,7 +4395,7 @@ var __exports__ = (() => {
|
|
|
4402
4395
|
return void 0 && (void 0)(scriptSource, id);
|
|
4403
4396
|
}
|
|
4404
4397
|
if (isWorker) {
|
|
4405
|
-
eval.call(
|
|
4398
|
+
eval.call(globalThis, scriptSource);
|
|
4406
4399
|
return null;
|
|
4407
4400
|
}
|
|
4408
4401
|
const script = document.createElement("script");
|
|
@@ -4813,19 +4806,15 @@ var __exports__ = (() => {
|
|
|
4813
4806
|
}
|
|
4814
4807
|
throw new Error("Can't instantiate NodeFile. Make sure to import @loaders.gl/polyfills first.");
|
|
4815
4808
|
}
|
|
4816
|
-
/** Read data */
|
|
4817
4809
|
async read(start, end) {
|
|
4818
4810
|
throw NOT_IMPLEMENTED;
|
|
4819
4811
|
}
|
|
4820
|
-
/** Write to file. The number of bytes written will be returned */
|
|
4821
4812
|
async write(arrayBuffer, offset, length4) {
|
|
4822
4813
|
throw NOT_IMPLEMENTED;
|
|
4823
4814
|
}
|
|
4824
|
-
/** Get information about file */
|
|
4825
4815
|
async stat() {
|
|
4826
4816
|
throw NOT_IMPLEMENTED;
|
|
4827
4817
|
}
|
|
4828
|
-
/** Close the file */
|
|
4829
4818
|
async close() {
|
|
4830
4819
|
}
|
|
4831
4820
|
};
|
|
@@ -4837,21 +4826,13 @@ var __exports__ = (() => {
|
|
|
4837
4826
|
|
|
4838
4827
|
// ../loader-utils/src/lib/file-provider/file-handle-file.ts
|
|
4839
4828
|
var FileHandleFile = class {
|
|
4840
|
-
/** The FileHandle from which data is provided */
|
|
4841
|
-
/** The file length in bytes */
|
|
4842
|
-
/** Create a new FileHandleFile */
|
|
4843
4829
|
constructor(path) {
|
|
4844
4830
|
this.file = new NodeFileFacade(path, "r");
|
|
4845
4831
|
this.size = this.file.bigsize;
|
|
4846
4832
|
}
|
|
4847
|
-
/** Close file */
|
|
4848
4833
|
async destroy() {
|
|
4849
4834
|
await this.file.close();
|
|
4850
4835
|
}
|
|
4851
|
-
/**
|
|
4852
|
-
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
4853
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4854
|
-
*/
|
|
4855
4836
|
async getUint8(offset) {
|
|
4856
4837
|
const arrayBuffer = await this.file.read(offset, 1);
|
|
4857
4838
|
const val = new Uint8Array(arrayBuffer).at(0);
|
|
@@ -4860,10 +4841,6 @@ var __exports__ = (() => {
|
|
|
4860
4841
|
}
|
|
4861
4842
|
return val;
|
|
4862
4843
|
}
|
|
4863
|
-
/**
|
|
4864
|
-
* Gets an unsigned 16-bit integer at the specified byte offset from the start of the file.
|
|
4865
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4866
|
-
*/
|
|
4867
4844
|
async getUint16(offset) {
|
|
4868
4845
|
const arrayBuffer = await this.file.read(offset, 2);
|
|
4869
4846
|
const val = new Uint16Array(arrayBuffer).at(0);
|
|
@@ -4872,10 +4849,6 @@ var __exports__ = (() => {
|
|
|
4872
4849
|
}
|
|
4873
4850
|
return val;
|
|
4874
4851
|
}
|
|
4875
|
-
/**
|
|
4876
|
-
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
4877
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4878
|
-
*/
|
|
4879
4852
|
async getUint32(offset) {
|
|
4880
4853
|
const arrayBuffer = await this.file.read(offset, 4);
|
|
4881
4854
|
const val = new Uint32Array(arrayBuffer).at(0);
|
|
@@ -4884,10 +4857,6 @@ var __exports__ = (() => {
|
|
|
4884
4857
|
}
|
|
4885
4858
|
return val;
|
|
4886
4859
|
}
|
|
4887
|
-
/**
|
|
4888
|
-
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
4889
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4890
|
-
*/
|
|
4891
4860
|
async getBigUint64(offset) {
|
|
4892
4861
|
const arrayBuffer = await this.file.read(offset, 8);
|
|
4893
4862
|
const val = new BigInt64Array(arrayBuffer).at(0);
|
|
@@ -4896,11 +4865,6 @@ var __exports__ = (() => {
|
|
|
4896
4865
|
}
|
|
4897
4866
|
return val;
|
|
4898
4867
|
}
|
|
4899
|
-
/**
|
|
4900
|
-
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
4901
|
-
* @param startOffset The offset, in byte, from the start of the file where to start reading the data.
|
|
4902
|
-
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
4903
|
-
*/
|
|
4904
4868
|
async slice(startOffset, endOffset) {
|
|
4905
4869
|
const bigLength = endOffset - startOffset;
|
|
4906
4870
|
if (bigLength > Number.MAX_SAFE_INTEGER) {
|
|
@@ -4909,9 +4873,6 @@ var __exports__ = (() => {
|
|
|
4909
4873
|
const length4 = Number(bigLength);
|
|
4910
4874
|
return await this.file.read(startOffset, length4);
|
|
4911
4875
|
}
|
|
4912
|
-
/**
|
|
4913
|
-
* the length (in bytes) of the data.
|
|
4914
|
-
*/
|
|
4915
4876
|
get length() {
|
|
4916
4877
|
return this.size;
|
|
4917
4878
|
}
|
|
@@ -4925,49 +4886,26 @@ var __exports__ = (() => {
|
|
|
4925
4886
|
return Number(bigint);
|
|
4926
4887
|
};
|
|
4927
4888
|
var DataViewFile = class {
|
|
4928
|
-
/** The DataView from which data is provided */
|
|
4929
4889
|
constructor(file) {
|
|
4930
4890
|
this.file = file;
|
|
4931
4891
|
}
|
|
4932
4892
|
async destroy() {
|
|
4933
4893
|
}
|
|
4934
|
-
/**
|
|
4935
|
-
* Gets an unsigned 8-bit integer at the specified byte offset from the start of the file.
|
|
4936
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4937
|
-
*/
|
|
4938
4894
|
async getUint8(offset) {
|
|
4939
4895
|
return this.file.getUint8(toNumber(offset));
|
|
4940
4896
|
}
|
|
4941
|
-
/**
|
|
4942
|
-
* Gets an unsigned 16-bit intege at the specified byte offset from the start of the file.
|
|
4943
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4944
|
-
*/
|
|
4945
4897
|
async getUint16(offset) {
|
|
4946
4898
|
return this.file.getUint16(toNumber(offset), true);
|
|
4947
4899
|
}
|
|
4948
|
-
/**
|
|
4949
|
-
* Gets an unsigned 32-bit integer at the specified byte offset from the start of the file.
|
|
4950
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4951
|
-
*/
|
|
4952
4900
|
async getUint32(offset) {
|
|
4953
4901
|
return this.file.getUint32(toNumber(offset), true);
|
|
4954
4902
|
}
|
|
4955
|
-
/**
|
|
4956
|
-
* Gets an unsigned 64-bit integer at the specified byte offset from the start of the file.
|
|
4957
|
-
* @param offset The offset, in bytes, from the start of the file where to read the data.
|
|
4958
|
-
*/
|
|
4959
4903
|
async getBigUint64(offset) {
|
|
4960
4904
|
return this.file.getBigUint64(toNumber(offset), true);
|
|
4961
4905
|
}
|
|
4962
|
-
/**
|
|
4963
|
-
* returns an ArrayBuffer whose contents are a copy of this file bytes from startOffset, inclusive, up to endOffset, exclusive.
|
|
4964
|
-
* @param startOffset The offset, in bytes, from the start of the file where to start reading the data.
|
|
4965
|
-
* @param endOffset The offset, in bytes, from the start of the file where to end reading the data.
|
|
4966
|
-
*/
|
|
4967
4906
|
async slice(startOffset, endOffset) {
|
|
4968
4907
|
return this.file.buffer.slice(toNumber(startOffset), toNumber(endOffset));
|
|
4969
4908
|
}
|
|
4970
|
-
/** the length (in bytes) of the data. */
|
|
4971
4909
|
get length() {
|
|
4972
4910
|
return BigInt(this.file.byteLength);
|
|
4973
4911
|
}
|
|
@@ -10111,24 +10049,24 @@ var __exports__ = (() => {
|
|
|
10111
10049
|
}
|
|
10112
10050
|
|
|
10113
10051
|
// ../tiles/src/constants.ts
|
|
10114
|
-
var TILE_REFINEMENT =
|
|
10052
|
+
var TILE_REFINEMENT = function(TILE_REFINEMENT2) {
|
|
10115
10053
|
TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
|
|
10116
10054
|
TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
|
|
10117
10055
|
return TILE_REFINEMENT2;
|
|
10118
10056
|
}({});
|
|
10119
|
-
var TILE_TYPE =
|
|
10057
|
+
var TILE_TYPE = function(TILE_TYPE2) {
|
|
10120
10058
|
TILE_TYPE2["EMPTY"] = "empty";
|
|
10121
10059
|
TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
|
|
10122
10060
|
TILE_TYPE2["POINTCLOUD"] = "pointcloud";
|
|
10123
10061
|
TILE_TYPE2["MESH"] = "mesh";
|
|
10124
10062
|
return TILE_TYPE2;
|
|
10125
10063
|
}({});
|
|
10126
|
-
var TILESET_TYPE =
|
|
10064
|
+
var TILESET_TYPE = function(TILESET_TYPE2) {
|
|
10127
10065
|
TILESET_TYPE2["I3S"] = "I3S";
|
|
10128
10066
|
TILESET_TYPE2["TILES3D"] = "TILES3D";
|
|
10129
10067
|
return TILESET_TYPE2;
|
|
10130
10068
|
}({});
|
|
10131
|
-
var LOD_METRIC_TYPE =
|
|
10069
|
+
var LOD_METRIC_TYPE = function(LOD_METRIC_TYPE2) {
|
|
10132
10070
|
LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
|
|
10133
10071
|
LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
|
|
10134
10072
|
return LOD_METRIC_TYPE2;
|
|
@@ -10175,7 +10113,6 @@ var __exports__ = (() => {
|
|
|
10175
10113
|
var DEFAULT_DRACO_OPTIONS = {
|
|
10176
10114
|
draco: {
|
|
10177
10115
|
decoderType: typeof WebAssembly === "object" ? "wasm" : "js",
|
|
10178
|
-
// 'js' for IE11
|
|
10179
10116
|
libraryPath: "libs/",
|
|
10180
10117
|
extraAttributes: {},
|
|
10181
10118
|
attributeNameEntry: void 0
|
|
@@ -10185,7 +10122,6 @@ var __exports__ = (() => {
|
|
|
10185
10122
|
name: "Draco",
|
|
10186
10123
|
id: "draco",
|
|
10187
10124
|
module: "draco",
|
|
10188
|
-
// shapes: ['mesh'],
|
|
10189
10125
|
version: VERSION3,
|
|
10190
10126
|
worker: true,
|
|
10191
10127
|
extensions: ["drc"],
|
|
@@ -10335,24 +10271,15 @@ var __exports__ = (() => {
|
|
|
10335
10271
|
};
|
|
10336
10272
|
var INDEX_ITEM_SIZE = 4;
|
|
10337
10273
|
var DracoParser = class {
|
|
10338
|
-
// draco - the draco decoder, either import `draco3d` or load dynamically
|
|
10339
10274
|
constructor(draco) {
|
|
10340
10275
|
this.draco = draco;
|
|
10341
10276
|
this.decoder = new this.draco.Decoder();
|
|
10342
10277
|
this.metadataQuerier = new this.draco.MetadataQuerier();
|
|
10343
10278
|
}
|
|
10344
|
-
/**
|
|
10345
|
-
* Destroy draco resources
|
|
10346
|
-
*/
|
|
10347
10279
|
destroy() {
|
|
10348
10280
|
this.draco.destroy(this.decoder);
|
|
10349
10281
|
this.draco.destroy(this.metadataQuerier);
|
|
10350
10282
|
}
|
|
10351
|
-
/**
|
|
10352
|
-
* NOTE: caller must call `destroyGeometry` on the return value after using it
|
|
10353
|
-
* @param arrayBuffer
|
|
10354
|
-
* @param options
|
|
10355
|
-
*/
|
|
10356
10283
|
parseSync(arrayBuffer, options = {}) {
|
|
10357
10284
|
const buffer = new this.draco.DecoderBuffer();
|
|
10358
10285
|
buffer.Init(new Int8Array(arrayBuffer), arrayBuffer.byteLength);
|
|
@@ -10397,14 +10324,6 @@ var __exports__ = (() => {
|
|
|
10397
10324
|
}
|
|
10398
10325
|
}
|
|
10399
10326
|
}
|
|
10400
|
-
// Draco specific "loader data"
|
|
10401
|
-
/**
|
|
10402
|
-
* Extract
|
|
10403
|
-
* @param dracoGeometry
|
|
10404
|
-
* @param geometry_type
|
|
10405
|
-
* @param options
|
|
10406
|
-
* @returns
|
|
10407
|
-
*/
|
|
10408
10327
|
_getDracoLoaderData(dracoGeometry, geometry_type, options) {
|
|
10409
10328
|
const metadata = this._getTopLevelMetadata(dracoGeometry);
|
|
10410
10329
|
const attributes = this._getDracoAttributes(dracoGeometry, options);
|
|
@@ -10417,12 +10336,6 @@ var __exports__ = (() => {
|
|
|
10417
10336
|
attributes
|
|
10418
10337
|
};
|
|
10419
10338
|
}
|
|
10420
|
-
/**
|
|
10421
|
-
* Extract all draco provided information and metadata for each attribute
|
|
10422
|
-
* @param dracoGeometry
|
|
10423
|
-
* @param options
|
|
10424
|
-
* @returns
|
|
10425
|
-
*/
|
|
10426
10339
|
_getDracoAttributes(dracoGeometry, options) {
|
|
10427
10340
|
const dracoAttributes = {};
|
|
10428
10341
|
for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
|
|
@@ -10450,12 +10363,6 @@ var __exports__ = (() => {
|
|
|
10450
10363
|
}
|
|
10451
10364
|
return dracoAttributes;
|
|
10452
10365
|
}
|
|
10453
|
-
/**
|
|
10454
|
-
* Get standard loaders.gl mesh category data
|
|
10455
|
-
* Extracts the geometry from draco
|
|
10456
|
-
* @param dracoGeometry
|
|
10457
|
-
* @param options
|
|
10458
|
-
*/
|
|
10459
10366
|
_getMeshData(dracoGeometry, loaderData, options) {
|
|
10460
10367
|
const attributes = this._getMeshAttributes(loaderData, dracoGeometry, options);
|
|
10461
10368
|
const positionAttribute = attributes.POSITION;
|
|
@@ -10468,7 +10375,6 @@ var __exports__ = (() => {
|
|
|
10468
10375
|
return {
|
|
10469
10376
|
topology: "triangle-strip",
|
|
10470
10377
|
mode: 4,
|
|
10471
|
-
// GL.TRIANGLES
|
|
10472
10378
|
attributes,
|
|
10473
10379
|
indices: {
|
|
10474
10380
|
value: this._getTriangleStripIndices(dracoGeometry),
|
|
@@ -10480,7 +10386,6 @@ var __exports__ = (() => {
|
|
|
10480
10386
|
return {
|
|
10481
10387
|
topology: "triangle-list",
|
|
10482
10388
|
mode: 5,
|
|
10483
|
-
// GL.TRIANGLE_STRIP
|
|
10484
10389
|
attributes,
|
|
10485
10390
|
indices: {
|
|
10486
10391
|
value: this._getTriangleListIndices(dracoGeometry),
|
|
@@ -10492,7 +10397,6 @@ var __exports__ = (() => {
|
|
|
10492
10397
|
return {
|
|
10493
10398
|
topology: "point-list",
|
|
10494
10399
|
mode: 0,
|
|
10495
|
-
// GL.POINTS
|
|
10496
10400
|
attributes
|
|
10497
10401
|
};
|
|
10498
10402
|
}
|
|
@@ -10515,11 +10419,6 @@ var __exports__ = (() => {
|
|
|
10515
10419
|
}
|
|
10516
10420
|
return attributes;
|
|
10517
10421
|
}
|
|
10518
|
-
// MESH INDICES EXTRACTION
|
|
10519
|
-
/**
|
|
10520
|
-
* For meshes, we need indices to define the faces.
|
|
10521
|
-
* @param dracoGeometry
|
|
10522
|
-
*/
|
|
10523
10422
|
_getTriangleListIndices(dracoGeometry) {
|
|
10524
10423
|
const numFaces = dracoGeometry.num_faces();
|
|
10525
10424
|
const numIndices = numFaces * 3;
|
|
@@ -10532,10 +10431,6 @@ var __exports__ = (() => {
|
|
|
10532
10431
|
this.draco._free(ptr);
|
|
10533
10432
|
}
|
|
10534
10433
|
}
|
|
10535
|
-
/**
|
|
10536
|
-
* For meshes, we need indices to define the faces.
|
|
10537
|
-
* @param dracoGeometry
|
|
10538
|
-
*/
|
|
10539
10434
|
_getTriangleStripIndices(dracoGeometry) {
|
|
10540
10435
|
const dracoArray = new this.draco.DracoInt32Array();
|
|
10541
10436
|
try {
|
|
@@ -10545,12 +10440,6 @@ var __exports__ = (() => {
|
|
|
10545
10440
|
this.draco.destroy(dracoArray);
|
|
10546
10441
|
}
|
|
10547
10442
|
}
|
|
10548
|
-
/**
|
|
10549
|
-
*
|
|
10550
|
-
* @param dracoGeometry
|
|
10551
|
-
* @param dracoAttribute
|
|
10552
|
-
* @param attributeName
|
|
10553
|
-
*/
|
|
10554
10443
|
_getAttributeValues(dracoGeometry, attribute) {
|
|
10555
10444
|
const TypedArrayCtor = DRACO_DATA_TYPE_TO_TYPED_ARRAY_MAP[attribute.data_type];
|
|
10556
10445
|
const numComponents = attribute.num_components;
|
|
@@ -10572,30 +10461,6 @@ var __exports__ = (() => {
|
|
|
10572
10461
|
size: numComponents
|
|
10573
10462
|
};
|
|
10574
10463
|
}
|
|
10575
|
-
// Attribute names
|
|
10576
|
-
/**
|
|
10577
|
-
* DRACO does not store attribute names - We need to deduce an attribute name
|
|
10578
|
-
* for each attribute
|
|
10579
|
-
_getAttributeNames(
|
|
10580
|
-
dracoGeometry: Mesh | PointCloud,
|
|
10581
|
-
options: DracoParseOptions
|
|
10582
|
-
): {[unique_id: number]: string} {
|
|
10583
|
-
const attributeNames: {[unique_id: number]: string} = {};
|
|
10584
|
-
for (let attributeId = 0; attributeId < dracoGeometry.num_attributes(); attributeId++) {
|
|
10585
|
-
const dracoAttribute = this.decoder.GetAttribute(dracoGeometry, attributeId);
|
|
10586
|
-
const attributeName = this._deduceAttributeName(dracoAttribute, options);
|
|
10587
|
-
attributeNames[attributeName] = attributeName;
|
|
10588
|
-
}
|
|
10589
|
-
return attributeNames;
|
|
10590
|
-
}
|
|
10591
|
-
*/
|
|
10592
|
-
/**
|
|
10593
|
-
* Deduce an attribute name.
|
|
10594
|
-
* @note DRACO does not save attribute names, just general type (POSITION, COLOR)
|
|
10595
|
-
* to help optimize compression. We generate GLTF compatible names for the Draco-recognized
|
|
10596
|
-
* types
|
|
10597
|
-
* @param attributeData
|
|
10598
|
-
*/
|
|
10599
10464
|
_deduceAttributeName(attribute, options) {
|
|
10600
10465
|
const uniqueId = attribute.unique_id;
|
|
10601
10466
|
for (const [attributeName, attributeUniqueId] of Object.entries(options.extraAttributes || {})) {
|
|
@@ -10616,22 +10481,14 @@ var __exports__ = (() => {
|
|
|
10616
10481
|
}
|
|
10617
10482
|
return `CUSTOM_ATTRIBUTE_${uniqueId}`;
|
|
10618
10483
|
}
|
|
10619
|
-
// METADATA EXTRACTION
|
|
10620
|
-
/** Get top level metadata */
|
|
10621
10484
|
_getTopLevelMetadata(dracoGeometry) {
|
|
10622
10485
|
const dracoMetadata = this.decoder.GetMetadata(dracoGeometry);
|
|
10623
10486
|
return this._getDracoMetadata(dracoMetadata);
|
|
10624
10487
|
}
|
|
10625
|
-
/** Get per attribute metadata */
|
|
10626
10488
|
_getAttributeMetadata(dracoGeometry, attributeId) {
|
|
10627
10489
|
const dracoMetadata = this.decoder.GetAttributeMetadata(dracoGeometry, attributeId);
|
|
10628
10490
|
return this._getDracoMetadata(dracoMetadata);
|
|
10629
10491
|
}
|
|
10630
|
-
/**
|
|
10631
|
-
* Extract metadata field values
|
|
10632
|
-
* @param dracoMetadata
|
|
10633
|
-
* @returns
|
|
10634
|
-
*/
|
|
10635
10492
|
_getDracoMetadata(dracoMetadata) {
|
|
10636
10493
|
if (!dracoMetadata || !dracoMetadata.ptr) {
|
|
10637
10494
|
return {};
|
|
@@ -10644,11 +10501,6 @@ var __exports__ = (() => {
|
|
|
10644
10501
|
}
|
|
10645
10502
|
return result;
|
|
10646
10503
|
}
|
|
10647
|
-
/**
|
|
10648
|
-
* Extracts possible values for one metadata entry by name
|
|
10649
|
-
* @param dracoMetadata
|
|
10650
|
-
* @param entryName
|
|
10651
|
-
*/
|
|
10652
10504
|
_getDracoMetadataField(dracoMetadata, entryName) {
|
|
10653
10505
|
const dracoArray = new this.draco.DracoInt32Array();
|
|
10654
10506
|
try {
|
|
@@ -10664,8 +10516,6 @@ var __exports__ = (() => {
|
|
|
10664
10516
|
this.draco.destroy(dracoArray);
|
|
10665
10517
|
}
|
|
10666
10518
|
}
|
|
10667
|
-
// QUANTIZED ATTRIBUTE SUPPORT (NO DECOMPRESSION)
|
|
10668
|
-
/** Skip transforms for specific attribute types */
|
|
10669
10519
|
_disableAttributeTransforms(options) {
|
|
10670
10520
|
const {
|
|
10671
10521
|
quantizedAttributes = [],
|
|
@@ -10676,10 +10526,6 @@ var __exports__ = (() => {
|
|
|
10676
10526
|
this.decoder.SkipAttributeTransform(this.draco[dracoAttributeName]);
|
|
10677
10527
|
}
|
|
10678
10528
|
}
|
|
10679
|
-
/**
|
|
10680
|
-
* Extract (and apply?) Position Transform
|
|
10681
|
-
* @todo not used
|
|
10682
|
-
*/
|
|
10683
10529
|
_getQuantizationTransform(dracoAttribute, options) {
|
|
10684
10530
|
const {
|
|
10685
10531
|
quantizedAttributes = []
|
|
@@ -10722,7 +10568,6 @@ var __exports__ = (() => {
|
|
|
10722
10568
|
}
|
|
10723
10569
|
return null;
|
|
10724
10570
|
}
|
|
10725
|
-
// HELPERS
|
|
10726
10571
|
};
|
|
10727
10572
|
function getDracoDataType(draco, attributeType) {
|
|
10728
10573
|
switch (attributeType) {
|
|
@@ -10766,13 +10611,9 @@ var __exports__ = (() => {
|
|
|
10766
10611
|
var DRACO_ENCODER_VERSION = "1.4.1";
|
|
10767
10612
|
var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
|
|
10768
10613
|
var DRACO_EXTERNAL_LIBRARIES = {
|
|
10769
|
-
/** The primary Draco3D encoder, javascript wrapper part */
|
|
10770
10614
|
DECODER: "draco_wasm_wrapper.js",
|
|
10771
|
-
/** The primary draco decoder, compiled web assembly part */
|
|
10772
10615
|
DECODER_WASM: "draco_decoder.wasm",
|
|
10773
|
-
/** Fallback decoder for non-webassebly environments. Very big bundle, lower performance */
|
|
10774
10616
|
FALLBACK_DECODER: "draco_decoder.js",
|
|
10775
|
-
/** Draco encoder */
|
|
10776
10617
|
ENCODER: "draco_encoder.js"
|
|
10777
10618
|
};
|
|
10778
10619
|
var DRACO_EXTERNAL_LIBRARY_URLS = {
|
|
@@ -10820,7 +10661,6 @@ var __exports__ = (() => {
|
|
|
10820
10661
|
onModuleLoaded: (draco) => resolve2({
|
|
10821
10662
|
draco
|
|
10822
10663
|
})
|
|
10823
|
-
// Module is Promise-like. Wrap in object to avoid loop.
|
|
10824
10664
|
});
|
|
10825
10665
|
});
|
|
10826
10666
|
}
|
|
@@ -10845,20 +10685,12 @@ var __exports__ = (() => {
|
|
|
10845
10685
|
// ../math/src/geometry/constants.ts
|
|
10846
10686
|
var GL_PRIMITIVE_MODE = {
|
|
10847
10687
|
POINTS: 0,
|
|
10848
|
-
// Points. single points.
|
|
10849
10688
|
LINES: 1,
|
|
10850
|
-
// Lines. Each vertex connects to the one after it.
|
|
10851
10689
|
LINE_LOOP: 2,
|
|
10852
|
-
// Lines. Each set of two vertices is treated as a separate line segment.
|
|
10853
10690
|
LINE_STRIP: 3,
|
|
10854
|
-
// Lines/ a connected group of line segments from the first vertex to the last
|
|
10855
10691
|
TRIANGLES: 4,
|
|
10856
|
-
// Triangles. Each set of three vertices creates a separate triangle.
|
|
10857
10692
|
TRIANGLE_STRIP: 5,
|
|
10858
|
-
// Triangles. A connected group of triangles.
|
|
10859
10693
|
TRIANGLE_FAN: 6
|
|
10860
|
-
// Triangles. A connected group of triangles.
|
|
10861
|
-
// Each vertex connects to the previous and the first vertex in the fan.
|
|
10862
10694
|
};
|
|
10863
10695
|
var GL_TYPE = {
|
|
10864
10696
|
BYTE: 5120,
|
|
@@ -10898,13 +10730,6 @@ var __exports__ = (() => {
|
|
|
10898
10730
|
};
|
|
10899
10731
|
var ERR_TYPE_CONVERSION = "Failed to convert GL type";
|
|
10900
10732
|
var GLType = class {
|
|
10901
|
-
// Signature: fromTypedArray(new Uint8Array())
|
|
10902
|
-
// Signature: fromTypedArray(Uint8Array)
|
|
10903
|
-
/**
|
|
10904
|
-
* Returns the size, in bytes, of the corresponding datatype
|
|
10905
|
-
* @param arrayOrType
|
|
10906
|
-
* @returns glType a a string
|
|
10907
|
-
*/
|
|
10908
10733
|
static fromTypedArray(arrayOrType) {
|
|
10909
10734
|
arrayOrType = ArrayBuffer.isView(arrayOrType) ? arrayOrType.constructor : arrayOrType;
|
|
10910
10735
|
for (const glType in GL_TYPE_TO_ARRAY_TYPE) {
|
|
@@ -10915,11 +10740,6 @@ var __exports__ = (() => {
|
|
|
10915
10740
|
}
|
|
10916
10741
|
throw new Error(ERR_TYPE_CONVERSION);
|
|
10917
10742
|
}
|
|
10918
|
-
/**
|
|
10919
|
-
* Extracts name for glType from array NAME_TO_GL_TYPE
|
|
10920
|
-
* @param name
|
|
10921
|
-
* @returns glType as a number
|
|
10922
|
-
*/
|
|
10923
10743
|
static fromName(name12) {
|
|
10924
10744
|
const glType = NAME_TO_GL_TYPE[name12];
|
|
10925
10745
|
if (!glType) {
|
|
@@ -10927,8 +10747,6 @@ var __exports__ = (() => {
|
|
|
10927
10747
|
}
|
|
10928
10748
|
return glType;
|
|
10929
10749
|
}
|
|
10930
|
-
// Converts GL constant to corresponding typed array type
|
|
10931
|
-
// eslint-disable-next-line complexity
|
|
10932
10750
|
static getArrayType(glType) {
|
|
10933
10751
|
switch (glType) {
|
|
10934
10752
|
case GL_TYPE.UNSIGNED_SHORT_5_6_5:
|
|
@@ -10943,31 +10761,13 @@ var __exports__ = (() => {
|
|
|
10943
10761
|
return ArrayType;
|
|
10944
10762
|
}
|
|
10945
10763
|
}
|
|
10946
|
-
/**
|
|
10947
|
-
* Returns the size in bytes of one element of the provided WebGL type
|
|
10948
|
-
* @param glType
|
|
10949
|
-
* @returns size of glType
|
|
10950
|
-
*/
|
|
10951
10764
|
static getByteSize(glType) {
|
|
10952
10765
|
const ArrayType = GLType.getArrayType(glType);
|
|
10953
10766
|
return ArrayType.BYTES_PER_ELEMENT;
|
|
10954
10767
|
}
|
|
10955
|
-
/**
|
|
10956
|
-
* Returns `true` if `glType` is a valid WebGL data type.
|
|
10957
|
-
* @param glType
|
|
10958
|
-
* @returns boolean
|
|
10959
|
-
*/
|
|
10960
10768
|
static validate(glType) {
|
|
10961
10769
|
return Boolean(GLType.getArrayType(glType));
|
|
10962
10770
|
}
|
|
10963
|
-
/**
|
|
10964
|
-
* Creates a typed view of an array of bytes
|
|
10965
|
-
* @param glType The type of typed array (ArrayBuffer view) to create
|
|
10966
|
-
* @param buffer The buffer storage to use for the view.
|
|
10967
|
-
* @param byteOffset The offset, in bytes, to the first element in the view
|
|
10968
|
-
* @param length The number of elements in the view. Defaults to buffer length
|
|
10969
|
-
* @returns A typed array view of the buffer
|
|
10970
|
-
*/
|
|
10971
10771
|
static createTypedArray(glType, buffer, byteOffset = 0, length4) {
|
|
10972
10772
|
if (length4 === void 0) {
|
|
10973
10773
|
length4 = (buffer.byteLength - byteOffset) / GLType.getByteSize(glType);
|
|
@@ -11077,7 +10877,6 @@ var __exports__ = (() => {
|
|
|
11077
10877
|
}
|
|
11078
10878
|
return result;
|
|
11079
10879
|
}
|
|
11080
|
-
// HELPERS
|
|
11081
10880
|
_getTypedArrayFromBinary(propertyName, componentType, componentLength, count, byteOffset) {
|
|
11082
10881
|
const cachedTypedArrays = this._cachedTypedArrays;
|
|
11083
10882
|
let typedArray = cachedTypedArrays[propertyName];
|
|
@@ -11113,7 +10912,6 @@ var __exports__ = (() => {
|
|
|
11113
10912
|
VEC2: (values, i2) => [values[2 * i2 + 0], values[2 * i2 + 1]],
|
|
11114
10913
|
VEC3: (values, i2) => [values[3 * i2 + 0], values[3 * i2 + 1], values[3 * i2 + 2]],
|
|
11115
10914
|
VEC4: (values, i2) => [values[4 * i2 + 0], values[4 * i2 + 1], values[4 * i2 + 2], values[4 * i2 + 3]],
|
|
11116
|
-
// TODO: check column major
|
|
11117
10915
|
MAT2: (values, i2) => [values[4 * i2 + 0], values[4 * i2 + 1], values[4 * i2 + 2], values[4 * i2 + 3]],
|
|
11118
10916
|
MAT3: (values, i2) => [values[9 * i2 + 0], values[9 * i2 + 1], values[9 * i2 + 2], values[9 * i2 + 3], values[9 * i2 + 4], values[9 * i2 + 5], values[9 * i2 + 6], values[9 * i2 + 7], values[9 * i2 + 8]],
|
|
11119
10917
|
MAT4: (values, i2) => [values[16 * i2 + 0], values[16 * i2 + 1], values[16 * i2 + 2], values[16 * i2 + 3], values[16 * i2 + 4], values[16 * i2 + 5], values[16 * i2 + 6], values[16 * i2 + 7], values[16 * i2 + 8], values[16 * i2 + 9], values[16 * i2 + 10], values[16 * i2 + 11], values[16 * i2 + 12], values[16 * i2 + 13], values[16 * i2 + 14], values[16 * i2 + 15]]
|
|
@@ -11137,7 +10935,6 @@ var __exports__ = (() => {
|
|
|
11137
10935
|
values[4 * i2 + 2] = x[2];
|
|
11138
10936
|
values[4 * i2 + 3] = x[3];
|
|
11139
10937
|
},
|
|
11140
|
-
// TODO: check column major correctness
|
|
11141
10938
|
MAT2: (x, values, i2) => {
|
|
11142
10939
|
values[4 * i2 + 0] = x[0];
|
|
11143
10940
|
values[4 * i2 + 1] = x[1];
|
|
@@ -11374,13 +11171,10 @@ var __exports__ = (() => {
|
|
|
11374
11171
|
var clone5 = (x, y) => x;
|
|
11375
11172
|
var IGNORED_PROPERTY_FIELDS = {
|
|
11376
11173
|
HIERARCHY: true,
|
|
11377
|
-
// Deprecated HIERARCHY property
|
|
11378
11174
|
extensions: true,
|
|
11379
11175
|
extras: true
|
|
11380
11176
|
};
|
|
11381
11177
|
var Tile3DBatchTableParser = class {
|
|
11382
|
-
// Copy all top-level property fields from the json object, ignoring special fields
|
|
11383
|
-
// TODO: hierarchy support is only partially implemented and not tested
|
|
11384
11178
|
constructor(json, binary, featureCount, options = {}) {
|
|
11385
11179
|
assert2(featureCount >= 0);
|
|
11386
11180
|
this.json = json || {};
|
|
@@ -11490,7 +11284,6 @@ var __exports__ = (() => {
|
|
|
11490
11284
|
}
|
|
11491
11285
|
propertyValues[batchId] = clone5(value, true);
|
|
11492
11286
|
}
|
|
11493
|
-
// PRIVATE METHODS
|
|
11494
11287
|
_checkBatchId(batchId) {
|
|
11495
11288
|
const valid = batchId >= 0 && batchId < this.featureCount;
|
|
11496
11289
|
if (!valid) {
|
|
@@ -11530,7 +11323,6 @@ var __exports__ = (() => {
|
|
|
11530
11323
|
}
|
|
11531
11324
|
return null;
|
|
11532
11325
|
}
|
|
11533
|
-
// EXTENSION SUPPORT: 3DTILES_batch_table_hierarchy
|
|
11534
11326
|
_hasPropertyInHierarchy(batchId, name12) {
|
|
11535
11327
|
if (!this._hierarchy) {
|
|
11536
11328
|
return false;
|
|
@@ -12007,13 +11799,9 @@ var __exports__ = (() => {
|
|
|
12007
11799
|
}
|
|
12008
11800
|
}
|
|
12009
11801
|
tile.attributes = {
|
|
12010
|
-
// @ts-expect-error
|
|
12011
11802
|
positions: decodedPositions,
|
|
12012
|
-
// @ts-expect-error
|
|
12013
11803
|
colors: normalize3DTileColorAttribute(tile, decodedColors, void 0),
|
|
12014
|
-
// @ts-expect-error
|
|
12015
11804
|
normals: decodedNormals,
|
|
12016
|
-
// @ts-expect-error
|
|
12017
11805
|
batchIds: decodedBatchIds,
|
|
12018
11806
|
...batchTableAttributes
|
|
12019
11807
|
};
|
|
@@ -12030,12 +11818,10 @@ var __exports__ = (() => {
|
|
|
12030
11818
|
var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
|
|
12031
11819
|
|
|
12032
11820
|
// ../images/src/lib/category-api/image-type.ts
|
|
12033
|
-
var
|
|
12034
|
-
_parseImageNode
|
|
12035
|
-
} = globalThis;
|
|
11821
|
+
var parseImageNode = globalThis.loaders?.parseImageNode;
|
|
12036
11822
|
var IMAGE_SUPPORTED = typeof Image !== "undefined";
|
|
12037
11823
|
var IMAGE_BITMAP_SUPPORTED = typeof ImageBitmap !== "undefined";
|
|
12038
|
-
var NODE_IMAGE_SUPPORTED = Boolean(
|
|
11824
|
+
var NODE_IMAGE_SUPPORTED = Boolean(parseImageNode);
|
|
12039
11825
|
var DATA_SUPPORTED = isBrowser ? true : NODE_IMAGE_SUPPORTED;
|
|
12040
11826
|
function isImageTypeSupported(type) {
|
|
12041
11827
|
switch (type) {
|
|
@@ -12252,7 +12038,6 @@ var __exports__ = (() => {
|
|
|
12252
12038
|
}
|
|
12253
12039
|
return {
|
|
12254
12040
|
mimeType: mediaType.mimeType,
|
|
12255
|
-
// TODO - decode width and height
|
|
12256
12041
|
width: 0,
|
|
12257
12042
|
height: 0
|
|
12258
12043
|
};
|
|
@@ -12310,9 +12095,7 @@ var __exports__ = (() => {
|
|
|
12310
12095
|
return {
|
|
12311
12096
|
mimeType: "image/jpeg",
|
|
12312
12097
|
height: dataView.getUint16(i2 + 5, BIG_ENDIAN),
|
|
12313
|
-
// Number of lines
|
|
12314
12098
|
width: dataView.getUint16(i2 + 7, BIG_ENDIAN)
|
|
12315
|
-
// Number of pixels per line
|
|
12316
12099
|
};
|
|
12317
12100
|
}
|
|
12318
12101
|
if (!tableMarkers.has(marker2)) {
|
|
@@ -12352,9 +12135,9 @@ var __exports__ = (() => {
|
|
|
12352
12135
|
const {
|
|
12353
12136
|
mimeType
|
|
12354
12137
|
} = getBinaryImageMetadata(arrayBuffer) || {};
|
|
12355
|
-
const
|
|
12356
|
-
assert2(
|
|
12357
|
-
return await
|
|
12138
|
+
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
12139
|
+
assert2(parseImageNode2);
|
|
12140
|
+
return await parseImageNode2(arrayBuffer, mimeType);
|
|
12358
12141
|
}
|
|
12359
12142
|
|
|
12360
12143
|
// ../images/src/lib/parsers/parse-image.ts
|
|
@@ -12403,9 +12186,7 @@ var __exports__ = (() => {
|
|
|
12403
12186
|
image: {
|
|
12404
12187
|
type: "auto",
|
|
12405
12188
|
decode: true
|
|
12406
|
-
// if format is HTML
|
|
12407
12189
|
}
|
|
12408
|
-
// imagebitmap: {} - passes (platform dependent) parameters to ImageBitmap constructor
|
|
12409
12190
|
};
|
|
12410
12191
|
var ImageLoader = {
|
|
12411
12192
|
id: "image",
|
|
@@ -12415,7 +12196,6 @@ var __exports__ = (() => {
|
|
|
12415
12196
|
mimeTypes: MIME_TYPES,
|
|
12416
12197
|
extensions: EXTENSIONS,
|
|
12417
12198
|
parse: parseImage,
|
|
12418
|
-
// TODO: byteOffset, byteLength;
|
|
12419
12199
|
tests: [(arrayBuffer) => Boolean(getBinaryImageMetadata(new DataView(arrayBuffer)))],
|
|
12420
12200
|
options: DEFAULT_IMAGE_LOADER_OPTIONS
|
|
12421
12201
|
};
|
|
@@ -12431,11 +12211,9 @@ var __exports__ = (() => {
|
|
|
12431
12211
|
}
|
|
12432
12212
|
function checkNodeImageFormatSupport(mimeType) {
|
|
12433
12213
|
const NODE_FORMAT_SUPPORT = ["image/png", "image/jpeg", "image/gif"];
|
|
12434
|
-
const
|
|
12435
|
-
|
|
12436
|
-
|
|
12437
|
-
} = globalThis;
|
|
12438
|
-
return Boolean(_parseImageNode2) && _imageFormatsNode.includes(mimeType);
|
|
12214
|
+
const parseImageNode2 = globalThis.loaders?.parseImageNode;
|
|
12215
|
+
const imageFormatsNode = globalThis.loaders?.imageFormatsNode || NODE_FORMAT_SUPPORT;
|
|
12216
|
+
return Boolean(parseImageNode2) && imageFormatsNode.includes(mimeType);
|
|
12439
12217
|
}
|
|
12440
12218
|
function checkBrowserImageFormatSupport(mimeType) {
|
|
12441
12219
|
switch (mimeType) {
|
|
@@ -12475,17 +12253,11 @@ var __exports__ = (() => {
|
|
|
12475
12253
|
};
|
|
12476
12254
|
var BYTES = {
|
|
12477
12255
|
5120: 1,
|
|
12478
|
-
// BYTE
|
|
12479
12256
|
5121: 1,
|
|
12480
|
-
// UNSIGNED_BYTE
|
|
12481
12257
|
5122: 2,
|
|
12482
|
-
// SHORT
|
|
12483
12258
|
5123: 2,
|
|
12484
|
-
// UNSIGNED_SHORT
|
|
12485
12259
|
5125: 4,
|
|
12486
|
-
// UNSIGNED_INT
|
|
12487
12260
|
5126: 4
|
|
12488
|
-
// FLOAT
|
|
12489
12261
|
};
|
|
12490
12262
|
|
|
12491
12263
|
// ../gltf/src/lib/gltf-utils/gltf-utils.ts
|
|
@@ -12624,8 +12396,6 @@ var __exports__ = (() => {
|
|
|
12624
12396
|
};
|
|
12625
12397
|
}
|
|
12626
12398
|
var GLTFScenegraph = class {
|
|
12627
|
-
// internal
|
|
12628
|
-
// TODO - why is this not GLTFWithBuffers - what happens to images?
|
|
12629
12399
|
constructor(gltf) {
|
|
12630
12400
|
this.gltf = {
|
|
12631
12401
|
json: gltf?.json || makeDefaultGLTFJson(),
|
|
@@ -12639,7 +12409,6 @@ var __exports__ = (() => {
|
|
|
12639
12409
|
this.sourceBuffers = [this.gltf.buffers[0]];
|
|
12640
12410
|
}
|
|
12641
12411
|
}
|
|
12642
|
-
// Accessors
|
|
12643
12412
|
get json() {
|
|
12644
12413
|
return this.gltf.json;
|
|
12645
12414
|
}
|
|
@@ -12696,9 +12465,6 @@ var __exports__ = (() => {
|
|
|
12696
12465
|
getAccessor(index) {
|
|
12697
12466
|
return this.getObject("accessors", index);
|
|
12698
12467
|
}
|
|
12699
|
-
// getCamera(index: number): object | null {
|
|
12700
|
-
// return null; // TODO: fix thi: object as null;
|
|
12701
|
-
// }
|
|
12702
12468
|
getTexture(index) {
|
|
12703
12469
|
return this.getObject("textures", index);
|
|
12704
12470
|
}
|
|
@@ -12724,10 +12490,6 @@ var __exports__ = (() => {
|
|
|
12724
12490
|
}
|
|
12725
12491
|
return object;
|
|
12726
12492
|
}
|
|
12727
|
-
/**
|
|
12728
|
-
* Accepts buffer view index or buffer view object
|
|
12729
|
-
* @returns a `Uint8Array`
|
|
12730
|
-
*/
|
|
12731
12493
|
getTypedArrayForBufferView(bufferView) {
|
|
12732
12494
|
bufferView = this.getBufferView(bufferView);
|
|
12733
12495
|
const bufferIndex = bufferView.buffer;
|
|
@@ -12736,16 +12498,10 @@ var __exports__ = (() => {
|
|
|
12736
12498
|
const byteOffset = (bufferView.byteOffset || 0) + binChunk.byteOffset;
|
|
12737
12499
|
return new Uint8Array(binChunk.arrayBuffer, byteOffset, bufferView.byteLength);
|
|
12738
12500
|
}
|
|
12739
|
-
/** Accepts accessor index or accessor object
|
|
12740
|
-
* @returns a typed array with type that matches the types
|
|
12741
|
-
*/
|
|
12742
12501
|
getTypedArrayForAccessor(accessor) {
|
|
12743
12502
|
const gltfAccessor = this.getAccessor(accessor);
|
|
12744
12503
|
return getTypedArrayForAccessor(this.gltf.json, this.gltf.buffers, gltfAccessor);
|
|
12745
12504
|
}
|
|
12746
|
-
/** accepts accessor index or accessor object
|
|
12747
|
-
* returns a `Uint8Array`
|
|
12748
|
-
*/
|
|
12749
12505
|
getTypedArrayForImageData(image) {
|
|
12750
12506
|
image = this.getAccessor(image);
|
|
12751
12507
|
const bufferView = this.getBufferView(image.bufferView);
|
|
@@ -12754,17 +12510,10 @@ var __exports__ = (() => {
|
|
|
12754
12510
|
const byteOffset = bufferView.byteOffset || 0;
|
|
12755
12511
|
return new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
|
|
12756
12512
|
}
|
|
12757
|
-
// MODIFERS
|
|
12758
|
-
/**
|
|
12759
|
-
* Add an extra application-defined key to the top-level data structure
|
|
12760
|
-
*/
|
|
12761
12513
|
addApplicationData(key, data) {
|
|
12762
12514
|
this.json[key] = data;
|
|
12763
12515
|
return this;
|
|
12764
12516
|
}
|
|
12765
|
-
/**
|
|
12766
|
-
* `extras` - Standard GLTF field for storing application specific data
|
|
12767
|
-
*/
|
|
12768
12517
|
addExtraData(key, data) {
|
|
12769
12518
|
this.json.extras = this.json.extras || {};
|
|
12770
12519
|
this.json.extras[key] = data;
|
|
@@ -12791,9 +12540,6 @@ var __exports__ = (() => {
|
|
|
12791
12540
|
}
|
|
12792
12541
|
delete extensions[extensionName];
|
|
12793
12542
|
}
|
|
12794
|
-
/**
|
|
12795
|
-
* Add to standard GLTF top level extension object, mark as used
|
|
12796
|
-
*/
|
|
12797
12543
|
addExtension(extensionName, extensionData = {}) {
|
|
12798
12544
|
assert6(extensionData);
|
|
12799
12545
|
this.json.extensions = this.json.extensions || {};
|
|
@@ -12801,27 +12547,18 @@ var __exports__ = (() => {
|
|
|
12801
12547
|
this.registerUsedExtension(extensionName);
|
|
12802
12548
|
return extensionData;
|
|
12803
12549
|
}
|
|
12804
|
-
/**
|
|
12805
|
-
* Standard GLTF top level extension object, mark as used and required
|
|
12806
|
-
*/
|
|
12807
12550
|
addRequiredExtension(extensionName, extensionData = {}) {
|
|
12808
12551
|
assert6(extensionData);
|
|
12809
12552
|
this.addExtension(extensionName, extensionData);
|
|
12810
12553
|
this.registerRequiredExtension(extensionName);
|
|
12811
12554
|
return extensionData;
|
|
12812
12555
|
}
|
|
12813
|
-
/**
|
|
12814
|
-
* Add extensionName to list of used extensions
|
|
12815
|
-
*/
|
|
12816
12556
|
registerUsedExtension(extensionName) {
|
|
12817
12557
|
this.json.extensionsUsed = this.json.extensionsUsed || [];
|
|
12818
12558
|
if (!this.json.extensionsUsed.find((ext) => ext === extensionName)) {
|
|
12819
12559
|
this.json.extensionsUsed.push(extensionName);
|
|
12820
12560
|
}
|
|
12821
12561
|
}
|
|
12822
|
-
/**
|
|
12823
|
-
* Add extensionName to list of required extensions
|
|
12824
|
-
*/
|
|
12825
12562
|
registerRequiredExtension(extensionName) {
|
|
12826
12563
|
this.registerUsedExtension(extensionName);
|
|
12827
12564
|
this.json.extensionsRequired = this.json.extensionsRequired || [];
|
|
@@ -12829,9 +12566,6 @@ var __exports__ = (() => {
|
|
|
12829
12566
|
this.json.extensionsRequired.push(extensionName);
|
|
12830
12567
|
}
|
|
12831
12568
|
}
|
|
12832
|
-
/**
|
|
12833
|
-
* Removes an extension from the top-level list
|
|
12834
|
-
*/
|
|
12835
12569
|
removeExtension(extensionName) {
|
|
12836
12570
|
if (this.json.extensions?.[extensionName]) {
|
|
12837
12571
|
this.json.extensionsRemoved = this.json.extensionsRemoved || [];
|
|
@@ -12850,17 +12584,9 @@ var __exports__ = (() => {
|
|
|
12850
12584
|
this._removeStringFromArray(this.json.extensionsUsed, extensionName);
|
|
12851
12585
|
}
|
|
12852
12586
|
}
|
|
12853
|
-
/**
|
|
12854
|
-
* Set default scene which is to be displayed at load time
|
|
12855
|
-
*/
|
|
12856
12587
|
setDefaultScene(sceneIndex) {
|
|
12857
12588
|
this.json.scene = sceneIndex;
|
|
12858
12589
|
}
|
|
12859
|
-
/**
|
|
12860
|
-
* @todo: add more properties for scene initialization:
|
|
12861
|
-
* name`, `extensions`, `extras`
|
|
12862
|
-
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-scene
|
|
12863
|
-
*/
|
|
12864
12590
|
addScene(scene) {
|
|
12865
12591
|
const {
|
|
12866
12592
|
nodeIndices
|
|
@@ -12871,11 +12597,6 @@ var __exports__ = (() => {
|
|
|
12871
12597
|
});
|
|
12872
12598
|
return this.json.scenes.length - 1;
|
|
12873
12599
|
}
|
|
12874
|
-
/**
|
|
12875
|
-
* @todo: add more properties for node initialization:
|
|
12876
|
-
* `name`, `extensions`, `extras`, `camera`, `children`, `skin`, `rotation`, `scale`, `translation`, `weights`
|
|
12877
|
-
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#node
|
|
12878
|
-
*/
|
|
12879
12600
|
addNode(node2) {
|
|
12880
12601
|
const {
|
|
12881
12602
|
meshIndex,
|
|
@@ -12891,7 +12612,6 @@ var __exports__ = (() => {
|
|
|
12891
12612
|
this.json.nodes.push(nodeData);
|
|
12892
12613
|
return this.json.nodes.length - 1;
|
|
12893
12614
|
}
|
|
12894
|
-
/** Adds a mesh to the json part */
|
|
12895
12615
|
addMesh(mesh) {
|
|
12896
12616
|
const {
|
|
12897
12617
|
attributes,
|
|
@@ -12923,20 +12643,12 @@ var __exports__ = (() => {
|
|
|
12923
12643
|
primitives: [{
|
|
12924
12644
|
attributes: accessorIndices,
|
|
12925
12645
|
mode: 0
|
|
12926
|
-
// GL.POINTS
|
|
12927
12646
|
}]
|
|
12928
12647
|
};
|
|
12929
12648
|
this.json.meshes = this.json.meshes || [];
|
|
12930
12649
|
this.json.meshes.push(glTFMesh);
|
|
12931
12650
|
return this.json.meshes.length - 1;
|
|
12932
12651
|
}
|
|
12933
|
-
/**
|
|
12934
|
-
* Adds a binary image. Builds glTF "JSON metadata" and saves buffer reference
|
|
12935
|
-
* Buffer will be copied into BIN chunk during "pack"
|
|
12936
|
-
* Currently encodes as glTF image
|
|
12937
|
-
* @param imageData
|
|
12938
|
-
* @param mimeType
|
|
12939
|
-
*/
|
|
12940
12652
|
addImage(imageData, mimeTypeOpt) {
|
|
12941
12653
|
const metadata = getBinaryImageMetadata(imageData);
|
|
12942
12654
|
const mimeType = mimeTypeOpt || metadata?.mimeType;
|
|
@@ -12949,10 +12661,6 @@ var __exports__ = (() => {
|
|
|
12949
12661
|
this.json.images.push(glTFImage);
|
|
12950
12662
|
return this.json.images.length - 1;
|
|
12951
12663
|
}
|
|
12952
|
-
/**
|
|
12953
|
-
* Add one untyped source buffer, create a matching glTF `bufferView`, and return its index
|
|
12954
|
-
* @param buffer
|
|
12955
|
-
*/
|
|
12956
12664
|
addBufferView(buffer, bufferIndex = 0, byteOffset = this.byteLength) {
|
|
12957
12665
|
const byteLength = buffer.byteLength;
|
|
12958
12666
|
assert6(Number.isFinite(byteLength));
|
|
@@ -12960,7 +12668,6 @@ var __exports__ = (() => {
|
|
|
12960
12668
|
this.sourceBuffers.push(buffer);
|
|
12961
12669
|
const glTFBufferView = {
|
|
12962
12670
|
buffer: bufferIndex,
|
|
12963
|
-
// Write offset from the start of the binary body
|
|
12964
12671
|
byteOffset,
|
|
12965
12672
|
byteLength
|
|
12966
12673
|
};
|
|
@@ -12969,36 +12676,19 @@ var __exports__ = (() => {
|
|
|
12969
12676
|
this.json.bufferViews.push(glTFBufferView);
|
|
12970
12677
|
return this.json.bufferViews.length - 1;
|
|
12971
12678
|
}
|
|
12972
|
-
/**
|
|
12973
|
-
* Adds an accessor to a bufferView
|
|
12974
|
-
* @param bufferViewIndex
|
|
12975
|
-
* @param accessor
|
|
12976
|
-
*/
|
|
12977
12679
|
addAccessor(bufferViewIndex, accessor) {
|
|
12978
12680
|
const glTFAccessor = {
|
|
12979
12681
|
bufferView: bufferViewIndex,
|
|
12980
|
-
// @ts-ignore
|
|
12981
12682
|
type: getAccessorTypeFromSize(accessor.size),
|
|
12982
|
-
// @ts-ignore
|
|
12983
12683
|
componentType: accessor.componentType,
|
|
12984
|
-
// @ts-ignore
|
|
12985
12684
|
count: accessor.count,
|
|
12986
|
-
// @ts-ignore
|
|
12987
12685
|
max: accessor.max,
|
|
12988
|
-
// @ts-ignore
|
|
12989
12686
|
min: accessor.min
|
|
12990
12687
|
};
|
|
12991
12688
|
this.json.accessors = this.json.accessors || [];
|
|
12992
12689
|
this.json.accessors.push(glTFAccessor);
|
|
12993
12690
|
return this.json.accessors.length - 1;
|
|
12994
12691
|
}
|
|
12995
|
-
/**
|
|
12996
|
-
* Add a binary buffer. Builds glTF "JSON metadata" and saves buffer reference
|
|
12997
|
-
* Buffer will be copied into BIN chunk during "pack"
|
|
12998
|
-
* Currently encodes buffers as glTF accessors, but this could be optimized
|
|
12999
|
-
* @param sourceBuffer
|
|
13000
|
-
* @param accessor
|
|
13001
|
-
*/
|
|
13002
12692
|
addBinaryBuffer(sourceBuffer, accessor = {
|
|
13003
12693
|
size: 3
|
|
13004
12694
|
}) {
|
|
@@ -13011,22 +12701,14 @@ var __exports__ = (() => {
|
|
|
13011
12701
|
minMax = this._getAccessorMinMax(sourceBuffer, accessor.size);
|
|
13012
12702
|
}
|
|
13013
12703
|
const accessorDefaults = {
|
|
13014
|
-
// @ts-ignore
|
|
13015
12704
|
size: accessor.size,
|
|
13016
12705
|
componentType: getComponentTypeFromArray(sourceBuffer),
|
|
13017
|
-
// @ts-ignore
|
|
13018
12706
|
count: Math.round(sourceBuffer.length / accessor.size),
|
|
13019
12707
|
min: minMax.min,
|
|
13020
12708
|
max: minMax.max
|
|
13021
12709
|
};
|
|
13022
12710
|
return this.addAccessor(bufferViewIndex, Object.assign(accessorDefaults, accessor));
|
|
13023
12711
|
}
|
|
13024
|
-
/**
|
|
13025
|
-
* Adds a texture to the json part
|
|
13026
|
-
* @todo: add more properties for texture initialization
|
|
13027
|
-
* `sampler`, `name`, `extensions`, `extras`
|
|
13028
|
-
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#texture
|
|
13029
|
-
*/
|
|
13030
12712
|
addTexture(texture) {
|
|
13031
12713
|
const {
|
|
13032
12714
|
imageIndex
|
|
@@ -13038,13 +12720,11 @@ var __exports__ = (() => {
|
|
|
13038
12720
|
this.json.textures.push(glTFTexture);
|
|
13039
12721
|
return this.json.textures.length - 1;
|
|
13040
12722
|
}
|
|
13041
|
-
/** Adds a material to the json part */
|
|
13042
12723
|
addMaterial(pbrMaterialInfo) {
|
|
13043
12724
|
this.json.materials = this.json.materials || [];
|
|
13044
12725
|
this.json.materials.push(pbrMaterialInfo);
|
|
13045
12726
|
return this.json.materials.length - 1;
|
|
13046
12727
|
}
|
|
13047
|
-
/** Pack the binary chunk */
|
|
13048
12728
|
createBinaryChunk() {
|
|
13049
12729
|
this.gltf.buffers = [];
|
|
13050
12730
|
const totalByteLength = this.byteLength;
|
|
@@ -13064,7 +12744,6 @@ var __exports__ = (() => {
|
|
|
13064
12744
|
this.gltf.binary = arrayBuffer;
|
|
13065
12745
|
this.sourceBuffers = [arrayBuffer];
|
|
13066
12746
|
}
|
|
13067
|
-
// PRIVATE
|
|
13068
12747
|
_removeStringFromArray(array, string) {
|
|
13069
12748
|
let found = true;
|
|
13070
12749
|
while (found) {
|
|
@@ -13076,9 +12755,6 @@ var __exports__ = (() => {
|
|
|
13076
12755
|
}
|
|
13077
12756
|
}
|
|
13078
12757
|
}
|
|
13079
|
-
/**
|
|
13080
|
-
* Add attributes to buffers and create `attributes` object which is part of `mesh`
|
|
13081
|
-
*/
|
|
13082
12758
|
_addAttributes(attributes = {}) {
|
|
13083
12759
|
const result = {};
|
|
13084
12760
|
for (const attributeKey in attributes) {
|
|
@@ -13089,17 +12765,11 @@ var __exports__ = (() => {
|
|
|
13089
12765
|
}
|
|
13090
12766
|
return result;
|
|
13091
12767
|
}
|
|
13092
|
-
/**
|
|
13093
|
-
* Add indices to buffers
|
|
13094
|
-
*/
|
|
13095
12768
|
_addIndices(indices) {
|
|
13096
12769
|
return this.addBinaryBuffer(indices, {
|
|
13097
12770
|
size: 1
|
|
13098
12771
|
});
|
|
13099
12772
|
}
|
|
13100
|
-
/**
|
|
13101
|
-
* Deduce gltf specific attribue name from input attribute name
|
|
13102
|
-
*/
|
|
13103
12773
|
_getGltfAttributeName(attributeName) {
|
|
13104
12774
|
switch (attributeName.toLowerCase()) {
|
|
13105
12775
|
case "position":
|
|
@@ -13119,10 +12789,6 @@ var __exports__ = (() => {
|
|
|
13119
12789
|
return attributeName;
|
|
13120
12790
|
}
|
|
13121
12791
|
}
|
|
13122
|
-
/**
|
|
13123
|
-
* Calculate `min` and `max` arrays of accessor according to spec:
|
|
13124
|
-
* https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-accessor
|
|
13125
|
-
*/
|
|
13126
12792
|
_getAccessorMinMax(buffer, size) {
|
|
13127
12793
|
const result = {
|
|
13128
12794
|
min: null,
|
|
@@ -13140,16 +12806,8 @@ var __exports__ = (() => {
|
|
|
13140
12806
|
}
|
|
13141
12807
|
for (let index = size; index < buffer.length; index += size) {
|
|
13142
12808
|
for (let componentIndex = 0; componentIndex < size; componentIndex++) {
|
|
13143
|
-
result.min[0 + componentIndex] = Math.min(
|
|
13144
|
-
|
|
13145
|
-
result.min[0 + componentIndex],
|
|
13146
|
-
buffer[index + componentIndex]
|
|
13147
|
-
);
|
|
13148
|
-
result.max[0 + componentIndex] = Math.max(
|
|
13149
|
-
// @ts-ignore
|
|
13150
|
-
result.max[0 + componentIndex],
|
|
13151
|
-
buffer[index + componentIndex]
|
|
13152
|
-
);
|
|
12809
|
+
result.min[0 + componentIndex] = Math.min(result.min[0 + componentIndex], buffer[index + componentIndex]);
|
|
12810
|
+
result.max[0 + componentIndex] = Math.max(result.max[0 + componentIndex], buffer[index + componentIndex]);
|
|
13153
12811
|
}
|
|
13154
12812
|
}
|
|
13155
12813
|
return result;
|
|
@@ -13201,14 +12859,7 @@ var __exports__ = (() => {
|
|
|
13201
12859
|
return null;
|
|
13202
12860
|
}
|
|
13203
12861
|
const arrayOffsetsBytes = scenegraph.getTypedArrayForBufferView(bufferViewIndex);
|
|
13204
|
-
const arrayOffsets = convertRawBufferToMetadataArray(
|
|
13205
|
-
arrayOffsetsBytes,
|
|
13206
|
-
"SCALAR",
|
|
13207
|
-
// offsets consist of ONE component
|
|
13208
|
-
offsetType,
|
|
13209
|
-
numberOfElements + 1
|
|
13210
|
-
// The number of offsets is equal to the property table `count` plus one.
|
|
13211
|
-
);
|
|
12862
|
+
const arrayOffsets = convertRawBufferToMetadataArray(arrayOffsetsBytes, "SCALAR", offsetType, numberOfElements + 1);
|
|
13212
12863
|
if (arrayOffsets instanceof BigInt64Array || arrayOffsets instanceof BigUint64Array) {
|
|
13213
12864
|
return null;
|
|
13214
12865
|
}
|
|
@@ -13415,7 +13066,6 @@ var __exports__ = (() => {
|
|
|
13415
13066
|
var EXT_structural_metadata_exports = {};
|
|
13416
13067
|
__export(EXT_structural_metadata_exports, {
|
|
13417
13068
|
decode: () => decode2,
|
|
13418
|
-
getPropertyTableFromExtStructuralMetadata: () => getPropertyTableFromExtStructuralMetadata,
|
|
13419
13069
|
name: () => name2
|
|
13420
13070
|
});
|
|
13421
13071
|
var EXT_STRUCTURAL_METADATA_NAME = "EXT_structural_metadata";
|
|
@@ -13424,26 +13074,6 @@ var __exports__ = (() => {
|
|
|
13424
13074
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
13425
13075
|
decodeExtStructuralMetadata(scenegraph, options);
|
|
13426
13076
|
}
|
|
13427
|
-
function getPropertyTableFromExtStructuralMetadata(extension, metadataClass) {
|
|
13428
|
-
if (extension.propertyTables) {
|
|
13429
|
-
const firstPropertyTable = extension?.propertyTables[0];
|
|
13430
|
-
const propertyTableWithData = {};
|
|
13431
|
-
for (const propertyName in firstPropertyTable.properties) {
|
|
13432
|
-
propertyTableWithData[propertyName] = firstPropertyTable.properties[propertyName].data;
|
|
13433
|
-
}
|
|
13434
|
-
return propertyTableWithData;
|
|
13435
|
-
}
|
|
13436
|
-
if (extension.propertyTextures) {
|
|
13437
|
-
const firstPropertyTexture = extension?.propertyTextures[0];
|
|
13438
|
-
const propertyTableWithData = {};
|
|
13439
|
-
for (const propertyName in firstPropertyTexture.properties) {
|
|
13440
|
-
propertyTableWithData[propertyName] = firstPropertyTexture.properties[propertyName].data;
|
|
13441
|
-
}
|
|
13442
|
-
return propertyTableWithData;
|
|
13443
|
-
}
|
|
13444
|
-
console.warn("Cannot get property table from EXT_structural_metadata extension. There is neither propertyTables, nor propertyTextures in the extension.");
|
|
13445
|
-
return null;
|
|
13446
|
-
}
|
|
13447
13077
|
function decodeExtStructuralMetadata(scenegraph, options) {
|
|
13448
13078
|
if (!options.gltf?.loadBuffers) {
|
|
13449
13079
|
return;
|
|
@@ -13582,10 +13212,7 @@ var __exports__ = (() => {
|
|
|
13582
13212
|
return data;
|
|
13583
13213
|
}
|
|
13584
13214
|
function getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
|
|
13585
|
-
if (classProperty.array &&
|
|
13586
|
-
// If `count` is NOT defined, it's a VARIABLE-length array
|
|
13587
|
-
typeof classProperty.count === "undefined" && // `arrayOffsets` is an index of the buffer view containing offsets for variable-length arrays.
|
|
13588
|
-
typeof propertyTableProperty.arrayOffsets !== "undefined") {
|
|
13215
|
+
if (classProperty.array && typeof classProperty.count === "undefined" && typeof propertyTableProperty.arrayOffsets !== "undefined") {
|
|
13589
13216
|
return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType || "UINT32", numberOfElements);
|
|
13590
13217
|
}
|
|
13591
13218
|
return null;
|
|
@@ -13603,13 +13230,7 @@ var __exports__ = (() => {
|
|
|
13603
13230
|
const elementCount = valuesDataBytes.byteLength / elementSize;
|
|
13604
13231
|
let valuesData;
|
|
13605
13232
|
if (classProperty.componentType) {
|
|
13606
|
-
valuesData = convertRawBufferToMetadataArray(
|
|
13607
|
-
valuesDataBytes,
|
|
13608
|
-
classProperty.type,
|
|
13609
|
-
// The datatype of the element's components. Only applicable to `SCALAR`, `VECN`, and `MATN` types.
|
|
13610
|
-
classProperty.componentType,
|
|
13611
|
-
elementCount
|
|
13612
|
-
);
|
|
13233
|
+
valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, classProperty.componentType, elementCount);
|
|
13613
13234
|
} else {
|
|
13614
13235
|
valuesData = valuesDataBytes;
|
|
13615
13236
|
}
|
|
@@ -13721,7 +13342,6 @@ var __exports__ = (() => {
|
|
|
13721
13342
|
var EXT_feature_metadata_exports = {};
|
|
13722
13343
|
__export(EXT_feature_metadata_exports, {
|
|
13723
13344
|
decode: () => decode3,
|
|
13724
|
-
getPropertyTableFromExtFeatureMetadata: () => getPropertyTableFromExtFeatureMetadata,
|
|
13725
13345
|
name: () => name3
|
|
13726
13346
|
});
|
|
13727
13347
|
var EXT_FEATURE_METADATA_NAME = "EXT_feature_metadata";
|
|
@@ -13730,38 +13350,6 @@ var __exports__ = (() => {
|
|
|
13730
13350
|
const scenegraph = new GLTFScenegraph(gltfData);
|
|
13731
13351
|
decodeExtFeatureMetadata(scenegraph, options);
|
|
13732
13352
|
}
|
|
13733
|
-
function getPropertyTableFromExtFeatureMetadata(extension, metadataClass) {
|
|
13734
|
-
if (extension.featureTables) {
|
|
13735
|
-
const firstFeatureTableName = Object.keys(extension.featureTables)?.[0];
|
|
13736
|
-
if (firstFeatureTableName) {
|
|
13737
|
-
const featureTable = extension.featureTables[firstFeatureTableName];
|
|
13738
|
-
const propertyTable = {};
|
|
13739
|
-
for (const propertyName in featureTable.properties) {
|
|
13740
|
-
propertyTable[propertyName] = featureTable.properties[propertyName].data;
|
|
13741
|
-
}
|
|
13742
|
-
return propertyTable;
|
|
13743
|
-
}
|
|
13744
|
-
}
|
|
13745
|
-
if (extension.featureTextures) {
|
|
13746
|
-
let featureTexture;
|
|
13747
|
-
for (const textureKey in extension.featureTextures) {
|
|
13748
|
-
const texture = extension.featureTextures[textureKey];
|
|
13749
|
-
if (texture.class === metadataClass) {
|
|
13750
|
-
featureTexture = textureKey;
|
|
13751
|
-
}
|
|
13752
|
-
}
|
|
13753
|
-
if (typeof featureTexture === "string") {
|
|
13754
|
-
const featureTable = extension.featureTextures[featureTexture];
|
|
13755
|
-
const propertyTable = {};
|
|
13756
|
-
for (const propertyName in featureTable.properties) {
|
|
13757
|
-
propertyTable[propertyName] = featureTable.properties[propertyName].data;
|
|
13758
|
-
}
|
|
13759
|
-
return propertyTable;
|
|
13760
|
-
}
|
|
13761
|
-
}
|
|
13762
|
-
console.warn("Cannot get property table from EXT_feature_metadata extension. There is neither featureTables, nor featureTextures in the extension.");
|
|
13763
|
-
return null;
|
|
13764
|
-
}
|
|
13765
13353
|
function decodeExtFeatureMetadata(scenegraph, options) {
|
|
13766
13354
|
if (!options.gltf?.loadBuffers) {
|
|
13767
13355
|
return;
|
|
@@ -13870,29 +13458,14 @@ var __exports__ = (() => {
|
|
|
13870
13458
|
return data;
|
|
13871
13459
|
}
|
|
13872
13460
|
function getArrayOffsetsForProperty2(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
|
|
13873
|
-
if (classProperty.type === "ARRAY" &&
|
|
13874
|
-
|
|
13875
|
-
typeof classProperty.componentCount === "undefined" && // `arrayOffsetBufferView` is an index of the buffer view containing offsets for variable-length arrays.
|
|
13876
|
-
typeof propertyTableProperty.arrayOffsetBufferView !== "undefined") {
|
|
13877
|
-
return getOffsetsForProperty(
|
|
13878
|
-
scenegraph,
|
|
13879
|
-
propertyTableProperty.arrayOffsetBufferView,
|
|
13880
|
-
propertyTableProperty.offsetType || "UINT32",
|
|
13881
|
-
// offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView
|
|
13882
|
-
numberOfElements
|
|
13883
|
-
);
|
|
13461
|
+
if (classProperty.type === "ARRAY" && typeof classProperty.componentCount === "undefined" && typeof propertyTableProperty.arrayOffsetBufferView !== "undefined") {
|
|
13462
|
+
return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsetBufferView, propertyTableProperty.offsetType || "UINT32", numberOfElements);
|
|
13884
13463
|
}
|
|
13885
13464
|
return null;
|
|
13886
13465
|
}
|
|
13887
13466
|
function getStringOffsetsForProperty2(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
|
|
13888
13467
|
if (typeof propertyTableProperty.stringOffsetBufferView !== "undefined") {
|
|
13889
|
-
return getOffsetsForProperty(
|
|
13890
|
-
scenegraph,
|
|
13891
|
-
propertyTableProperty.stringOffsetBufferView,
|
|
13892
|
-
propertyTableProperty.offsetType || "UINT32",
|
|
13893
|
-
// offsetType is used both for stringOffsetBufferView and arrayOffsetBufferView
|
|
13894
|
-
numberOfElements
|
|
13895
|
-
);
|
|
13468
|
+
return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsetBufferView, propertyTableProperty.offsetType || "UINT32", numberOfElements);
|
|
13896
13469
|
}
|
|
13897
13470
|
return null;
|
|
13898
13471
|
}
|
|
@@ -13952,13 +13525,9 @@ var __exports__ = (() => {
|
|
|
13952
13525
|
|
|
13953
13526
|
// ../textures/src/lib/parsers/basis-module-loader.ts
|
|
13954
13527
|
var BASIS_EXTERNAL_LIBRARIES = {
|
|
13955
|
-
/** Basis transcoder, javascript wrapper part */
|
|
13956
13528
|
TRANSCODER: "basis_transcoder.js",
|
|
13957
|
-
/** Basis transcoder, compiled web assembly part */
|
|
13958
13529
|
TRANSCODER_WASM: "basis_transcoder.wasm",
|
|
13959
|
-
/** Basis encoder, javascript wrapper part */
|
|
13960
13530
|
ENCODER: "basis_encoder.js",
|
|
13961
|
-
/** Basis encoder, compiled web assembly part */
|
|
13962
13531
|
ENCODER_WASM: "basis_encoder.wasm"
|
|
13963
13532
|
};
|
|
13964
13533
|
var loadBasisTranscoderPromise;
|
|
@@ -14036,12 +13605,10 @@ var __exports__ = (() => {
|
|
|
14036
13605
|
|
|
14037
13606
|
// ../textures/src/lib/gl-extensions.ts
|
|
14038
13607
|
var GL_EXTENSIONS_CONSTANTS = {
|
|
14039
|
-
// WEBGL_compressed_texture_s3tc
|
|
14040
13608
|
COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
|
|
14041
13609
|
COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
|
|
14042
13610
|
COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
|
|
14043
13611
|
COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
|
|
14044
|
-
// WEBGL_compressed_texture_es3
|
|
14045
13612
|
COMPRESSED_R11_EAC: 37488,
|
|
14046
13613
|
COMPRESSED_SIGNED_R11_EAC: 37489,
|
|
14047
13614
|
COMPRESSED_RG11_EAC: 37490,
|
|
@@ -14052,18 +13619,14 @@ var __exports__ = (() => {
|
|
|
14052
13619
|
COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
|
|
14053
13620
|
COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
|
|
14054
13621
|
COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
|
|
14055
|
-
// WEBGL_compressed_texture_pvrtc
|
|
14056
13622
|
COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
|
|
14057
13623
|
COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
|
|
14058
13624
|
COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
|
|
14059
13625
|
COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
|
|
14060
|
-
// WEBGL_compressed_texture_etc1
|
|
14061
13626
|
COMPRESSED_RGB_ETC1_WEBGL: 36196,
|
|
14062
|
-
// WEBGL_compressed_texture_atc
|
|
14063
13627
|
COMPRESSED_RGB_ATC_WEBGL: 35986,
|
|
14064
13628
|
COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
|
|
14065
13629
|
COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
|
|
14066
|
-
// WEBGL_compressed_texture_astc
|
|
14067
13630
|
COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
|
|
14068
13631
|
COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
|
|
14069
13632
|
COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
|
|
@@ -14092,12 +13655,10 @@ var __exports__ = (() => {
|
|
|
14092
13655
|
COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
|
|
14093
13656
|
COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
|
|
14094
13657
|
COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
|
|
14095
|
-
// EXT_texture_compression_rgtc
|
|
14096
13658
|
COMPRESSED_RED_RGTC1_EXT: 36283,
|
|
14097
13659
|
COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
|
|
14098
13660
|
COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
|
|
14099
13661
|
COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
|
|
14100
|
-
// WEBGL_compressed_texture_s3tc_srgb
|
|
14101
13662
|
COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
|
|
14102
13663
|
COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
|
|
14103
13664
|
COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
|
|
@@ -14107,7 +13668,6 @@ var __exports__ = (() => {
|
|
|
14107
13668
|
// ../textures/src/lib/utils/texture-formats.ts
|
|
14108
13669
|
var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
|
|
14109
13670
|
var WEBGL_EXTENSIONS = {
|
|
14110
|
-
/* eslint-disable camelcase */
|
|
14111
13671
|
WEBGL_compressed_texture_s3tc: "dxt",
|
|
14112
13672
|
WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
|
|
14113
13673
|
WEBGL_compressed_texture_etc1: "etc1",
|
|
@@ -14116,7 +13676,6 @@ var __exports__ = (() => {
|
|
|
14116
13676
|
WEBGL_compressed_texture_atc: "atc",
|
|
14117
13677
|
WEBGL_compressed_texture_astc: "astc",
|
|
14118
13678
|
EXT_texture_compression_rgtc: "rgtc"
|
|
14119
|
-
/* eslint-enable camelcase */
|
|
14120
13679
|
};
|
|
14121
13680
|
var formats = null;
|
|
14122
13681
|
function getSupportedGPUTextureFormats(gl) {
|
|
@@ -14172,35 +13731,10 @@ var __exports__ = (() => {
|
|
|
14172
13731
|
}(f || (f = {}));
|
|
14173
13732
|
|
|
14174
13733
|
// ../textures/src/lib/parsers/parse-ktx.ts
|
|
14175
|
-
var KTX2_ID = [
|
|
14176
|
-
// '´', 'K', 'T', 'X', '2', '0', 'ª', '\r', '\n', '\x1A', '\n'
|
|
14177
|
-
171,
|
|
14178
|
-
75,
|
|
14179
|
-
84,
|
|
14180
|
-
88,
|
|
14181
|
-
32,
|
|
14182
|
-
50,
|
|
14183
|
-
48,
|
|
14184
|
-
187,
|
|
14185
|
-
13,
|
|
14186
|
-
10,
|
|
14187
|
-
26,
|
|
14188
|
-
10
|
|
14189
|
-
];
|
|
13734
|
+
var KTX2_ID = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
|
|
14190
13735
|
function isKTX(data) {
|
|
14191
13736
|
const id = new Uint8Array(data);
|
|
14192
|
-
const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] ||
|
|
14193
|
-
id[1] !== KTX2_ID[1] || // 'K'
|
|
14194
|
-
id[2] !== KTX2_ID[2] || // 'T'
|
|
14195
|
-
id[3] !== KTX2_ID[3] || // 'X'
|
|
14196
|
-
id[4] !== KTX2_ID[4] || // ' '
|
|
14197
|
-
id[5] !== KTX2_ID[5] || // '2'
|
|
14198
|
-
id[6] !== KTX2_ID[6] || // '0'
|
|
14199
|
-
id[7] !== KTX2_ID[7] || // 'ª'
|
|
14200
|
-
id[8] !== KTX2_ID[8] || // '\r'
|
|
14201
|
-
id[9] !== KTX2_ID[9] || // '\n'
|
|
14202
|
-
id[10] !== KTX2_ID[10] || // '\x1A'
|
|
14203
|
-
id[11] !== KTX2_ID[11];
|
|
13737
|
+
const notKTX = id.byteLength < KTX2_ID.length || id[0] !== KTX2_ID[0] || id[1] !== KTX2_ID[1] || id[2] !== KTX2_ID[2] || id[3] !== KTX2_ID[3] || id[4] !== KTX2_ID[4] || id[5] !== KTX2_ID[5] || id[6] !== KTX2_ID[6] || id[7] !== KTX2_ID[7] || id[8] !== KTX2_ID[8] || id[9] !== KTX2_ID[9] || id[10] !== KTX2_ID[10] || id[11] !== KTX2_ID[11];
|
|
14204
13738
|
return !notKTX;
|
|
14205
13739
|
}
|
|
14206
13740
|
|
|
@@ -14335,9 +13869,7 @@ var __exports__ = (() => {
|
|
|
14335
13869
|
function transcodeImage(basisFile, imageIndex, levelIndex, options) {
|
|
14336
13870
|
const width = basisFile.getImageWidth(imageIndex, levelIndex);
|
|
14337
13871
|
const height = basisFile.getImageHeight(imageIndex, levelIndex);
|
|
14338
|
-
const hasAlpha = basisFile.getHasAlpha(
|
|
14339
|
-
/* imageIndex, levelIndex */
|
|
14340
|
-
);
|
|
13872
|
+
const hasAlpha = basisFile.getHasAlpha();
|
|
14341
13873
|
const {
|
|
14342
13874
|
compressed,
|
|
14343
13875
|
format,
|
|
@@ -14349,14 +13881,11 @@ var __exports__ = (() => {
|
|
|
14349
13881
|
throw new Error("failed to start Basis transcoding");
|
|
14350
13882
|
}
|
|
14351
13883
|
return {
|
|
14352
|
-
// standard loaders.gl image category payload
|
|
14353
13884
|
width,
|
|
14354
13885
|
height,
|
|
14355
13886
|
data: decodedData,
|
|
14356
13887
|
compressed,
|
|
14357
13888
|
format,
|
|
14358
|
-
// Additional fields
|
|
14359
|
-
// Add levelSize field.
|
|
14360
13889
|
hasAlpha
|
|
14361
13890
|
};
|
|
14362
13891
|
}
|
|
@@ -14391,26 +13920,14 @@ var __exports__ = (() => {
|
|
|
14391
13920
|
} = getBasisOptions(options, alphaFlag);
|
|
14392
13921
|
const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
|
|
14393
13922
|
const decodedData = new Uint8Array(decodedSize);
|
|
14394
|
-
if (!ktx2File.transcodeImage(
|
|
14395
|
-
decodedData,
|
|
14396
|
-
levelIndex,
|
|
14397
|
-
0,
|
|
14398
|
-
0,
|
|
14399
|
-
basisFormat,
|
|
14400
|
-
0,
|
|
14401
|
-
-1,
|
|
14402
|
-
-1
|
|
14403
|
-
/* channel1 */
|
|
14404
|
-
)) {
|
|
13923
|
+
if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
|
|
14405
13924
|
throw new Error("Failed to transcode KTX2 image");
|
|
14406
13925
|
}
|
|
14407
13926
|
return {
|
|
14408
|
-
// standard loaders.gl image category payload
|
|
14409
13927
|
width,
|
|
14410
13928
|
height,
|
|
14411
13929
|
data: decodedData,
|
|
14412
13930
|
compressed,
|
|
14413
|
-
// Additional fields
|
|
14414
13931
|
levelSize: decodedSize,
|
|
14415
13932
|
hasAlpha: alphaFlag,
|
|
14416
13933
|
format
|
|
@@ -14463,12 +13980,9 @@ var __exports__ = (() => {
|
|
|
14463
13980
|
options: {
|
|
14464
13981
|
basis: {
|
|
14465
13982
|
format: "auto",
|
|
14466
|
-
// gl context doesn't exist on a worker thread
|
|
14467
13983
|
libraryPath: "libs/",
|
|
14468
13984
|
containerFormat: "auto",
|
|
14469
|
-
// 'basis' || 'ktx2' || 'auto'
|
|
14470
13985
|
module: "transcoder"
|
|
14471
|
-
// 'transcoder' || 'encoder'
|
|
14472
13986
|
}
|
|
14473
13987
|
}
|
|
14474
13988
|
};
|
|
@@ -14504,10 +14018,8 @@ var __exports__ = (() => {
|
|
|
14504
14018
|
const version = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN2);
|
|
14505
14019
|
const byteLength = dataView.getUint32(byteOffset + 8, LITTLE_ENDIAN2);
|
|
14506
14020
|
Object.assign(glb, {
|
|
14507
|
-
// Put less important stuff in a header, to avoid clutter
|
|
14508
14021
|
header: {
|
|
14509
14022
|
byteOffset,
|
|
14510
|
-
// Byte offset into the initial arrayBuffer
|
|
14511
14023
|
byteLength,
|
|
14512
14024
|
hasBinChunk: false
|
|
14513
14025
|
},
|
|
@@ -14584,7 +14096,6 @@ var __exports__ = (() => {
|
|
|
14584
14096
|
byteOffset,
|
|
14585
14097
|
byteLength: chunkLength,
|
|
14586
14098
|
arrayBuffer: dataView.buffer
|
|
14587
|
-
// TODO - copy, or create typed array view?
|
|
14588
14099
|
});
|
|
14589
14100
|
return padToNBytes(chunkLength, 4);
|
|
14590
14101
|
}
|
|
@@ -14615,23 +14126,19 @@ var __exports__ = (() => {
|
|
|
14615
14126
|
var detector = new Uint8Array([0, 97, 115, 109, 1, 0, 0, 0, 1, 4, 1, 96, 0, 0, 3, 3, 2, 0, 0, 5, 3, 1, 0, 1, 12, 1, 0, 10, 22, 2, 12, 0, 65, 0, 65, 0, 65, 0, 252, 10, 0, 0, 11, 7, 0, 65, 0, 253, 15, 26, 11]);
|
|
14616
14127
|
var wasmpack = new Uint8Array([32, 0, 65, 253, 3, 1, 2, 34, 4, 106, 6, 5, 11, 8, 7, 20, 13, 33, 12, 16, 128, 9, 116, 64, 19, 113, 127, 15, 10, 21, 22, 14, 255, 66, 24, 54, 136, 107, 18, 23, 192, 26, 114, 118, 132, 17, 77, 101, 130, 144, 27, 87, 131, 44, 45, 74, 156, 154, 70, 167]);
|
|
14617
14128
|
var FILTERS = {
|
|
14618
|
-
// legacy index-based enums for glTF
|
|
14619
14129
|
0: "",
|
|
14620
14130
|
1: "meshopt_decodeFilterOct",
|
|
14621
14131
|
2: "meshopt_decodeFilterQuat",
|
|
14622
14132
|
3: "meshopt_decodeFilterExp",
|
|
14623
|
-
// string-based enums for glTF
|
|
14624
14133
|
NONE: "",
|
|
14625
14134
|
OCTAHEDRAL: "meshopt_decodeFilterOct",
|
|
14626
14135
|
QUATERNION: "meshopt_decodeFilterQuat",
|
|
14627
14136
|
EXPONENTIAL: "meshopt_decodeFilterExp"
|
|
14628
14137
|
};
|
|
14629
14138
|
var DECODERS = {
|
|
14630
|
-
// legacy index-based enums for glTF
|
|
14631
14139
|
0: "meshopt_decodeVertexBuffer",
|
|
14632
14140
|
1: "meshopt_decodeIndexBuffer",
|
|
14633
14141
|
2: "meshopt_decodeIndexSequence",
|
|
14634
|
-
// string-based enums for glTF
|
|
14635
14142
|
ATTRIBUTES: "meshopt_decodeVertexBuffer",
|
|
14636
14143
|
TRIANGLES: "meshopt_decodeIndexBuffer",
|
|
14637
14144
|
INDICES: "meshopt_decodeIndexSequence"
|
|
@@ -14802,14 +14309,8 @@ var __exports__ = (() => {
|
|
|
14802
14309
|
count
|
|
14803
14310
|
} = getAccessorData(attribute);
|
|
14804
14311
|
const glTFAccessor = {
|
|
14805
|
-
// glTF Accessor values
|
|
14806
|
-
// TODO: Instead of a bufferView index we could have an actual buffer (typed array)
|
|
14807
|
-
// bufferView: null,
|
|
14808
|
-
// TODO: Deprecate `value` in favor of bufferView?
|
|
14809
|
-
// @ts-ignore
|
|
14810
14312
|
value: buffer,
|
|
14811
14313
|
size,
|
|
14812
|
-
// Decoded `type` (e.g. SCALAR)
|
|
14813
14314
|
byteOffset: 0,
|
|
14814
14315
|
count,
|
|
14815
14316
|
type: getAccessorTypeFromSize(size),
|
|
@@ -14926,14 +14427,11 @@ var __exports__ = (() => {
|
|
|
14926
14427
|
const glTFMesh = {
|
|
14927
14428
|
primitives: [{
|
|
14928
14429
|
attributes: fauxAccessors,
|
|
14929
|
-
// TODO - verify with spec
|
|
14930
14430
|
mode,
|
|
14931
|
-
// GL.POINTS
|
|
14932
14431
|
extensions: {
|
|
14933
14432
|
[KHR_DRACO_MESH_COMPRESSION]: {
|
|
14934
14433
|
bufferView: bufferViewIndex,
|
|
14935
14434
|
attributes: fauxAccessors
|
|
14936
|
-
// TODO - verify with spec
|
|
14937
14435
|
}
|
|
14938
14436
|
}
|
|
14939
14437
|
}]
|
|
@@ -15235,12 +14733,7 @@ var __exports__ = (() => {
|
|
|
15235
14733
|
for (const material of json.materials || []) {
|
|
15236
14734
|
const materialExtension = gltfScenegraph.getObjectExtension(material, KHR_TECHNIQUES_WEBGL);
|
|
15237
14735
|
if (materialExtension) {
|
|
15238
|
-
material.technique = Object.assign(
|
|
15239
|
-
{},
|
|
15240
|
-
materialExtension,
|
|
15241
|
-
// @ts-ignore
|
|
15242
|
-
techniques[materialExtension.technique]
|
|
15243
|
-
);
|
|
14736
|
+
material.technique = Object.assign({}, materialExtension, techniques[materialExtension.technique]);
|
|
15244
14737
|
material.technique.values = resolveValues(material.technique, gltfScenegraph);
|
|
15245
14738
|
}
|
|
15246
14739
|
gltfScenegraph.removeObjectExtension(material, KHR_TECHNIQUES_WEBGL);
|
|
@@ -15289,24 +14782,7 @@ var __exports__ = (() => {
|
|
|
15289
14782
|
}
|
|
15290
14783
|
|
|
15291
14784
|
// ../gltf/src/lib/api/gltf-extensions.ts
|
|
15292
|
-
var EXTENSIONS2 = [
|
|
15293
|
-
// 1.0
|
|
15294
|
-
// KHR_binary_gltf is handled separately - must be processed before other parsing starts
|
|
15295
|
-
// KHR_binary_gltf,
|
|
15296
|
-
// 2.0
|
|
15297
|
-
EXT_structural_metadata_exports,
|
|
15298
|
-
EXT_mesh_features_exports,
|
|
15299
|
-
EXT_meshopt_compression_exports,
|
|
15300
|
-
EXT_texture_webp_exports,
|
|
15301
|
-
// Basisu should come after webp, we want basisu to be preferred if both are provided
|
|
15302
|
-
KHR_texture_basisu_exports,
|
|
15303
|
-
KHR_draco_mesh_compression_exports,
|
|
15304
|
-
KHR_lights_punctual_exports,
|
|
15305
|
-
KHR_materials_unlit_exports,
|
|
15306
|
-
KHR_techniques_webgl_exports,
|
|
15307
|
-
KHR_texture_transform_exports,
|
|
15308
|
-
EXT_feature_metadata_exports
|
|
15309
|
-
];
|
|
14785
|
+
var EXTENSIONS2 = [EXT_structural_metadata_exports, EXT_mesh_features_exports, EXT_meshopt_compression_exports, EXT_texture_webp_exports, KHR_texture_basisu_exports, KHR_draco_mesh_compression_exports, KHR_lights_punctual_exports, KHR_materials_unlit_exports, KHR_techniques_webgl_exports, KHR_texture_transform_exports, EXT_feature_metadata_exports];
|
|
15310
14786
|
function preprocessExtensions(gltf, options = {}, context) {
|
|
15311
14787
|
const extensions = EXTENSIONS2.filter((extension) => useExtension(extension.name, options));
|
|
15312
14788
|
for (const extension of extensions) {
|
|
@@ -15389,13 +14865,6 @@ var __exports__ = (() => {
|
|
|
15389
14865
|
skins: {},
|
|
15390
14866
|
textures: {}
|
|
15391
14867
|
};
|
|
15392
|
-
// constructor() {}
|
|
15393
|
-
/**
|
|
15394
|
-
* Convert (normalize) glTF < 2.0 to glTF 2.0
|
|
15395
|
-
* @param gltf - object with json and binChunks
|
|
15396
|
-
* @param options
|
|
15397
|
-
* @param options normalize Whether to actually normalize
|
|
15398
|
-
*/
|
|
15399
14868
|
normalize(gltf, options) {
|
|
15400
14869
|
this.json = gltf.json;
|
|
15401
14870
|
const json = gltf.json;
|
|
@@ -15420,7 +14889,6 @@ var __exports__ = (() => {
|
|
|
15420
14889
|
this._updateObjects(json);
|
|
15421
14890
|
this._updateMaterial(json);
|
|
15422
14891
|
}
|
|
15423
|
-
// asset is now required, #642 https://github.com/KhronosGroup/glTF/issues/639
|
|
15424
14892
|
_addAsset(json) {
|
|
15425
14893
|
json.asset = json.asset || {};
|
|
15426
14894
|
json.asset.version = "2.0";
|
|
@@ -15431,7 +14899,6 @@ var __exports__ = (() => {
|
|
|
15431
14899
|
this._convertTopLevelObjectToArray(json, arrayName);
|
|
15432
14900
|
}
|
|
15433
14901
|
}
|
|
15434
|
-
/** Convert one top level object to array */
|
|
15435
14902
|
_convertTopLevelObjectToArray(json, mapName) {
|
|
15436
14903
|
const objectMap = json[mapName];
|
|
15437
14904
|
if (!objectMap || Array.isArray(objectMap)) {
|
|
@@ -15446,7 +14913,6 @@ var __exports__ = (() => {
|
|
|
15446
14913
|
this.idToIndexMap[mapName][id] = index;
|
|
15447
14914
|
}
|
|
15448
14915
|
}
|
|
15449
|
-
/** Go through all objects in all top-level arrays and replace ids with indices */
|
|
15450
14916
|
_convertObjectIdsToArrayIndices(json) {
|
|
15451
14917
|
for (const arrayName in GLTF_ARRAYS) {
|
|
15452
14918
|
this._convertIdsToIndices(json, arrayName);
|
|
@@ -15503,7 +14969,6 @@ var __exports__ = (() => {
|
|
|
15503
14969
|
scene.nodes = scene.nodes.map((node2) => this._convertIdToIndex(node2, "node"));
|
|
15504
14970
|
}
|
|
15505
14971
|
}
|
|
15506
|
-
/** Go through all objects in a top-level array and replace ids with indices */
|
|
15507
14972
|
_convertIdsToIndices(json, topLevelArrayName) {
|
|
15508
14973
|
if (!json[topLevelArrayName]) {
|
|
15509
14974
|
console.warn(`gltf v1: json doesn't contain attribute ${topLevelArrayName}`);
|
|
@@ -15528,19 +14993,11 @@ var __exports__ = (() => {
|
|
|
15528
14993
|
}
|
|
15529
14994
|
return id;
|
|
15530
14995
|
}
|
|
15531
|
-
/**
|
|
15532
|
-
*
|
|
15533
|
-
* @param {*} json
|
|
15534
|
-
*/
|
|
15535
14996
|
_updateObjects(json) {
|
|
15536
14997
|
for (const buffer of this.json.buffers) {
|
|
15537
14998
|
delete buffer.type;
|
|
15538
14999
|
}
|
|
15539
15000
|
}
|
|
15540
|
-
/**
|
|
15541
|
-
* Update material (set pbrMetallicRoughness)
|
|
15542
|
-
* @param {*} json
|
|
15543
|
-
*/
|
|
15544
15001
|
_updateMaterial(json) {
|
|
15545
15002
|
for (const material of json.materials) {
|
|
15546
15003
|
material.pbrMetallicRoughness = {
|
|
@@ -15686,7 +15143,6 @@ var __exports__ = (() => {
|
|
|
15686
15143
|
if (parsedImage && parsedImage[0]) {
|
|
15687
15144
|
parsedImage = {
|
|
15688
15145
|
compressed: true,
|
|
15689
|
-
// @ts-expect-error
|
|
15690
15146
|
mipmaps: false,
|
|
15691
15147
|
width: parsedImage[0].width,
|
|
15692
15148
|
height: parsedImage[0].height,
|
|
@@ -15712,17 +15168,11 @@ var __exports__ = (() => {
|
|
|
15712
15168
|
options: {
|
|
15713
15169
|
gltf: {
|
|
15714
15170
|
normalize: true,
|
|
15715
|
-
// Normalize glTF v1 to glTF v2 format (not yet stable)
|
|
15716
15171
|
loadBuffers: true,
|
|
15717
|
-
// Fetch any linked .BIN buffers, decode base64
|
|
15718
15172
|
loadImages: true,
|
|
15719
|
-
// Create image objects
|
|
15720
15173
|
decompressMeshes: true
|
|
15721
|
-
// Decompress Draco encoded meshes
|
|
15722
15174
|
},
|
|
15723
|
-
// common?
|
|
15724
15175
|
log: console
|
|
15725
|
-
// eslint-disable-line
|
|
15726
15176
|
},
|
|
15727
15177
|
deprecatedOptions: {
|
|
15728
15178
|
fetchImages: "gltf.loadImages",
|
|
@@ -15763,25 +15213,17 @@ var __exports__ = (() => {
|
|
|
15763
15213
|
};
|
|
15764
15214
|
var BYTES2 = {
|
|
15765
15215
|
5120: 1,
|
|
15766
|
-
// BYTE
|
|
15767
15216
|
5121: 1,
|
|
15768
|
-
// UNSIGNED_BYTE
|
|
15769
15217
|
5122: 2,
|
|
15770
|
-
// SHORT
|
|
15771
15218
|
5123: 2,
|
|
15772
|
-
// UNSIGNED_SHORT
|
|
15773
15219
|
5125: 4,
|
|
15774
|
-
// UNSIGNED_INT
|
|
15775
15220
|
5126: 4
|
|
15776
|
-
// FLOAT
|
|
15777
15221
|
};
|
|
15778
15222
|
var GL_SAMPLER = {
|
|
15779
|
-
// Sampler parameters
|
|
15780
15223
|
TEXTURE_MAG_FILTER: 10240,
|
|
15781
15224
|
TEXTURE_MIN_FILTER: 10241,
|
|
15782
15225
|
TEXTURE_WRAP_S: 10242,
|
|
15783
15226
|
TEXTURE_WRAP_T: 10243,
|
|
15784
|
-
// Sampler default values
|
|
15785
15227
|
REPEAT: 10497,
|
|
15786
15228
|
LINEAR: 9729,
|
|
15787
15229
|
NEAREST_MIPMAP_LINEAR: 9986
|
|
@@ -15812,8 +15254,6 @@ var __exports__ = (() => {
|
|
|
15812
15254
|
}
|
|
15813
15255
|
var GLTFPostProcessor = class {
|
|
15814
15256
|
baseUri = "";
|
|
15815
|
-
// @ts-expect-error
|
|
15816
|
-
// @ts-expect-error
|
|
15817
15257
|
buffers = [];
|
|
15818
15258
|
images = [];
|
|
15819
15259
|
postProcess(gltf, options = {}) {
|
|
@@ -15833,9 +15273,6 @@ var __exports__ = (() => {
|
|
|
15833
15273
|
this.json = this._resolveTree(gltf.json, options);
|
|
15834
15274
|
return this.json;
|
|
15835
15275
|
}
|
|
15836
|
-
// Convert indexed glTF structure into tree structure
|
|
15837
|
-
// cross-link index resolution, enum lookup, convenience calculations
|
|
15838
|
-
// eslint-disable-next-line complexity, max-statements
|
|
15839
15276
|
_resolveTree(gltf, options = {}) {
|
|
15840
15277
|
const json = {
|
|
15841
15278
|
...gltf
|
|
@@ -15923,11 +15360,9 @@ var __exports__ = (() => {
|
|
|
15923
15360
|
}
|
|
15924
15361
|
return object;
|
|
15925
15362
|
}
|
|
15926
|
-
// PARSING HELPERS
|
|
15927
15363
|
_resolveScene(scene, index) {
|
|
15928
15364
|
return {
|
|
15929
15365
|
...scene,
|
|
15930
|
-
// @ts-ignore
|
|
15931
15366
|
id: scene.id || `scene-${index}`,
|
|
15932
15367
|
nodes: (scene.nodes || []).map((node2) => this.getNode(node2))
|
|
15933
15368
|
};
|
|
@@ -15935,7 +15370,6 @@ var __exports__ = (() => {
|
|
|
15935
15370
|
_resolveNode(gltfNode, index) {
|
|
15936
15371
|
const node2 = {
|
|
15937
15372
|
...gltfNode,
|
|
15938
|
-
// @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
15939
15373
|
id: gltfNode?.id || `node-${index}`
|
|
15940
15374
|
};
|
|
15941
15375
|
if (gltfNode.mesh !== void 0) {
|
|
@@ -16005,7 +15439,6 @@ var __exports__ = (() => {
|
|
|
16005
15439
|
_resolveMaterial(gltfMaterial, index) {
|
|
16006
15440
|
const material = {
|
|
16007
15441
|
...gltfMaterial,
|
|
16008
|
-
// @ts-expect-error
|
|
16009
15442
|
id: gltfMaterial.id || `material-${index}`
|
|
16010
15443
|
};
|
|
16011
15444
|
if (material.normalTexture) {
|
|
@@ -16055,7 +15488,6 @@ var __exports__ = (() => {
|
|
|
16055
15488
|
const bytesPerElement = bytesPerComponent * components;
|
|
16056
15489
|
const accessor = {
|
|
16057
15490
|
...gltfAccessor,
|
|
16058
|
-
// @ts-expect-error
|
|
16059
15491
|
id: gltfAccessor.id || `accessor-${index}`,
|
|
16060
15492
|
bytesPerComponent,
|
|
16061
15493
|
components,
|
|
@@ -16082,16 +15514,6 @@ var __exports__ = (() => {
|
|
|
16082
15514
|
}
|
|
16083
15515
|
return accessor;
|
|
16084
15516
|
}
|
|
16085
|
-
/**
|
|
16086
|
-
* Take values of particular accessor from interleaved buffer
|
|
16087
|
-
* various parts of the buffer
|
|
16088
|
-
* @param buffer
|
|
16089
|
-
* @param byteOffset
|
|
16090
|
-
* @param byteStride
|
|
16091
|
-
* @param bytesPerElement
|
|
16092
|
-
* @param count
|
|
16093
|
-
* @returns
|
|
16094
|
-
*/
|
|
16095
15517
|
_getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {
|
|
16096
15518
|
const result = new Uint8Array(count * bytesPerElement);
|
|
16097
15519
|
for (let i2 = 0; i2 < count; i2++) {
|
|
@@ -16103,7 +15525,6 @@ var __exports__ = (() => {
|
|
|
16103
15525
|
_resolveTexture(gltfTexture, index) {
|
|
16104
15526
|
return {
|
|
16105
15527
|
...gltfTexture,
|
|
16106
|
-
// @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
16107
15528
|
id: gltfTexture.id || `texture-${index}`,
|
|
16108
15529
|
sampler: typeof gltfTexture.sampler === "number" ? this.getSampler(gltfTexture.sampler) : makeDefaultSampler(),
|
|
16109
15530
|
source: typeof gltfTexture.source === "number" ? this.getImage(gltfTexture.source) : void 0
|
|
@@ -16111,7 +15532,6 @@ var __exports__ = (() => {
|
|
|
16111
15532
|
}
|
|
16112
15533
|
_resolveSampler(gltfSampler, index) {
|
|
16113
15534
|
const sampler = {
|
|
16114
|
-
// @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
16115
15535
|
id: gltfSampler.id || `sampler-${index}`,
|
|
16116
15536
|
...gltfSampler,
|
|
16117
15537
|
parameters: {}
|
|
@@ -16130,7 +15550,6 @@ var __exports__ = (() => {
|
|
|
16130
15550
|
_resolveImage(gltfImage, index) {
|
|
16131
15551
|
const image = {
|
|
16132
15552
|
...gltfImage,
|
|
16133
|
-
// @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
16134
15553
|
id: gltfImage.id || `image-${index}`,
|
|
16135
15554
|
image: null,
|
|
16136
15555
|
bufferView: gltfImage.bufferView !== void 0 ? this.getBufferView(gltfImage.bufferView) : void 0
|
|
@@ -16149,10 +15568,8 @@ var __exports__ = (() => {
|
|
|
16149
15568
|
byteOffset += gltfBufferView.byteOffset;
|
|
16150
15569
|
}
|
|
16151
15570
|
const bufferView = {
|
|
16152
|
-
// // @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
16153
15571
|
id: `bufferView-${index}`,
|
|
16154
15572
|
...gltfBufferView,
|
|
16155
|
-
// ...this.buffers[bufferIndex],
|
|
16156
15573
|
buffer: this.buffers[bufferIndex],
|
|
16157
15574
|
data: new Uint8Array(arrayBuffer, byteOffset, gltfBufferView.byteLength)
|
|
16158
15575
|
};
|
|
@@ -16161,7 +15578,6 @@ var __exports__ = (() => {
|
|
|
16161
15578
|
_resolveCamera(gltfCamera, index) {
|
|
16162
15579
|
const camera = {
|
|
16163
15580
|
...gltfCamera,
|
|
16164
|
-
// @ts-expect-error id could already be present, glTF standard does not prevent it
|
|
16165
15581
|
id: gltfCamera.id || `camera-${index}`
|
|
16166
15582
|
};
|
|
16167
15583
|
if (camera.perspective) {
|
|
@@ -18827,7 +18243,6 @@ var __exports__ = (() => {
|
|
|
18827
18243
|
...Tiles3DLoader,
|
|
18828
18244
|
id: "cesium-ion",
|
|
18829
18245
|
name: "Cesium Ion",
|
|
18830
|
-
// @ts-ignore
|
|
18831
18246
|
preload,
|
|
18832
18247
|
parse: async (data, options, context) => {
|
|
18833
18248
|
options = {
|
|
@@ -19014,7 +18429,6 @@ var __exports__ = (() => {
|
|
|
19014
18429
|
hash
|
|
19015
18430
|
});
|
|
19016
18431
|
}
|
|
19017
|
-
// HELPERS
|
|
19018
18432
|
async concatenate(asyncIterator) {
|
|
19019
18433
|
return await concatenateArrayBuffersAsync(asyncIterator);
|
|
19020
18434
|
}
|
|
@@ -19506,15 +18920,8 @@ var __exports__ = (() => {
|
|
|
19506
18920
|
super();
|
|
19507
18921
|
this.options = options;
|
|
19508
18922
|
}
|
|
19509
|
-
/**
|
|
19510
|
-
* Atomic hash calculation
|
|
19511
|
-
* @returns base64 encoded hash
|
|
19512
|
-
*/
|
|
19513
18923
|
async hash(input, encoding) {
|
|
19514
|
-
const md5Promise = new Promise((resolve2, reject) => (
|
|
19515
|
-
// @ts-expect-error
|
|
19516
|
-
md5WASM(input).then(resolve2).catch(reject)
|
|
19517
|
-
));
|
|
18924
|
+
const md5Promise = new Promise((resolve2, reject) => md5WASM(input).then(resolve2).catch(reject));
|
|
19518
18925
|
const hex = await md5Promise;
|
|
19519
18926
|
return encodeHex(hex, encoding);
|
|
19520
18927
|
}
|
|
@@ -19554,39 +18961,31 @@ var __exports__ = (() => {
|
|
|
19554
18961
|
this.compressBatches = this.compressBatches.bind(this);
|
|
19555
18962
|
this.decompressBatches = this.decompressBatches.bind(this);
|
|
19556
18963
|
}
|
|
19557
|
-
/** Preloads any dynamic libraries. May enable sync functions */
|
|
19558
18964
|
async preload() {
|
|
19559
18965
|
return;
|
|
19560
18966
|
}
|
|
19561
|
-
/** Asynchronously compress data */
|
|
19562
18967
|
async compress(input) {
|
|
19563
18968
|
await this.preload();
|
|
19564
18969
|
return this.compressSync(input);
|
|
19565
18970
|
}
|
|
19566
|
-
/** Asynchronously decompress data */
|
|
19567
18971
|
async decompress(input, size) {
|
|
19568
18972
|
await this.preload();
|
|
19569
18973
|
return this.decompressSync(input, size);
|
|
19570
18974
|
}
|
|
19571
|
-
/** Synchronously compress data */
|
|
19572
18975
|
compressSync(input) {
|
|
19573
18976
|
throw new Error(`${this.name}: sync compression not supported`);
|
|
19574
18977
|
}
|
|
19575
|
-
/** Synchronously compress data */
|
|
19576
18978
|
decompressSync(input, size) {
|
|
19577
18979
|
throw new Error(`${this.name}: sync decompression not supported`);
|
|
19578
18980
|
}
|
|
19579
|
-
/** Compress batches */
|
|
19580
18981
|
async *compressBatches(asyncIterator) {
|
|
19581
18982
|
const input = await this.concatenate(asyncIterator);
|
|
19582
18983
|
yield this.compress(input);
|
|
19583
18984
|
}
|
|
19584
|
-
/** Decompress batches */
|
|
19585
18985
|
async *decompressBatches(asyncIterator) {
|
|
19586
18986
|
const input = await this.concatenate(asyncIterator);
|
|
19587
18987
|
yield this.decompress(input);
|
|
19588
18988
|
}
|
|
19589
|
-
// HELPERS
|
|
19590
18989
|
concatenate(asyncIterator) {
|
|
19591
18990
|
return concatenateArrayBuffersAsync(asyncIterator);
|
|
19592
18991
|
}
|
|
@@ -19711,26 +19110,16 @@ var __exports__ = (() => {
|
|
|
19711
19110
|
this._chunks = [];
|
|
19712
19111
|
return chunks;
|
|
19713
19112
|
}
|
|
19714
|
-
// TODO - For some reason we don't get the error message from pako in _onEnd?
|
|
19715
19113
|
_getError(code = 0) {
|
|
19716
19114
|
const MESSAGES = {
|
|
19717
|
-
/* Z_NEED_DICT 2 */
|
|
19718
19115
|
2: "need dictionary",
|
|
19719
|
-
/* Z_STREAM_END 1 */
|
|
19720
19116
|
1: "stream end",
|
|
19721
|
-
/* Z_OK 0 */
|
|
19722
19117
|
0: "",
|
|
19723
|
-
/* Z_ERRNO (-1) */
|
|
19724
19118
|
"-1": "file error",
|
|
19725
|
-
/* Z_STREAM_ERROR (-2) */
|
|
19726
19119
|
"-2": "stream error",
|
|
19727
|
-
/* Z_DATA_ERROR (-3) */
|
|
19728
19120
|
"-3": "data error",
|
|
19729
|
-
/* Z_MEM_ERROR (-4) */
|
|
19730
19121
|
"-4": "insufficient memory",
|
|
19731
|
-
/* Z_BUF_ERROR (-5) */
|
|
19732
19122
|
"-5": "buffer error",
|
|
19733
|
-
/* Z_VERSION_ERROR (-6) */
|
|
19734
19123
|
"-6": "incompatible version"
|
|
19735
19124
|
};
|
|
19736
19125
|
return `${this.name}: ${MESSAGES[code]}`;
|
|
@@ -19739,9 +19128,7 @@ var __exports__ = (() => {
|
|
|
19739
19128
|
|
|
19740
19129
|
// ../zip/src/filesystems/zip-filesystem.ts
|
|
19741
19130
|
var COMPRESSION_METHODS = {
|
|
19742
|
-
/** No compression */
|
|
19743
19131
|
0: async (compressedFile) => compressedFile,
|
|
19744
|
-
/** Deflation */
|
|
19745
19132
|
8: async (compressedFile) => {
|
|
19746
19133
|
const compression = new DeflateCompression({
|
|
19747
19134
|
raw: true
|
|
@@ -19751,12 +19138,7 @@ var __exports__ = (() => {
|
|
|
19751
19138
|
}
|
|
19752
19139
|
};
|
|
19753
19140
|
var ZipFileSystem = class {
|
|
19754
|
-
/** FileProvider instance promise */
|
|
19755
19141
|
fileProvider = null;
|
|
19756
|
-
/**
|
|
19757
|
-
* Constructor
|
|
19758
|
-
* @param file - instance of FileProvider or file path string
|
|
19759
|
-
*/
|
|
19760
19142
|
constructor(file) {
|
|
19761
19143
|
if (typeof file === "string") {
|
|
19762
19144
|
this.fileName = file;
|
|
@@ -19769,16 +19151,11 @@ var __exports__ = (() => {
|
|
|
19769
19151
|
this.fileProvider = file;
|
|
19770
19152
|
}
|
|
19771
19153
|
}
|
|
19772
|
-
/** Clean up resources */
|
|
19773
19154
|
async destroy() {
|
|
19774
19155
|
if (this.fileProvider) {
|
|
19775
19156
|
await this.fileProvider.destroy();
|
|
19776
19157
|
}
|
|
19777
19158
|
}
|
|
19778
|
-
/**
|
|
19779
|
-
* Get file names list from zip archive
|
|
19780
|
-
* @returns array of file names
|
|
19781
|
-
*/
|
|
19782
19159
|
async readdir() {
|
|
19783
19160
|
if (!this.fileProvider) {
|
|
19784
19161
|
throw new Error("No data detected in the zip archive");
|
|
@@ -19790,11 +19167,6 @@ var __exports__ = (() => {
|
|
|
19790
19167
|
}
|
|
19791
19168
|
return fileNames;
|
|
19792
19169
|
}
|
|
19793
|
-
/**
|
|
19794
|
-
* Get file metadata
|
|
19795
|
-
* @param filename - name of a file
|
|
19796
|
-
* @returns central directory data
|
|
19797
|
-
*/
|
|
19798
19170
|
async stat(filename2) {
|
|
19799
19171
|
const cdFileHeader = await this.getCDFileHeader(filename2);
|
|
19800
19172
|
return {
|
|
@@ -19802,11 +19174,6 @@ var __exports__ = (() => {
|
|
|
19802
19174
|
size: Number(cdFileHeader.uncompressedSize)
|
|
19803
19175
|
};
|
|
19804
19176
|
}
|
|
19805
|
-
/**
|
|
19806
|
-
* Implementation of fetch against this file system
|
|
19807
|
-
* @param filename - name of a file
|
|
19808
|
-
* @returns - Response with file data
|
|
19809
|
-
*/
|
|
19810
19177
|
async fetch(filename2) {
|
|
19811
19178
|
if (!this.fileProvider) {
|
|
19812
19179
|
throw new Error("No data detected in the zip archive");
|
|
@@ -19828,11 +19195,6 @@ var __exports__ = (() => {
|
|
|
19828
19195
|
});
|
|
19829
19196
|
return response;
|
|
19830
19197
|
}
|
|
19831
|
-
/**
|
|
19832
|
-
* Get central directory file header
|
|
19833
|
-
* @param filename - name of a file
|
|
19834
|
-
* @returns central directory file header
|
|
19835
|
-
*/
|
|
19836
19198
|
async getCDFileHeader(filename2) {
|
|
19837
19199
|
if (!this.fileProvider) {
|
|
19838
19200
|
throw new Error("No data detected in the zip archive");
|
|
@@ -19854,30 +19216,16 @@ var __exports__ = (() => {
|
|
|
19854
19216
|
|
|
19855
19217
|
// src/3d-tiles-archive/3d-tiles-archive-archive.ts
|
|
19856
19218
|
var COMPRESSION_METHODS2 = {
|
|
19857
|
-
/** No compression */
|
|
19858
19219
|
0: (data) => new NoCompression().decompress(data),
|
|
19859
|
-
/** Deflation */
|
|
19860
19220
|
8: (data) => new DeflateCompression({
|
|
19861
19221
|
raw: true
|
|
19862
19222
|
}).decompress(data)
|
|
19863
19223
|
};
|
|
19864
19224
|
var Tiles3DArchive = class {
|
|
19865
|
-
/** FileProvider with whe whole file */
|
|
19866
|
-
/** hash info */
|
|
19867
|
-
/**
|
|
19868
|
-
* creates Tiles3DArchive handler
|
|
19869
|
-
* @param fileProvider - FileProvider with the whole file
|
|
19870
|
-
* @param hashTable - hash info
|
|
19871
|
-
*/
|
|
19872
19225
|
constructor(fileProvider, hashTable) {
|
|
19873
19226
|
this.fileProvider = fileProvider;
|
|
19874
19227
|
this.hashTable = hashTable;
|
|
19875
19228
|
}
|
|
19876
|
-
/**
|
|
19877
|
-
* Returns file with the given path from 3tz archive
|
|
19878
|
-
* @param path - path inside the 3tz
|
|
19879
|
-
* @returns buffer with ready to use file
|
|
19880
|
-
*/
|
|
19881
19229
|
async getFile(path) {
|
|
19882
19230
|
let data = await this.getFileBytes(path.toLocaleLowerCase());
|
|
19883
19231
|
if (!data) {
|
|
@@ -19888,11 +19236,6 @@ var __exports__ = (() => {
|
|
|
19888
19236
|
}
|
|
19889
19237
|
return data;
|
|
19890
19238
|
}
|
|
19891
|
-
/**
|
|
19892
|
-
* Trying to get raw file data by adress
|
|
19893
|
-
* @param path - path inside the archive
|
|
19894
|
-
* @returns buffer with the raw file data
|
|
19895
|
-
*/
|
|
19896
19239
|
async getFileBytes(path) {
|
|
19897
19240
|
const arrayBuffer = new TextEncoder().encode(path).buffer;
|
|
19898
19241
|
const nameHash = await new MD5Hash().hash(arrayBuffer, "hex");
|
|
@@ -19952,20 +19295,9 @@ var __exports__ = (() => {
|
|
|
19952
19295
|
|
|
19953
19296
|
// src/lib/filesystems/tiles-3d-archive-file-system.ts
|
|
19954
19297
|
var Tiles3DArchiveFileSystem = class extends ZipFileSystem {
|
|
19955
|
-
/**
|
|
19956
|
-
* Constructor
|
|
19957
|
-
* @param file - instance of FileProvider or file path string
|
|
19958
|
-
*/
|
|
19959
19298
|
constructor(file) {
|
|
19960
19299
|
super(file);
|
|
19961
19300
|
}
|
|
19962
|
-
/**
|
|
19963
|
-
* Implementation of fetch against this file system.
|
|
19964
|
-
* It tries to take `@3dtilesIndex1@` file from the archive and use it
|
|
19965
|
-
* for faster access to archived files
|
|
19966
|
-
* @param filename - name of a file
|
|
19967
|
-
* @returns - Response with file data
|
|
19968
|
-
*/
|
|
19969
19301
|
async fetch(filename2) {
|
|
19970
19302
|
const fileProvider = this.fileProvider;
|
|
19971
19303
|
if (!fileProvider) {
|
|
@@ -19983,11 +19315,6 @@ var __exports__ = (() => {
|
|
|
19983
19315
|
}
|
|
19984
19316
|
return super.fetch(filename2);
|
|
19985
19317
|
}
|
|
19986
|
-
/**
|
|
19987
|
-
* Try to get and parse '@3dtilesIndex1@' file, that allows to get direct access
|
|
19988
|
-
* to files inside the archive
|
|
19989
|
-
* @returns void
|
|
19990
|
-
*/
|
|
19991
19318
|
async parseHashTable() {
|
|
19992
19319
|
if (this.hashTable !== void 0) {
|
|
19993
19320
|
return;
|