@loaders.gl/tiles 4.2.0-alpha.4 → 4.2.0-alpha.6

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 (75) hide show
  1. package/dist/constants.js +34 -32
  2. package/dist/dist.dev.js +679 -449
  3. package/dist/dist.min.js +9 -0
  4. package/dist/index.cjs +265 -326
  5. package/dist/index.cjs.map +7 -0
  6. package/dist/index.d.ts +10 -10
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +3 -1
  9. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts +1 -1
  10. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.d.ts.map +1 -1
  11. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js +45 -35
  12. package/dist/tileset/format-i3s/i3s-pending-tiles-register.js +38 -22
  13. package/dist/tileset/format-i3s/i3s-tile-manager.d.ts +1 -1
  14. package/dist/tileset/format-i3s/i3s-tile-manager.d.ts.map +1 -1
  15. package/dist/tileset/format-i3s/i3s-tile-manager.js +68 -69
  16. package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts +2 -2
  17. package/dist/tileset/format-i3s/i3s-tileset-traverser.d.ts.map +1 -1
  18. package/dist/tileset/format-i3s/i3s-tileset-traverser.js +79 -57
  19. package/dist/tileset/helpers/3d-tiles-options.d.ts +1 -1
  20. package/dist/tileset/helpers/3d-tiles-options.d.ts.map +1 -1
  21. package/dist/tileset/helpers/3d-tiles-options.js +3 -4
  22. package/dist/tileset/helpers/bounding-volume.js +269 -128
  23. package/dist/tileset/helpers/frame-state.d.ts +1 -1
  24. package/dist/tileset/helpers/frame-state.d.ts.map +1 -1
  25. package/dist/tileset/helpers/frame-state.js +114 -95
  26. package/dist/tileset/helpers/i3s-lod.d.ts +2 -2
  27. package/dist/tileset/helpers/i3s-lod.d.ts.map +1 -1
  28. package/dist/tileset/helpers/i3s-lod.js +68 -39
  29. package/dist/tileset/helpers/tiles-3d-lod.js +97 -85
  30. package/dist/tileset/helpers/transform-utils.js +45 -44
  31. package/dist/tileset/helpers/zoom.d.ts +1 -1
  32. package/dist/tileset/helpers/zoom.d.ts.map +1 -1
  33. package/dist/tileset/helpers/zoom.js +70 -40
  34. package/dist/tileset/tile-3d.d.ts +7 -6
  35. package/dist/tileset/tile-3d.d.ts.map +1 -1
  36. package/dist/tileset/tile-3d.js +608 -399
  37. package/dist/tileset/tileset-3d.d.ts +7 -6
  38. package/dist/tileset/tileset-3d.d.ts.map +1 -1
  39. package/dist/tileset/tileset-3d.js +739 -597
  40. package/dist/tileset/tileset-cache.d.ts +2 -2
  41. package/dist/tileset/tileset-cache.d.ts.map +1 -1
  42. package/dist/tileset/tileset-cache.js +65 -48
  43. package/dist/tileset/tileset-traverser.d.ts +3 -3
  44. package/dist/tileset/tileset-traverser.d.ts.map +1 -1
  45. package/dist/tileset/tileset-traverser.js +282 -220
  46. package/dist/types.js +0 -1
  47. package/dist/utils/doubly-linked-list-node.js +17 -9
  48. package/dist/utils/doubly-linked-list.d.ts +1 -1
  49. package/dist/utils/doubly-linked-list.d.ts.map +1 -1
  50. package/dist/utils/doubly-linked-list.js +83 -56
  51. package/dist/utils/managed-array.js +140 -76
  52. package/package.json +10 -9
  53. package/src/tileset/tile-3d.ts +1 -1
  54. package/src/tileset/tileset-3d.ts +1 -1
  55. package/dist/constants.js.map +0 -1
  56. package/dist/index.js.map +0 -1
  57. package/dist/tileset/format-3d-tiles/tileset-3d-traverser.js.map +0 -1
  58. package/dist/tileset/format-i3s/i3s-pending-tiles-register.js.map +0 -1
  59. package/dist/tileset/format-i3s/i3s-tile-manager.js.map +0 -1
  60. package/dist/tileset/format-i3s/i3s-tileset-traverser.js.map +0 -1
  61. package/dist/tileset/helpers/3d-tiles-options.js.map +0 -1
  62. package/dist/tileset/helpers/bounding-volume.js.map +0 -1
  63. package/dist/tileset/helpers/frame-state.js.map +0 -1
  64. package/dist/tileset/helpers/i3s-lod.js.map +0 -1
  65. package/dist/tileset/helpers/tiles-3d-lod.js.map +0 -1
  66. package/dist/tileset/helpers/transform-utils.js.map +0 -1
  67. package/dist/tileset/helpers/zoom.js.map +0 -1
  68. package/dist/tileset/tile-3d.js.map +0 -1
  69. package/dist/tileset/tileset-3d.js.map +0 -1
  70. package/dist/tileset/tileset-cache.js.map +0 -1
  71. package/dist/tileset/tileset-traverser.js.map +0 -1
  72. package/dist/types.js.map +0 -1
  73. package/dist/utils/doubly-linked-list-node.js.map +0 -1
  74. package/dist/utils/doubly-linked-list.js.map +0 -1
  75. package/dist/utils/managed-array.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -17,9 +17,9 @@ var __copyProps = (to, from, except, desc) => {
17
17
  };
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
 
