@loaders.gl/3d-tiles 4.2.0-alpha.3 → 4.2.0-alpha.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.
Files changed (141) hide show
  1. package/dist/3d-tiles-archive/3d-tiles-archive-archive.js +66 -41
  2. package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts +1 -1
  3. package/dist/3d-tiles-archive/3d-tiles-archive-parser.d.ts.map +1 -1
  4. package/dist/3d-tiles-archive/3d-tiles-archive-parser.js +26 -16
  5. package/dist/3d-tiles-archive-loader.js +26 -15
  6. package/dist/cesium-ion-loader.js +34 -30
  7. package/dist/dist.dev.js +1963 -1037
  8. package/dist/dist.min.js +32 -0
  9. package/dist/index.cjs +122 -337
  10. package/dist/index.cjs.map +7 -0
  11. package/dist/index.d.ts +13 -13
  12. package/dist/index.d.ts.map +1 -1
  13. package/dist/index.js +7 -1
  14. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js +103 -87
  15. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js +179 -155
  16. package/dist/lib/classes/tile-3d-batch-table.js +232 -217
  17. package/dist/lib/classes/tile-3d-feature-table.js +62 -59
  18. package/dist/lib/constants.js +19 -15
  19. package/dist/lib/encoders/encode-3d-tile-batched-model.js +40 -35
  20. package/dist/lib/encoders/encode-3d-tile-composite.js +19 -17
  21. package/dist/lib/encoders/encode-3d-tile-instanced-model.js +32 -31
  22. package/dist/lib/encoders/encode-3d-tile-point-cloud.js +31 -32
  23. package/dist/lib/encoders/encode-3d-tile.js +23 -19
  24. package/dist/lib/encoders/helpers/encode-3d-tile-header.js +23 -23
  25. package/dist/lib/ion/ion.js +55 -54
  26. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts +1 -1
  27. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.d.ts.map +1 -1
  28. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js +57 -51
  29. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts +1 -1
  30. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.d.ts.map +1 -1
  31. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js +21 -18
  32. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js +35 -20
  33. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts +4 -4
  34. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.d.ts.map +1 -1
  35. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js +269 -234
  36. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts +2 -2
  37. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.d.ts.map +1 -1
  38. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js +83 -55
  39. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts +1 -1
  40. package/dist/lib/parsers/helpers/parse-3d-tile-header.d.ts.map +1 -1
  41. package/dist/lib/parsers/helpers/parse-3d-tile-header.js +23 -14
  42. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts +1 -1
  43. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.d.ts.map +1 -1
  44. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js +82 -54
  45. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts +2 -2
  46. package/dist/lib/parsers/helpers/parse-3d-tile-tables.d.ts.map +1 -1
  47. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js +79 -68
  48. package/dist/lib/parsers/helpers/parse-utils.js +19 -14
  49. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts +2 -2
  50. package/dist/lib/parsers/parse-3d-tile-batched-model.d.ts.map +1 -1
  51. package/dist/lib/parsers/parse-3d-tile-batched-model.js +21 -17
  52. package/dist/lib/parsers/parse-3d-tile-composite.d.ts +2 -2
  53. package/dist/lib/parsers/parse-3d-tile-composite.d.ts.map +1 -1
  54. package/dist/lib/parsers/parse-3d-tile-composite.js +18 -14
  55. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts +2 -2
  56. package/dist/lib/parsers/parse-3d-tile-gltf.d.ts.map +1 -1
  57. package/dist/lib/parsers/parse-3d-tile-gltf.js +22 -14
  58. package/dist/lib/parsers/parse-3d-tile-header.d.ts +2 -2
  59. package/dist/lib/parsers/parse-3d-tile-header.d.ts.map +1 -1
  60. package/dist/lib/parsers/parse-3d-tile-header.js +168 -159
  61. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts +2 -2
  62. package/dist/lib/parsers/parse-3d-tile-instanced-model.d.ts.map +1 -1
  63. package/dist/lib/parsers/parse-3d-tile-instanced-model.js +153 -123
  64. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts +2 -2
  65. package/dist/lib/parsers/parse-3d-tile-point-cloud.d.ts.map +1 -1
  66. package/dist/lib/parsers/parse-3d-tile-point-cloud.js +380 -174
  67. package/dist/lib/parsers/parse-3d-tile.d.ts +2 -2
  68. package/dist/lib/parsers/parse-3d-tile.d.ts.map +1 -1
  69. package/dist/lib/parsers/parse-3d-tile.js +24 -24
  70. package/dist/lib/utils/obb/s2-corners-to-obb.js +29 -16
  71. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts +1 -1
  72. package/dist/lib/utils/s2/converters/s2-to-boundary.d.ts.map +1 -1
  73. package/dist/lib/utils/s2/converters/s2-to-boundary.js +55 -35
  74. package/dist/lib/utils/s2/converters/s2-to-obb-points.js +31 -20
  75. package/dist/lib/utils/s2/converters/s2-to-region.d.ts +1 -1
  76. package/dist/lib/utils/s2/converters/s2-to-region.d.ts.map +1 -1
  77. package/dist/lib/utils/s2/converters/s2-to-region.js +51 -35
  78. package/dist/lib/utils/s2/index.d.ts +7 -7
  79. package/dist/lib/utils/s2/index.d.ts.map +1 -1
  80. package/dist/lib/utils/s2/index.js +3 -1
  81. package/dist/lib/utils/s2/s2-geometry-functions.js +19 -5
  82. package/dist/lib/utils/s2/s2-token-functions.js +51 -22
  83. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts +1 -1
  84. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.d.ts.map +1 -1
  85. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js +23 -9
  86. package/dist/lib/utils/s2/s2geometry/s2-geometry.js +218 -157
  87. package/dist/lib/utils/version.js +4 -2
  88. package/dist/tile-3d-subtree-loader.d.ts +1 -1
  89. package/dist/tile-3d-subtree-loader.d.ts.map +1 -1
  90. package/dist/tile-3d-subtree-loader.js +15 -10
  91. package/dist/tile-3d-writer.js +19 -14
  92. package/dist/tiles-3d-loader.js +65 -55
  93. package/dist/types.js +3 -1
  94. package/package.json +11 -10
  95. package/dist/3d-tiles-archive/3d-tiles-archive-archive.js.map +0 -1
  96. package/dist/3d-tiles-archive/3d-tiles-archive-parser.js.map +0 -1
  97. package/dist/3d-tiles-archive-loader.js.map +0 -1
  98. package/dist/cesium-ion-loader.js.map +0 -1
  99. package/dist/index.js.map +0 -1
  100. package/dist/lib/classes/helpers/tile-3d-accessor-utils.js.map +0 -1
  101. package/dist/lib/classes/tile-3d-batch-table-hierarchy.js.map +0 -1
  102. package/dist/lib/classes/tile-3d-batch-table.js.map +0 -1
  103. package/dist/lib/classes/tile-3d-feature-table.js.map +0 -1
  104. package/dist/lib/constants.js.map +0 -1
  105. package/dist/lib/encoders/encode-3d-tile-batched-model.js.map +0 -1
  106. package/dist/lib/encoders/encode-3d-tile-composite.js.map +0 -1
  107. package/dist/lib/encoders/encode-3d-tile-instanced-model.js.map +0 -1
  108. package/dist/lib/encoders/encode-3d-tile-point-cloud.js.map +0 -1
  109. package/dist/lib/encoders/encode-3d-tile.js.map +0 -1
  110. package/dist/lib/encoders/helpers/encode-3d-tile-header.js.map +0 -1
  111. package/dist/lib/ion/ion.js.map +0 -1
  112. package/dist/lib/parsers/helpers/normalize-3d-tile-colors.js.map +0 -1
  113. package/dist/lib/parsers/helpers/normalize-3d-tile-normals.js.map +0 -1
  114. package/dist/lib/parsers/helpers/normalize-3d-tile-positions.js.map +0 -1
  115. package/dist/lib/parsers/helpers/parse-3d-implicit-tiles.js.map +0 -1
  116. package/dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js.map +0 -1
  117. package/dist/lib/parsers/helpers/parse-3d-tile-header.js.map +0 -1
  118. package/dist/lib/parsers/helpers/parse-3d-tile-subtree.js.map +0 -1
  119. package/dist/lib/parsers/helpers/parse-3d-tile-tables.js.map +0 -1
  120. package/dist/lib/parsers/helpers/parse-utils.js.map +0 -1
  121. package/dist/lib/parsers/parse-3d-tile-batched-model.js.map +0 -1
  122. package/dist/lib/parsers/parse-3d-tile-composite.js.map +0 -1
  123. package/dist/lib/parsers/parse-3d-tile-gltf.js.map +0 -1
  124. package/dist/lib/parsers/parse-3d-tile-header.js.map +0 -1
  125. package/dist/lib/parsers/parse-3d-tile-instanced-model.js.map +0 -1
  126. package/dist/lib/parsers/parse-3d-tile-point-cloud.js.map +0 -1
  127. package/dist/lib/parsers/parse-3d-tile.js.map +0 -1
  128. package/dist/lib/utils/obb/s2-corners-to-obb.js.map +0 -1
  129. package/dist/lib/utils/s2/converters/s2-to-boundary.js.map +0 -1
  130. package/dist/lib/utils/s2/converters/s2-to-obb-points.js.map +0 -1
  131. package/dist/lib/utils/s2/converters/s2-to-region.js.map +0 -1
  132. package/dist/lib/utils/s2/index.js.map +0 -1
  133. package/dist/lib/utils/s2/s2-geometry-functions.js.map +0 -1
  134. package/dist/lib/utils/s2/s2-token-functions.js.map +0 -1
  135. package/dist/lib/utils/s2/s2geometry/s2-cell-utils.js.map +0 -1
  136. package/dist/lib/utils/s2/s2geometry/s2-geometry.js.map +0 -1
  137. package/dist/lib/utils/version.js.map +0 -1
  138. package/dist/tile-3d-subtree-loader.js.map +0 -1
  139. package/dist/tile-3d-writer.js.map +0 -1
  140. package/dist/tiles-3d-loader.js.map +0 -1
  141. package/dist/types.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -27,9 +27,9 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
