@loaders.gl/3d-tiles 4.0.0-beta.3 → 4.0.0-beta.4

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.
Files changed (2) hide show
  1. package/dist/dist.dev.js +31 -650
  2. 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] = // eslint-disable-next-line @typescript-eslint/no-misused-promises
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(global_2, scriptSource);
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 = /* @__PURE__ */ function(TILE_REFINEMENT2) {
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 = /* @__PURE__ */ function(TILE_TYPE2) {
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 = /* @__PURE__ */ function(TILESET_TYPE2) {
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 = /* @__PURE__ */ function(LOD_METRIC_TYPE2) {
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(_parseImageNode);
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 _parseImageNode2 = globalThis._parseImageNode;
12356
- assert2(_parseImageNode2);
12357
- return await _parseImageNode2(arrayBuffer, mimeType);
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
- _parseImageNode: _parseImageNode2,
12436
- _imageFormatsNode = NODE_FORMAT_SUPPORT
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
- // @ts-ignore
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
  }
@@ -13582,10 +13233,7 @@ var __exports__ = (() => {
13582
13233
  return data;
13583
13234
  }
13584
13235
  function getArrayOffsetsForProperty(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
13585
- if (classProperty.array && // `count` is a number of array elements. May only be defined when `array` is true.
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") {
13236
+ if (classProperty.array && typeof classProperty.count === "undefined" && typeof propertyTableProperty.arrayOffsets !== "undefined") {
13589
13237
  return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsets, propertyTableProperty.arrayOffsetType || "UINT32", numberOfElements);
13590
13238
  }
13591
13239
  return null;
@@ -13603,13 +13251,7 @@ var __exports__ = (() => {
13603
13251
  const elementCount = valuesDataBytes.byteLength / elementSize;
13604
13252
  let valuesData;
13605
13253
  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
- );
13254
+ valuesData = convertRawBufferToMetadataArray(valuesDataBytes, classProperty.type, classProperty.componentType, elementCount);
13613
13255
  } else {
13614
13256
  valuesData = valuesDataBytes;
13615
13257
  }
@@ -13870,29 +13512,14 @@ var __exports__ = (() => {
13870
13512
  return data;
13871
13513
  }
13872
13514
  function getArrayOffsetsForProperty2(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
13873
- if (classProperty.type === "ARRAY" && // `componentCount` is a number of fixed-length array elements.
13874
- // If `componentCount` is NOT defined, it's a VARIABLE-length array
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
- );
13515
+ if (classProperty.type === "ARRAY" && typeof classProperty.componentCount === "undefined" && typeof propertyTableProperty.arrayOffsetBufferView !== "undefined") {
13516
+ return getOffsetsForProperty(scenegraph, propertyTableProperty.arrayOffsetBufferView, propertyTableProperty.offsetType || "UINT32", numberOfElements);
13884
13517
  }
13885
13518
  return null;
13886
13519
  }
13887
13520
  function getStringOffsetsForProperty2(scenegraph, classProperty, propertyTableProperty, numberOfElements) {
13888
13521
  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
- );
13522
+ return getOffsetsForProperty(scenegraph, propertyTableProperty.stringOffsetBufferView, propertyTableProperty.offsetType || "UINT32", numberOfElements);
13896
13523
  }
13897
13524
  return null;
13898
13525
  }
@@ -13952,13 +13579,9 @@ var __exports__ = (() => {
13952
13579
 
13953
13580
  // ../textures/src/lib/parsers/basis-module-loader.ts
13954
13581
  var BASIS_EXTERNAL_LIBRARIES = {
13955
- /** Basis transcoder, javascript wrapper part */
13956
13582
  TRANSCODER: "basis_transcoder.js",
13957
- /** Basis transcoder, compiled web assembly part */
13958
13583
  TRANSCODER_WASM: "basis_transcoder.wasm",
13959
- /** Basis encoder, javascript wrapper part */
13960
13584
  ENCODER: "basis_encoder.js",
13961
- /** Basis encoder, compiled web assembly part */
13962
13585
  ENCODER_WASM: "basis_encoder.wasm"
13963
13586
  };
13964
13587
  var loadBasisTranscoderPromise;
@@ -14036,12 +13659,10 @@ var __exports__ = (() => {
14036
13659
 
14037
13660
  // ../textures/src/lib/gl-extensions.ts
14038
13661
  var GL_EXTENSIONS_CONSTANTS = {
14039
- // WEBGL_compressed_texture_s3tc
14040
13662
  COMPRESSED_RGB_S3TC_DXT1_EXT: 33776,
14041
13663
  COMPRESSED_RGBA_S3TC_DXT1_EXT: 33777,
14042
13664
  COMPRESSED_RGBA_S3TC_DXT3_EXT: 33778,
14043
13665
  COMPRESSED_RGBA_S3TC_DXT5_EXT: 33779,
14044
- // WEBGL_compressed_texture_es3
14045
13666
  COMPRESSED_R11_EAC: 37488,
14046
13667
  COMPRESSED_SIGNED_R11_EAC: 37489,
14047
13668
  COMPRESSED_RG11_EAC: 37490,
@@ -14052,18 +13673,14 @@ var __exports__ = (() => {
14052
13673
  COMPRESSED_SRGB8_ALPHA8_ETC2_EAC: 37495,
14053
13674
  COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37496,
14054
13675
  COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2: 37497,
14055
- // WEBGL_compressed_texture_pvrtc
14056
13676
  COMPRESSED_RGB_PVRTC_4BPPV1_IMG: 35840,
14057
13677
  COMPRESSED_RGBA_PVRTC_4BPPV1_IMG: 35842,
14058
13678
  COMPRESSED_RGB_PVRTC_2BPPV1_IMG: 35841,
14059
13679
  COMPRESSED_RGBA_PVRTC_2BPPV1_IMG: 35843,
14060
- // WEBGL_compressed_texture_etc1
14061
13680
  COMPRESSED_RGB_ETC1_WEBGL: 36196,
14062
- // WEBGL_compressed_texture_atc
14063
13681
  COMPRESSED_RGB_ATC_WEBGL: 35986,
14064
13682
  COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL: 35987,
14065
13683
  COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL: 34798,
14066
- // WEBGL_compressed_texture_astc
14067
13684
  COMPRESSED_RGBA_ASTC_4X4_KHR: 37808,
14068
13685
  COMPRESSED_RGBA_ASTC_5X4_KHR: 37809,
14069
13686
  COMPRESSED_RGBA_ASTC_5X5_KHR: 37810,
@@ -14092,12 +13709,10 @@ var __exports__ = (() => {
14092
13709
  COMPRESSED_SRGB8_ALPHA8_ASTC_10X10_KHR: 37851,
14093
13710
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X10_KHR: 37852,
14094
13711
  COMPRESSED_SRGB8_ALPHA8_ASTC_12X12_KHR: 37853,
14095
- // EXT_texture_compression_rgtc
14096
13712
  COMPRESSED_RED_RGTC1_EXT: 36283,
14097
13713
  COMPRESSED_SIGNED_RED_RGTC1_EXT: 36284,
14098
13714
  COMPRESSED_RED_GREEN_RGTC2_EXT: 36285,
14099
13715
  COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT: 36286,
14100
- // WEBGL_compressed_texture_s3tc_srgb
14101
13716
  COMPRESSED_SRGB_S3TC_DXT1_EXT: 35916,
14102
13717
  COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT: 35917,
14103
13718
  COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT: 35918,
@@ -14107,7 +13722,6 @@ var __exports__ = (() => {
14107
13722
  // ../textures/src/lib/utils/texture-formats.ts
14108
13723
  var BROWSER_PREFIXES = ["", "WEBKIT_", "MOZ_"];
14109
13724
  var WEBGL_EXTENSIONS = {
14110
- /* eslint-disable camelcase */
14111
13725
  WEBGL_compressed_texture_s3tc: "dxt",
14112
13726
  WEBGL_compressed_texture_s3tc_srgb: "dxt-srgb",
14113
13727
  WEBGL_compressed_texture_etc1: "etc1",
@@ -14116,7 +13730,6 @@ var __exports__ = (() => {
14116
13730
  WEBGL_compressed_texture_atc: "atc",
14117
13731
  WEBGL_compressed_texture_astc: "astc",
14118
13732
  EXT_texture_compression_rgtc: "rgtc"
14119
- /* eslint-enable camelcase */
14120
13733
  };
14121
13734
  var formats = null;
14122
13735
  function getSupportedGPUTextureFormats(gl) {
@@ -14172,35 +13785,10 @@ var __exports__ = (() => {
14172
13785
  }(f || (f = {}));
14173
13786
 
14174
13787
  // ../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
- ];
13788
+ var KTX2_ID = [171, 75, 84, 88, 32, 50, 48, 187, 13, 10, 26, 10];
14190
13789
  function isKTX(data) {
14191
13790
  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];
13791
+ 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
13792
  return !notKTX;
14205
13793
  }
14206
13794
 
@@ -14335,9 +13923,7 @@ var __exports__ = (() => {
14335
13923
  function transcodeImage(basisFile, imageIndex, levelIndex, options) {
14336
13924
  const width = basisFile.getImageWidth(imageIndex, levelIndex);
14337
13925
  const height = basisFile.getImageHeight(imageIndex, levelIndex);
14338
- const hasAlpha = basisFile.getHasAlpha(
14339
- /* imageIndex, levelIndex */
14340
- );
13926
+ const hasAlpha = basisFile.getHasAlpha();
14341
13927
  const {
14342
13928
  compressed,
14343
13929
  format,
@@ -14349,14 +13935,11 @@ var __exports__ = (() => {
14349
13935
  throw new Error("failed to start Basis transcoding");
14350
13936
  }
14351
13937
  return {
14352
- // standard loaders.gl image category payload
14353
13938
  width,
14354
13939
  height,
14355
13940
  data: decodedData,
14356
13941
  compressed,
14357
13942
  format,
14358
- // Additional fields
14359
- // Add levelSize field.
14360
13943
  hasAlpha
14361
13944
  };
14362
13945
  }
@@ -14391,26 +13974,14 @@ var __exports__ = (() => {
14391
13974
  } = getBasisOptions(options, alphaFlag);
14392
13975
  const decodedSize = ktx2File.getImageTranscodedSizeInBytes(levelIndex, 0, 0, basisFormat);
14393
13976
  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
- )) {
13977
+ if (!ktx2File.transcodeImage(decodedData, levelIndex, 0, 0, basisFormat, 0, -1, -1)) {
14405
13978
  throw new Error("Failed to transcode KTX2 image");
14406
13979
  }
14407
13980
  return {
14408
- // standard loaders.gl image category payload
14409
13981
  width,
14410
13982
  height,
14411
13983
  data: decodedData,
14412
13984
  compressed,
14413
- // Additional fields
14414
13985
  levelSize: decodedSize,
14415
13986
  hasAlpha: alphaFlag,
14416
13987
  format
@@ -14463,12 +14034,9 @@ var __exports__ = (() => {
14463
14034
  options: {
14464
14035
  basis: {
14465
14036
  format: "auto",
14466
- // gl context doesn't exist on a worker thread
14467
14037
  libraryPath: "libs/",
14468
14038
  containerFormat: "auto",
14469
- // 'basis' || 'ktx2' || 'auto'
14470
14039
  module: "transcoder"
14471
- // 'transcoder' || 'encoder'
14472
14040
  }
14473
14041
  }
14474
14042
  };
@@ -14504,10 +14072,8 @@ var __exports__ = (() => {
14504
14072
  const version = dataView.getUint32(byteOffset + 4, LITTLE_ENDIAN2);
14505
14073
  const byteLength = dataView.getUint32(byteOffset + 8, LITTLE_ENDIAN2);
14506
14074
  Object.assign(glb, {
14507
- // Put less important stuff in a header, to avoid clutter
14508
14075
  header: {
14509
14076
  byteOffset,
14510
- // Byte offset into the initial arrayBuffer
14511
14077
  byteLength,
14512
14078
  hasBinChunk: false
14513
14079
  },
@@ -14584,7 +14150,6 @@ var __exports__ = (() => {
14584
14150
  byteOffset,
14585
14151
  byteLength: chunkLength,
14586
14152
  arrayBuffer: dataView.buffer
14587
- // TODO - copy, or create typed array view?
14588
14153
  });
14589
14154
  return padToNBytes(chunkLength, 4);
14590
14155
  }
@@ -14615,23 +14180,19 @@ var __exports__ = (() => {
14615
14180
  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
14181
  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
14182
  var FILTERS = {
14618
- // legacy index-based enums for glTF
14619
14183
  0: "",
14620
14184
  1: "meshopt_decodeFilterOct",
14621
14185
  2: "meshopt_decodeFilterQuat",
14622
14186
  3: "meshopt_decodeFilterExp",
14623
- // string-based enums for glTF
14624
14187
  NONE: "",
14625
14188
  OCTAHEDRAL: "meshopt_decodeFilterOct",
14626
14189
  QUATERNION: "meshopt_decodeFilterQuat",
14627
14190
  EXPONENTIAL: "meshopt_decodeFilterExp"
14628
14191
  };
14629
14192
  var DECODERS = {
14630
- // legacy index-based enums for glTF
14631
14193
  0: "meshopt_decodeVertexBuffer",
14632
14194
  1: "meshopt_decodeIndexBuffer",
14633
14195
  2: "meshopt_decodeIndexSequence",
14634
- // string-based enums for glTF
14635
14196
  ATTRIBUTES: "meshopt_decodeVertexBuffer",
14636
14197
  TRIANGLES: "meshopt_decodeIndexBuffer",
14637
14198
  INDICES: "meshopt_decodeIndexSequence"
@@ -14802,14 +14363,8 @@ var __exports__ = (() => {
14802
14363
  count
14803
14364
  } = getAccessorData(attribute);
14804
14365
  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
14366
  value: buffer,
14811
14367
  size,
14812
- // Decoded `type` (e.g. SCALAR)
14813
14368
  byteOffset: 0,
14814
14369
  count,
14815
14370
  type: getAccessorTypeFromSize(size),
@@ -14926,14 +14481,11 @@ var __exports__ = (() => {
14926
14481
  const glTFMesh = {
14927
14482
  primitives: [{
14928
14483
  attributes: fauxAccessors,
14929
- // TODO - verify with spec
14930
14484
  mode,
14931
- // GL.POINTS
14932
14485
  extensions: {
14933
14486
  [KHR_DRACO_MESH_COMPRESSION]: {
14934
14487
  bufferView: bufferViewIndex,
14935
14488
  attributes: fauxAccessors
14936
- // TODO - verify with spec
14937
14489
  }
14938
14490
  }
14939
14491
  }]
@@ -15235,12 +14787,7 @@ var __exports__ = (() => {
15235
14787
  for (const material of json.materials || []) {
15236
14788
  const materialExtension = gltfScenegraph.getObjectExtension(material, KHR_TECHNIQUES_WEBGL);
15237
14789
  if (materialExtension) {
15238
- material.technique = Object.assign(
15239
- {},
15240
- materialExtension,
15241
- // @ts-ignore
15242
- techniques[materialExtension.technique]
15243
- );
14790
+ material.technique = Object.assign({}, materialExtension, techniques[materialExtension.technique]);
15244
14791
  material.technique.values = resolveValues(material.technique, gltfScenegraph);
15245
14792
  }
15246
14793
  gltfScenegraph.removeObjectExtension(material, KHR_TECHNIQUES_WEBGL);
@@ -15289,24 +14836,7 @@ var __exports__ = (() => {
15289
14836
  }
15290
14837
 
15291
14838
  // ../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
- ];
14839
+ 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
14840
  function preprocessExtensions(gltf, options = {}, context) {
15311
14841
  const extensions = EXTENSIONS2.filter((extension) => useExtension(extension.name, options));
15312
14842
  for (const extension of extensions) {
@@ -15389,13 +14919,6 @@ var __exports__ = (() => {
15389
14919
  skins: {},
15390
14920
  textures: {}
15391
14921
  };
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
14922
  normalize(gltf, options) {
15400
14923
  this.json = gltf.json;
15401
14924
  const json = gltf.json;
@@ -15420,7 +14943,6 @@ var __exports__ = (() => {
15420
14943
  this._updateObjects(json);
15421
14944
  this._updateMaterial(json);
15422
14945
  }
15423
- // asset is now required, #642 https://github.com/KhronosGroup/glTF/issues/639
15424
14946
  _addAsset(json) {
15425
14947
  json.asset = json.asset || {};
15426
14948
  json.asset.version = "2.0";
@@ -15431,7 +14953,6 @@ var __exports__ = (() => {
15431
14953
  this._convertTopLevelObjectToArray(json, arrayName);
15432
14954
  }
15433
14955
  }
15434
- /** Convert one top level object to array */
15435
14956
  _convertTopLevelObjectToArray(json, mapName) {
15436
14957
  const objectMap = json[mapName];
15437
14958
  if (!objectMap || Array.isArray(objectMap)) {
@@ -15446,7 +14967,6 @@ var __exports__ = (() => {
15446
14967
  this.idToIndexMap[mapName][id] = index;
15447
14968
  }
15448
14969
  }
15449
- /** Go through all objects in all top-level arrays and replace ids with indices */
15450
14970
  _convertObjectIdsToArrayIndices(json) {
15451
14971
  for (const arrayName in GLTF_ARRAYS) {
15452
14972
  this._convertIdsToIndices(json, arrayName);
@@ -15503,7 +15023,6 @@ var __exports__ = (() => {
15503
15023
  scene.nodes = scene.nodes.map((node2) => this._convertIdToIndex(node2, "node"));
15504
15024
  }
15505
15025
  }
15506
- /** Go through all objects in a top-level array and replace ids with indices */
15507
15026
  _convertIdsToIndices(json, topLevelArrayName) {
15508
15027
  if (!json[topLevelArrayName]) {
15509
15028
  console.warn(`gltf v1: json doesn't contain attribute ${topLevelArrayName}`);
@@ -15528,19 +15047,11 @@ var __exports__ = (() => {
15528
15047
  }
15529
15048
  return id;
15530
15049
  }
15531
- /**
15532
- *
15533
- * @param {*} json
15534
- */
15535
15050
  _updateObjects(json) {
15536
15051
  for (const buffer of this.json.buffers) {
15537
15052
  delete buffer.type;
15538
15053
  }
15539
15054
  }
15540
- /**
15541
- * Update material (set pbrMetallicRoughness)
15542
- * @param {*} json
15543
- */
15544
15055
  _updateMaterial(json) {
15545
15056
  for (const material of json.materials) {
15546
15057
  material.pbrMetallicRoughness = {
@@ -15686,7 +15197,6 @@ var __exports__ = (() => {
15686
15197
  if (parsedImage && parsedImage[0]) {
15687
15198
  parsedImage = {
15688
15199
  compressed: true,
15689
- // @ts-expect-error
15690
15200
  mipmaps: false,
15691
15201
  width: parsedImage[0].width,
15692
15202
  height: parsedImage[0].height,
@@ -15712,17 +15222,11 @@ var __exports__ = (() => {
15712
15222
  options: {
15713
15223
  gltf: {
15714
15224
  normalize: true,
15715
- // Normalize glTF v1 to glTF v2 format (not yet stable)
15716
15225
  loadBuffers: true,
15717
- // Fetch any linked .BIN buffers, decode base64
15718
15226
  loadImages: true,
15719
- // Create image objects
15720
15227
  decompressMeshes: true
15721
- // Decompress Draco encoded meshes
15722
15228
  },
15723
- // common?
15724
15229
  log: console
15725
- // eslint-disable-line
15726
15230
  },
15727
15231
  deprecatedOptions: {
15728
15232
  fetchImages: "gltf.loadImages",
@@ -15763,25 +15267,17 @@ var __exports__ = (() => {
15763
15267
  };
15764
15268
  var BYTES2 = {
15765
15269
  5120: 1,
15766
- // BYTE
15767
15270
  5121: 1,
15768
- // UNSIGNED_BYTE
15769
15271
  5122: 2,
15770
- // SHORT
15771
15272
  5123: 2,
15772
- // UNSIGNED_SHORT
15773
15273
  5125: 4,
15774
- // UNSIGNED_INT
15775
15274
  5126: 4
15776
- // FLOAT
15777
15275
  };
15778
15276
  var GL_SAMPLER = {
15779
- // Sampler parameters
15780
15277
  TEXTURE_MAG_FILTER: 10240,
15781
15278
  TEXTURE_MIN_FILTER: 10241,
15782
15279
  TEXTURE_WRAP_S: 10242,
15783
15280
  TEXTURE_WRAP_T: 10243,
15784
- // Sampler default values
15785
15281
  REPEAT: 10497,
15786
15282
  LINEAR: 9729,
15787
15283
  NEAREST_MIPMAP_LINEAR: 9986
@@ -15812,8 +15308,6 @@ var __exports__ = (() => {
15812
15308
  }
15813
15309
  var GLTFPostProcessor = class {
15814
15310
  baseUri = "";
15815
- // @ts-expect-error
15816
- // @ts-expect-error
15817
15311
  buffers = [];
15818
15312
  images = [];
15819
15313
  postProcess(gltf, options = {}) {
@@ -15833,9 +15327,6 @@ var __exports__ = (() => {
15833
15327
  this.json = this._resolveTree(gltf.json, options);
15834
15328
  return this.json;
15835
15329
  }
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
15330
  _resolveTree(gltf, options = {}) {
15840
15331
  const json = {
15841
15332
  ...gltf
@@ -15923,11 +15414,9 @@ var __exports__ = (() => {
15923
15414
  }
15924
15415
  return object;
15925
15416
  }
15926
- // PARSING HELPERS
15927
15417
  _resolveScene(scene, index) {
15928
15418
  return {
15929
15419
  ...scene,
15930
- // @ts-ignore
15931
15420
  id: scene.id || `scene-${index}`,
15932
15421
  nodes: (scene.nodes || []).map((node2) => this.getNode(node2))
15933
15422
  };
@@ -15935,7 +15424,6 @@ var __exports__ = (() => {
15935
15424
  _resolveNode(gltfNode, index) {
15936
15425
  const node2 = {
15937
15426
  ...gltfNode,
15938
- // @ts-expect-error id could already be present, glTF standard does not prevent it
15939
15427
  id: gltfNode?.id || `node-${index}`
15940
15428
  };
15941
15429
  if (gltfNode.mesh !== void 0) {
@@ -16005,7 +15493,6 @@ var __exports__ = (() => {
16005
15493
  _resolveMaterial(gltfMaterial, index) {
16006
15494
  const material = {
16007
15495
  ...gltfMaterial,
16008
- // @ts-expect-error
16009
15496
  id: gltfMaterial.id || `material-${index}`
16010
15497
  };
16011
15498
  if (material.normalTexture) {
@@ -16055,7 +15542,6 @@ var __exports__ = (() => {
16055
15542
  const bytesPerElement = bytesPerComponent * components;
16056
15543
  const accessor = {
16057
15544
  ...gltfAccessor,
16058
- // @ts-expect-error
16059
15545
  id: gltfAccessor.id || `accessor-${index}`,
16060
15546
  bytesPerComponent,
16061
15547
  components,
@@ -16082,16 +15568,6 @@ var __exports__ = (() => {
16082
15568
  }
16083
15569
  return accessor;
16084
15570
  }
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
15571
  _getValueFromInterleavedBuffer(buffer, byteOffset, byteStride, bytesPerElement, count) {
16096
15572
  const result = new Uint8Array(count * bytesPerElement);
16097
15573
  for (let i2 = 0; i2 < count; i2++) {
@@ -16103,7 +15579,6 @@ var __exports__ = (() => {
16103
15579
  _resolveTexture(gltfTexture, index) {
16104
15580
  return {
16105
15581
  ...gltfTexture,
16106
- // @ts-expect-error id could already be present, glTF standard does not prevent it
16107
15582
  id: gltfTexture.id || `texture-${index}`,
16108
15583
  sampler: typeof gltfTexture.sampler === "number" ? this.getSampler(gltfTexture.sampler) : makeDefaultSampler(),
16109
15584
  source: typeof gltfTexture.source === "number" ? this.getImage(gltfTexture.source) : void 0
@@ -16111,7 +15586,6 @@ var __exports__ = (() => {
16111
15586
  }
16112
15587
  _resolveSampler(gltfSampler, index) {
16113
15588
  const sampler = {
16114
- // @ts-expect-error id could already be present, glTF standard does not prevent it
16115
15589
  id: gltfSampler.id || `sampler-${index}`,
16116
15590
  ...gltfSampler,
16117
15591
  parameters: {}
@@ -16130,7 +15604,6 @@ var __exports__ = (() => {
16130
15604
  _resolveImage(gltfImage, index) {
16131
15605
  const image = {
16132
15606
  ...gltfImage,
16133
- // @ts-expect-error id could already be present, glTF standard does not prevent it
16134
15607
  id: gltfImage.id || `image-${index}`,
16135
15608
  image: null,
16136
15609
  bufferView: gltfImage.bufferView !== void 0 ? this.getBufferView(gltfImage.bufferView) : void 0
@@ -16149,10 +15622,8 @@ var __exports__ = (() => {
16149
15622
  byteOffset += gltfBufferView.byteOffset;
16150
15623
  }
16151
15624
  const bufferView = {
16152
- // // @ts-expect-error id could already be present, glTF standard does not prevent it
16153
15625
  id: `bufferView-${index}`,
16154
15626
  ...gltfBufferView,
16155
- // ...this.buffers[bufferIndex],
16156
15627
  buffer: this.buffers[bufferIndex],
16157
15628
  data: new Uint8Array(arrayBuffer, byteOffset, gltfBufferView.byteLength)
16158
15629
  };
@@ -16161,7 +15632,6 @@ var __exports__ = (() => {
16161
15632
  _resolveCamera(gltfCamera, index) {
16162
15633
  const camera = {
16163
15634
  ...gltfCamera,
16164
- // @ts-expect-error id could already be present, glTF standard does not prevent it
16165
15635
  id: gltfCamera.id || `camera-${index}`
16166
15636
  };
16167
15637
  if (camera.perspective) {
@@ -18827,7 +18297,6 @@ var __exports__ = (() => {
18827
18297
  ...Tiles3DLoader,
18828
18298
  id: "cesium-ion",
18829
18299
  name: "Cesium Ion",
18830
- // @ts-ignore
18831
18300
  preload,
18832
18301
  parse: async (data, options, context) => {
18833
18302
  options = {
@@ -19014,7 +18483,6 @@ var __exports__ = (() => {
19014
18483
  hash
19015
18484
  });
19016
18485
  }
19017
- // HELPERS
19018
18486
  async concatenate(asyncIterator) {
19019
18487
  return await concatenateArrayBuffersAsync(asyncIterator);
19020
18488
  }
@@ -19506,15 +18974,8 @@ var __exports__ = (() => {
19506
18974
  super();
19507
18975
  this.options = options;
19508
18976
  }
19509
- /**
19510
- * Atomic hash calculation
19511
- * @returns base64 encoded hash
19512
- */
19513
18977
  async hash(input, encoding) {
19514
- const md5Promise = new Promise((resolve2, reject) => (
19515
- // @ts-expect-error
19516
- md5WASM(input).then(resolve2).catch(reject)
19517
- ));
18978
+ const md5Promise = new Promise((resolve2, reject) => md5WASM(input).then(resolve2).catch(reject));
19518
18979
  const hex = await md5Promise;
19519
18980
  return encodeHex(hex, encoding);
19520
18981
  }
@@ -19554,39 +19015,31 @@ var __exports__ = (() => {
19554
19015
  this.compressBatches = this.compressBatches.bind(this);
19555
19016
  this.decompressBatches = this.decompressBatches.bind(this);
19556
19017
  }
19557
- /** Preloads any dynamic libraries. May enable sync functions */
19558
19018
  async preload() {
19559
19019
  return;
19560
19020
  }
19561
- /** Asynchronously compress data */
19562
19021
  async compress(input) {
19563
19022
  await this.preload();
19564
19023
  return this.compressSync(input);
19565
19024
  }
19566
- /** Asynchronously decompress data */
19567
19025
  async decompress(input, size) {
19568
19026
  await this.preload();
19569
19027
  return this.decompressSync(input, size);
19570
19028
  }
19571
- /** Synchronously compress data */
19572
19029
  compressSync(input) {
19573
19030
  throw new Error(`${this.name}: sync compression not supported`);
19574
19031
  }
19575
- /** Synchronously compress data */
19576
19032
  decompressSync(input, size) {
19577
19033
  throw new Error(`${this.name}: sync decompression not supported`);
19578
19034
  }
19579
- /** Compress batches */
19580
19035
  async *compressBatches(asyncIterator) {
19581
19036
  const input = await this.concatenate(asyncIterator);
19582
19037
  yield this.compress(input);
19583
19038
  }
19584
- /** Decompress batches */
19585
19039
  async *decompressBatches(asyncIterator) {
19586
19040
  const input = await this.concatenate(asyncIterator);
19587
19041
  yield this.decompress(input);
19588
19042
  }
19589
- // HELPERS
19590
19043
  concatenate(asyncIterator) {
19591
19044
  return concatenateArrayBuffersAsync(asyncIterator);
19592
19045
  }
@@ -19711,26 +19164,16 @@ var __exports__ = (() => {
19711
19164
  this._chunks = [];
19712
19165
  return chunks;
19713
19166
  }
19714
- // TODO - For some reason we don't get the error message from pako in _onEnd?
19715
19167
  _getError(code = 0) {
19716
19168
  const MESSAGES = {
19717
- /* Z_NEED_DICT 2 */
19718
19169
  2: "need dictionary",
19719
- /* Z_STREAM_END 1 */
19720
19170
  1: "stream end",
19721
- /* Z_OK 0 */
19722
19171
  0: "",
19723
- /* Z_ERRNO (-1) */
19724
19172
  "-1": "file error",
19725
- /* Z_STREAM_ERROR (-2) */
19726
19173
  "-2": "stream error",
19727
- /* Z_DATA_ERROR (-3) */
19728
19174
  "-3": "data error",
19729
- /* Z_MEM_ERROR (-4) */
19730
19175
  "-4": "insufficient memory",
19731
- /* Z_BUF_ERROR (-5) */
19732
19176
  "-5": "buffer error",
19733
- /* Z_VERSION_ERROR (-6) */
19734
19177
  "-6": "incompatible version"
19735
19178
  };
19736
19179
  return `${this.name}: ${MESSAGES[code]}`;
@@ -19739,9 +19182,7 @@ var __exports__ = (() => {
19739
19182
 
19740
19183
  // ../zip/src/filesystems/zip-filesystem.ts
19741
19184
  var COMPRESSION_METHODS = {
19742
- /** No compression */
19743
19185
  0: async (compressedFile) => compressedFile,
19744
- /** Deflation */
19745
19186
  8: async (compressedFile) => {
19746
19187
  const compression = new DeflateCompression({
19747
19188
  raw: true
@@ -19751,12 +19192,7 @@ var __exports__ = (() => {
19751
19192
  }
19752
19193
  };
19753
19194
  var ZipFileSystem = class {
19754
- /** FileProvider instance promise */
19755
19195
  fileProvider = null;
19756
- /**
19757
- * Constructor
19758
- * @param file - instance of FileProvider or file path string
19759
- */
19760
19196
  constructor(file) {
19761
19197
  if (typeof file === "string") {
19762
19198
  this.fileName = file;
@@ -19769,16 +19205,11 @@ var __exports__ = (() => {
19769
19205
  this.fileProvider = file;
19770
19206
  }
19771
19207
  }
19772
- /** Clean up resources */
19773
19208
  async destroy() {
19774
19209
  if (this.fileProvider) {
19775
19210
  await this.fileProvider.destroy();
19776
19211
  }
19777
19212
  }
19778
- /**
19779
- * Get file names list from zip archive
19780
- * @returns array of file names
19781
- */
19782
19213
  async readdir() {
19783
19214
  if (!this.fileProvider) {
19784
19215
  throw new Error("No data detected in the zip archive");
@@ -19790,11 +19221,6 @@ var __exports__ = (() => {
19790
19221
  }
19791
19222
  return fileNames;
19792
19223
  }
19793
- /**
19794
- * Get file metadata
19795
- * @param filename - name of a file
19796
- * @returns central directory data
19797
- */
19798
19224
  async stat(filename2) {
19799
19225
  const cdFileHeader = await this.getCDFileHeader(filename2);
19800
19226
  return {
@@ -19802,11 +19228,6 @@ var __exports__ = (() => {
19802
19228
  size: Number(cdFileHeader.uncompressedSize)
19803
19229
  };
19804
19230
  }
19805
- /**
19806
- * Implementation of fetch against this file system
19807
- * @param filename - name of a file
19808
- * @returns - Response with file data
19809
- */
19810
19231
  async fetch(filename2) {
19811
19232
  if (!this.fileProvider) {
19812
19233
  throw new Error("No data detected in the zip archive");
@@ -19828,11 +19249,6 @@ var __exports__ = (() => {
19828
19249
  });
19829
19250
  return response;
19830
19251
  }
19831
- /**
19832
- * Get central directory file header
19833
- * @param filename - name of a file
19834
- * @returns central directory file header
19835
- */
19836
19252
  async getCDFileHeader(filename2) {
19837
19253
  if (!this.fileProvider) {
19838
19254
  throw new Error("No data detected in the zip archive");
@@ -19854,30 +19270,16 @@ var __exports__ = (() => {
19854
19270
 
19855
19271
  // src/3d-tiles-archive/3d-tiles-archive-archive.ts
19856
19272
  var COMPRESSION_METHODS2 = {
19857
- /** No compression */
19858
19273
  0: (data) => new NoCompression().decompress(data),
19859
- /** Deflation */
19860
19274
  8: (data) => new DeflateCompression({
19861
19275
  raw: true
19862
19276
  }).decompress(data)
19863
19277
  };
19864
19278
  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
19279
  constructor(fileProvider, hashTable) {
19873
19280
  this.fileProvider = fileProvider;
19874
19281
  this.hashTable = hashTable;
19875
19282
  }
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
19283
  async getFile(path) {
19882
19284
  let data = await this.getFileBytes(path.toLocaleLowerCase());
19883
19285
  if (!data) {
@@ -19888,11 +19290,6 @@ var __exports__ = (() => {
19888
19290
  }
19889
19291
  return data;
19890
19292
  }
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
19293
  async getFileBytes(path) {
19897
19294
  const arrayBuffer = new TextEncoder().encode(path).buffer;
19898
19295
  const nameHash = await new MD5Hash().hash(arrayBuffer, "hex");
@@ -19952,20 +19349,9 @@ var __exports__ = (() => {
19952
19349
 
19953
19350
  // src/lib/filesystems/tiles-3d-archive-file-system.ts
19954
19351
  var Tiles3DArchiveFileSystem = class extends ZipFileSystem {
19955
- /**
19956
- * Constructor
19957
- * @param file - instance of FileProvider or file path string
19958
- */
19959
19352
  constructor(file) {
19960
19353
  super(file);
19961
19354
  }
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
19355
  async fetch(filename2) {
19970
19356
  const fileProvider = this.fileProvider;
19971
19357
  if (!fileProvider) {
@@ -19983,11 +19369,6 @@ var __exports__ = (() => {
19983
19369
  }
19984
19370
  return super.fetch(filename2);
19985
19371
  }
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
19372
  async parseHashTable() {
19992
19373
  if (this.hashTable !== void 0) {
19993
19374
  return;