20
- // src/index.ts
21
- var src_exports = {};
22
- __export(src_exports, {
20
+ // dist/index.js
21
+ var dist_exports = {};
22
+ __export(dist_exports, {
23
23
  LOD_METRIC_TYPE: () => LOD_METRIC_TYPE,
24
24
  TILESET_TYPE: () => TILESET_TYPE,
25
25
  TILE_CONTENT_STATE: () => TILE_CONTENT_STATE,
@@ -34,16 +34,19 @@ __export(src_exports, {
34
34
  getFrameState: () => getFrameState,
35
35
  getLodStatus: () => getLodStatus
36
36
  });
37
- module.exports = __toCommonJS(src_exports);
37
+ module.exports = __toCommonJS(dist_exports);
38
38
 
39
- // src/tileset/tileset-3d.ts
39
+ // dist/tileset/tileset-3d.js
40
40
  var import_core10 = require("@math.gl/core");
41
41
  var import_geospatial6 = require("@math.gl/geospatial");
42
42
  var import_stats = require("@probe.gl/stats");
43
43
  var import_loader_utils4 = require("@loaders.gl/loader-utils");
44
44
 
45
- // src/utils/doubly-linked-list-node.ts
45
+ // dist/utils/doubly-linked-list-node.js
46
46
  var DoublyLinkedListNode = class {
47
+ item;
48
+ previous;
49
+ next;
47
50
  constructor(item, previous, next) {
48
51
  this.item = item;
49
52
  this.previous = previous;
@@ -51,13 +54,11 @@ var DoublyLinkedListNode = class {
51
54
  }
52
55
  };
53
56
 
54
- // src/utils/doubly-linked-list.ts
57
+ // dist/utils/doubly-linked-list.js
55
58
  var DoublyLinkedList = class {
56
- constructor() {
57
- this.head = null;
58
- this.tail = null;
59
- this._length = 0;
60
- }
59
+ head = null;
60
+ tail = null;
61
+ _length = 0;
61
62
  get length() {
62
63
  return this._length;
63
64
  }
@@ -129,8 +130,11 @@ var DoublyLinkedList = class {
129
130
  }
130
131
  };
131
132
 
132
- // src/tileset/tileset-cache.ts
133
+ // dist/tileset/tileset-cache.js
133
134
  var TilesetCache = class {
135
+ _list;
136
+ _sentinel;
137
+ _trimTiles;
134
138
  constructor() {
135
139
  this._list = new DoublyLinkedList();
136
140
  this._sentinel = this._list.add("sentinel");
@@ -182,7 +186,7 @@ var TilesetCache = class {
182
186
  }
183
187
  };
184
188
 
185
- // src/tileset/helpers/transform-utils.ts
189
+ // dist/tileset/helpers/transform-utils.js
186
190
  var import_geospatial = require("@math.gl/geospatial");
187
191
  var import_core = require("@math.gl/core");
188
192
  var import_loader_utils = require("@loaders.gl/loader-utils");
@@ -190,10 +194,7 @@ function calculateTransformProps(tileHeader, tile) {
190
194
  (0, import_loader_utils.assert)(tileHeader);
191
195
  (0, import_loader_utils.assert)(tile);
192
196
  const { rtcCenter, gltfUpAxis } = tile;
193
- const {
194
- computedTransform,
195
- boundingVolume: { center }
196
- } = tileHeader;
197
+ const { computedTransform, boundingVolume: { center } } = tileHeader;
197
198
  let modelMatrix = new import_core.Matrix4(computedTransform);
198
199
  if (rtcCenter) {
199
200
  modelMatrix.translate(rtcCenter);
@@ -218,10 +219,7 @@ function calculateTransformProps(tileHeader, tile) {
218
219
  const cartesianOrigin = new import_core.Vector3(center);
219
220
  tile.cartesianModelMatrix = modelMatrix;
220
221
  tile.cartesianOrigin = cartesianOrigin;
221
- const cartographicOrigin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(
222
- cartesianOrigin,
223
- new import_core.Vector3()
224
- );
222
+ const cartographicOrigin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core.Vector3());
225
223
  const fromFixedFrameMatrix = import_geospatial.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin);
226
224
  const toFixedFrameMatrix = fromFixedFrameMatrix.invert();
227
225
  tile.cartographicModelMatrix = toFixedFrameMatrix.multiplyRight(modelMatrix);
@@ -231,7 +229,7 @@ function calculateTransformProps(tileHeader, tile) {
231
229
  }
232
230
  }
233
231
 
234
- // src/tileset/helpers/frame-state.ts
232
+ // dist/tileset/helpers/frame-state.js
235
233
  var import_core2 = require("@math.gl/core");
236
234
  var import_culling = require("@math.gl/culling");
237
235
  var import_geospatial2 = require("@math.gl/geospatial");
@@ -251,10 +249,7 @@ function getFrameState(viewport, frameNumber) {
251
249
  const viewportCenterCartesian = worldToCartesian(viewport, viewport.center);
252
250
  const enuToFixedTransform = import_geospatial2.Ellipsoid.WGS84.eastNorthUpToFixedFrame(viewportCenterCartesian);
253
251
  const cameraPositionCartographic = viewport.unprojectPosition(viewport.cameraPosition);
254
- const cameraPositionCartesian2 = import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(
255
- cameraPositionCartographic,
256
- new import_core2.Vector3()
257
- );
252
+ const cameraPositionCartesian2 = import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(cameraPositionCartographic, new import_core2.Vector3());
258
253
  const cameraDirectionCartesian = new import_core2.Vector3(
259
254
  // @ts-ignore
260
255
  enuToFixedTransform.transformAsVector(new import_core2.Vector3(cameraDirection).scale(metersPerUnit))
@@ -321,10 +316,7 @@ function commonSpacePlanesToWGS84(viewport) {
321
316
  const nearCenterCartesian = worldToCartesian(viewport, nearCenterCommon);
322
317
  const cameraCartesian = worldToCartesian(viewport, viewport.cameraPosition, scratchPosition);
323
318
  let i = 0;
324
- cullingVolume.planes[i++].fromPointNormal(
325
- nearCenterCartesian,
326
- scratchVector.copy(nearCenterCartesian).subtract(cameraCartesian)
327
- );
319
+ cullingVolume.planes[i++].fromPointNormal(nearCenterCartesian, scratchVector.copy(nearCenterCartesian).subtract(cameraCartesian));
328
320
  for (const dir in frustumPlanes) {
329
321
  if (dir === "near") {
330
322
  continue;
@@ -349,7 +341,7 @@ function worldToCartesian(viewport, point, out = new import_core2.Vector3()) {
349
341
  return import_geospatial2.Ellipsoid.WGS84.cartographicToCartesian(cartographicPos, out);
350
342
  }
351
343
 
352
- // src/tileset/helpers/zoom.ts
344
+ // dist/tileset/helpers/zoom.js
353
345
  var import_core3 = require("@math.gl/core");
354
346
  var import_culling2 = require("@math.gl/culling");
355
347
  var import_geospatial3 = require("@math.gl/geospatial");
@@ -374,22 +366,13 @@ function getZoomFromBoundingVolume(boundingVolume, cartorgraphicCenter) {
374
366
  return 1;
375
367
  }
376
368
  function getZoomFromFullExtent(fullExtent, cartorgraphicCenter, cartesianCenter) {
377
- import_geospatial3.Ellipsoid.WGS84.cartographicToCartesian(
378
- [fullExtent.xmax, fullExtent.ymax, fullExtent.zmax],
379
- scratchVector2
380
- );
381
- const extentSize = Math.sqrt(
382
- Math.pow(scratchVector2[0] - cartesianCenter[0], 2) + Math.pow(scratchVector2[1] - cartesianCenter[1], 2) + Math.pow(scratchVector2[2] - cartesianCenter[2], 2)
383
- );
369
+ import_geospatial3.Ellipsoid.WGS84.cartographicToCartesian([fullExtent.xmax, fullExtent.ymax, fullExtent.zmax], scratchVector2);
370
+ const extentSize = Math.sqrt(Math.pow(scratchVector2[0] - cartesianCenter[0], 2) + Math.pow(scratchVector2[1] - cartesianCenter[1], 2) + Math.pow(scratchVector2[2] - cartesianCenter[2], 2));
384
371
  return Math.log2(WGS84_RADIUS_Z / (extentSize + cartorgraphicCenter[2]));
385
372
  }
386
373
  function getZoomFromExtent(extent, cartorgraphicCenter, cartesianCenter) {
387
374
  const [xmin, ymin, xmax, ymax] = extent;
388
- return getZoomFromFullExtent(
389
- { xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 },
390
- cartorgraphicCenter,
391
- cartesianCenter
392
- );
375
+ return getZoomFromFullExtent({ xmin, xmax, ymin, ymax, zmin: 0, zmax: 0 }, cartorgraphicCenter, cartesianCenter);
393
376
  }
394
377
  function getObbSize(halfAxes) {
395
378
  halfAxes.getColumn(0, scratchVector2);
@@ -400,12 +383,12 @@ function getObbSize(halfAxes) {
400
383
  return size;
401
384
  }
402
385
 
403
- // src/tileset/tile-3d.ts
386
+ // dist/tileset/tile-3d.js
404
387
  var import_core7 = require("@math.gl/core");
405
388
  var import_culling4 = require("@math.gl/culling");
406
389
  var import_core8 = require("@loaders.gl/core");
407
390
 
408
- // src/constants.ts
391
+ // dist/constants.js
409
392
  var TILE_CONTENT_STATE = {
410
393
  UNLOADED: 0,
411
394
  // Has never been requested
@@ -420,35 +403,35 @@ var TILE_CONTENT_STATE = {
420
403
  FAILED: 5
421
404
  // Request failed.
422
405
  };
423
- var TILE_REFINEMENT = /* @__PURE__ */ ((TILE_REFINEMENT2) => {
406
+ var TILE_REFINEMENT;
407
+ (function(TILE_REFINEMENT2) {
424
408
  TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
425
409
  TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
426
- return TILE_REFINEMENT2;
427
- })(TILE_REFINEMENT || {});
428
- var TILE_TYPE = /* @__PURE__ */ ((TILE_TYPE2) => {
410
+ })(TILE_REFINEMENT || (TILE_REFINEMENT = {}));
411
+ var TILE_TYPE;
412
+ (function(TILE_TYPE2) {
429
413
  TILE_TYPE2["EMPTY"] = "empty";
430
414
  TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
431
415
  TILE_TYPE2["POINTCLOUD"] = "pointcloud";
432
416
  TILE_TYPE2["MESH"] = "mesh";
433
- return TILE_TYPE2;
434
- })(TILE_TYPE || {});
435
- var TILESET_TYPE = /* @__PURE__ */ ((TILESET_TYPE2) => {
417
+ })(TILE_TYPE || (TILE_TYPE = {}));
418
+ var TILESET_TYPE;
419
+ (function(TILESET_TYPE2) {
436
420
  TILESET_TYPE2["I3S"] = "I3S";
437
421
  TILESET_TYPE2["TILES3D"] = "TILES3D";
438
- return TILESET_TYPE2;
439
- })(TILESET_TYPE || {});
440
- var LOD_METRIC_TYPE = /* @__PURE__ */ ((LOD_METRIC_TYPE2) => {
422
+ })(TILESET_TYPE || (TILESET_TYPE = {}));
423
+ var LOD_METRIC_TYPE;
424
+ (function(LOD_METRIC_TYPE2) {
441
425
  LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
442
426
  LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
443
- return LOD_METRIC_TYPE2;
444
- })(LOD_METRIC_TYPE || {});
427
+ })(LOD_METRIC_TYPE || (LOD_METRIC_TYPE = {}));
445
428
  var TILE3D_OPTIMIZATION_HINT = {
446
429
  NOT_COMPUTED: -1,
447
430
  USE_OPTIMIZATION: 1,
448
431
  SKIP_OPTIMIZATION: 0
449
432
  };
450
433
 
451
- // src/tileset/helpers/bounding-volume.ts
434
+ // dist/tileset/helpers/bounding-volume.js
452
435
  var import_core4 = require("@math.gl/core");
453
436
  var import_culling3 = require("@math.gl/culling");
454
437
  var import_geospatial4 = require("@math.gl/geospatial");
@@ -550,37 +533,19 @@ function createSphere(sphere, transform, result) {
550
533
  }
551
534
  function createObbFromRegion(region) {
552
535
  const [west, south, east, north, minHeight, maxHeight] = region;
553
- const northWest = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
554
- [(0, import_core4.degrees)(west), (0, import_core4.degrees)(north), minHeight],
555
- scratchNorthWest
556
- );
557
- const southEast = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
558
- [(0, import_core4.degrees)(east), (0, import_core4.degrees)(south), maxHeight],
559
- scratchSouthEast
560
- );
536
+ const northWest = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(west), (0, import_core4.degrees)(north), minHeight], scratchNorthWest);
537
+ const southEast = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(east), (0, import_core4.degrees)(south), maxHeight], scratchSouthEast);
561
538
  const centerInCartesian = new import_core4.Vector3().addVectors(northWest, southEast).multiplyByScalar(0.5);
562
539
  import_geospatial4.Ellipsoid.WGS84.cartesianToCartographic(centerInCartesian, scratchCenter);
563
- import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
564
- [(0, import_core4.degrees)(east), scratchCenter[1], scratchCenter[2]],
565
- scratchXAxis
566
- );
567
- import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
568
- [scratchCenter[0], (0, import_core4.degrees)(north), scratchCenter[2]],
569
- scratchYAxis
570
- );
571
- import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(
572
- [scratchCenter[0], scratchCenter[1], maxHeight],
573
- scratchZAxis
574
- );
575
- return createBox(
576
- [
577
- ...centerInCartesian,
578
- ...scratchXAxis.subtract(centerInCartesian),
579
- ...scratchYAxis.subtract(centerInCartesian),
580
- ...scratchZAxis.subtract(centerInCartesian)
581
- ],
582
- new import_core4.Matrix4()
583
- );
540
+ import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([(0, import_core4.degrees)(east), scratchCenter[1], scratchCenter[2]], scratchXAxis);
541
+ import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([scratchCenter[0], (0, import_core4.degrees)(north), scratchCenter[2]], scratchYAxis);
542
+ import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian([scratchCenter[0], scratchCenter[1], maxHeight], scratchZAxis);
543
+ return createBox([
544
+ ...centerInCartesian,
545
+ ...scratchXAxis.subtract(centerInCartesian),
546
+ ...scratchYAxis.subtract(centerInCartesian),
547
+ ...scratchZAxis.subtract(centerInCartesian)
548
+ ], new import_core4.Matrix4());
584
549
  }
585
550
  function orientedBoundingBoxToCartographicBounds(boundingVolume) {
586
551
  const result = emptyCartographicBounds();
@@ -648,7 +613,7 @@ function addToCartographicBounds(target, cartesian) {
648
613
  target[1][2] = Math.max(target[1][2], scratchPoint[2]);
649
614
  }
650
615
 
651
- // src/tileset/helpers/tiles-3d-lod.ts
616
+ // dist/tileset/helpers/tiles-3d-lod.js
652
617
  var import_core5 = require("@math.gl/core");
653
618
  var scratchPositionNormal = new import_core5.Vector3();
654
619
  var scratchCartographic = new import_core5.Vector3();
@@ -684,7 +649,7 @@ function getTiles3DScreenSpaceError(tile, frameState, useParentLodMetric) {
684
649
  return error;
685
650
  }
686
651
 
687
- // src/tileset/helpers/i3s-lod.ts
652
+ // dist/tileset/helpers/i3s-lod.js
688
653
  var import_core6 = require("@math.gl/core");
689
654
  var import_geospatial5 = require("@math.gl/geospatial");
690
655
  var cameraPositionCartesian = new import_core6.Vector3();
@@ -722,38 +687,34 @@ function getProjectedRadius(tile, frameState) {
722
687
  import_geospatial5.Ellipsoid.WGS84.eastNorthUpToFixedFrame(mbsCenterCartesian, enuToCartesianMatrix);
723
688
  cartesianToEnuMatrix.copy(enuToCartesianMatrix).invert();
724
689
  cameraPositionEnu.copy(cameraPositionCartesian).transform(cartesianToEnuMatrix);
725
- const projection = Math.sqrt(
726
- cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]
727
- );
690
+ const projection = Math.sqrt(cameraPositionEnu[0] * cameraPositionEnu[0] + cameraPositionEnu[1] * cameraPositionEnu[1]);
728
691
  const extraZ = projection * projection / cameraPositionEnu[2];
729
692
  extraVertexEnu.copy([cameraPositionEnu[0], cameraPositionEnu[1], extraZ]);
730
693
  const extraVertexCartesian = extraVertexEnu.transform(enuToCartesianMatrix);
731
694
  const extraVectorCartesian = extraVertexCartesian.subtract(mbsCenterCartesian).normalize();
732
695
  const radiusVector = toEye.cross(extraVectorCartesian).normalize().scale(mbsR);
733
696
  const sphereMbsBorderVertexCartesian = radiusVector.add(mbsCenterCartesian);
734
- const sphereMbsBorderVertexCartographic = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(
735
- sphereMbsBorderVertexCartesian
736
- );
697
+ const sphereMbsBorderVertexCartographic = import_geospatial5.Ellipsoid.WGS84.cartesianToCartographic(sphereMbsBorderVertexCartesian);
737
698
  const projectedOrigin = viewport.project([mbsLon, mbsLat, mbsZ]);
738
- const projectedMbsBorderVertex = viewport.project(
739
- sphereMbsBorderVertexCartographic
740
- );
699
+ const projectedMbsBorderVertex = viewport.project(sphereMbsBorderVertexCartographic);
741
700
  const projectedRadius = projectedOriginVector.copy(projectedOrigin).subtract(projectedMbsBorderVertex).magnitude();
742
701
  return projectedRadius;
743
702
  }
744
703
 
745
- // src/tileset/helpers/3d-tiles-options.ts
704
+ // dist/tileset/helpers/3d-tiles-options.js
746
705
  function get3dTilesOptions(tileset) {
747
706
  return {
748
707
  assetGltfUpAxis: tileset.asset && tileset.asset.gltfUpAxis || "Y"
749
708
  };
750
709
  }
751
710
 
752
- // src/utils/managed-array.ts
711
+ // dist/utils/managed-array.js
753
712
  var import_loader_utils3 = require("@loaders.gl/loader-utils");
754
713
  var ManagedArray = class {
714
+ _map = /* @__PURE__ */ new Map();
715
+ _array;
716
+ _length;
755
717
  constructor(length = 0) {
756
- this._map = /* @__PURE__ */ new Map();
757
718
  this._array = new Array(length);
758
719
  this._length = length;
759
720
  }
@@ -888,7 +849,7 @@ var ManagedArray = class {
888
849
  }
889
850
  };
890
851
 
891
- // src/tileset/tileset-traverser.ts
852
+ // dist/tileset/tileset-traverser.js
892
853
  var DEFAULT_PROPS = {
893
854
  loadSiblings: false,
894
855
  skipLevelOfDetail: false,
@@ -899,29 +860,30 @@ var DEFAULT_PROPS = {
899
860
  basePath: ""
900
861
  };
901
862
  var TilesetTraverser = class {
902
- // TODO nested props
903
- constructor(options) {
904
- // fulfill in traverse call
905
- this.root = null;
906
- // tiles should be rendered
907
- this.selectedTiles = {};
908
- // tiles should be loaded from server
909
- this.requestedTiles = {};
910
- // tiles does not have render content
911
- this.emptyTiles = {};
912
- this.lastUpdate = new Date().getTime();
913
- this.updateDebounceTime = 1e3;
914
- /** temporary storage to hold the traversed tiles during a traversal */
915
- this._traversalStack = new ManagedArray();
916
- this._emptyTraversalStack = new ManagedArray();
917
- /** set in every traverse cycle */
918
- this._frameNumber = null;
919
- this.options = { ...DEFAULT_PROPS, ...options };
920
- }
863
+ options;
864
+ // fulfill in traverse call
865
+ root = null;
866
+ // tiles should be rendered
867
+ selectedTiles = {};
868
+ // tiles should be loaded from server
869
+ requestedTiles = {};
870
+ // tiles does not have render content
871
+ emptyTiles = {};
872
+ lastUpdate = new Date().getTime();
873
+ updateDebounceTime = 1e3;
874
+ /** temporary storage to hold the traversed tiles during a traversal */
875
+ _traversalStack = new ManagedArray();
876
+ _emptyTraversalStack = new ManagedArray();
877
+ /** set in every traverse cycle */
878
+ _frameNumber = null;
921
879
  // RESULT
922
880
  traversalFinished(frameState) {
923
881
  return true;
924
882
  }
883
+ // TODO nested props
884
+ constructor(options) {
885
+ this.options = { ...DEFAULT_PROPS, ...options };
886
+ }
925
887
  // tiles should be visible
926
888
  traverse(root, frameState, options) {
927
889
  this.root = root;
@@ -957,12 +919,7 @@ var TilesetTraverser = class {
957
919
  let shouldRefine = false;
958
920
  if (this.canTraverse(tile, frameState)) {
959
921
  this.updateChildTiles(tile, frameState);
960
- shouldRefine = this.updateAndPushChildren(
961
- tile,
962
- frameState,
963
- stack,
964
- tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth
965
- );
922
+ shouldRefine = this.updateAndPushChildren(tile, frameState, stack, tile.hasRenderContent ? tile._selectionDepth + 1 : tile._selectionDepth);
966
923
  }
967
924
  const parent = tile.parent;
968
925
  const parentRefines = Boolean(!parent || parent._shouldRefine);
@@ -973,10 +930,10 @@ var TilesetTraverser = class {
973
930
  if (stoppedRefining) {
974
931
  this.selectTile(tile, frameState);
975
932
  }
976
- } else if (tile.refine === 1 /* ADD */) {
933
+ } else if (tile.refine === TILE_REFINEMENT.ADD) {
977
934
  this.loadTile(tile, frameState);
978
935
  this.selectTile(tile, frameState);
979
- } else if (tile.refine === 2 /* REPLACE */) {
936
+ } else if (tile.refine === TILE_REFINEMENT.REPLACE) {
980
937
  this.loadTile(tile, frameState);
981
938
  if (stoppedRefining) {
982
939
  this.selectTile(tile, frameState);
@@ -1002,7 +959,7 @@ var TilesetTraverser = class {
1002
959
  const { loadSiblings, skipLevelOfDetail } = this.options;
1003
960
  const children = tile.children;
1004
961
  children.sort(this.compareDistanceToCamera.bind(this));
1005
- const checkRefines = tile.refine === 2 /* REPLACE */ && tile.hasRenderContent && !skipLevelOfDetail;
962
+ const checkRefines = tile.refine === TILE_REFINEMENT.REPLACE && tile.hasRenderContent && !skipLevelOfDetail;
1006
963
  let hasVisibleChild = false;
1007
964
  let refines = true;
1008
965
  for (const child of children) {
@@ -1145,12 +1102,75 @@ var TilesetTraverser = class {
1145
1102
  }
1146
1103
  };
1147
1104
 
1148
- // src/tileset/tile-3d.ts
1105
+ // dist/tileset/tile-3d.js
1149
1106
  var scratchVector3 = new import_core7.Vector3();
1150
1107
  function defined2(x) {
1151
1108
  return x !== void 0 && x !== null;
1152
1109
  }
1153
1110
  var Tile3D = class {
1111
+ tileset;
1112
+ header;
1113
+ id;
1114
+ url;
1115
+ parent;
1116
+ /* Specifies the type of refine that is used when traversing this tile for rendering. */
1117
+ refine;
1118
+ type;
1119
+ contentUrl;
1120
+ /** Different refinement algorithms used by I3S and 3D tiles */
1121
+ lodMetricType = "geometricError";
1122
+ /** The error, in meters, introduced if this tile is rendered and its children are not. */
1123
+ lodMetricValue = 0;
1124
+ /** @todo math.gl is not exporting BoundingVolume base type? */
1125
+ boundingVolume = null;
1126
+ /**
1127
+ * The tile's content. This represents the actual tile's payload,
1128
+ * not the content's metadata in the tileset JSON file.
1129
+ */
1130
+ content = null;
1131
+ contentState = TILE_CONTENT_STATE.UNLOADED;
1132
+ gpuMemoryUsageInBytes = 0;
1133
+ /** The tile's children - an array of Tile3D objects. */
1134
+ children = [];
1135
+ depth = 0;
1136
+ viewportIds = [];
1137
+ transform = new import_core7.Matrix4();
1138
+ extensions = null;
1139
+ /** TODO Cesium 3d tiles specific */
1140
+ implicitTiling = null;
1141
+ /** Container to store application specific data */
1142
+ userData = {};
1143
+ computedTransform;
1144
+ hasEmptyContent = false;
1145
+ hasTilesetContent = false;
1146
+ traverser = new TilesetTraverser({});
1147
+ /** Used by TilesetCache */
1148
+ _cacheNode = null;
1149
+ _frameNumber = null;
1150
+ // TODO Cesium 3d tiles specific
1151
+ _expireDate = null;
1152
+ _expiredContent = null;
1153
+ _boundingBox = void 0;
1154
+ /** updated every frame for tree traversal and rendering optimizations: */
1155
+ _distanceToCamera = 0;
1156
+ _screenSpaceError = 0;
1157
+ _visibilityPlaneMask;
1158
+ _visible = void 0;
1159
+ _contentBoundingVolume;
1160
+ _viewerRequestVolume;
1161
+ _initialTransform = new import_core7.Matrix4();
1162
+ // Used by traverser, cannot be marked private
1163
+ _priority = 0;
1164
+ _selectedFrame = 0;
1165
+ _requestedFrame = 0;
1166
+ _selectionDepth = 0;
1167
+ _touchedFrame = 0;
1168
+ _centerZDepth = 0;
1169
+ _shouldRefine = false;
1170
+ _stackLength = 0;
1171
+ _visitedFrame = 0;
1172
+ _inRequestVolume = false;
1173
+ _lodJudge = null;
1154
1174
  // TODO i3s specific, needs to remove
1155
1175
  /**
1156
1176
  * @constructs
@@ -1163,56 +1183,6 @@ var Tile3D = class {
1163
1183
  */
1164
1184
  // eslint-disable-next-line max-statements
1165
1185
  constructor(tileset, header, parentHeader, extendedId = "") {
1166
- /** Different refinement algorithms used by I3S and 3D tiles */
1167
- this.lodMetricType = "geometricError";
1168
- /** The error, in meters, introduced if this tile is rendered and its children are not. */
1169
- this.lodMetricValue = 0;
1170
- /** @todo math.gl is not exporting BoundingVolume base type? */
1171
- this.boundingVolume = null;
1172
- /**
1173
- * The tile's content. This represents the actual tile's payload,
1174
- * not the content's metadata in the tileset JSON file.
1175
- */
1176
- this.content = null;
1177
- this.contentState = TILE_CONTENT_STATE.UNLOADED;
1178
- this.gpuMemoryUsageInBytes = 0;
1179
- /** The tile's children - an array of Tile3D objects. */
1180
- this.children = [];
1181
- this.depth = 0;
1182
- this.viewportIds = [];
1183
- this.transform = new import_core7.Matrix4();
1184
- this.extensions = null;
1185
- /** TODO Cesium 3d tiles specific */
1186
- this.implicitTiling = null;
1187
- /** Container to store application specific data */
1188
- this.userData = {};
1189
- this.hasEmptyContent = false;
1190
- this.hasTilesetContent = false;
1191
- this.traverser = new TilesetTraverser({});
1192
- /** Used by TilesetCache */
1193
- this._cacheNode = null;
1194
- this._frameNumber = null;
1195
- // TODO Cesium 3d tiles specific
1196
- this._expireDate = null;
1197
- this._expiredContent = null;
1198
- this._boundingBox = void 0;
1199
- /** updated every frame for tree traversal and rendering optimizations: */
1200
- this._distanceToCamera = 0;
1201
- this._screenSpaceError = 0;
1202
- this._visible = void 0;
1203
- this._initialTransform = new import_core7.Matrix4();
1204
- // Used by traverser, cannot be marked private
1205
- this._priority = 0;
1206
- this._selectedFrame = 0;
1207
- this._requestedFrame = 0;
1208
- this._selectionDepth = 0;
1209
- this._touchedFrame = 0;
1210
- this._centerZDepth = 0;
1211
- this._shouldRefine = false;
1212
- this._stackLength = 0;
1213
- this._visitedFrame = 0;
1214
- this._inRequestVolume = false;
1215
- this._lodJudge = null;
1216
1186
  this.header = header;
1217
1187
  this.tileset = tileset;
1218
1188
  this.id = extendedId || header.id;
@@ -1263,9 +1233,7 @@ var Tile3D = class {
1263
1233
  * content is ready or if it has expired content this renders while new content loads; otherwise,
1264
1234
  */
1265
1235
  get contentAvailable() {
1266
- return Boolean(
1267
- this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed
1268
- );
1236
+ return Boolean(this.contentReady && this.hasRenderContent || this._expiredContent && !this.contentFailed);
1269
1237
  }
1270
1238
  /** Returns true if tile has renderable content but it's unloaded */
1271
1239
  get hasUnloadedContent() {
@@ -1315,9 +1283,9 @@ var Tile3D = class {
1315
1283
  /** Get the tile's screen space error. */
1316
1284
  getScreenSpaceError(frameState, useParentLodMetric) {
1317
1285
  switch (this.tileset.type) {
1318
- case "I3S" /* I3S */:
1286
+ case TILESET_TYPE.I3S:
1319
1287
  return getProjectedRadius(this, frameState);
1320
- case "TILES3D" /* TILES3D */:
1288
+ case TILESET_TYPE.TILES3D:
1321
1289
  return getTiles3DScreenSpaceError(this, frameState, useParentLodMetric);
1322
1290
  default:
1323
1291
  throw new Error("Unsupported tileset type");
@@ -1344,7 +1312,7 @@ var Tile3D = class {
1344
1312
  _getPriority() {
1345
1313
  const traverser = this.tileset._traverser;
1346
1314
  const { skipLevelOfDetail } = traverser.options;
1347
- const maySkipTile = this.refine === 1 /* ADD */ || skipLevelOfDetail;
1315
+ const maySkipTile = this.refine === TILE_REFINEMENT.ADD || skipLevelOfDetail;
1348
1316
  if (maySkipTile && !this.isVisible && this._visible !== void 0) {
1349
1317
  return -1;
1350
1318
  }
@@ -1377,10 +1345,7 @@ var Tile3D = class {
1377
1345
  this._expireDate = null;
1378
1346
  }
1379
1347
  this.contentState = TILE_CONTENT_STATE.LOADING;
1380
- const requestToken = await this.tileset._requestScheduler.scheduleRequest(
1381
- this.id,
1382
- this._getPriority.bind(this)
1383
- );
1348
+ const requestToken = await this.tileset._requestScheduler.scheduleRequest(this.id, this._getPriority.bind(this));
1384
1349
  if (!requestToken) {
1385
1350
  this.contentState = TILE_CONTENT_STATE.UNLOADED;
1386
1351
  return false;
@@ -1521,9 +1486,7 @@ var Tile3D = class {
1521
1486
  this.lodMetricValue = header.lodMetricValue;
1522
1487
  } else {
1523
1488
  this.lodMetricValue = this.parent && this.parent.lodMetricValue || this.tileset.lodMetricValue;
1524
- console.warn(
1525
- "3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue"
1526
- );
1489
+ console.warn("3D Tile: Required prop lodMetricValue is undefined. Using parent lodMetricValue");
1527
1490
  }
1528
1491
  }
1529
1492
  _initializeTransforms(tileHeader) {
@@ -1570,7 +1533,7 @@ var Tile3D = class {
1570
1533
  this._priority = 0;
1571
1534
  }
1572
1535
  _getRefine(refine) {
1573
- return refine || this.parent && this.parent.refine || 2 /* REPLACE */;
1536
+ return refine || this.parent && this.parent.refine || TILE_REFINEMENT.REPLACE;
1574
1537
  }
1575
1538
  _isTileset() {
1576
1539
  return this.contentUrl.indexOf(".json") !== -1;
@@ -1590,28 +1553,16 @@ var Tile3D = class {
1590
1553
  }
1591
1554
  }
1592
1555
  _updateBoundingVolume(header) {
1593
- this.boundingVolume = createBoundingVolume(
1594
- header.boundingVolume,
1595
- this.computedTransform,
1596
- this.boundingVolume
1597
- );
1556
+ this.boundingVolume = createBoundingVolume(header.boundingVolume, this.computedTransform, this.boundingVolume);
1598
1557
  const content = header.content;
1599
1558
  if (!content) {
1600
1559
  return;
1601
1560
  }
1602
1561
  if (content.boundingVolume) {
1603
- this._contentBoundingVolume = createBoundingVolume(
1604
- content.boundingVolume,
1605
- this.computedTransform,
1606
- this._contentBoundingVolume
1607
- );
1562
+ this._contentBoundingVolume = createBoundingVolume(content.boundingVolume, this.computedTransform, this._contentBoundingVolume);
1608
1563
  }
1609
1564
  if (header.viewerRequestVolume) {
1610
- this._viewerRequestVolume = createBoundingVolume(
1611
- header.viewerRequestVolume,
1612
- this.computedTransform,
1613
- this._viewerRequestVolume
1614
- );
1565
+ this._viewerRequestVolume = createBoundingVolume(header.viewerRequestVolume, this.computedTransform, this._viewerRequestVolume);
1615
1566
  }
1616
1567
  }
1617
1568
  // Update the tile's transform. The transform is applied to the tile's bounding volumes.
@@ -1654,7 +1605,7 @@ var Tile3D = class {
1654
1605
  }
1655
1606
  };
1656
1607
 
1657
- // src/tileset/format-3d-tiles/tileset-3d-traverser.ts
1608
+ // dist/tileset/format-3d-tiles/tileset-3d-traverser.js
1658
1609
  var Tileset3DTraverser = class extends TilesetTraverser {
1659
1610
  compareDistanceToCamera(a, b) {
1660
1611
  return b._distanceToCamera === 0 && a._distanceToCamera === 0 ? b._centerZDepth - a._centerZDepth : b._distanceToCamera - a._distanceToCamera;
@@ -1675,7 +1626,7 @@ var Tileset3DTraverser = class extends TilesetTraverser {
1675
1626
  tile._visible = false;
1676
1627
  return;
1677
1628
  }
1678
- const replace = tile.refine === 2 /* REPLACE */;
1629
+ const replace = tile.refine === TILE_REFINEMENT.REPLACE;
1679
1630
  const useOptimization = tile._optimChildrenWithinParent === TILE3D_OPTIMIZATION_HINT.USE_OPTIMIZATION;
1680
1631
  if (replace && useOptimization && hasChildren) {
1681
1632
  if (!this.anyChildrenVisible(tile, frameState)) {
@@ -1686,21 +1637,19 @@ var Tileset3DTraverser = class extends TilesetTraverser {
1686
1637
  }
1687
1638
  meetsScreenSpaceErrorEarly(tile, frameState) {
1688
1639
  const { parent } = tile;
1689
- if (!parent || parent.hasTilesetContent || parent.refine !== 1 /* ADD */) {
1640
+ if (!parent || parent.hasTilesetContent || parent.refine !== TILE_REFINEMENT.ADD) {
1690
1641
  return false;
1691
1642
  }
1692
1643
  return !this.shouldRefine(tile, frameState, true);
1693
1644
  }
1694
1645
  };
1695
1646
 
1696
- // src/tileset/format-i3s/i3s-tileset-traverser.ts
1647
+ // dist/tileset/format-i3s/i3s-tileset-traverser.js
1697
1648
  var import_core9 = require("@loaders.gl/core");
1698
1649
 
1699
- // src/tileset/format-i3s/i3s-pending-tiles-register.ts
1650
+ // dist/tileset/format-i3s/i3s-pending-tiles-register.js
1700
1651
  var I3SPendingTilesRegister = class {
1701
- constructor() {
1702
- this.frameNumberMap = /* @__PURE__ */ new Map();
1703
- }
1652
+ frameNumberMap = /* @__PURE__ */ new Map();
1704
1653
  /**
1705
1654
  * Register a new pending tile header for the particular frameNumber
1706
1655
  * @param viewportId
@@ -1738,15 +1687,16 @@ var I3SPendingTilesRegister = class {
1738
1687
  }
1739
1688
  };
1740
1689
 
1741
- // src/tileset/format-i3s/i3s-tile-manager.ts
1690
+ // dist/tileset/format-i3s/i3s-tile-manager.js
1742
1691
  var STATUS = {
1743
1692
  REQUESTED: "REQUESTED",
1744
1693
  COMPLETED: "COMPLETED",
1745
1694
  ERROR: "ERROR"
1746
1695
  };
1747
1696
  var I3STileManager = class {
1697
+ _statusMap;
1698
+ pendingTilesRegister = new I3SPendingTilesRegister();
1748
1699
  constructor() {
1749
- this.pendingTilesRegister = new I3SPendingTilesRegister();
1750
1700
  this._statusMap = {};
1751
1701
  }
1752
1702
  /**
@@ -1758,26 +1708,17 @@ var I3STileManager = class {
1758
1708
  */
1759
1709
  add(request, key, callback, frameState) {
1760
1710
  if (!this._statusMap[key]) {
1761
- const {
1762
- frameNumber,
1763
- viewport: { id }
1764
- } = frameState;
1711
+ const { frameNumber, viewport: { id } } = frameState;
1765
1712
  this._statusMap[key] = { request, callback, key, frameState, status: STATUS.REQUESTED };
1766
1713
  this.pendingTilesRegister.register(id, frameNumber);
1767
1714
  request().then((data) => {
1768
1715
  this._statusMap[key].status = STATUS.COMPLETED;
1769
- const {
1770
- frameNumber: actualFrameNumber,
1771
- viewport: { id: id2 }
1772
- } = this._statusMap[key].frameState;
1716
+ const { frameNumber: actualFrameNumber, viewport: { id: id2 } } = this._statusMap[key].frameState;
1773
1717
  this.pendingTilesRegister.deregister(id2, actualFrameNumber);
1774
1718
  this._statusMap[key].callback(data, frameState);
1775
1719
  }).catch((error) => {
1776
1720
  this._statusMap[key].status = STATUS.ERROR;
1777
- const {
1778
- frameNumber: actualFrameNumber,
1779
- viewport: { id: id2 }
1780
- } = this._statusMap[key].frameState;
1721
+ const { frameNumber: actualFrameNumber, viewport: { id: id2 } } = this._statusMap[key].frameState;
1781
1722
  this.pendingTilesRegister.deregister(id2, actualFrameNumber);
1782
1723
  callback(error);
1783
1724
  });
@@ -1790,15 +1731,9 @@ var I3STileManager = class {
1790
1731
  */
1791
1732
  update(key, frameState) {
1792
1733
  if (this._statusMap[key]) {
1793
- const {
1794
- frameNumber,
1795
- viewport: { id }
1796
- } = this._statusMap[key].frameState;
1734
+ const { frameNumber, viewport: { id } } = this._statusMap[key].frameState;
1797
1735
  this.pendingTilesRegister.deregister(id, frameNumber);
1798
- const {
1799
- frameNumber: newFrameNumber,
1800
- viewport: { id: newViewportId }
1801
- } = frameState;
1736
+ const { frameNumber: newFrameNumber, viewport: { id: newViewportId } } = frameState;
1802
1737
  this.pendingTilesRegister.register(newViewportId, newFrameNumber);
1803
1738
  this._statusMap[key].frameState = frameState;
1804
1739
  }
@@ -1822,8 +1757,9 @@ var I3STileManager = class {
1822
1757
  }
1823
1758
  };
1824
1759
 
1825
- // src/tileset/format-i3s/i3s-tileset-traverser.ts
1760
+ // dist/tileset/format-i3s/i3s-tileset-traverser.js
1826
1761
  var I3STilesetTraverser = class extends TilesetTraverser {
1762
+ _tileManager;
1827
1763
  constructor(options) {
1828
1764
  super(options);
1829
1765
  this._tileManager = new I3STileManager();
@@ -1854,12 +1790,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
1854
1790
  if (tileset.tileset.nodePages) {
1855
1791
  request = () => tileset.tileset.nodePagesTile.formTileFromNodePages(child.id);
1856
1792
  }
1857
- this._tileManager.add(
1858
- request,
1859
- extendedId,
1860
- (header) => this._onTileLoad(header, tile, extendedId),
1861
- frameState
1862
- );
1793
+ this._tileManager.add(request, extendedId, (header) => this._onTileLoad(header, tile, extendedId), frameState);
1863
1794
  } else {
1864
1795
  this._tileManager.update(extendedId, frameState);
1865
1796
  }
@@ -1900,7 +1831,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
1900
1831
  }
1901
1832
  };
1902
1833
 
1903
- // src/tileset/tileset-3d.ts
1834
+ // dist/tileset/tileset-3d.js
1904
1835
  var DEFAULT_PROPS2 = {
1905
1836
  description: "",
1906
1837
  ellipsoid: import_geospatial6.Ellipsoid.WGS84,
@@ -1943,6 +1874,78 @@ var POINTS_COUNT = "Points/Vertices";
1943
1874
  var TILES_GPU_MEMORY = "Tile Memory Use";
1944
1875
  var MAXIMUM_SSE = "Maximum Screen Space Error";
1945
1876
  var Tileset3D = class {
1877
+ // props: Tileset3DProps;
1878
+ options;
1879
+ loadOptions;
1880
+ type;
1881
+ tileset;
1882
+ loader;
1883
+ url;
1884
+ basePath;
1885
+ modelMatrix;
1886
+ ellipsoid;
1887
+ lodMetricType;
1888
+ lodMetricValue;
1889
+ refine;
1890
+ root = null;
1891
+ roots = {};
1892
+ /** @todo any->unknown */
1893
+ asset = {};
1894
+ // Metadata for the entire tileset
1895
+ description = "";
1896
+ properties;
1897
+ extras = null;
1898
+ attributions = {};
1899
+ credits = {};
1900
+ stats;
1901
+ /** flags that contain information about data types in nested tiles */
1902
+ contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
1903
+ // view props
1904
+ cartographicCenter = null;
1905
+ cartesianCenter = null;
1906
+ zoom = 1;
1907
+ boundingVolume = null;
1908
+ /** Updated based on the camera position and direction */
1909
+ dynamicScreenSpaceErrorComputedDensity = 0;
1910
+ // METRICS
1911
+ /**
1912
+ * The maximum amount of GPU memory (in MB) that may be used to cache tiles
1913
+ * Tiles not in view are unloaded to enforce private
1914
+ */
1915
+ maximumMemoryUsage = 32;
1916
+ /** The total amount of GPU memory in bytes used by the tileset. */
1917
+ gpuMemoryUsageInBytes = 0;
1918
+ /**
1919
+ * If loading the level of detail required by maximumScreenSpaceError
1920
+ * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement
1921
+ * will instead use this (larger) adjusted screen space error to achieve the
1922
+ * best possible visual quality within the available memory.
1923
+ */
1924
+ memoryAdjustedScreenSpaceError = 0;
1925
+ _cacheBytes = 0;
1926
+ _cacheOverflowBytes = 0;
1927
+ /** Update tracker. increase in each update cycle. */
1928
+ _frameNumber = 0;
1929
+ _queryParams = {};
1930
+ _extensionsUsed = [];
1931
+ _tiles = {};
1932
+ /** counter for tracking tiles requests */
1933
+ _pendingCount = 0;
1934
+ /** Hold traversal results */
1935
+ selectedTiles = [];
1936
+ // TRAVERSAL
1937
+ traverseCounter = 0;
1938
+ geometricError = 0;
1939
+ lastUpdatedVieports = null;
1940
+ _requestedTiles = [];
1941
+ _emptyTiles = [];
1942
+ frameStateData = {};
1943
+ _traverser;
1944
+ _cache = new TilesetCache();
1945
+ _requestScheduler;
1946
+ // Promise tracking
1947
+ updatePromise = null;
1948
+ tilesetInitializationPromise;
1946
1949
  /**
1947
1950
  * Create a new Tileset3D
1948
1951
  * @param json
@@ -1950,60 +1953,6 @@ var Tileset3D = class {
1950
1953
  */
1951
1954
  // eslint-disable-next-line max-statements
1952
1955
  constructor(tileset, options) {
1953
- this.root = null;
1954
- this.roots = {};
1955
- /** @todo any->unknown */
1956
- this.asset = {};
1957
- // Metadata for the entire tileset
1958
- this.description = "";
1959
- this.extras = null;
1960
- this.attributions = {};
1961
- this.credits = {};
1962
- /** flags that contain information about data types in nested tiles */
1963
- this.contentFormats = { draco: false, meshopt: false, dds: false, ktx2: false };
1964
- // view props
1965
- this.cartographicCenter = null;
1966
- this.cartesianCenter = null;
1967
- this.zoom = 1;
1968
- this.boundingVolume = null;
1969
- /** Updated based on the camera position and direction */
1970
- this.dynamicScreenSpaceErrorComputedDensity = 0;
1971
- // METRICS
1972
- /**
1973
- * The maximum amount of GPU memory (in MB) that may be used to cache tiles
1974
- * Tiles not in view are unloaded to enforce private
1975
- */
1976
- this.maximumMemoryUsage = 32;
1977
- /** The total amount of GPU memory in bytes used by the tileset. */
1978
- this.gpuMemoryUsageInBytes = 0;
1979
- /**
1980
- * If loading the level of detail required by maximumScreenSpaceError
1981
- * results in the memory usage exceeding maximumMemoryUsage (GPU), level of detail refinement
1982
- * will instead use this (larger) adjusted screen space error to achieve the
1983
- * best possible visual quality within the available memory.
1984
- */
1985
- this.memoryAdjustedScreenSpaceError = 0;
1986
- this._cacheBytes = 0;
1987
- this._cacheOverflowBytes = 0;
1988
- /** Update tracker. increase in each update cycle. */
1989
- this._frameNumber = 0;
1990
- this._queryParams = {};
1991
- this._extensionsUsed = [];
1992
- this._tiles = {};
1993
- /** counter for tracking tiles requests */
1994
- this._pendingCount = 0;
1995
- /** Hold traversal results */
1996
- this.selectedTiles = [];
1997
- // TRAVERSAL
1998
- this.traverseCounter = 0;
1999
- this.geometricError = 0;
2000
- this.lastUpdatedVieports = null;
2001
- this._requestedTiles = [];
2002
- this._emptyTiles = [];
2003
- this.frameStateData = {};
2004
- this._cache = new TilesetCache();
2005
- // Promise tracking
2006
- this.updatePromise = null;
2007
1956
  this.options = { ...DEFAULT_PROPS2, ...options };
2008
1957
  this.tileset = tileset;
2009
1958
  this.loader = tileset.loader;
@@ -2114,10 +2063,7 @@ var Tileset3D = class {
2114
2063
  }
2115
2064
  adjustScreenSpaceError() {
2116
2065
  if (this.gpuMemoryUsageInBytes < this._cacheBytes) {
2117
- this.memoryAdjustedScreenSpaceError = Math.max(
2118
- this.memoryAdjustedScreenSpaceError / 1.02,
2119
- this.options.maximumScreenSpaceError
2120
- );
2066
+ this.memoryAdjustedScreenSpaceError = Math.max(this.memoryAdjustedScreenSpaceError / 1.02, this.options.maximumScreenSpaceError);
2121
2067
  } else if (this.gpuMemoryUsageInBytes > this._cacheBytes + this._cacheOverflowBytes) {
2122
2068
  this.memoryAdjustedScreenSpaceError *= 1.02;
2123
2069
  }
@@ -2185,11 +2131,7 @@ var Tileset3D = class {
2185
2131
  }
2186
2132
  const currentFrameStateData = this.frameStateData[id];
2187
2133
  const selectedTiles = Object.values(this._traverser.selectedTiles);
2188
- const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(
2189
- selectedTiles,
2190
- frameState,
2191
- this.options.maximumTilesSelected
2192
- );
2134
+ const [filteredSelectedTiles, unselectedTiles] = limitSelectedTiles(selectedTiles, frameState, this.options.maximumTilesSelected);
2193
2135
  currentFrameStateData.selectedTiles = filteredSelectedTiles;
2194
2136
  for (const tile of unselectedTiles) {
2195
2137
  tile.unselect();
@@ -2262,16 +2204,16 @@ var Tileset3D = class {
2262
2204
  this.stats.get(MAXIMUM_SSE).count = this.memoryAdjustedScreenSpaceError;
2263
2205
  }
2264
2206
  async _initializeTileSet(tilesetJson) {
2265
- if (this.type === "I3S" /* I3S */) {
2207
+ if (this.type === TILESET_TYPE.I3S) {
2266
2208
  this.calculateViewPropsI3S();
2267
2209
  tilesetJson.root = await tilesetJson.root;
2268
2210
  }
2269
2211
  this.root = this._initializeTileHeaders(tilesetJson, null);
2270
- if (this.type === "TILES3D" /* TILES3D */) {
2212
+ if (this.type === TILESET_TYPE.TILES3D) {
2271
2213
  this._initializeTiles3DTileset(tilesetJson);
2272
2214
  this.calculateViewPropsTiles3D();
2273
2215
  }
2274
- if (this.type === "I3S" /* I3S */) {
2216
+ if (this.type === TILESET_TYPE.I3S) {
2275
2217
  this._initializeI3STileset();
2276
2218
  }
2277
2219
  }
@@ -2286,11 +2228,7 @@ var Tileset3D = class {
2286
2228
  const fullExtent = this.tileset.fullExtent;
2287
2229
  if (fullExtent) {
2288
2230
  const { xmin, xmax, ymin, ymax, zmin, zmax } = fullExtent;
2289
- this.cartographicCenter = new import_core10.Vector3(
2290
- xmin + (xmax - xmin) / 2,
2291
- ymin + (ymax - ymin) / 2,
2292
- zmin + (zmax - zmin) / 2
2293
- );
2231
+ this.cartographicCenter = new import_core10.Vector3(xmin + (xmax - xmin) / 2, ymin + (ymax - ymin) / 2, zmin + (zmax - zmin) / 2);
2294
2232
  this.cartesianCenter = new import_core10.Vector3();
2295
2233
  import_geospatial6.Ellipsoid.WGS84.cartographicToCartesian(this.cartographicCenter, this.cartesianCenter);
2296
2234
  this.zoom = getZoomFromFullExtent(fullExtent, this.cartographicCenter, this.cartesianCenter);
@@ -2356,7 +2294,7 @@ var Tileset3D = class {
2356
2294
  parentTileHeader.children.push(rootTile);
2357
2295
  rootTile.depth = parentTileHeader.depth + 1;
2358
2296
  }
2359
- if (this.type === "TILES3D" /* TILES3D */) {
2297
+ if (this.type === TILESET_TYPE.TILES3D) {
2360
2298
  const stack = [];
2361
2299
  stack.push(rootTile);
2362
2300
  while (stack.length > 0) {
@@ -2384,10 +2322,10 @@ var Tileset3D = class {
2384
2322
  let TraverserClass;
2385
2323
  const type = this.type;
2386
2324
  switch (type) {
2387
- case "TILES3D" /* TILES3D */:
2325
+ case TILESET_TYPE.TILES3D:
2388
2326
  TraverserClass = Tileset3DTraverser;
2389
2327
  break;
2390
- case "I3S" /* I3S */:
2328
+ case TILESET_TYPE.I3S:
2391
2329
  TraverserClass = I3STilesetTraverser;
2392
2330
  break;
2393
2331
  default:
@@ -2425,7 +2363,7 @@ var Tileset3D = class {
2425
2363
  if (!loaded) {
2426
2364
  return;
2427
2365
  }
2428
- if (this.type === "I3S" /* I3S */) {
2366
+ if (this.type === TILESET_TYPE.I3S) {
2429
2367
  const nodesInNodePages = ((_b = (_a = this.tileset) == null ? void 0 : _a.nodePagesTile) == null ? void 0 : _b.nodesInNodePages) || 0;
2430
2368
  this.stats.get(TILES_TOTAL).reset();
2431
2369
  this.stats.get(TILES_TOTAL).addCount(nodesInNodePages);
@@ -2443,7 +2381,7 @@ var Tileset3D = class {
2443
2381
  */
2444
2382
  updateContentTypes(tile) {
2445
2383
  var _a;
2446
- if (this.type === "I3S" /* I3S */) {
2384
+ if (this.type === TILESET_TYPE.I3S) {
2447
2385
  if (tile.header.isDracoGeometry) {
2448
2386
  this.contentFormats.draco = true;
2449
2387
  }
@@ -2456,7 +2394,7 @@ var Tileset3D = class {
2456
2394
  break;
2457
2395
  default:
2458
2396
  }
2459
- } else if (this.type === "TILES3D" /* TILES3D */) {
2397
+ } else if (this.type === TILESET_TYPE.TILES3D) {
2460
2398
  const { extensionsRemoved = [] } = ((_a = tile.content) == null ? void 0 : _a.gltf) || {};
2461
2399
  if (extensionsRemoved.includes("KHR_draco_mesh_compression")) {
2462
2400
  this.contentFormats.draco = true;
@@ -2564,3 +2502,4 @@ var Tileset3D = class {
2564
2502
  }
2565
2503
  }
2566
2504
  };
2505
+ //# sourceMappingURL=index.cjs.map