30
+ // dist/index.js
31
+ var dist_exports = {};
32
+ __export(dist_exports, {
33
33
  CesiumIonLoader: () => CesiumIonLoader,
34
34
  TILE3D_TYPE: () => TILE3D_TYPE,
35
35
  Tile3DBatchTable: () => Tile3DBatchTableParser,
@@ -41,16 +41,16 @@ __export(src_exports, {
41
41
  Tiles3DLoader: () => Tiles3DLoader,
42
42
  _getIonTilesetMetadata: () => getIonTilesetMetadata
43
43
  });
44
- module.exports = __toCommonJS(src_exports);
44
+ module.exports = __toCommonJS(dist_exports);
45
45
 
46
- // src/tiles-3d-loader.ts
46
+ // dist/tiles-3d-loader.js
47
47
  var import_loader_utils8 = require("@loaders.gl/loader-utils");
48
48
  var import_tiles2 = require("@loaders.gl/tiles");
49
49
 
50
- // src/lib/utils/version.ts
51
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
50
+ // dist/lib/utils/version.js
51
+ var VERSION = true ? "4.2.0-alpha.4" : "latest";
52
52
 
53
- // src/lib/constants.ts
53
+ // dist/lib/constants.js
54
54
  var TILE3D_TYPE = {
55
55
  COMPOSITE: "cmpt",
56
56
  POINT_CLOUD: "pnts",
@@ -68,7 +68,7 @@ var MAGIC_ARRAY = {
68
68
  COMPOSITE: [99, 109, 112, 116]
69
69
  };
70
70
 
71
- // src/lib/parsers/helpers/parse-utils.ts
71
+ // dist/lib/parsers/helpers/parse-utils.js
72
72
  var import_loader_utils = require("@loaders.gl/loader-utils");
73
73
  function getStringFromArrayBuffer(arrayBuffer, byteOffset, byteLength) {
74
74
  (0, import_loader_utils.assert)(arrayBuffer instanceof ArrayBuffer);
@@ -82,13 +82,13 @@ function getMagicString(arrayBuffer, byteOffset = 0) {
82
82
  return `${String.fromCharCode(dataView.getUint8(byteOffset + 0))}${String.fromCharCode(dataView.getUint8(byteOffset + 1))}${String.fromCharCode(dataView.getUint8(byteOffset + 2))}${String.fromCharCode(dataView.getUint8(byteOffset + 3))}`;
83
83
  }
84
84
 
85
- // src/lib/parsers/parse-3d-tile-point-cloud.ts
85
+ // dist/lib/parsers/parse-3d-tile-point-cloud.js
86
86
  var import_draco = require("@loaders.gl/draco");
87
87
  var import_loader_utils4 = require("@loaders.gl/loader-utils");
88
88
  var import_math6 = require("@loaders.gl/math");
89
89
  var import_core3 = require("@math.gl/core");
90
90
 
91
- // src/lib/classes/tile-3d-feature-table.ts
91
+ // dist/lib/classes/tile-3d-feature-table.js
92
92
  var import_math = require("@loaders.gl/math");
93
93
  var Tile3DFeatureTable = class {
94
94
  constructor(featureTableJson, featureTableBinary) {
@@ -106,13 +106,7 @@ var Tile3DFeatureTable = class {
106
106
  getGlobalProperty(propertyName, componentType = import_math.GL.UNSIGNED_INT, componentLength = 1) {
107
107
  const jsonValue = this.json[propertyName];
108
108
  if (jsonValue && Number.isFinite(jsonValue.byteOffset)) {
109
- return this._getTypedArrayFromBinary(
110
- propertyName,
111
- componentType,
112
- componentLength,
113
- 1,
114
- jsonValue.byteOffset
115
- );
109
+ return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, 1, jsonValue.byteOffset);
116
110
  }
117
111
  return jsonValue;
118
112
  }
@@ -122,13 +116,7 @@ var Tile3DFeatureTable = class {
122
116
  if ("componentType" in jsonValue) {
123
117
  componentType = import_math.GLType.fromName(jsonValue.componentType);
124
118
  }
125
- return this._getTypedArrayFromBinary(
126
- propertyName,
127
- componentType,
128
- componentLength,
129
- this.featuresLength,
130
- jsonValue.byteOffset
131
- );
119
+ return this._getTypedArrayFromBinary(propertyName, componentType, componentLength, this.featuresLength, jsonValue.byteOffset);
132
120
  }
133
121
  return this._getTypedArrayFromArray(propertyName, componentType, jsonValue);
134
122
  }
@@ -151,12 +139,7 @@ var Tile3DFeatureTable = class {
151
139
  const cachedTypedArrays = this._cachedTypedArrays;
152
140
  let typedArray = cachedTypedArrays[propertyName];
153
141
  if (!typedArray) {
154
- typedArray = import_math.GLType.createTypedArray(
155
- componentType,
156
- this.buffer.buffer,
157
- this.buffer.byteOffset + byteOffset,
158
- count * componentLength
159
- );
142
+ typedArray = import_math.GLType.createTypedArray(componentType, this.buffer.buffer, this.buffer.byteOffset + byteOffset, count * componentLength);
160
143
  cachedTypedArrays[propertyName] = typedArray;
161
144
  }
162
145
  return typedArray;
@@ -172,10 +155,10 @@ var Tile3DFeatureTable = class {
172
155
  }
173
156
  };
174
157
 
175
- // src/lib/classes/tile-3d-batch-table.ts
158
+ // dist/lib/classes/tile-3d-batch-table.js
176
159
  var import_loader_utils3 = require("@loaders.gl/loader-utils");
177
160
 
178
- // src/lib/classes/helpers/tile-3d-accessor-utils.ts
161
+ // dist/lib/classes/helpers/tile-3d-accessor-utils.js
179
162
  var import_math2 = require("@loaders.gl/math");
180
163
  var import_loader_utils2 = require("@loaders.gl/loader-utils");
181
164
  var COMPONENTS_PER_ATTRIBUTE = {
@@ -304,7 +287,7 @@ function createTypedArrayFromAccessor(tile3DAccessor, buffer, byteOffset, length
304
287
  };
305
288
  }
306
289
 
307
- // src/lib/classes/tile-3d-batch-table-hierarchy.ts
290
+ // dist/lib/classes/tile-3d-batch-table-hierarchy.js
308
291
  var defined = (x) => x !== void 0;
309
292
  function initializeHierarchy(batchTable, jsonHeader, binaryBody) {
310
293
  if (!jsonHeader) {
@@ -337,11 +320,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
337
320
  classIds.componentType = defaultValue(classIds.componentType, GL.UNSIGNED_SHORT);
338
321
  classIds.type = AttributeType.SCALAR;
339
322
  binaryAccessor = getBinaryAccessor(classIds);
340
- classIds = binaryAccessor.createArrayBufferView(
341
- binaryBody.buffer,
342
- binaryBody.byteOffset + classIds.byteOffset,
343
- instancesLength
344
- );
323
+ classIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + classIds.byteOffset, instancesLength);
345
324
  }
346
325
  let parentIndexes;
347
326
  if (defined(parentCounts)) {
@@ -349,11 +328,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
349
328
  parentCounts.componentType = defaultValue(parentCounts.componentType, GL.UNSIGNED_SHORT);
350
329
  parentCounts.type = AttributeType.SCALAR;
351
330
  binaryAccessor = getBinaryAccessor(parentCounts);
352
- parentCounts = binaryAccessor.createArrayBufferView(
353
- binaryBody.buffer,
354
- binaryBody.byteOffset + parentCounts.byteOffset,
355
- instancesLength
356
- );
331
+ parentCounts = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentCounts.byteOffset, instancesLength);
357
332
  }
358
333
  parentIndexes = new Uint16Array(instancesLength);
359
334
  parentIdsLength = 0;
@@ -366,11 +341,7 @@ function initializeHierarchyValues(hierarchyJson, binaryBody) {
366
341
  parentIds.componentType = defaultValue(parentIds.componentType, GL.UNSIGNED_SHORT);
367
342
  parentIds.type = AttributeType.SCALAR;
368
343
  binaryAccessor = getBinaryAccessor(parentIds);
369
- parentIds = binaryAccessor.createArrayBufferView(
370
- binaryBody.buffer,
371
- binaryBody.byteOffset + parentIds.byteOffset,
372
- parentIdsLength
373
- );
344
+ parentIds = binaryAccessor.createArrayBufferView(binaryBody.buffer, binaryBody.byteOffset + parentIds.byteOffset, parentIdsLength);
374
345
  }
375
346
  const classesLength = classes.length;
376
347
  for (i = 0; i < classesLength; ++i) {
@@ -474,14 +445,8 @@ function validateInstance(hierarchy, instanceIndex, stack2) {
474
445
  if (!defined(parentIds)) {
475
446
  return;
476
447
  }
477
- assert(
478
- instanceIndex < instancesLength,
479
- `Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`
480
- );
481
- assert(
482
- stack2.indexOf(instanceIndex) === -1,
483
- "Circular dependency detected in the batch table hierarchy."
484
- );
448
+ assert(instanceIndex < instancesLength, `Parent index ${instanceIndex} exceeds the total number of instances: ${instancesLength}`);
449
+ assert(stack2.indexOf(instanceIndex) === -1, "Circular dependency detected in the batch table hierarchy.");
485
450
  stack2.push(instanceIndex);
486
451
  const parentCount = defined(parentCounts) ? parentCounts[instanceIndex] : 1;
487
452
  const parentIndex = defined(parentCounts) ? parentIndexes[instanceIndex] : instanceIndex;
@@ -494,7 +459,7 @@ function validateInstance(hierarchy, instanceIndex, stack2) {
494
459
  stack2.pop(instanceIndex);
495
460
  }
496
461
 
497
- // src/lib/classes/tile-3d-batch-table.ts
462
+ // dist/lib/classes/tile-3d-batch-table.js
498
463
  function defined2(x) {
499
464
  return x !== void 0 && x !== null;
500
465
  }
@@ -646,12 +611,7 @@ var Tile3DBatchTableParser = class {
646
611
  const tile3DAccessor = property;
647
612
  (0, import_loader_utils3.assert)(this.binary, `Property ${name} requires a batch table binary.`);
648
613
  (0, import_loader_utils3.assert)(tile3DAccessor.type, `Property ${name} requires a type.`);
649
- const accessor = createTypedArrayFromAccessor(
650
- tile3DAccessor,
651
- this.binary.buffer,
652
- this.binary.byteOffset | 0,
653
- this.featureCount
654
- );
614
+ const accessor = createTypedArrayFromAccessor(tile3DAccessor, this.binary.buffer, this.binary.byteOffset | 0, this.featureCount);
655
615
  return {
656
616
  typedArray: accessor.values,
657
617
  componentCount: accessor.size,
@@ -722,7 +682,7 @@ var Tile3DBatchTableParser = class {
722
682
  }
723
683
  };
724
684
 
725
- // src/lib/parsers/helpers/parse-3d-tile-header.ts
685
+ // dist/lib/parsers/helpers/parse-3d-tile-header.js
726
686
  var SIZEOF_UINT32 = 4;
727
687
  function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {
728
688
  const view = new DataView(arrayBuffer);
@@ -738,7 +698,7 @@ function parse3DTileHeaderSync(tile, arrayBuffer, byteOffset = 0) {
738
698
  return byteOffset;
739
699
  }
740
700
 
741
- // src/lib/parsers/helpers/parse-3d-tile-tables.ts
701
+ // dist/lib/parsers/helpers/parse-3d-tile-tables.js
742
702
  var SIZEOF_UINT322 = 4;
743
703
  var DEPRECATION_WARNING = "b3dm tile in legacy format.";
744
704
  function parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset) {
@@ -788,11 +748,7 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
788
748
  BATCH_LENGTH: batchLength || 0
789
749
  };
790
750
  if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
791
- const featureTableString = getStringFromArrayBuffer(
792
- arrayBuffer,
793
- byteOffset,
794
- featureTableJsonByteLength
795
- );
751
+ const featureTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, featureTableJsonByteLength);
796
752
  tile.featureTableJson = JSON.parse(featureTableString);
797
753
  }
798
754
  byteOffset += featureTableJsonByteLength || 0;
@@ -803,11 +759,7 @@ function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
803
759
  function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
804
760
  const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};
805
761
  if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
806
- const batchTableString = getStringFromArrayBuffer(
807
- arrayBuffer,
808
- byteOffset,
809
- batchTableJsonByteLength
810
- );
762
+ const batchTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, batchTableJsonByteLength);
811
763
  tile.batchTableJson = JSON.parse(batchTableString);
812
764
  byteOffset += batchTableJsonByteLength;
813
765
  if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
@@ -819,7 +771,7 @@ function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
819
771
  return byteOffset;
820
772
  }
821
773
 
822
- // src/lib/parsers/helpers/normalize-3d-tile-colors.ts
774
+ // dist/lib/parsers/helpers/normalize-3d-tile-colors.js
823
775
  var import_math3 = require("@loaders.gl/math");
824
776
  function normalize3DTileColorAttribute(tile, colors, batchTable) {
825
777
  if (!colors && (!tile || !tile.batchIds || !batchTable)) {
@@ -874,7 +826,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
874
826
  };
875
827
  }
876
828
 
877
- // src/lib/parsers/helpers/normalize-3d-tile-normals.ts
829
+ // dist/lib/parsers/helpers/normalize-3d-tile-normals.js
878
830
  var import_core = require("@math.gl/core");
879
831
  var import_math4 = require("@loaders.gl/math");
880
832
  var scratchNormal = new import_core.Vector3();
@@ -901,7 +853,7 @@ function normalize3DTileNormalAttribute(tile, normals) {
901
853
  };
902
854
  }
903
855
 
904
- // src/lib/parsers/helpers/normalize-3d-tile-positions.ts
856
+ // dist/lib/parsers/helpers/normalize-3d-tile-positions.js
905
857
  var import_core2 = require("@math.gl/core");
906
858
  var import_math5 = require("@loaders.gl/math");
907
859
  function normalize3DTilePositionAttribute(tile, positions, options) {
@@ -928,7 +880,7 @@ function decodeQuantizedPositions(tile, positions) {
928
880
  return decodedArray;
929
881
  }
930
882
 
931
- // src/lib/parsers/parse-3d-tile-point-cloud.ts
883
+ // dist/lib/parsers/parse-3d-tile-point-cloud.js
932
884
  async function parsePointCloud3DTile(tile, arrayBuffer, byteOffset, options, context) {
933
885
  byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
934
886
  byteOffset = parse3DTileTablesHeaderSync(tile, arrayBuffer, byteOffset);
@@ -981,19 +933,11 @@ function parsePositions(tile, featureTable, options) {
981
933
  const positions = featureTable.getPropertyArray("POSITION_QUANTIZED", import_math6.GL.UNSIGNED_SHORT, 3);
982
934
  tile.isQuantized = true;
983
935
  tile.quantizedRange = (1 << 16) - 1;
984
- tile.quantizedVolumeScale = featureTable.getGlobalProperty(
985
- "QUANTIZED_VOLUME_SCALE",
986
- import_math6.GL.FLOAT,
987
- 3
988
- );
936
+ tile.quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", import_math6.GL.FLOAT, 3);
989
937
  if (!tile.quantizedVolumeScale) {
990
938
  throw new Error("QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
991
939
  }
992
- tile.quantizedVolumeOffset = featureTable.getGlobalProperty(
993
- "QUANTIZED_VOLUME_OFFSET",
994
- import_math6.GL.FLOAT,
995
- 3
996
- );
940
+ tile.quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", import_math6.GL.FLOAT, 3);
997
941
  if (!tile.quantizedVolumeOffset) {
998
942
  throw new Error("QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
999
943
  }
@@ -1077,10 +1021,7 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
1077
1021
  if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
1078
1022
  throw new Error("Draco properties, byteOffset, and byteLength must be defined");
1079
1023
  }
1080
- dracoBuffer = (tile.featureTableBinary || []).slice(
1081
- dracoByteOffset,
1082
- dracoByteOffset + dracoByteLength
1083
- );
1024
+ dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
1084
1025
  tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
1085
1026
  tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
1086
1027
  tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
@@ -1151,10 +1092,10 @@ async function loadDraco(tile, dracoData, options, context) {
1151
1092
  };
1152
1093
  }
1153
1094
 
1154
- // src/lib/parsers/parse-3d-tile-batched-model.ts
1095
+ // dist/lib/parsers/parse-3d-tile-batched-model.js
1155
1096
  var import_math7 = require("@loaders.gl/math");
1156
1097
 
1157
- // src/lib/parsers/helpers/parse-3d-tile-gltf-view.ts
1098
+ // dist/lib/parsers/helpers/parse-3d-tile-gltf-view.js
1158
1099
  var import_gltf = require("@loaders.gl/gltf");
1159
1100
  var import_loader_utils5 = require("@loaders.gl/loader-utils");
1160
1101
  var GLTF_FORMAT = {
@@ -1191,12 +1132,7 @@ async function extractGLTF(tile, gltfFormat, options, context) {
1191
1132
  tile.gltfByteOffset = 0;
1192
1133
  }
1193
1134
  if (tile.gltfArrayBuffer) {
1194
- const gltfWithBuffers = await (0, import_loader_utils5.parseFromContext)(
1195
- tile.gltfArrayBuffer,
1196
- import_gltf.GLTFLoader,
1197
- options,
1198
- context
1199
- );
1135
+ const gltfWithBuffers = await (0, import_loader_utils5.parseFromContext)(tile.gltfArrayBuffer, import_gltf.GLTFLoader, options, context);
1200
1136
  tile.gltf = (0, import_gltf.postProcessGLTF)(gltfWithBuffers);
1201
1137
  tile.gpuMemoryUsageInBytes = (0, import_gltf._getMemoryUsageGLTF)(tile.gltf);
1202
1138
  delete tile.gltfArrayBuffer;
@@ -1225,7 +1161,7 @@ function extractGLTFBufferOrURL(tile, gltfFormat, options) {
1225
1161
  }
1226
1162
  }
1227
1163
 
1228
- // src/lib/parsers/parse-3d-tile-batched-model.ts
1164
+ // dist/lib/parsers/parse-3d-tile-batched-model.js
1229
1165
  async function parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
1230
1166
  var _a;
1231
1167
  byteOffset = parseBatchedModel(tile, arrayBuffer, byteOffset, options, context);
@@ -1246,7 +1182,7 @@ function parseBatchedModel(tile, arrayBuffer, byteOffset, options, context) {
1246
1182
  return byteOffset;
1247
1183
  }
1248
1184
 
1249
- // src/lib/parsers/parse-3d-tile-instanced-model.ts
1185
+ // dist/lib/parsers/parse-3d-tile-instanced-model.js
1250
1186
  var import_core4 = require("@math.gl/core");
1251
1187
  var import_geospatial = require("@math.gl/geospatial");
1252
1188
  var import_math8 = require("@loaders.gl/math");
@@ -1278,11 +1214,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
1278
1214
  }
1279
1215
  tile.eastNorthUp = featureTable.getGlobalProperty("EAST_NORTH_UP");
1280
1216
  tile.rtcCenter = featureTable.getGlobalProperty("RTC_CENTER", import_math8.GL.FLOAT, 3);
1281
- const batchTable = new Tile3DBatchTableParser(
1282
- tile.batchTableJson,
1283
- tile.batchTableBinary,
1284
- instancesLength
1285
- );
1217
+ const batchTable = new Tile3DBatchTableParser(tile.batchTableJson, tile.batchTableBinary, instancesLength);
1286
1218
  extractInstancedAttributes(tile, featureTable, batchTable, instancesLength);
1287
1219
  return byteOffset;
1288
1220
  }
@@ -1306,32 +1238,14 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
1306
1238
  if (featureTable.hasProperty("POSITION")) {
1307
1239
  position = featureTable.getProperty("POSITION", import_math8.GL.FLOAT, 3, i, instancePosition);
1308
1240
  } else if (featureTable.hasProperty("POSITION_QUANTIZED")) {
1309
- position = featureTable.getProperty(
1310
- "POSITION_QUANTIZED",
1311
- import_math8.GL.UNSIGNED_SHORT,
1312
- 3,
1313
- i,
1314
- instancePosition
1315
- );
1316
- const quantizedVolumeOffset = featureTable.getGlobalProperty(
1317
- "QUANTIZED_VOLUME_OFFSET",
1318
- import_math8.GL.FLOAT,
1319
- 3
1320
- );
1241
+ position = featureTable.getProperty("POSITION_QUANTIZED", import_math8.GL.UNSIGNED_SHORT, 3, i, instancePosition);
1242
+ const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", import_math8.GL.FLOAT, 3);
1321
1243
  if (!quantizedVolumeOffset) {
1322
- throw new Error(
1323
- "i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions."
1324
- );
1244
+ throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
1325
1245
  }
1326
- const quantizedVolumeScale = featureTable.getGlobalProperty(
1327
- "QUANTIZED_VOLUME_SCALE",
1328
- import_math8.GL.FLOAT,
1329
- 3
1330
- );
1246
+ const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", import_math8.GL.FLOAT, 3);
1331
1247
  if (!quantizedVolumeScale) {
1332
- throw new Error(
1333
- "i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions."
1334
- );
1248
+ throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
1335
1249
  }
1336
1250
  const MAX_UNSIGNED_SHORT = 65535;
1337
1251
  for (let j = 0; j < 3; j++) {
@@ -1352,25 +1266,11 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
1352
1266
  }
1353
1267
  tile.hasCustomOrientation = true;
1354
1268
  } else {
1355
- tile.octNormalUp = featureTable.getProperty(
1356
- "NORMAL_UP_OCT32P",
1357
- import_math8.GL.UNSIGNED_SHORT,
1358
- 2,
1359
- i,
1360
- scratch1
1361
- );
1362
- tile.octNormalRight = featureTable.getProperty(
1363
- "NORMAL_RIGHT_OCT32P",
1364
- import_math8.GL.UNSIGNED_SHORT,
1365
- 2,
1366
- i,
1367
- scratch2
1368
- );
1269
+ tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", import_math8.GL.UNSIGNED_SHORT, 2, i, scratch1);
1270
+ tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", import_math8.GL.UNSIGNED_SHORT, 2, i, scratch2);
1369
1271
  if (tile.octNormalUp) {
1370
1272
  if (!tile.octNormalRight) {
1371
- throw new Error(
1372
- "i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P"
1373
- );
1273
+ throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");
1374
1274
  }
1375
1275
  throw new Error("i3dm: oct-encoded orientation not implemented");
1376
1276
  } else if (tile.eastNorthUp) {
@@ -1416,7 +1316,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
1416
1316
  tile.instances = instances;
1417
1317
  }
1418
1318
 
1419
- // src/lib/parsers/parse-3d-tile-composite.ts
1319
+ // dist/lib/parsers/parse-3d-tile-composite.js
1420
1320
  async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile2) {
1421
1321
  byteOffset = parse3DTileHeaderSync(tile, arrayBuffer, byteOffset);
1422
1322
  const view = new DataView(arrayBuffer);
@@ -1431,7 +1331,7 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
1431
1331
  return byteOffset;
1432
1332
  }
1433
1333
 
1434
- // src/lib/parsers/parse-3d-tile-gltf.ts
1334
+ // dist/lib/parsers/parse-3d-tile-gltf.js
1435
1335
  var import_loader_utils6 = require("@loaders.gl/loader-utils");
1436
1336
  var import_gltf2 = require("@loaders.gl/gltf");
1437
1337
  async function parseGltf3DTile(tile, arrayBuffer, options, context) {
@@ -1451,20 +1351,13 @@ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
1451
1351
  return arrayBuffer.byteLength;
1452
1352
  }
1453
1353
 
1454
- // src/lib/parsers/parse-3d-tile.ts
1354
+ // dist/lib/parsers/parse-3d-tile.js
1455
1355
  async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = { shape: "tile3d" }) {
1456
1356
  tile.byteOffset = byteOffset;
1457
1357
  tile.type = getMagicString(arrayBuffer, byteOffset);
1458
1358
  switch (tile.type) {
1459
1359
  case TILE3D_TYPE.COMPOSITE:
1460
- return await parseComposite3DTile(
1461
- tile,
1462
- arrayBuffer,
1463
- byteOffset,
1464
- options,
1465
- context,
1466
- parse3DTile
1467
- );
1360
+ return await parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
1468
1361
  case TILE3D_TYPE.BATCHED_3D_MODEL:
1469
1362
  return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
1470
1363
  case TILE3D_TYPE.GLTF:
@@ -1478,10 +1371,10 @@ async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile =
1478
1371
  }
1479
1372
  }
1480
1373
 
1481
- // src/lib/parsers/parse-3d-tile-header.ts
1374
+ // dist/lib/parsers/parse-3d-tile-header.js
1482
1375
  var import_loader_utils7 = require("@loaders.gl/loader-utils");
1483
1376
 
1484
- // src/lib/parsers/helpers/parse-3d-tile-subtree.ts
1377
+ // dist/lib/parsers/helpers/parse-3d-tile-subtree.js
1485
1378
  var SUBTREE_FILE_MAGIC = 1952609651;
1486
1379
  var SUBTREE_FILE_VERSION = 1;
1487
1380
  async function parse3DTilesSubtree(data, options, context) {
@@ -1509,19 +1402,9 @@ async function parse3DTilesSubtree(data, options, context) {
1509
1402
  await loadExplicitBitstream(subtree, contentAvailability, internalBinaryBuffer, context);
1510
1403
  }
1511
1404
  } else {
1512
- await loadExplicitBitstream(
1513
- subtree,
1514
- subtree.contentAvailability,
1515
- internalBinaryBuffer,
1516
- context
1517
- );
1518
- }
1519
- await loadExplicitBitstream(
1520
- subtree,
1521
- subtree.childSubtreeAvailability,
1522
- internalBinaryBuffer,
1523
- context
1524
- );
1405
+ await loadExplicitBitstream(subtree, subtree.contentAvailability, internalBinaryBuffer, context);
1406
+ }
1407
+ await loadExplicitBitstream(subtree, subtree.childSubtreeAvailability, internalBinaryBuffer, context);
1525
1408
  return subtree;
1526
1409
  }
1527
1410
  async function loadExplicitBitstream(subtree, availabilityObject, internalBinaryBuffer, context) {
@@ -1541,19 +1424,11 @@ async function loadExplicitBitstream(subtree, availabilityObject, internalBinary
1541
1424
  const bufferUri = `${(context == null ? void 0 : context.baseUrl) || ""}/${buffer.uri}`;
1542
1425
  const response = await context.fetch(bufferUri);
1543
1426
  const data = await response.arrayBuffer();
1544
- availabilityObject.explicitBitstream = new Uint8Array(
1545
- data,
1546
- bufferView.byteOffset,
1547
- bufferView.byteLength
1548
- );
1427
+ availabilityObject.explicitBitstream = new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
1549
1428
  return;
1550
1429
  }
1551
1430
  const bufferStart = subtree.buffers.slice(0, bufferView.buffer).reduce((offset, buf) => offset + buf.byteLength, 0);
1552
- availabilityObject.explicitBitstream = new Uint8Array(
1553
- internalBinaryBuffer.slice(bufferStart, bufferStart + buffer.byteLength),
1554
- bufferView.byteOffset,
1555
- bufferView.byteLength
1556
- );
1431
+ availabilityObject.explicitBitstream = new Uint8Array(internalBinaryBuffer.slice(bufferStart, bufferStart + buffer.byteLength), bufferView.byteOffset, bufferView.byteLength);
1557
1432
  }
1558
1433
  function parseUint64Value(buffer) {
1559
1434
  const dataView = new DataView(buffer);
@@ -1562,7 +1437,7 @@ function parseUint64Value(buffer) {
1562
1437
  return left + 2 ** 32 * right;
1563
1438
  }
1564
1439
 
1565
- // src/tile-3d-subtree-loader.ts
1440
+ // dist/tile-3d-subtree-loader.js
1566
1441
  var Tile3DSubtreeLoader = {
1567
1442
  id: "3d-tiles-subtree",
1568
1443
  name: "3D Tiles Subtree",
@@ -1575,15 +1450,15 @@ var Tile3DSubtreeLoader = {
1575
1450
  options: {}
1576
1451
  };
1577
1452
 
1578
- // src/lib/parsers/parse-3d-tile-header.ts
1453
+ // dist/lib/parsers/parse-3d-tile-header.js
1579
1454
  var import_core8 = require("@loaders.gl/core");
1580
1455
  var import_tiles = require("@loaders.gl/tiles");
1581
1456
 
1582
- // src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
1457
+ // dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
1583
1458
  var import_core7 = require("@loaders.gl/core");
1584
1459
  var import_log = __toESM(require("@probe.gl/log"), 1);
1585
1460
 
1586
- // src/lib/utils/s2/s2-token-functions.ts
1461
+ // dist/lib/utils/s2/s2-token-functions.js
1587
1462
  var import_long = __toESM(require("long"), 1);
1588
1463
  var MAXIMUM_TOKEN_LENGTH = 16;
1589
1464
  function getS2CellIdFromToken(token) {
@@ -1616,7 +1491,7 @@ function lsb(cellId) {
1616
1491
  return cellId.and(cellId.not().add(1));
1617
1492
  }
1618
1493
 
1619
- // src/lib/utils/s2/s2geometry/s2-geometry.ts
1494
+ // dist/lib/utils/s2/s2geometry/s2-geometry.js
1620
1495
  var import_long2 = __toESM(require("long"), 1);
1621
1496
  var FACE_BITS = 3;
1622
1497
  var MAX_LEVEL = 30;
@@ -1733,7 +1608,7 @@ function getS2LngLatFromS2Cell(s2Cell) {
1733
1608
  return XYZToLngLat(xyz);
1734
1609
  }
1735
1610
 
1736
- // src/lib/utils/s2/converters/s2-to-boundary.ts
1611
+ // dist/lib/utils/s2/converters/s2-to-boundary.js
1737
1612
  var MAX_RESOLUTION = 100;
1738
1613
  function getS2BoundaryFlatFromS2Cell(s2cell) {
1739
1614
  const { face, ij, level } = s2cell;
@@ -1775,7 +1650,7 @@ function getS2BoundaryFlatFromS2Cell(s2cell) {
1775
1650
  return result;
1776
1651
  }
1777
1652
 
1778
- // src/lib/utils/s2/s2geometry/s2-cell-utils.ts
1653
+ // dist/lib/utils/s2/s2geometry/s2-cell-utils.js
1779
1654
  function getS2Cell(tokenOrKey) {
1780
1655
  const key = getS2QuadKey(tokenOrKey);
1781
1656
  const s2cell = getS2CellFromQuadKey(key);
@@ -1789,13 +1664,13 @@ function getS2QuadKey(tokenOrKey) {
1789
1664
  return getS2QuadkeyFromCellId(id);
1790
1665
  }
1791
1666
 
1792
- // src/lib/utils/s2/s2-geometry-functions.ts
1667
+ // dist/lib/utils/s2/s2-geometry-functions.js
1793
1668
  function getS2LngLat(s2Token) {
1794
1669
  const s2cell = getS2Cell(s2Token);
1795
1670
  return getS2LngLatFromS2Cell(s2cell);
1796
1671
  }
1797
1672
 
1798
- // src/lib/utils/s2/converters/s2-to-region.ts
1673
+ // dist/lib/utils/s2/converters/s2-to-region.js
1799
1674
  function getS2Region(s2cell) {
1800
1675
  let region;
1801
1676
  if (s2cell.face === 2 || s2cell.face === 5) {
@@ -1837,7 +1712,7 @@ function get2DRegionFromS2Corners(corners) {
1837
1712
  };
1838
1713
  }
1839
1714
 
1840
- // src/lib/utils/s2/converters/s2-to-obb-points.ts
1715
+ // dist/lib/utils/s2/converters/s2-to-obb-points.js
1841
1716
  var import_core5 = require("@math.gl/core");
1842
1717
  function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
1843
1718
  const min = (heightInfo == null ? void 0 : heightInfo.minimumHeight) || 0;
@@ -1860,7 +1735,7 @@ function getS2OrientedBoundingBoxCornerPoints(tokenOrKey, heightInfo) {
1860
1735
  return points;
1861
1736
  }
1862
1737
 
1863
- // src/lib/utils/obb/s2-corners-to-obb.ts
1738
+ // dist/lib/utils/obb/s2-corners-to-obb.js
1864
1739
  var import_core6 = require("@math.gl/core");
1865
1740
  var import_culling = require("@math.gl/culling");
1866
1741
  var import_geospatial2 = require("@math.gl/geospatial");
@@ -1886,7 +1761,7 @@ function convertS2BoundingVolumetoOBB(s2VolumeInfo) {
1886
1761
  return box;
1887
1762
  }
1888
1763
 
1889
- // src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
1764
+ // dist/lib/parsers/helpers/parse-3d-implicit-tiles.js
1890
1765
  var QUADTREE_DIVISION_COUNT = 4;
1891
1766
  var OCTREE_DIVISION_COUNT = 8;
1892
1767
  var SUBDIVISION_COUNT_MAP = {
@@ -1922,42 +1797,23 @@ function getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme) {
1922
1797
  return void 0;
1923
1798
  }
1924
1799
  async function parseImplicitTiles(params) {
1925
- const {
1926
- implicitOptions,
1927
- parentData = {
1928
- mortonIndex: 0,
1929
- x: 0,
1930
- y: 0,
1931
- z: 0
1932
- },
1933
- childIndex = 0,
1934
- s2VolumeBox,
1935
- loaderOptions
1936
- } = params;
1937
- let {
1938
- subtree,
1939
- level = 0,
1940
- globalData = {
1941
- level: 0,
1942
- mortonIndex: 0,
1943
- x: 0,
1944
- y: 0,
1945
- z: 0
1946
- }
1947
- } = params;
1948
- const {
1949
- subdivisionScheme,
1950
- subtreeLevels,
1951
- maximumLevel,
1952
- contentUrlTemplate,
1953
- subtreesUriTemplate,
1954
- basePath
1955
- } = implicitOptions;
1800
+ const { implicitOptions, parentData = {
1801
+ mortonIndex: 0,
1802
+ x: 0,
1803
+ y: 0,
1804
+ z: 0
1805
+ }, childIndex = 0, s2VolumeBox, loaderOptions } = params;
1806
+ let { subtree, level = 0, globalData = {
1807
+ level: 0,
1808
+ mortonIndex: 0,
1809
+ x: 0,
1810
+ y: 0,
1811
+ z: 0
1812
+ } } = params;
1813
+ const { subdivisionScheme, subtreeLevels, maximumLevel, contentUrlTemplate, subtreesUriTemplate, basePath } = implicitOptions;
1956
1814
  const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
1957
1815
  if (!maximumLevel) {
1958
- import_log.default.once(
1959
- `Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`
1960
- );
1816
+ import_log.default.once(`Missing 'maximumLevel' or 'availableLevels' property. The subtree ${contentUrlTemplate} won't be loaded...`);
1961
1817
  return tile;
1962
1818
  }
1963
1819
  const lev = level + globalData.level;
@@ -1977,10 +1833,7 @@ async function parseImplicitTiles(params) {
1977
1833
  let childTileZ = concatBits(parentData.z, childZ, 1);
1978
1834
  let isChildSubtreeAvailable = false;
1979
1835
  if (level >= subtreeLevels) {
1980
- isChildSubtreeAvailable = getAvailabilityResult(
1981
- subtree.childSubtreeAvailability,
1982
- childTileMortonIndex
1983
- );
1836
+ isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
1984
1837
  }
1985
1838
  const x = concatBits(globalData.x, childTileX, level);
1986
1839
  const y = concatBits(globalData.y, childTileY, level);
@@ -2008,21 +1861,14 @@ async function parseImplicitTiles(params) {
2008
1861
  if (!isTileAvailable) {
2009
1862
  return tile;
2010
1863
  }
2011
- const isContentAvailable = getAvailabilityResult(
2012
- subtree.contentAvailability,
2013
- tileAvailabilityIndex
2014
- );
1864
+ const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
2015
1865
  if (isContentAvailable) {
2016
1866
  tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, lev, x, y, z);
2017
1867
  }
2018
1868
  const childTileLevel = level + 1;
2019
1869
  const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
2020
1870
  for (let index = 0; index < childrenPerTile; index++) {
2021
- const childS2VolumeBox = getChildS2VolumeBox(
2022
- s2VolumeBox,
2023
- index,
2024
- subdivisionScheme
2025
- );
1871
+ const childS2VolumeBox = getChildS2VolumeBox(s2VolumeBox, index, subdivisionScheme);
2026
1872
  const childTileParsed = await parseImplicitTiles({
2027
1873
  subtree,
2028
1874
  implicitOptions,
@@ -2036,13 +1882,7 @@ async function parseImplicitTiles(params) {
2036
1882
  if (childTileParsed.contentUrl || childTileParsed.children.length) {
2037
1883
  const globalLevel = lev + 1;
2038
1884
  const childCoordinates = { childTileX, childTileY, childTileZ };
2039
- const formattedTile = formatTileData(
2040
- childTileParsed,
2041
- globalLevel,
2042
- childCoordinates,
2043
- implicitOptions,
2044
- s2VolumeBox
2045
- );
1885
+ const formattedTile = formatTileData(childTileParsed, globalLevel, childCoordinates, implicitOptions, s2VolumeBox);
2046
1886
  tile.children.push(formattedTile);
2047
1887
  }
2048
1888
  }
@@ -2067,23 +1907,11 @@ function getAvailabilityResult(availabilityData, index) {
2067
1907
  return false;
2068
1908
  }
2069
1909
  function formatTileData(tile, level, childCoordinates, options, s2VolumeBox) {
2070
- const {
2071
- basePath,
2072
- refine,
2073
- getRefine: getRefine2,
2074
- lodMetricType,
2075
- getTileType: getTileType2,
2076
- rootLodMetricValue,
2077
- rootBoundingVolume
2078
- } = options;
1910
+ const { basePath, refine, getRefine: getRefine2, lodMetricType, getTileType: getTileType2, rootLodMetricValue, rootBoundingVolume } = options;
2079
1911
  const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
2080
1912
  const lodMetricValue = rootLodMetricValue / 2 ** level;
2081
1913
  const boundingVolume = (s2VolumeBox == null ? void 0 : s2VolumeBox.box) ? { box: s2VolumeBox.box } : rootBoundingVolume;
2082
- const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(
2083
- level,
2084
- boundingVolume,
2085
- childCoordinates
2086
- );
1914
+ const boundingVolumeForChildTile = calculateBoundingVolumeForChildTile(level, boundingVolume, childCoordinates);
2087
1915
  return {
2088
1916
  children: tile.children,
2089
1917
  contentUrl: tile.contentUrl,
@@ -2142,7 +1970,7 @@ function getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {
2142
1970
  return bitValue === 1;
2143
1971
  }
2144
1972
 
2145
- // src/lib/parsers/parse-3d-tile-header.ts
1973
+ // dist/lib/parsers/parse-3d-tile-header.js
2146
1974
  function getTileType(tile, tileContentUrl = "") {
2147
1975
  if (!tileContentUrl) {
2148
1976
  return import_tiles.TILE_TYPE.EMPTY;
@@ -2211,13 +2039,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
2211
2039
  let root = null;
2212
2040
  const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
2213
2041
  if (rootImplicitTilingExtension && tileset.root) {
2214
- root = await normalizeImplicitTileHeaders(
2215
- tileset.root,
2216
- tileset,
2217
- basePath,
2218
- rootImplicitTilingExtension,
2219
- options
2220
- );
2042
+ root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);
2221
2043
  } else {
2222
2044
  root = normalizeTileData(tileset.root, basePath);
2223
2045
  }
@@ -2231,13 +2053,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
2231
2053
  const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
2232
2054
  let childHeaderPostprocessed;
2233
2055
  if (childImplicitTilingExtension) {
2234
- childHeaderPostprocessed = await normalizeImplicitTileHeaders(
2235
- childHeader,
2236
- tileset,
2237
- basePath,
2238
- childImplicitTilingExtension,
2239
- options
2240
- );
2056
+ childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);
2241
2057
  } else {
2242
2058
  childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
2243
2059
  }
@@ -2252,13 +2068,7 @@ async function normalizeTileHeaders(tileset, basePath, options) {
2252
2068
  }
2253
2069
  async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {
2254
2070
  var _a, _b, _c;
2255
- const {
2256
- subdivisionScheme,
2257
- maximumLevel,
2258
- availableLevels,
2259
- subtreeLevels,
2260
- subtrees: { uri: subtreesUriTemplate }
2261
- } = implicitTilingExtension;
2071
+ const { subdivisionScheme, maximumLevel, availableLevels, subtreeLevels, subtrees: { uri: subtreesUriTemplate } } = implicitTilingExtension;
2262
2072
  const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
2263
2073
  const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
2264
2074
  const subtree = await (0, import_core8.load)(subtreeUrl, Tile3DSubtreeLoader, options);
@@ -2323,7 +2133,7 @@ function getImplicitTilingExtensionData(tile) {
2323
2133
  return ((_a = tile == null ? void 0 : tile.extensions) == null ? void 0 : _a["3DTILES_implicit_tiling"]) || (tile == null ? void 0 : tile.implicitTiling);
2324
2134
  }
2325
2135
 
2326
- // src/tiles-3d-loader.ts
2136
+ // dist/tiles-3d-loader.js
2327
2137
  var Tiles3DLoader = {
2328
2138
  id: "3d-tiles",
2329
2139
  name: "3D Tiles",
@@ -2387,7 +2197,7 @@ function getBaseUri(tilesetUrl) {
2387
2197
  return import_loader_utils8.path.dirname(tilesetUrl);
2388
2198
  }
2389
2199
 
2390
- // src/lib/ion/ion.ts
2200
+ // dist/lib/ion/ion.js
2391
2201
  var import_core9 = require("@loaders.gl/core");
2392
2202
  var import_loader_utils9 = require("@loaders.gl/loader-utils");
2393
2203
  var CESIUM_ION_URL = "https://api.cesium.com/v1/assets";
@@ -2439,7 +2249,7 @@ async function getIonAssetMetadata(accessToken, assetId) {
2439
2249
  return metadata;
2440
2250
  }
2441
2251
 
2442
- // src/cesium-ion-loader.ts
2252
+ // dist/cesium-ion-loader.js
2443
2253
  async function preload(url, options = {}) {
2444
2254
  options = options["cesium-ion"] || {};
2445
2255
  const { accessToken } = options;
@@ -2470,13 +2280,13 @@ var CesiumIonLoader = {
2470
2280
  }
2471
2281
  };
2472
2282
 
2473
- // src/3d-tiles-archive-loader.ts
2283
+ // dist/3d-tiles-archive-loader.js
2474
2284
  var import_loader_utils10 = require("@loaders.gl/loader-utils");
2475
2285
 
2476
- // src/3d-tiles-archive/3d-tiles-archive-parser.ts
2286
+ // dist/3d-tiles-archive/3d-tiles-archive-parser.js
2477
2287
  var import_zip2 = require("@loaders.gl/zip");
2478
2288
 
2479
- // src/3d-tiles-archive/3d-tiles-archive-archive.ts
2289
+ // dist/3d-tiles-archive/3d-tiles-archive-archive.js
2480
2290
  var import_crypto = require("@loaders.gl/crypto");
2481
2291
  var import_compression = require("@loaders.gl/compression");
2482
2292
  var import_zip = require("@loaders.gl/zip");
@@ -2529,10 +2339,7 @@ var Tiles3DArchive = class extends import_zip.IndexedArchive {
2529
2339
  if (!localFileHeader) {
2530
2340
  return null;
2531
2341
  }
2532
- const compressedFile = await this.fileProvider.slice(
2533
- localFileHeader.fileDataOffset,
2534
- localFileHeader.fileDataOffset + localFileHeader.compressedSize
2535
- );
2342
+ const compressedFile = await this.fileProvider.slice(localFileHeader.fileDataOffset, localFileHeader.fileDataOffset + localFileHeader.compressedSize);
2536
2343
  const compressionMethod = COMPRESSION_METHODS[localFileHeader.compressionMethod];
2537
2344
  if (!compressionMethod) {
2538
2345
  throw Error("Only Deflation compression is supported");
@@ -2545,36 +2352,28 @@ var Tiles3DArchive = class extends import_zip.IndexedArchive {
2545
2352
  }
2546
2353
  };
2547
2354
 
2548
- // src/3d-tiles-archive/3d-tiles-archive-parser.ts
2355
+ // dist/3d-tiles-archive/3d-tiles-archive-parser.js
2549
2356
  var parse3DTilesArchive = async (fileProvider, cb) => {
2550
2357
  const hashCDOffset = await (0, import_zip2.searchFromTheEnd)(fileProvider, import_zip2.CD_HEADER_SIGNATURE);
2551
2358
  const cdFileHeader = await (0, import_zip2.parseZipCDFileHeader)(hashCDOffset, fileProvider);
2552
2359
  let hashTable;
2553
2360
  if ((cdFileHeader == null ? void 0 : cdFileHeader.fileName) !== "@3dtilesIndex1@") {
2554
2361
  hashTable = await (0, import_zip2.makeHashTableFromZipHeaders)(fileProvider);
2555
- cb == null ? void 0 : cb(
2556
- "3tz doesnt contain hash file, hash info has been composed according to zip archive headers"
2557
- );
2362
+ cb == null ? void 0 : cb("3tz doesnt contain hash file, hash info has been composed according to zip archive headers");
2558
2363
  } else {
2559
- const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(
2560
- cdFileHeader.localHeaderOffset,
2561
- fileProvider
2562
- );
2364
+ const localFileHeader = await (0, import_zip2.parseZipLocalFileHeader)(cdFileHeader.localHeaderOffset, fileProvider);
2563
2365
  if (!localFileHeader) {
2564
2366
  throw new Error("corrupted 3tz zip archive");
2565
2367
  }
2566
2368
  const fileDataOffset = localFileHeader.fileDataOffset;
2567
- const hashFile = await fileProvider.slice(
2568
- fileDataOffset,
2569
- fileDataOffset + localFileHeader.compressedSize
2570
- );
2369
+ const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
2571
2370
  hashTable = (0, import_zip2.parseHashTable)(hashFile);
2572
2371
  }
2573
2372
  return new Tiles3DArchive(fileProvider, hashTable);
2574
2373
  };
2575
2374
 
2576
- // src/3d-tiles-archive-loader.ts
2577
- var VERSION2 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2375
+ // dist/3d-tiles-archive-loader.js
2376
+ var VERSION2 = true ? "4.2.0-alpha.4" : "latest";
2578
2377
  var Tiles3DArchiveFileLoader = {
2579
2378
  name: "3tz",
2580
2379
  id: "3tz",
@@ -2591,10 +2390,10 @@ async function parse3DTilesArchive2(data, options = {}) {
2591
2390
  return archive.getFile(((_a = options["3d-tiles-archive"]) == null ? void 0 : _a.path) ?? "");
2592
2391
  }
2593
2392
 
2594
- // src/lib/encoders/encode-3d-tile.ts
2393
+ // dist/lib/encoders/encode-3d-tile.js
2595
2394
  var import_loader_utils15 = require("@loaders.gl/loader-utils");
2596
2395
 
2597
- // src/lib/encoders/helpers/encode-3d-tile-header.ts
2396
+ // dist/lib/encoders/helpers/encode-3d-tile-header.js
2598
2397
  var import_loader_utils11 = require("@loaders.gl/loader-utils");
2599
2398
  function encode3DTileHeader(tile, dataView, byteOffset) {
2600
2399
  const HEADER_SIZE = 12;
@@ -2619,7 +2418,7 @@ function encode3DTileByteLength(dataView, byteOffsetTileStart, byteLength) {
2619
2418
  dataView.setUint32(byteOffsetTileStart + 8, byteLength, true);
2620
2419
  }
2621
2420
 
2622
- // src/lib/encoders/encode-3d-tile-composite.ts
2421
+ // dist/lib/encoders/encode-3d-tile-composite.js
2623
2422
  function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile2) {
2624
2423
  tile = { magic: MAGIC_ARRAY.COMPOSITE, tiles: [], ...tile };
2625
2424
  const byteOffsetStart = byteOffset;
@@ -2635,7 +2434,7 @@ function encodeComposite3DTile(tile, dataView, byteOffset, options, encode3DTile
2635
2434
  return byteOffset;
2636
2435
  }
2637
2436
 
2638
- // src/lib/encoders/encode-3d-tile-batched-model.ts
2437
+ // dist/lib/encoders/encode-3d-tile-batched-model.js
2639
2438
  var import_loader_utils12 = require("@loaders.gl/loader-utils");
2640
2439
  function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
2641
2440
  const { featuresLength = 0, batchTable } = tile;
@@ -2668,7 +2467,7 @@ function encodeBatchedModel3DTile(tile, dataView, byteOffset, options) {
2668
2467
  return byteOffset;
2669
2468
  }
2670
2469
 
2671
- // src/lib/encoders/encode-3d-tile-instanced-model.ts
2470
+ // dist/lib/encoders/encode-3d-tile-instanced-model.js
2672
2471
  var import_loader_utils13 = require("@loaders.gl/loader-utils");
2673
2472
  function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
2674
2473
  const { featuresLength = 1, gltfFormat = 1, gltfUri = "" } = tile;
@@ -2690,18 +2489,13 @@ function encodeInstancedModel3DTile(tile, dataView, byteOffset, options) {
2690
2489
  dataView.setUint32(28, gltfFormat, true);
2691
2490
  }
2692
2491
  byteOffset += 20;
2693
- byteOffset += (0, import_loader_utils13.copyStringToDataView)(
2694
- dataView,
2695
- byteOffset,
2696
- featureTableJsonString,
2697
- featureTableJsonByteLength
2698
- );
2492
+ byteOffset += (0, import_loader_utils13.copyStringToDataView)(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
2699
2493
  byteOffset += (0, import_loader_utils13.copyStringToDataView)(dataView, byteOffset, gltfUri, gltfUriByteLength);
2700
2494
  encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
2701
2495
  return byteOffset;
2702
2496
  }
2703
2497
 
2704
- // src/lib/encoders/encode-3d-tile-point-cloud.ts
2498
+ // dist/lib/encoders/encode-3d-tile-point-cloud.js
2705
2499
  var import_loader_utils14 = require("@loaders.gl/loader-utils");
2706
2500
  var DEFAULT_FEATURE_TABLE_JSON = {
2707
2501
  POINTS_LENGTH: 1,
@@ -2726,23 +2520,13 @@ function encodePointCloud3DTile(tile, dataView, byteOffset, options) {
2726
2520
  dataView.setUint32(byteOffset + 12, 0, true);
2727
2521
  }
2728
2522
  byteOffset += 16;
2729
- byteOffset += (0, import_loader_utils14.copyStringToDataView)(
2730
- dataView,
2731
- byteOffset,
2732
- featureTableJsonString,
2733
- featureTableJsonByteLength
2734
- );
2735
- byteOffset += (0, import_loader_utils14.copyBinaryToDataView)(
2736
- dataView,
2737
- byteOffset,
2738
- featureTableBinary,
2739
- featureTableBinaryByteLength
2740
- );
2523
+ byteOffset += (0, import_loader_utils14.copyStringToDataView)(dataView, byteOffset, featureTableJsonString, featureTableJsonByteLength);
2524
+ byteOffset += (0, import_loader_utils14.copyBinaryToDataView)(dataView, byteOffset, featureTableBinary, featureTableBinaryByteLength);
2741
2525
  encode3DTileByteLength(dataView, byteOffsetStart, byteOffset - byteOffsetStart);
2742
2526
  return byteOffset;
2743
2527
  }
2744
2528
 
2745
- // src/lib/encoders/encode-3d-tile.ts
2529
+ // dist/lib/encoders/encode-3d-tile.js
2746
2530
  function encode3DTile(tile, options) {
2747
2531
  const byteLength = encode3DTileToDataView(tile, null, 0, options);
2748
2532
  const arrayBuffer = new ArrayBuffer(byteLength);
@@ -2766,7 +2550,7 @@ function encode3DTileToDataView(tile, dataView, byteOffset, options) {
2766
2550
  }
2767
2551
  }
2768
2552
 
2769
- // src/tile-3d-writer.ts
2553
+ // dist/tile-3d-writer.js
2770
2554
  var Tile3DWriter = {
2771
2555
  name: "3D Tile",
2772
2556
  id: "3d-tiles",
@@ -2784,3 +2568,4 @@ var Tile3DWriter = {
2784
2568
  function encodeSync(tile, options) {
2785
2569
  return encode3DTile(tile, options);
2786
2570
  }
2571
+ //# sourceMappingURL=index.cjs.map