@loaders.gl/tile-converter 3.1.0-beta.7 → 3.1.0

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 (153) hide show
  1. package/dist/bundle.js +1267 -1174
  2. package/dist/converter.min.js +20 -20
  3. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +429 -189
  4. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  5. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +306 -209
  6. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  7. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +8 -4
  8. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
  9. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +13 -13
  10. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/json-templates/tileset.js +51 -32
  12. package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  13. package/dist/es5/bundle.js +1 -1
  14. package/dist/es5/bundle.js.map +1 -1
  15. package/dist/es5/deps-installer/deps-installer.js +61 -17
  16. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  17. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +55 -16
  18. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  19. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +33 -9
  20. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
  21. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +103 -93
  22. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  23. package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +5 -1
  24. package/dist/es5/i3s-converter/helpers/geometry-converter.js +547 -336
  25. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  26. package/dist/es5/i3s-converter/helpers/node-debug.js +27 -31
  27. package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
  28. package/dist/es5/i3s-converter/helpers/node-pages.js +209 -101
  29. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  30. package/dist/es5/i3s-converter/i3s-converter.js +1645 -700
  31. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  32. package/dist/es5/i3s-converter/json-templates/layers.js +213 -177
  33. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  34. package/dist/es5/i3s-converter/json-templates/metadata.js +24 -20
  35. package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
  36. package/dist/es5/i3s-converter/json-templates/node.js +92 -74
  37. package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
  38. package/dist/es5/i3s-converter/json-templates/scene-server.js +34 -28
  39. package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
  40. package/dist/es5/i3s-converter/json-templates/shared-resources.js +162 -107
  41. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  42. package/dist/es5/i3s-converter/json-templates/store.js +4 -2
  43. package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
  44. package/dist/es5/i3s-converter/types.js +2 -0
  45. package/dist/es5/i3s-converter/types.js.map +1 -0
  46. package/dist/es5/i3s-server/app.js +6 -6
  47. package/dist/es5/i3s-server/app.js.map +1 -1
  48. package/dist/es5/i3s-server/controllers/index-controller.js +60 -20
  49. package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
  50. package/dist/es5/i3s-server/routes/index.js +41 -14
  51. package/dist/es5/i3s-server/routes/index.js.map +1 -1
  52. package/dist/es5/index.js +4 -4
  53. package/dist/es5/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
  54. package/dist/es5/lib/utils/compress-util.js +345 -123
  55. package/dist/es5/lib/utils/compress-util.js.map +1 -1
  56. package/dist/es5/lib/utils/file-utils.js +98 -20
  57. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  58. package/dist/es5/lib/utils/lod-conversion-utils.js +9 -9
  59. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  60. package/dist/es5/lib/utils/statistic-utills.js +152 -41
  61. package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
  62. package/dist/es5/pgm-loader.js +31 -4
  63. package/dist/es5/pgm-loader.js.map +1 -1
  64. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +7 -6
  65. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  66. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +7 -0
  67. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  68. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
  69. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +1 -1
  70. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  71. package/dist/esm/3d-tiles-converter/json-templates/tileset.js +12 -9
  72. package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  73. package/dist/esm/deps-installer/deps-installer.js +2 -6
  74. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  75. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +35 -3
  76. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  77. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +2 -2
  78. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
  79. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  80. package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +5 -1
  81. package/dist/esm/i3s-converter/helpers/geometry-converter.js +50 -16
  82. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  83. package/dist/esm/i3s-converter/helpers/node-debug.js +2 -4
  84. package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
  85. package/dist/esm/i3s-converter/helpers/node-pages.js +15 -4
  86. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  87. package/dist/esm/i3s-converter/i3s-converter.js +147 -62
  88. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  89. package/dist/esm/i3s-converter/json-templates/layers.js +37 -27
  90. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
  91. package/dist/esm/i3s-converter/json-templates/metadata.js +2 -2
  92. package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
  93. package/dist/esm/i3s-converter/json-templates/node.js +16 -12
  94. package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
  95. package/dist/esm/i3s-converter/json-templates/scene-server.js +2 -2
  96. package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
  97. package/dist/esm/i3s-converter/json-templates/shared-resources.js +19 -14
  98. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  99. package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
  100. package/dist/esm/i3s-converter/types.js +2 -0
  101. package/dist/esm/i3s-converter/types.js.map +1 -0
  102. package/dist/esm/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
  103. package/dist/esm/pgm-loader.js +3 -3
  104. package/dist/esm/pgm-loader.js.map +1 -1
  105. package/package.json +15 -13
  106. package/src/3d-tiles-converter/3d-tiles-converter.ts +21 -20
  107. package/src/3d-tiles-converter/helpers/{b3dm-converter.js → b3dm-converter.ts} +19 -2
  108. package/src/3d-tiles-converter/helpers/{i3s-obb-to-3d-tiles-obb.js → i3s-obb-to-3d-tiles-obb.ts} +16 -1
  109. package/src/3d-tiles-converter/helpers/texture-atlas.ts +4 -4
  110. package/src/3d-tiles-converter/json-templates/{tileset.js → tileset.ts} +9 -9
  111. package/src/deps-installer/deps-installer.js +2 -2
  112. package/src/i3s-converter/helpers/coordinate-converter.ts +62 -9
  113. package/src/i3s-converter/helpers/{create-scene-server-path.js → create-scene-server-path.ts} +2 -2
  114. package/src/i3s-converter/helpers/{geometry-attributes.js → geometry-attributes.ts} +4 -4
  115. package/src/i3s-converter/helpers/geometry-converter.d.ts +5 -1
  116. package/src/i3s-converter/helpers/geometry-converter.js +63 -13
  117. package/src/i3s-converter/helpers/{node-debug.js → node-debug.ts} +3 -2
  118. package/src/i3s-converter/helpers/{node-pages.js → node-pages.ts} +41 -26
  119. package/src/i3s-converter/i3s-converter.ts +204 -133
  120. package/src/i3s-converter/json-templates/{layers.js → layers.ts} +29 -27
  121. package/src/i3s-converter/json-templates/{metadata.js → metadata.ts} +2 -2
  122. package/src/i3s-converter/json-templates/{node.js → node.ts} +12 -12
  123. package/src/i3s-converter/json-templates/{scene-server.js → scene-server.ts} +2 -2
  124. package/src/i3s-converter/json-templates/{shared-resources.js → shared-resources.ts} +14 -14
  125. package/src/i3s-converter/json-templates/{store.js → store.ts} +0 -0
  126. package/src/i3s-converter/types.ts +14 -0
  127. package/src/lib/utils/{compress-utils.d.ts → compress-util.d.ts} +0 -0
  128. package/src/pgm-loader.ts +2 -2
  129. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
  130. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
  131. package/dist/es5/i3s-converter/helpers/node-pages.d.ts +0 -144
  132. package/dist/es5/lib/geoid-height-model.d.ts +0 -41
  133. package/dist/es5/lib/geoid-height-model.js +0 -149
  134. package/dist/es5/lib/geoid-height-model.js.map +0 -1
  135. package/dist/es5/lib/pgm-parser.d.ts +0 -14
  136. package/dist/es5/lib/pgm-parser.js +0 -192
  137. package/dist/es5/lib/pgm-parser.js.map +0 -1
  138. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
  139. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
  140. package/dist/esm/i3s-converter/helpers/node-pages.d.ts +0 -144
  141. package/dist/esm/lib/geoid-height-model.d.ts +0 -41
  142. package/dist/esm/lib/geoid-height-model.js +0 -140
  143. package/dist/esm/lib/geoid-height-model.js.map +0 -1
  144. package/dist/esm/lib/pgm-parser.d.ts +0 -14
  145. package/dist/esm/lib/pgm-parser.js +0 -183
  146. package/dist/esm/lib/pgm-parser.js.map +0 -1
  147. package/src/3d-tiles-converter/helpers/b3dm-converter.d.ts +0 -23
  148. package/src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +0 -16
  149. package/src/i3s-converter/helpers/node-pages.d.ts +0 -144
  150. package/src/lib/geoid-height-model.d.ts +0 -41
  151. package/src/lib/geoid-height-model.js +0 -239
  152. package/src/lib/pgm-parser.d.ts +0 -14
  153. package/src/lib/pgm-parser.js +0 -179
package/dist/bundle.js CHANGED
@@ -34,7 +34,6 @@ var require_interopRequireDefault = __commonJS({
34
34
  };
35
35
  }
36
36
  module2.exports = _interopRequireDefault;
37
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
38
37
  }
39
38
  });
40
39
 
@@ -47,7 +46,6 @@ var require_classCallCheck = __commonJS({
47
46
  }
48
47
  }
49
48
  module2.exports = _classCallCheck;
50
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
51
49
  }
52
50
  });
53
51
 
@@ -72,7 +70,6 @@ var require_createClass = __commonJS({
72
70
  return Constructor;
73
71
  }
74
72
  module2.exports = _createClass;
75
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
76
73
  }
77
74
  });
78
75
 
@@ -384,17 +381,14 @@ var require_typeof = __commonJS({
384
381
  module2.exports = _typeof = function _typeof2(obj2) {
385
382
  return typeof obj2;
386
383
  };
387
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
388
384
  } else {
389
385
  module2.exports = _typeof = function _typeof2(obj2) {
390
386
  return obj2 && typeof Symbol === "function" && obj2.constructor === Symbol && obj2 !== Symbol.prototype ? "symbol" : typeof obj2;
391
387
  };
392
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
393
388
  }
394
389
  return _typeof(obj);
395
390
  }
396
391
  module2.exports = _typeof;
397
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
398
392
  }
399
393
  });
400
394
 
@@ -554,7 +548,6 @@ var require_arrayLikeToArray = __commonJS({
554
548
  return arr2;
555
549
  }
556
550
  module2.exports = _arrayLikeToArray;
557
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
558
551
  }
559
552
  });
560
553
 
@@ -567,7 +560,6 @@ var require_arrayWithoutHoles = __commonJS({
567
560
  return arrayLikeToArray(arr);
568
561
  }
569
562
  module2.exports = _arrayWithoutHoles;
570
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
571
563
  }
572
564
  });
573
565
 
@@ -575,11 +567,10 @@ var require_arrayWithoutHoles = __commonJS({
575
567
  var require_iterableToArray = __commonJS({
576
568
  "../../node_modules/@babel/runtime/helpers/iterableToArray.js"(exports, module2) {
577
569
  function _iterableToArray(iter) {
578
- if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null)
570
+ if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter))
579
571
  return Array.from(iter);
580
572
  }
581
573
  module2.exports = _iterableToArray;
582
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
583
574
  }
584
575
  });
585
576
 
@@ -601,7 +592,6 @@ var require_unsupportedIterableToArray = __commonJS({
601
592
  return arrayLikeToArray(o, minLen);
602
593
  }
603
594
  module2.exports = _unsupportedIterableToArray;
604
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
605
595
  }
606
596
  });
607
597
 
@@ -612,7 +602,6 @@ var require_nonIterableSpread = __commonJS({
612
602
  throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
613
603
  }
614
604
  module2.exports = _nonIterableSpread;
615
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
616
605
  }
617
606
  });
618
607
 
@@ -627,7 +616,6 @@ var require_toConsumableArray = __commonJS({
627
616
  return arrayWithoutHoles(arr) || iterableToArray(arr) || unsupportedIterableToArray(arr) || nonIterableSpread();
628
617
  }
629
618
  module2.exports = _toConsumableArray;
630
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
631
619
  }
632
620
  });
633
621
 
@@ -648,7 +636,6 @@ var require_defineProperty = __commonJS({
648
636
  return obj;
649
637
  }
650
638
  module2.exports = _defineProperty;
651
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
652
639
  }
653
640
  });
654
641
 
@@ -1674,11 +1661,9 @@ var require_setPrototypeOf = __commonJS({
1674
1661
  o2.__proto__ = p2;
1675
1662
  return o2;
1676
1663
  };
1677
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1678
1664
  return _setPrototypeOf(o, p);
1679
1665
  }
1680
1666
  module2.exports = _setPrototypeOf;
1681
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1682
1667
  }
1683
1668
  });
1684
1669
 
@@ -1693,7 +1678,7 @@ var require_isNativeReflectConstruct = __commonJS({
1693
1678
  if (typeof Proxy === "function")
1694
1679
  return true;
1695
1680
  try {
1696
- Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
1681
+ Date.prototype.toString.call(Reflect.construct(Date, [], function() {
1697
1682
  }));
1698
1683
  return true;
1699
1684
  } catch (e) {
@@ -1701,7 +1686,6 @@ var require_isNativeReflectConstruct = __commonJS({
1701
1686
  }
1702
1687
  }
1703
1688
  module2.exports = _isNativeReflectConstruct;
1704
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1705
1689
  }
1706
1690
  });
1707
1691
 
@@ -1713,7 +1697,6 @@ var require_construct = __commonJS({
1713
1697
  function _construct(Parent, args, Class) {
1714
1698
  if (isNativeReflectConstruct()) {
1715
1699
  module2.exports = _construct = Reflect.construct;
1716
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1717
1700
  } else {
1718
1701
  module2.exports = _construct = function _construct2(Parent2, args2, Class2) {
1719
1702
  var a = [null];
@@ -1724,12 +1707,10 @@ var require_construct = __commonJS({
1724
1707
  setPrototypeOf(instance, Class2.prototype);
1725
1708
  return instance;
1726
1709
  };
1727
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1728
1710
  }
1729
1711
  return _construct.apply(null, arguments);
1730
1712
  }
1731
1713
  module2.exports = _construct;
1732
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1733
1714
  }
1734
1715
  });
1735
1716
 
@@ -1977,7 +1958,6 @@ var require_inherits = __commonJS({
1977
1958
  setPrototypeOf(subClass, superClass);
1978
1959
  }
1979
1960
  module2.exports = _inherits;
1980
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1981
1961
  }
1982
1962
  });
1983
1963
 
@@ -1991,14 +1971,13 @@ var require_assertThisInitialized = __commonJS({
1991
1971
  return self2;
1992
1972
  }
1993
1973
  module2.exports = _assertThisInitialized;
1994
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
1995
1974
  }
1996
1975
  });
1997
1976
 
1998
1977
  // ../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js
1999
1978
  var require_possibleConstructorReturn = __commonJS({
2000
1979
  "../../node_modules/@babel/runtime/helpers/possibleConstructorReturn.js"(exports, module2) {
2001
- var _typeof = require_typeof()["default"];
1980
+ var _typeof = require_typeof();
2002
1981
  var assertThisInitialized = require_assertThisInitialized();
2003
1982
  function _possibleConstructorReturn(self2, call) {
2004
1983
  if (call && (_typeof(call) === "object" || typeof call === "function")) {
@@ -2007,7 +1986,6 @@ var require_possibleConstructorReturn = __commonJS({
2007
1986
  return assertThisInitialized(self2);
2008
1987
  }
2009
1988
  module2.exports = _possibleConstructorReturn;
2010
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
2011
1989
  }
2012
1990
  });
2013
1991
 
@@ -2018,11 +1996,9 @@ var require_getPrototypeOf = __commonJS({
2018
1996
  module2.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf2(o2) {
2019
1997
  return o2.__proto__ || Object.getPrototypeOf(o2);
2020
1998
  };
2021
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
2022
1999
  return _getPrototypeOf(o);
2023
2000
  }
2024
2001
  module2.exports = _getPrototypeOf;
2025
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
2026
2002
  }
2027
2003
  });
2028
2004
 
@@ -5070,7 +5046,6 @@ var require_arrayWithHoles = __commonJS({
5070
5046
  return arr;
5071
5047
  }
5072
5048
  module2.exports = _arrayWithHoles;
5073
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
5074
5049
  }
5075
5050
  });
5076
5051
 
@@ -5078,15 +5053,14 @@ var require_arrayWithHoles = __commonJS({
5078
5053
  var require_iterableToArrayLimit = __commonJS({
5079
5054
  "../../node_modules/@babel/runtime/helpers/iterableToArrayLimit.js"(exports, module2) {
5080
5055
  function _iterableToArrayLimit(arr, i) {
5081
- var _i = arr && (typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]);
5082
- if (_i == null)
5056
+ if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr)))
5083
5057
  return;
5084
5058
  var _arr = [];
5085
5059
  var _n = true;
5086
5060
  var _d = false;
5087
- var _s, _e;
5061
+ var _e = void 0;
5088
5062
  try {
5089
- for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
5063
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
5090
5064
  _arr.push(_s.value);
5091
5065
  if (i && _arr.length === i)
5092
5066
  break;
@@ -5106,7 +5080,6 @@ var require_iterableToArrayLimit = __commonJS({
5106
5080
  return _arr;
5107
5081
  }
5108
5082
  module2.exports = _iterableToArrayLimit;
5109
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
5110
5083
  }
5111
5084
  });
5112
5085
 
@@ -5117,7 +5090,6 @@ var require_nonIterableRest = __commonJS({
5117
5090
  throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
5118
5091
  }
5119
5092
  module2.exports = _nonIterableRest;
5120
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
5121
5093
  }
5122
5094
  });
5123
5095
 
@@ -5132,7 +5104,6 @@ var require_slicedToArray = __commonJS({
5132
5104
  return arrayWithHoles(arr) || iterableToArrayLimit(arr, i) || unsupportedIterableToArray(arr, i) || nonIterableRest();
5133
5105
  }
5134
5106
  module2.exports = _slicedToArray;
5135
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
5136
5107
  }
5137
5108
  });
5138
5109
 
@@ -9317,7 +9288,7 @@ var require_type_utils = __commonJS({
9317
9288
  var noop2 = function noop3(x) {
9318
9289
  return x;
9319
9290
  };
9320
- var scratchVector6 = new _core.Vector3();
9291
+ var scratchVector7 = new _core.Vector3();
9321
9292
  function fromCartographic(cartographic, result) {
9322
9293
  var map = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : noop2;
9323
9294
  if ((0, _core.isArray)(cartographic)) {
@@ -9336,11 +9307,11 @@ var require_type_utils = __commonJS({
9336
9307
  return result;
9337
9308
  }
9338
9309
  function fromCartographicToRadians(cartographic) {
9339
- var vector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : scratchVector6;
9310
+ var vector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : scratchVector7;
9340
9311
  return fromCartographic(cartographic, vector, _core.config._cartographicRadians ? noop2 : _core.toRadians);
9341
9312
  }
9342
9313
  function fromCartographicToDegrees(cartographic) {
9343
- var vector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : scratchVector6;
9314
+ var vector = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : scratchVector7;
9344
9315
  return fromCartographic(cartographic, vector, _core.config._cartographicRadians ? _core.toDegrees : noop2);
9345
9316
  }
9346
9317
  function toCartographic(vector, cartographic) {
@@ -9370,7 +9341,7 @@ var require_type_utils = __commonJS({
9370
9341
  if (!vector) {
9371
9342
  return false;
9372
9343
  }
9373
- scratchVector6.from(vector);
9344
+ scratchVector7.from(vector);
9374
9345
  var oneOverRadiiSquared = _constants.WGS84_CONSTANTS.oneOverRadiiSquared, centerToleranceSquared = _constants.WGS84_CONSTANTS.centerToleranceSquared;
9375
9346
  var x2 = vector[0] * vector[0] * oneOverRadiiSquared[0];
9376
9347
  var y2 = vector[1] * vector[1] * oneOverRadiiSquared[1];
@@ -9429,13 +9400,13 @@ var require_scale_to_geodetic_surface = __commonJS({
9429
9400
  }
9430
9401
  return newObj;
9431
9402
  }
9432
- var scratchVector6 = new _core.Vector3();
9403
+ var scratchVector7 = new _core.Vector3();
9433
9404
  var scaleToGeodeticSurfaceIntersection = new _core.Vector3();
9434
9405
  var scaleToGeodeticSurfaceGradient = new _core.Vector3();
9435
9406
  function scaleToGeodeticSurface(cartesian, ellipsoid) {
9436
9407
  var result = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : new _core.Vector3();
9437
9408
  var oneOverRadii = ellipsoid.oneOverRadii, oneOverRadiiSquared = ellipsoid.oneOverRadiiSquared, centerToleranceSquared = ellipsoid.centerToleranceSquared;
9438
- scratchVector6.from(cartesian);
9409
+ scratchVector7.from(cartesian);
9439
9410
  var positionX = cartesian.x;
9440
9411
  var positionY = cartesian.y;
9441
9412
  var positionZ = cartesian.z;
@@ -9482,7 +9453,7 @@ var require_scale_to_geodetic_surface = __commonJS({
9482
9453
  var derivative = -2 * denominator;
9483
9454
  correction = func / derivative;
9484
9455
  } while (Math.abs(func) > _core._MathUtils.EPSILON12);
9485
- return scratchVector6.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
9456
+ return scratchVector7.scale([xMultiplier, yMultiplier, zMultiplier]).to(result);
9486
9457
  }
9487
9458
  }
9488
9459
  });
@@ -9668,7 +9639,7 @@ var require_ellipsoid = __commonJS({
9668
9639
  }
9669
9640
  return newObj;
9670
9641
  }
9671
- var scratchVector6 = new _core.Vector3();
9642
+ var scratchVector7 = new _core.Vector3();
9672
9643
  var scratchNormal2 = new _core.Vector3();
9673
9644
  var scratchK = new _core.Vector3();
9674
9645
  var scratchPosition3 = new _core.Vector3();
@@ -9755,7 +9726,7 @@ var require_ellipsoid = __commonJS({
9755
9726
  key: "geocentricSurfaceNormal",
9756
9727
  value: function geocentricSurfaceNormal(cartesian) {
9757
9728
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
9758
- return scratchVector6.from(cartesian).normalize().to(result);
9729
+ return scratchVector7.from(cartesian).normalize().to(result);
9759
9730
  }
9760
9731
  }, {
9761
9732
  key: "geodeticSurfaceNormalCartographic",
@@ -9765,14 +9736,14 @@ var require_ellipsoid = __commonJS({
9765
9736
  var longitude = cartographicVectorRadians[0];
9766
9737
  var latitude = cartographicVectorRadians[1];
9767
9738
  var cosLatitude = Math.cos(latitude);
9768
- scratchVector6.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
9769
- return scratchVector6.to(result);
9739
+ scratchVector7.set(cosLatitude * Math.cos(longitude), cosLatitude * Math.sin(longitude), Math.sin(latitude)).normalize();
9740
+ return scratchVector7.to(result);
9770
9741
  }
9771
9742
  }, {
9772
9743
  key: "geodeticSurfaceNormal",
9773
9744
  value: function geodeticSurfaceNormal(cartesian) {
9774
9745
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
9775
- return scratchVector6.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
9746
+ return scratchVector7.from(cartesian).scale(this.oneOverRadiiSquared).normalize().to(result);
9776
9747
  }
9777
9748
  }, {
9778
9749
  key: "scaleToGeodeticSurface",
@@ -9885,7 +9856,7 @@ var require_axis_aligned_bounding_box = __commonJS({
9885
9856
  var _createClass2 = _interopRequireDefault(require_createClass());
9886
9857
  var _core = require_es53();
9887
9858
  var _constants = require_constants2();
9888
- var scratchVector6 = new _core.Vector3();
9859
+ var scratchVector7 = new _core.Vector3();
9889
9860
  var scratchNormal2 = new _core.Vector3();
9890
9861
  var AxisAlignedBoundingBox = function() {
9891
9862
  function AxisAlignedBoundingBox2() {
@@ -9893,7 +9864,7 @@ var require_axis_aligned_bounding_box = __commonJS({
9893
9864
  var maximum = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [0, 0, 0];
9894
9865
  var center = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : null;
9895
9866
  (0, _classCallCheck2.default)(this, AxisAlignedBoundingBox2);
9896
- center = center || scratchVector6.copy(minimum).add(maximum).scale(0.5);
9867
+ center = center || scratchVector7.copy(minimum).add(maximum).scale(0.5);
9897
9868
  this.center = new _core.Vector3(center);
9898
9869
  this.halfDiagonal = new _core.Vector3(maximum).subtract(this.center);
9899
9870
  this.minimum = new _core.Vector3(minimum);
@@ -9941,7 +9912,7 @@ var require_axis_aligned_bounding_box = __commonJS({
9941
9912
  }, {
9942
9913
  key: "distanceSquaredTo",
9943
9914
  value: function distanceSquaredTo(point) {
9944
- var offset = scratchVector6.from(point).subtract(this.center);
9915
+ var offset = scratchVector7.from(point).subtract(this.center);
9945
9916
  var halfDiagonal = this.halfDiagonal;
9946
9917
  var distanceSquared = 0;
9947
9918
  var d;
@@ -10019,7 +9990,7 @@ var require_bounding_sphere = __commonJS({
10019
9990
  }
10020
9991
  return newObj;
10021
9992
  }
10022
- var scratchVector6 = new _core.Vector3();
9993
+ var scratchVector7 = new _core.Vector3();
10023
9994
  var scratchVector23 = new _core.Vector3();
10024
9995
  var BoundingSphere3 = function() {
10025
9996
  function BoundingSphere4() {
@@ -10040,7 +10011,7 @@ var require_bounding_sphere = __commonJS({
10040
10011
  }, {
10041
10012
  key: "fromCornerPoints",
10042
10013
  value: function fromCornerPoints(corner, oppositeCorner) {
10043
- oppositeCorner = scratchVector6.from(oppositeCorner);
10014
+ oppositeCorner = scratchVector7.from(oppositeCorner);
10044
10015
  this.center = new _core.Vector3().from(corner).add(oppositeCorner).scale(0.5);
10045
10016
  this.radius = this.center.distance(oppositeCorner);
10046
10017
  return this;
@@ -10062,7 +10033,7 @@ var require_bounding_sphere = __commonJS({
10062
10033
  var leftRadius = this.radius;
10063
10034
  var rightCenter = boundingSphere.center;
10064
10035
  var rightRadius = boundingSphere.radius;
10065
- var toRightCenter = scratchVector6.copy(rightCenter).subtract(leftCenter);
10036
+ var toRightCenter = scratchVector7.copy(rightCenter).subtract(leftCenter);
10066
10037
  var centerSeparation = toRightCenter.magnitude();
10067
10038
  if (leftRadius >= centerSeparation + rightRadius) {
10068
10039
  return this.clone();
@@ -10079,7 +10050,7 @@ var require_bounding_sphere = __commonJS({
10079
10050
  }, {
10080
10051
  key: "expand",
10081
10052
  value: function expand(point) {
10082
- point = scratchVector6.from(point);
10053
+ point = scratchVector7.from(point);
10083
10054
  var radius = point.subtract(this.center).magnitude();
10084
10055
  if (radius > this.radius) {
10085
10056
  this.radius = radius;
@@ -10090,14 +10061,14 @@ var require_bounding_sphere = __commonJS({
10090
10061
  key: "transform",
10091
10062
  value: function transform9(_transform) {
10092
10063
  this.center.transform(_transform);
10093
- var scale = mat4.getScaling(scratchVector6, _transform);
10064
+ var scale = mat4.getScaling(scratchVector7, _transform);
10094
10065
  this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
10095
10066
  return this;
10096
10067
  }
10097
10068
  }, {
10098
10069
  key: "distanceSquaredTo",
10099
10070
  value: function distanceSquaredTo(point) {
10100
- point = scratchVector6.from(point);
10071
+ point = scratchVector7.from(point);
10101
10072
  var delta = point.subtract(this.center);
10102
10073
  return delta.lengthSquared() - this.radius * this.radius;
10103
10074
  }
@@ -10997,7 +10968,7 @@ var require_bounding_sphere_from_points = __commonJS({
10997
10968
  Object.defineProperty(exports, "__esModule", {
10998
10969
  value: true
10999
10970
  });
11000
- exports.default = makeBoundingSphereFromPoints;
10971
+ exports.default = makeBoundingSphereFromPoints2;
11001
10972
  var _core = require_es53();
11002
10973
  var _boundingSphere = _interopRequireDefault(require_bounding_sphere());
11003
10974
  function _createForOfIteratorHelper(o, allowArrayLike) {
@@ -11073,7 +11044,7 @@ var require_bounding_sphere_from_points = __commonJS({
11073
11044
  var fromPointsMaxBoxPt = new _core.Vector3();
11074
11045
  var fromPointsNaiveCenterScratch = new _core.Vector3();
11075
11046
  var volumeConstant = 4 / 3 * Math.PI;
11076
- function makeBoundingSphereFromPoints(positions) {
11047
+ function makeBoundingSphereFromPoints2(positions) {
11077
11048
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new _boundingSphere.default();
11078
11049
  if (!positions || positions.length === 0) {
11079
11050
  return result.fromCenterRadius([0, 0, 0], 0);
@@ -11290,7 +11261,7 @@ var require_bounding_box_from_points = __commonJS({
11290
11261
  Object.defineProperty(exports, "__esModule", {
11291
11262
  value: true
11292
11263
  });
11293
- exports.makeOrientedBoundingBoxFromPoints = makeOrientedBoundingBoxFromPoints;
11264
+ exports.makeOrientedBoundingBoxFromPoints = makeOrientedBoundingBoxFromPoints2;
11294
11265
  exports.makeAxisAlignedBoundingBoxFromPoints = makeAxisAlignedBoundingBoxFromPoints;
11295
11266
  var _core = require_es53();
11296
11267
  var _computeEigenDecomposition = _interopRequireDefault(require_compute_eigen_decomposition());
@@ -11360,13 +11331,13 @@ var require_bounding_box_from_points = __commonJS({
11360
11331
  var scratchVector33 = new _core.Vector3();
11361
11332
  var scratchVector42 = new _core.Vector3();
11362
11333
  var scratchVector52 = new _core.Vector3();
11363
- var scratchVector6 = new _core.Vector3();
11334
+ var scratchVector62 = new _core.Vector3();
11364
11335
  var scratchCovarianceResult = new _core.Matrix3();
11365
11336
  var scratchEigenResult = {
11366
11337
  diagonal: new _core.Matrix3(),
11367
11338
  unitary: new _core.Matrix3()
11368
11339
  };
11369
- function makeOrientedBoundingBoxFromPoints(positions) {
11340
+ function makeOrientedBoundingBoxFromPoints2(positions) {
11370
11341
  var result = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : new _orientedBoundingBox.default();
11371
11342
  if (!positions || positions.length === 0) {
11372
11343
  result.halfAxes = new _core.Matrix3([0, 0, 0, 0, 0, 0, 0, 0, 0]);
@@ -11431,7 +11402,7 @@ var require_bounding_box_from_points = __commonJS({
11431
11402
  var rotation = result.halfAxes.copy(unitary);
11432
11403
  var v12 = rotation.getColumn(0, scratchVector42);
11433
11404
  var v2 = rotation.getColumn(1, scratchVector52);
11434
- var v32 = rotation.getColumn(2, scratchVector6);
11405
+ var v32 = rotation.getColumn(2, scratchVector62);
11435
11406
  var u1 = -Number.MAX_VALUE;
11436
11407
  var u2 = -Number.MAX_VALUE;
11437
11408
  var u3 = -Number.MAX_VALUE;
@@ -45981,6 +45952,427 @@ var require_regenerator = __commonJS({
45981
45952
  }
45982
45953
  });
45983
45954
 
45955
+ // ../../node_modules/@math.gl/geoid/dist/es5/geoid.js
45956
+ var require_geoid = __commonJS({
45957
+ "../../node_modules/@math.gl/geoid/dist/es5/geoid.js"(exports) {
45958
+ "use strict";
45959
+ var _interopRequireDefault = require_interopRequireDefault();
45960
+ Object.defineProperty(exports, "__esModule", {
45961
+ value: true
45962
+ });
45963
+ exports.default = void 0;
45964
+ var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
45965
+ var _createClass2 = _interopRequireDefault(require_createClass());
45966
+ var c0_ = 240;
45967
+ var c3_ = [9, -18, -88, 0, 96, 90, 0, 0, -60, -20, -9, 18, 8, 0, -96, 30, 0, 0, 60, -20, 9, -88, -18, 90, 96, 0, -20, -60, 0, 0, 186, -42, -42, -150, -96, -150, 60, 60, 60, 60, 54, 162, -78, 30, -24, -90, -60, 60, -60, 60, -9, -32, 18, 30, 24, 0, 20, -60, 0, 0, -9, 8, 18, 30, -96, 0, -20, 60, 0, 0, 54, -78, 162, -90, -24, 30, 60, -60, 60, -60, -54, 78, 78, 90, 144, 90, -60, -60, -60, -60, 9, -8, -18, -30, -24, 0, 20, 60, 0, 0, -9, 18, -32, 0, 24, 30, 0, 0, -60, 20, 9, -18, -8, 0, -24, -30, 0, 0, 60, 20];
45968
+ var c0n_ = 372;
45969
+ var c3n_ = [0, 0, -131, 0, 138, 144, 0, 0, -102, -31, 0, 0, 7, 0, -138, 42, 0, 0, 102, -31, 62, 0, -31, 0, 0, -62, 0, 0, 0, 31, 124, 0, -62, 0, 0, -124, 0, 0, 0, 62, 124, 0, -62, 0, 0, -124, 0, 0, 0, 62, 62, 0, -31, 0, 0, -62, 0, 0, 0, 31, 0, 0, 45, 0, -183, -9, 0, 93, 18, 0, 0, 0, 216, 0, 33, 87, 0, -93, 12, -93, 0, 0, 156, 0, 153, 99, 0, -93, -12, -93, 0, 0, -45, 0, -3, 9, 0, 93, -18, 0, 0, 0, -55, 0, 48, 42, 0, 0, -84, 31, 0, 0, -7, 0, -48, -42, 0, 0, 84, 31];
45970
+ var c0s_ = 372;
45971
+ var c3s_ = [18, -36, -122, 0, 120, 135, 0, 0, -84, -31, -18, 36, -2, 0, -120, 51, 0, 0, 84, -31, 36, -165, -27, 93, 147, -9, 0, -93, 18, 0, 210, 45, -111, -93, -57, -192, 0, 93, 12, 93, 162, 141, -75, -93, -129, -180, 0, 93, -12, 93, -36, -21, 27, 93, 39, 9, 0, -93, -18, 0, 0, 0, 62, 0, 0, 31, 0, 0, 0, -31, 0, 0, 124, 0, 0, 62, 0, 0, 0, -62, 0, 0, 124, 0, 0, 62, 0, 0, 0, -62, 0, 0, 62, 0, 0, 31, 0, 0, 0, -31, -18, 36, -64, 0, 66, 51, 0, 0, -102, 31, 18, -36, 2, 0, -66, -51, 0, 0, 102, 31];
45972
+ var stencilsize_ = 12;
45973
+ var nterms_ = (3 + 1) * (3 + 2) / 2;
45974
+ var PIXEL_SIZE = 2;
45975
+ var Geoid = function() {
45976
+ function Geoid2(options) {
45977
+ (0, _classCallCheck2.default)(this, Geoid2);
45978
+ this.options = options;
45979
+ this._v00 = 0;
45980
+ this._v01 = 0;
45981
+ this._v10 = 0;
45982
+ this._v11 = 0;
45983
+ this._t = [];
45984
+ this._ix = this.options._width;
45985
+ this._iy = this.options._height;
45986
+ }
45987
+ (0, _createClass2.default)(Geoid2, [{
45988
+ key: "getHeight",
45989
+ value: function getHeight(lat, lon) {
45990
+ lat = Math.abs(lat) > 90 ? NaN : lat;
45991
+ if (isNaN(lat) || isNaN(lon)) {
45992
+ return NaN;
45993
+ }
45994
+ var rem = remainder(lon, 360);
45995
+ lon = rem !== -180 ? rem : 180;
45996
+ var fx = lon * this.options._rlonres;
45997
+ var fy = -lat * this.options._rlatres;
45998
+ var ix = Math.floor(fx);
45999
+ var iy = Math.min(Math.round((this.options._height - 1) / 2 - 1), Math.floor(fy));
46000
+ fx -= ix;
46001
+ fy -= iy;
46002
+ iy += (this.options._height - 1) / 2;
46003
+ ix += ix < 0 ? this.options._width : ix >= this.options._width ? -this.options._width : 0;
46004
+ var v00 = 0;
46005
+ var v01 = 0;
46006
+ var v10 = 0;
46007
+ var v11 = 0;
46008
+ var t = new Array(nterms_);
46009
+ if (!(ix === this._ix && iy === this._iy)) {
46010
+ if (!this.options.cubic) {
46011
+ v00 = this._rawval(ix, iy);
46012
+ v01 = this._rawval(ix + 1, iy);
46013
+ v10 = this._rawval(ix, iy + 1);
46014
+ v11 = this._rawval(ix + 1, iy + 1);
46015
+ } else {
46016
+ var v = [this._rawval(ix, iy - 1), this._rawval(ix + 1, iy - 1), this._rawval(ix - 1, iy), this._rawval(ix, iy), this._rawval(ix + 1, iy), this._rawval(ix + 2, iy), this._rawval(ix - 1, iy + 1), this._rawval(ix, iy + 1), this._rawval(ix + 1, iy + 1), this._rawval(ix + 2, iy + 1), this._rawval(ix, iy + 2), this._rawval(ix + 1, iy + 2)];
46017
+ var c3x = c3n_;
46018
+ if (iy !== 0) {
46019
+ c3x = iy === this.options._height - 2 ? c3s_ : c3_;
46020
+ }
46021
+ var c0x = c0n_;
46022
+ if (iy !== 0) {
46023
+ c0x = iy === this.options._height - 2 ? c0s_ : c0_;
46024
+ }
46025
+ for (var i = 0; i < nterms_; ++i) {
46026
+ t[i] = 0;
46027
+ for (var j = 0; j < stencilsize_; ++j) {
46028
+ t[i] += v[j] * c3x[nterms_ * j + i];
46029
+ }
46030
+ t[i] /= c0x;
46031
+ }
46032
+ }
46033
+ } else if (!this.options.cubic) {
46034
+ v00 = this._v00;
46035
+ v01 = this._v01;
46036
+ v10 = this._v10;
46037
+ v11 = this._v11;
46038
+ } else {
46039
+ t = this._t;
46040
+ }
46041
+ if (!this.options.cubic) {
46042
+ var a = (1 - fx) * v00 + fx * v01;
46043
+ var b = (1 - fx) * v10 + fx * v11;
46044
+ var c = (1 - fy) * a + fy * b;
46045
+ var _h = this.options._offset + this.options._scale * c;
46046
+ this._ix = ix;
46047
+ this._iy = iy;
46048
+ this._v00 = v00;
46049
+ this._v01 = v01;
46050
+ this._v10 = v10;
46051
+ this._v11 = v11;
46052
+ return _h;
46053
+ }
46054
+ var h = t[0] + fx * (t[1] + fx * (t[3] + fx * t[6])) + fy * (t[2] + fx * (t[4] + fx * t[7]) + fy * (t[5] + fx * t[8] + fy * t[9]));
46055
+ h = this.options._offset + this.options._scale * h;
46056
+ this._ix = ix;
46057
+ this._iy = iy;
46058
+ this._t = t;
46059
+ return h;
46060
+ }
46061
+ }, {
46062
+ key: "_rawval",
46063
+ value: function _rawval(ix, iy) {
46064
+ if (ix < 0) {
46065
+ ix += this.options._width;
46066
+ } else if (ix >= this.options._width) {
46067
+ ix -= this.options._width;
46068
+ }
46069
+ if (iy < 0 || iy >= this.options._height) {
46070
+ iy = iy < 0 ? -iy : 2 * (this.options._height - 1) - iy;
46071
+ ix += (ix < this.options._width / 2 ? 1 : -1) * this.options._width / 2;
46072
+ }
46073
+ var bufferPosition = this.options._datastart + PIXEL_SIZE * (iy * this.options._swidth + ix);
46074
+ var a = this.options.data[bufferPosition];
46075
+ var b = this.options.data[bufferPosition + 1];
46076
+ var r = a << 8 | b;
46077
+ return r;
46078
+ }
46079
+ }]);
46080
+ return Geoid2;
46081
+ }();
46082
+ exports.default = Geoid;
46083
+ function remainder(x, y) {
46084
+ y = Math.abs(y);
46085
+ var z = fmod(x, y);
46086
+ if (2 * Math.abs(z) === y)
46087
+ z -= fmod(x, 2 * y) - z;
46088
+ else if (2 * Math.abs(z) > y)
46089
+ z += z < 0 ? y : -y;
46090
+ return z;
46091
+ }
46092
+ function fmod(x, y) {
46093
+ return x - Math.floor(x / y) * y;
46094
+ }
46095
+ }
46096
+ });
46097
+
46098
+ // ../../node_modules/@math.gl/geoid/dist/es5/parse-pgm.js
46099
+ var require_parse_pgm = __commonJS({
46100
+ "../../node_modules/@math.gl/geoid/dist/es5/parse-pgm.js"(exports) {
46101
+ "use strict";
46102
+ var _interopRequireDefault = require_interopRequireDefault();
46103
+ Object.defineProperty(exports, "__esModule", {
46104
+ value: true
46105
+ });
46106
+ exports.parsePGM = parsePGM2;
46107
+ var _regenerator = _interopRequireDefault(require_regenerator());
46108
+ var _geoid = _interopRequireDefault(require_geoid());
46109
+ function _createForOfIteratorHelper(o, allowArrayLike) {
46110
+ var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"];
46111
+ if (!it) {
46112
+ if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
46113
+ if (it)
46114
+ o = it;
46115
+ var i = 0;
46116
+ var F = function F2() {
46117
+ };
46118
+ return { s: F, n: function n() {
46119
+ if (i >= o.length)
46120
+ return { done: true };
46121
+ return { done: false, value: o[i++] };
46122
+ }, e: function e(_e) {
46123
+ throw _e;
46124
+ }, f: F };
46125
+ }
46126
+ throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
46127
+ }
46128
+ var normalCompletion = true, didErr = false, err;
46129
+ return { s: function s() {
46130
+ it = it.call(o);
46131
+ }, n: function n() {
46132
+ var step = it.next();
46133
+ normalCompletion = step.done;
46134
+ return step;
46135
+ }, e: function e(_e2) {
46136
+ didErr = true;
46137
+ err = _e2;
46138
+ }, f: function f() {
46139
+ try {
46140
+ if (!normalCompletion && it.return != null)
46141
+ it.return();
46142
+ } finally {
46143
+ if (didErr)
46144
+ throw err;
46145
+ }
46146
+ } };
46147
+ }
46148
+ function _unsupportedIterableToArray(o, minLen) {
46149
+ if (!o)
46150
+ return;
46151
+ if (typeof o === "string")
46152
+ return _arrayLikeToArray(o, minLen);
46153
+ var n = Object.prototype.toString.call(o).slice(8, -1);
46154
+ if (n === "Object" && o.constructor)
46155
+ n = o.constructor.name;
46156
+ if (n === "Map" || n === "Set")
46157
+ return Array.from(o);
46158
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
46159
+ return _arrayLikeToArray(o, minLen);
46160
+ }
46161
+ function _arrayLikeToArray(arr, len) {
46162
+ if (len == null || len > arr.length)
46163
+ len = arr.length;
46164
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
46165
+ arr2[i] = arr[i];
46166
+ }
46167
+ return arr2;
46168
+ }
46169
+ var _marked = _regenerator.default.mark(_getLineGenerator);
46170
+ var ENDL = 10;
46171
+ var PIXEL_MAX = 65535;
46172
+ function parsePGM2(data, options) {
46173
+ var getline = _getLineGenerator(data);
46174
+ var currentLine = getline.next();
46175
+ if (currentLine.done || currentLine.value.line !== "P5") {
46176
+ throw new Error("Geoid model file: File not in PGM format");
46177
+ }
46178
+ var _offset = Number.MAX_VALUE;
46179
+ var _scale = 0;
46180
+ var _maxerror = -1;
46181
+ var _rmserror = -1;
46182
+ var _description = "NONE";
46183
+ var _datetime = "UNKNOWN";
46184
+ var _width = 0;
46185
+ var _height = 0;
46186
+ var _datastart = null;
46187
+ var _swidth = null;
46188
+ do {
46189
+ currentLine = getline.next();
46190
+ var s = currentLine.value.line;
46191
+ if (!s.length) {
46192
+ continue;
46193
+ }
46194
+ if (s[0] === "#") {
46195
+ var sArr = s.split(" ");
46196
+ var commentId = sArr[0];
46197
+ var key = sArr[1];
46198
+ if (commentId !== "#" || !key) {
46199
+ continue;
46200
+ }
46201
+ var infoArr = sArr.length > 2 ? sArr.slice(2) : [];
46202
+ if (key === "Description") {
46203
+ _description = infoArr.join(" ");
46204
+ } else if (key === "DateTime") {
46205
+ _datetime = infoArr.join(" ");
46206
+ } else if (key === "Offset") {
46207
+ if (!sArr[2]) {
46208
+ throw new Error("Geoid model file: Error reading offset");
46209
+ }
46210
+ _offset = parseInt(sArr[2], 10);
46211
+ } else if (key === "Scale") {
46212
+ if (!sArr[2]) {
46213
+ throw new Error("Geoid model file: Error reading scale");
46214
+ }
46215
+ _scale = parseFloat(sArr[2]);
46216
+ } else if (key === (options.cubic ? "MaxCubicError" : "MaxBilinearError")) {
46217
+ if (isFinite(parseFloat(sArr[2]))) {
46218
+ _maxerror = parseFloat(sArr[2]);
46219
+ }
46220
+ } else if (key === (options.cubic ? "RMSCubicError" : "RMSBilinearError")) {
46221
+ if (isFinite(parseFloat(sArr[2]))) {
46222
+ _rmserror = parseFloat(sArr[2]);
46223
+ }
46224
+ }
46225
+ } else {
46226
+ var _sArr = s.split(" ");
46227
+ _sArr = _sArr.filter(function(testString) {
46228
+ return testString !== "";
46229
+ });
46230
+ _width = parseInt(_sArr[0], 10);
46231
+ _height = parseInt(_sArr[1], 10);
46232
+ if (!(_width && _height)) {
46233
+ throw new Error("Geoid model file: Error reading raster size");
46234
+ }
46235
+ break;
46236
+ }
46237
+ } while (!currentLine.done);
46238
+ currentLine = getline.next();
46239
+ var maxval = parseInt(currentLine.value.line, 10);
46240
+ if (currentLine.done) {
46241
+ throw new Error("Geoid model file: Error reading maxval");
46242
+ }
46243
+ if (maxval !== PIXEL_MAX) {
46244
+ throw new Error("Geoid model file: Incorrect value of maxval");
46245
+ }
46246
+ _datastart = currentLine.value.offset;
46247
+ _swidth = _width;
46248
+ if (_offset === Number.MAX_VALUE) {
46249
+ throw new Error("Geoid model file: Offset not set");
46250
+ }
46251
+ if (_scale === 0) {
46252
+ throw new Error("Geoid model file: Scale not set");
46253
+ }
46254
+ if (_scale < 0) {
46255
+ throw new Error("Geoid model file: Scale must be positive");
46256
+ }
46257
+ if (_height < 2 || _width < 2) {
46258
+ throw new Error("Geoid model file: Raster size too small");
46259
+ }
46260
+ if (_width & 1) {
46261
+ throw new Error("Geoid model file: Raster width is odd");
46262
+ }
46263
+ if (!(_height & 1)) {
46264
+ throw new Error("Geoid model file: Raster height is even");
46265
+ }
46266
+ var _rlonres = _width / 360;
46267
+ var _rlatres = (_height - 1) / 180;
46268
+ return new _geoid.default({
46269
+ cubic: options.cubic,
46270
+ _width,
46271
+ _height,
46272
+ _rlonres,
46273
+ _rlatres,
46274
+ _offset,
46275
+ _scale,
46276
+ _swidth,
46277
+ _datastart,
46278
+ _maxerror,
46279
+ _rmserror,
46280
+ _description,
46281
+ _datetime,
46282
+ data
46283
+ });
46284
+ }
46285
+ function _getLineGenerator(data) {
46286
+ var offset, endLineIndex, line, _line;
46287
+ return _regenerator.default.wrap(function _getLineGenerator$(_context) {
46288
+ while (1) {
46289
+ switch (_context.prev = _context.next) {
46290
+ case 0:
46291
+ offset = 0;
46292
+ case 1:
46293
+ endLineIndex = data.indexOf(ENDL, offset);
46294
+ if (!(endLineIndex !== -1)) {
46295
+ _context.next = 9;
46296
+ break;
46297
+ }
46298
+ line = data.subarray(offset, endLineIndex);
46299
+ offset = endLineIndex + 1;
46300
+ _context.next = 7;
46301
+ return {
46302
+ offset,
46303
+ line: _getStringFromCharArray(line)
46304
+ };
46305
+ case 7:
46306
+ _context.next = 13;
46307
+ break;
46308
+ case 9:
46309
+ _line = data.subarray(offset, data.length);
46310
+ offset = data.length;
46311
+ _context.next = 13;
46312
+ return {
46313
+ offset,
46314
+ line: _getStringFromCharArray(_line)
46315
+ };
46316
+ case 13:
46317
+ if (offset < data.length) {
46318
+ _context.next = 1;
46319
+ break;
46320
+ }
46321
+ case 14:
46322
+ return _context.abrupt("return", {
46323
+ offset,
46324
+ line: ""
46325
+ });
46326
+ case 15:
46327
+ case "end":
46328
+ return _context.stop();
46329
+ }
46330
+ }
46331
+ }, _marked);
46332
+ }
46333
+ function _getStringFromCharArray(array) {
46334
+ var s = "";
46335
+ var _iterator = _createForOfIteratorHelper(array), _step;
46336
+ try {
46337
+ for (_iterator.s(); !(_step = _iterator.n()).done; ) {
46338
+ var char = _step.value;
46339
+ s += String.fromCharCode(char);
46340
+ }
46341
+ } catch (err) {
46342
+ _iterator.e(err);
46343
+ } finally {
46344
+ _iterator.f();
46345
+ }
46346
+ return s;
46347
+ }
46348
+ }
46349
+ });
46350
+
46351
+ // ../../node_modules/@math.gl/geoid/dist/es5/index.js
46352
+ var require_es56 = __commonJS({
46353
+ "../../node_modules/@math.gl/geoid/dist/es5/index.js"(exports) {
46354
+ "use strict";
46355
+ var _interopRequireDefault = require_interopRequireDefault();
46356
+ Object.defineProperty(exports, "__esModule", {
46357
+ value: true
46358
+ });
46359
+ Object.defineProperty(exports, "parsePGM", {
46360
+ enumerable: true,
46361
+ get: function get() {
46362
+ return _parsePgm.parsePGM;
46363
+ }
46364
+ });
46365
+ Object.defineProperty(exports, "Geoid", {
46366
+ enumerable: true,
46367
+ get: function get() {
46368
+ return _geoid.default;
46369
+ }
46370
+ });
46371
+ var _parsePgm = require_parse_pgm();
46372
+ var _geoid = _interopRequireDefault(require_geoid());
46373
+ }
46374
+ });
46375
+
45984
46376
  // ../../node_modules/@babel/runtime/helpers/asyncToGenerator.js
45985
46377
  var require_asyncToGenerator = __commonJS({
45986
46378
  "../../node_modules/@babel/runtime/helpers/asyncToGenerator.js"(exports, module2) {
@@ -46014,7 +46406,6 @@ var require_asyncToGenerator = __commonJS({
46014
46406
  };
46015
46407
  }
46016
46408
  module2.exports = _asyncToGenerator;
46017
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
46018
46409
  }
46019
46410
  });
46020
46411
 
@@ -47791,7 +48182,7 @@ var require_context = __commonJS({
47791
48182
  });
47792
48183
 
47793
48184
  // ../../node_modules/@luma.gl/gltools/dist/es5/index.js
47794
- var require_es56 = __commonJS({
48185
+ var require_es57 = __commonJS({
47795
48186
  "../../node_modules/@luma.gl/gltools/dist/es5/index.js"(exports) {
47796
48187
  "use strict";
47797
48188
  Object.defineProperty(exports, "__esModule", {
@@ -47938,7 +48329,7 @@ var require_init2 = __commonJS({
47938
48329
  exports.default = exports.lumaStats = void 0;
47939
48330
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
47940
48331
  var _createClass2 = _interopRequireDefault(require_createClass());
47941
- var _gltools = require_es56();
48332
+ var _gltools = require_es57();
47942
48333
  var _probe = require_es52();
47943
48334
  var _env = require_env2();
47944
48335
  var VERSION15 = true ? "8.5.4" : "untranspiled source";
@@ -48216,7 +48607,7 @@ var require_stub_methods = __commonJS({
48216
48607
  value: true
48217
48608
  });
48218
48609
  exports.stubRemovedMethods = stubRemovedMethods;
48219
- var _gltools = require_es56();
48610
+ var _gltools = require_es57();
48220
48611
  function stubRemovedMethods(instance, className, version2, methodNames) {
48221
48612
  var upgradeMessage = "See luma.gl ".concat(version2, " Upgrade Guide at https://luma.gl/docs/upgrade-guide");
48222
48613
  var prototype = Object.getPrototypeOf(instance);
@@ -48241,7 +48632,7 @@ var require_check_props = __commonJS({
48241
48632
  value: true
48242
48633
  });
48243
48634
  exports.checkProps = checkProps;
48244
- var _gltools = require_es56();
48635
+ var _gltools = require_es57();
48245
48636
  function checkProps(className, props, propChecks) {
48246
48637
  var _propChecks$removedPr = propChecks.removedProps, removedProps = _propChecks$removedPr === void 0 ? {} : _propChecks$removedPr, _propChecks$deprecate = propChecks.deprecatedProps, deprecatedProps = _propChecks$deprecate === void 0 ? {} : _propChecks$deprecate, _propChecks$replacedP = propChecks.replacedProps, replacedProps = _propChecks$replacedP === void 0 ? {} : _propChecks$replacedP;
48247
48638
  for (var propName in removedProps) {
@@ -48468,7 +48859,7 @@ var require_resource = __commonJS({
48468
48859
  exports.default = void 0;
48469
48860
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
48470
48861
  var _createClass2 = _interopRequireDefault(require_createClass());
48471
- var _gltools = require_es56();
48862
+ var _gltools = require_es57();
48472
48863
  var _init = require_init2();
48473
48864
  var _webglUtils = require_webgl_utils();
48474
48865
  var _utils = require_utils4();
@@ -48917,7 +49308,7 @@ var require_buffer = __commonJS({
48917
49308
  var _resource = _interopRequireDefault(require_resource());
48918
49309
  var _accessor = _interopRequireDefault(require_accessor());
48919
49310
  var _webglUtils = require_webgl_utils();
48920
- var _gltools = require_es56();
49311
+ var _gltools = require_es57();
48921
49312
  var _utils = require_utils4();
48922
49313
  function _createSuper(Derived) {
48923
49314
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
@@ -49296,7 +49687,7 @@ var require_texture_formats = __commonJS({
49296
49687
  exports.isLinearFilteringSupported = isLinearFilteringSupported;
49297
49688
  exports.TYPE_SIZES = exports.DATA_FORMAT_CHANNELS = exports.TEXTURE_FORMATS = void 0;
49298
49689
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
49299
- var _gltools = require_es56();
49690
+ var _gltools = require_es57();
49300
49691
  var _TEXTURE_FORMATS;
49301
49692
  var _DATA_FORMAT_CHANNELS;
49302
49693
  var _TYPE_SIZES;
@@ -49377,7 +49768,7 @@ var require_texture = __commonJS({
49377
49768
  var _inherits2 = _interopRequireDefault(require_inherits());
49378
49769
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
49379
49770
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
49380
- var _gltools = require_es56();
49771
+ var _gltools = require_es57();
49381
49772
  var _env = require_env2();
49382
49773
  var _resource = _interopRequireDefault(require_resource());
49383
49774
  var _buffer = _interopRequireDefault(require_buffer());
@@ -50097,7 +50488,7 @@ var require_texture_2d = __commonJS({
50097
50488
  var _inherits2 = _interopRequireDefault(require_inherits());
50098
50489
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
50099
50490
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
50100
- var _gltools = require_es56();
50491
+ var _gltools = require_es57();
50101
50492
  var _texture = _interopRequireDefault(require_texture());
50102
50493
  var _loadFile = require_load_file();
50103
50494
  function _createSuper(Derived) {
@@ -50182,7 +50573,7 @@ var require_texture_cube = __commonJS({
50182
50573
  var _inherits2 = _interopRequireDefault(require_inherits());
50183
50574
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
50184
50575
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
50185
- var _gltools = require_es56();
50576
+ var _gltools = require_es57();
50186
50577
  var _texture = _interopRequireDefault(require_texture());
50187
50578
  function _createSuper(Derived) {
50188
50579
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
@@ -50348,7 +50739,7 @@ var require_texture_3d = __commonJS({
50348
50739
  var _inherits2 = _interopRequireDefault(require_inherits());
50349
50740
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
50350
50741
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
50351
- var _gltools = require_es56();
50742
+ var _gltools = require_es57();
50352
50743
  var _texture = _interopRequireDefault(require_texture());
50353
50744
  var _textureFormats = require_texture_formats();
50354
50745
  var _buffer = _interopRequireDefault(require_buffer());
@@ -50451,7 +50842,6 @@ var require_superPropBase = __commonJS({
50451
50842
  return object;
50452
50843
  }
50453
50844
  module2.exports = _superPropBase;
50454
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
50455
50845
  }
50456
50846
  });
50457
50847
 
@@ -50462,7 +50852,6 @@ var require_get = __commonJS({
50462
50852
  function _get(target, property, receiver) {
50463
50853
  if (typeof Reflect !== "undefined" && Reflect.get) {
50464
50854
  module2.exports = _get = Reflect.get;
50465
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
50466
50855
  } else {
50467
50856
  module2.exports = _get = function _get2(target2, property2, receiver2) {
50468
50857
  var base = superPropBase(target2, property2);
@@ -50474,12 +50863,10 @@ var require_get = __commonJS({
50474
50863
  }
50475
50864
  return desc.value;
50476
50865
  };
50477
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
50478
50866
  }
50479
50867
  return _get(target, property, receiver || target);
50480
50868
  }
50481
50869
  module2.exports = _get;
50482
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
50483
50870
  }
50484
50871
  });
50485
50872
 
@@ -50634,7 +51021,7 @@ var require_renderbuffer = __commonJS({
50634
51021
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
50635
51022
  var _resource = _interopRequireDefault(require_resource());
50636
51023
  var _renderbufferFormats = _interopRequireDefault(require_renderbuffer_formats());
50637
- var _gltools = require_es56();
51024
+ var _gltools = require_es57();
50638
51025
  var _utils = require_utils4();
50639
51026
  function _createSuper(Derived) {
50640
51027
  var hasNativeReflectConstruct = _isNativeReflectConstruct();
@@ -50784,7 +51171,7 @@ var require_clear = __commonJS({
50784
51171
  exports.clear = clear;
50785
51172
  exports.clearBuffer = clearBuffer;
50786
51173
  var _slicedToArray2 = _interopRequireDefault(require_slicedToArray());
50787
- var _gltools = require_es56();
51174
+ var _gltools = require_es57();
50788
51175
  var _utils = require_utils4();
50789
51176
  var GL_DEPTH_BUFFER_BIT = 256;
50790
51177
  var GL_STENCIL_BUFFER_BIT = 1024;
@@ -50927,7 +51314,7 @@ var require_copy_and_blit = __commonJS({
50927
51314
  var _buffer = _interopRequireDefault(require_buffer());
50928
51315
  var _framebuffer = _interopRequireDefault(require_framebuffer());
50929
51316
  var _texture = _interopRequireDefault(require_texture());
50930
- var _gltools = require_es56();
51317
+ var _gltools = require_es57();
50931
51318
  var _webglUtils = require_webgl_utils();
50932
51319
  var _typedArrayUtils = require_typed_array_utils();
50933
51320
  var _formatUtils = require_format_utils();
@@ -51296,7 +51683,7 @@ var require_limits = __commonJS({
51296
51683
  exports.getContextInfo = getContextInfo;
51297
51684
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
51298
51685
  var _webglLimitsTable = _interopRequireDefault(require_webgl_limits_table());
51299
- var _gltools = require_es56();
51686
+ var _gltools = require_es57();
51300
51687
  function getContextLimits(gl) {
51301
51688
  gl.luma = gl.luma || {};
51302
51689
  if (!gl.luma.limits) {
@@ -51409,7 +51796,7 @@ var require_features = __commonJS({
51409
51796
  exports.hasFeatures = hasFeatures;
51410
51797
  exports.getFeatures = getFeatures;
51411
51798
  var _webglFeaturesTable = _interopRequireDefault(require_webgl_features_table());
51412
- var _gltools = require_es56();
51799
+ var _gltools = require_es57();
51413
51800
  var _utils = require_utils4();
51414
51801
  function _createForOfIteratorHelper(o, allowArrayLike) {
51415
51802
  var it;
@@ -51670,7 +52057,7 @@ var require_framebuffer = __commonJS({
51670
52057
  var _inherits2 = _interopRequireDefault(require_inherits());
51671
52058
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
51672
52059
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
51673
- var _gltools = require_es56();
52060
+ var _gltools = require_es57();
51674
52061
  var _resource = _interopRequireDefault(require_resource());
51675
52062
  var _texture2d = _interopRequireDefault(require_texture_2d());
51676
52063
  var _renderbuffer = _interopRequireDefault(require_renderbuffer());
@@ -52403,18 +52790,18 @@ var require_texture_utils = __commonJS({
52403
52790
  // ../../node_modules/@babel/runtime/helpers/interopRequireWildcard.js
52404
52791
  var require_interopRequireWildcard = __commonJS({
52405
52792
  "../../node_modules/@babel/runtime/helpers/interopRequireWildcard.js"(exports, module2) {
52406
- var _typeof = require_typeof()["default"];
52407
- function _getRequireWildcardCache(nodeInterop) {
52793
+ var _typeof = require_typeof();
52794
+ function _getRequireWildcardCache() {
52408
52795
  if (typeof WeakMap !== "function")
52409
52796
  return null;
52410
- var cacheBabelInterop = new WeakMap();
52411
- var cacheNodeInterop = new WeakMap();
52412
- return (_getRequireWildcardCache = function _getRequireWildcardCache2(nodeInterop2) {
52413
- return nodeInterop2 ? cacheNodeInterop : cacheBabelInterop;
52414
- })(nodeInterop);
52797
+ var cache = new WeakMap();
52798
+ _getRequireWildcardCache = function _getRequireWildcardCache2() {
52799
+ return cache;
52800
+ };
52801
+ return cache;
52415
52802
  }
52416
- function _interopRequireWildcard(obj, nodeInterop) {
52417
- if (!nodeInterop && obj && obj.__esModule) {
52803
+ function _interopRequireWildcard(obj) {
52804
+ if (obj && obj.__esModule) {
52418
52805
  return obj;
52419
52806
  }
52420
52807
  if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") {
@@ -52422,14 +52809,14 @@ var require_interopRequireWildcard = __commonJS({
52422
52809
  "default": obj
52423
52810
  };
52424
52811
  }
52425
- var cache = _getRequireWildcardCache(nodeInterop);
52812
+ var cache = _getRequireWildcardCache();
52426
52813
  if (cache && cache.has(obj)) {
52427
52814
  return cache.get(obj);
52428
52815
  }
52429
52816
  var newObj = {};
52430
52817
  var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
52431
52818
  for (var key in obj) {
52432
- if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
52819
+ if (Object.prototype.hasOwnProperty.call(obj, key)) {
52433
52820
  var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
52434
52821
  if (desc && (desc.get || desc.set)) {
52435
52822
  Object.defineProperty(newObj, key, desc);
@@ -52445,7 +52832,6 @@ var require_interopRequireWildcard = __commonJS({
52445
52832
  return newObj;
52446
52833
  }
52447
52834
  module2.exports = _interopRequireWildcard;
52448
- module2.exports["default"] = module2.exports, module2.exports.__esModule = true;
52449
52835
  }
52450
52836
  });
52451
52837
 
@@ -52658,7 +53044,7 @@ var require_shader = __commonJS({
52658
53044
  var _inherits2 = _interopRequireDefault(require_inherits());
52659
53045
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
52660
53046
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
52661
- var _gltools = require_es56();
53047
+ var _gltools = require_es57();
52662
53048
  var _glslUtils = require_glsl_utils();
52663
53049
  var _utils = require_utils4();
52664
53050
  var _resource = _interopRequireDefault(require_resource());
@@ -52856,7 +53242,7 @@ var require_uniforms = __commonJS({
52856
53242
  exports.checkUniformValues = checkUniformValues;
52857
53243
  exports.copyUniform = copyUniform;
52858
53244
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
52859
- var _gltools = require_es56();
53245
+ var _gltools = require_es57();
52860
53246
  var _framebuffer = _interopRequireDefault(require_framebuffer());
52861
53247
  var _renderbuffer = _interopRequireDefault(require_renderbuffer());
52862
53248
  var _texture = _interopRequireDefault(require_texture());
@@ -53189,7 +53575,7 @@ var require_program_configuration = __commonJS({
53189
53575
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
53190
53576
  var _createClass2 = _interopRequireDefault(require_createClass());
53191
53577
  var _accessor = _interopRequireDefault(require_accessor());
53192
- var _gltools = require_es56();
53578
+ var _gltools = require_es57();
53193
53579
  var _attributeUtils = require_attribute_utils();
53194
53580
  var ProgramConfiguration = function() {
53195
53581
  function ProgramConfiguration2(program) {
@@ -53348,7 +53734,7 @@ var require_program = __commonJS({
53348
53734
  var _uniforms = require_uniforms();
53349
53735
  var _shader = require_shader();
53350
53736
  var _programConfiguration = _interopRequireDefault(require_program_configuration());
53351
- var _gltools = require_es56();
53737
+ var _gltools = require_es57();
53352
53738
  var _webglUtils = require_webgl_utils();
53353
53739
  var _attributeUtils = require_attribute_utils();
53354
53740
  var _utils = require_utils4();
@@ -53759,7 +54145,7 @@ var require_query = __commonJS({
53759
54145
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
53760
54146
  var _resource = _interopRequireDefault(require_resource());
53761
54147
  var _features = require_features2();
53762
- var _gltools = require_es56();
54148
+ var _gltools = require_es57();
53763
54149
  var _utils = require_utils4();
53764
54150
  function _createForOfIteratorHelper(o, allowArrayLike) {
53765
54151
  var it;
@@ -54023,7 +54409,7 @@ var require_transform_feedback = __commonJS({
54023
54409
  var _inherits2 = _interopRequireDefault(require_inherits());
54024
54410
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
54025
54411
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
54026
- var _gltools = require_es56();
54412
+ var _gltools = require_es57();
54027
54413
  var _resource = _interopRequireDefault(require_resource());
54028
54414
  var _buffer = _interopRequireDefault(require_buffer());
54029
54415
  var _utils = require_utils4();
@@ -54308,7 +54694,7 @@ var require_vertex_array_object = __commonJS({
54308
54694
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
54309
54695
  var _resource = _interopRequireDefault(require_resource());
54310
54696
  var _buffer = _interopRequireDefault(require_buffer());
54311
- var _gltools = require_es56();
54697
+ var _gltools = require_es57();
54312
54698
  var _arrayUtilsFlat = require_array_utils_flat();
54313
54699
  var _utils = require_utils4();
54314
54700
  var _probe = require_es52();
@@ -54636,7 +55022,7 @@ var require_vertex_array = __commonJS({
54636
55022
  exports.default = void 0;
54637
55023
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
54638
55024
  var _createClass2 = _interopRequireDefault(require_createClass());
54639
- var _gltools = require_es56();
55025
+ var _gltools = require_es57();
54640
55026
  var _accessor2 = _interopRequireDefault(require_accessor());
54641
55027
  var _buffer = _interopRequireDefault(require_buffer());
54642
55028
  var _vertexArrayObject = _interopRequireDefault(require_vertex_array_object());
@@ -55512,7 +55898,7 @@ var require_debug_program_configuration = __commonJS({
55512
55898
  });
55513
55899
 
55514
55900
  // ../../node_modules/@luma.gl/webgl/dist/es5/index.js
55515
- var require_es57 = __commonJS({
55901
+ var require_es58 = __commonJS({
55516
55902
  "../../node_modules/@luma.gl/webgl/dist/es5/index.js"(exports) {
55517
55903
  "use strict";
55518
55904
  var _interopRequireDefault = require_interopRequireDefault();
@@ -55858,7 +56244,7 @@ var require_es57 = __commonJS({
55858
56244
  var _loadFile = require_load_file();
55859
56245
  var _getShaderName = _interopRequireDefault(require_get_shader_name());
55860
56246
  var _getShaderVersion = _interopRequireDefault(require_get_shader_version());
55861
- var _gltools = require_es56();
56247
+ var _gltools = require_es57();
55862
56248
  var _assert = _interopRequireDefault(require_assert4());
55863
56249
  var _utils = require_utils3();
55864
56250
  var _uniforms = require_uniforms();
@@ -55882,8 +56268,8 @@ var require_animation_loop = __commonJS({
55882
56268
  var _asyncToGenerator2 = _interopRequireDefault(require_asyncToGenerator());
55883
56269
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
55884
56270
  var _createClass2 = _interopRequireDefault(require_createClass());
55885
- var _gltools = require_es56();
55886
- var _webgl = require_es57();
56271
+ var _gltools = require_es57();
56272
+ var _webgl = require_es58();
55887
56273
  var _env = require_env2();
55888
56274
  var isPage = (0, _env.isBrowser)() && typeof document !== "undefined";
55889
56275
  var statIdCounter = 0;
@@ -61553,7 +61939,7 @@ var require_pose2 = __commonJS({
61553
61939
  });
61554
61940
 
61555
61941
  // ../../node_modules/@luma.gl/shadertools/node_modules/@math.gl/core/dist/es5/index.js
61556
- var require_es58 = __commonJS({
61942
+ var require_es59 = __commonJS({
61557
61943
  "../../node_modules/@luma.gl/shadertools/node_modules/@math.gl/core/dist/es5/index.js"(exports) {
61558
61944
  "use strict";
61559
61945
  var _interopRequireDefault = require_interopRequireDefault();
@@ -61803,7 +62189,7 @@ var require_project = __commonJS({
61803
62189
  value: true
61804
62190
  });
61805
62191
  exports.project = void 0;
61806
- var _core = require_es58();
62192
+ var _core = require_es59();
61807
62193
  var IDENTITY_MATRIX = [1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1];
61808
62194
  var DEFAULT_MODULE_OPTIONS = {
61809
62195
  modelMatrix: IDENTITY_MATRIX,
@@ -63133,7 +63519,7 @@ var require_modules = __commonJS({
63133
63519
  });
63134
63520
 
63135
63521
  // ../../node_modules/@luma.gl/shadertools/dist/es5/index.js
63136
- var require_es59 = __commonJS({
63522
+ var require_es510 = __commonJS({
63137
63523
  "../../node_modules/@luma.gl/shadertools/dist/es5/index.js"(exports) {
63138
63524
  "use strict";
63139
63525
  Object.defineProperty(exports, "__esModule", {
@@ -63230,8 +63616,8 @@ var require_program_manager = __commonJS({
63230
63616
  exports.default = void 0;
63231
63617
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
63232
63618
  var _createClass2 = _interopRequireDefault(require_createClass());
63233
- var _shadertools = require_es59();
63234
- var _webgl = require_es57();
63619
+ var _shadertools = require_es510();
63620
+ var _webgl = require_es58();
63235
63621
  function _createForOfIteratorHelper(o, allowArrayLike) {
63236
63622
  var it;
63237
63623
  if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
@@ -63479,7 +63865,7 @@ var require_model_utils = __commonJS({
63479
63865
  exports.getBuffersFromGeometry = getBuffersFromGeometry;
63480
63866
  exports.inferAttributeAccessor = inferAttributeAccessor;
63481
63867
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
63482
- var _webgl = require_es57();
63868
+ var _webgl = require_es58();
63483
63869
  function ownKeys(object, enumerableOnly) {
63484
63870
  var keys = Object.keys(object);
63485
63871
  if (Object.getOwnPropertySymbols) {
@@ -63596,9 +63982,9 @@ var require_model = __commonJS({
63596
63982
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
63597
63983
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
63598
63984
  var _createClass2 = _interopRequireDefault(require_createClass());
63599
- var _gltools = require_es56();
63985
+ var _gltools = require_es57();
63600
63986
  var _programManager = _interopRequireDefault(require_program_manager());
63601
- var _webgl = require_es57();
63987
+ var _webgl = require_es58();
63602
63988
  var _modelUtils = require_model_utils();
63603
63989
  var LOG_DRAW_PRIORITY = 2;
63604
63990
  var LOG_DRAW_TIMEOUT = 1e4;
@@ -64045,8 +64431,8 @@ var require_buffer_transform = __commonJS({
64045
64431
  exports.default = void 0;
64046
64432
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
64047
64433
  var _createClass2 = _interopRequireDefault(require_createClass());
64048
- var _gltools = require_es56();
64049
- var _webgl = require_es57();
64434
+ var _gltools = require_es57();
64435
+ var _webgl = require_es58();
64050
64436
  function _createForOfIteratorHelper(o, allowArrayLike) {
64051
64437
  var it;
64052
64438
  if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
@@ -64346,8 +64732,8 @@ var require_transform_shader_utils = __commonJS({
64346
64732
  exports.getSizeUniforms = getSizeUniforms;
64347
64733
  exports.getVaryingType = getVaryingType;
64348
64734
  exports.processAttributeDefinition = processAttributeDefinition;
64349
- var _webgl = require_es57();
64350
- var _shadertools = require_es59();
64735
+ var _webgl = require_es58();
64736
+ var _shadertools = require_es510();
64351
64737
  var SAMPLER_UNIFORM_PREFIX = "transform_uSampler_";
64352
64738
  var SIZE_UNIFORM_PREFIX = "transform_uSize_";
64353
64739
  var VS_POS_VARIABLE = "transform_position";
@@ -64475,8 +64861,8 @@ var require_texture_transform = __commonJS({
64475
64861
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
64476
64862
  var _createClass2 = _interopRequireDefault(require_createClass());
64477
64863
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
64478
- var _webgl = require_es57();
64479
- var _shadertools = require_es59();
64864
+ var _webgl = require_es58();
64865
+ var _shadertools = require_es510();
64480
64866
  var _transformShaderUtils = require_transform_shader_utils();
64481
64867
  var _SRC_TEX_PARAMETER_OV;
64482
64868
  var SRC_TEX_PARAMETER_OVERRIDES = (_SRC_TEX_PARAMETER_OV = {}, (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10241, 9728), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10240, 9728), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10242, 33071), (0, _defineProperty2.default)(_SRC_TEX_PARAMETER_OV, 10243, 33071), _SRC_TEX_PARAMETER_OV);
@@ -64801,11 +65187,11 @@ var require_transform2 = __commonJS({
64801
65187
  exports.default = void 0;
64802
65188
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
64803
65189
  var _createClass2 = _interopRequireDefault(require_createClass());
64804
- var _shadertools = require_es59();
65190
+ var _shadertools = require_es510();
64805
65191
  var _bufferTransform = _interopRequireDefault(require_buffer_transform());
64806
65192
  var _textureTransform = _interopRequireDefault(require_texture_transform());
64807
- var _gltools = require_es56();
64808
- var _webgl = require_es57();
65193
+ var _gltools = require_es57();
65194
+ var _webgl = require_es58();
64809
65195
  var _model = _interopRequireDefault(require_model());
64810
65196
  function _createForOfIteratorHelper(o, allowArrayLike) {
64811
65197
  var it;
@@ -65080,7 +65466,7 @@ var require_geometry = __commonJS({
65080
65466
  var _defineProperty2 = _interopRequireDefault(require_defineProperty());
65081
65467
  var _classCallCheck2 = _interopRequireDefault(require_classCallCheck());
65082
65468
  var _createClass2 = _interopRequireDefault(require_createClass());
65083
- var _webgl = require_es57();
65469
+ var _webgl = require_es58();
65084
65470
  function ownKeys(object, enumerableOnly) {
65085
65471
  var keys = Object.keys(object);
65086
65472
  if (Object.getOwnPropertySymbols) {
@@ -65230,7 +65616,7 @@ var require_truncated_cone_geometry = __commonJS({
65230
65616
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
65231
65617
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
65232
65618
  var _geometry = _interopRequireDefault(require_geometry());
65233
- var _webgl = require_es57();
65619
+ var _webgl = require_es58();
65234
65620
  function ownKeys(object, enumerableOnly) {
65235
65621
  var keys = Object.keys(object);
65236
65622
  if (Object.getOwnPropertySymbols) {
@@ -65412,7 +65798,7 @@ var require_cone_geometry = __commonJS({
65412
65798
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
65413
65799
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
65414
65800
  var _truncatedConeGeometry = _interopRequireDefault(require_truncated_cone_geometry());
65415
- var _webgl = require_es57();
65801
+ var _webgl = require_es58();
65416
65802
  function ownKeys(object, enumerableOnly) {
65417
65803
  var keys = Object.keys(object);
65418
65804
  if (Object.getOwnPropertySymbols) {
@@ -65506,7 +65892,7 @@ var require_cube_geometry = __commonJS({
65506
65892
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
65507
65893
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
65508
65894
  var _geometry = _interopRequireDefault(require_geometry());
65509
- var _webgl = require_es57();
65895
+ var _webgl = require_es58();
65510
65896
  function ownKeys(object, enumerableOnly) {
65511
65897
  var keys = Object.keys(object);
65512
65898
  if (Object.getOwnPropertySymbols) {
@@ -65619,7 +66005,7 @@ var require_cylinder_geometry = __commonJS({
65619
66005
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
65620
66006
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
65621
66007
  var _truncatedConeGeometry = _interopRequireDefault(require_truncated_cone_geometry());
65622
- var _webgl = require_es57();
66008
+ var _webgl = require_es58();
65623
66009
  function ownKeys(object, enumerableOnly) {
65624
66010
  var keys = Object.keys(object);
65625
66011
  if (Object.getOwnPropertySymbols) {
@@ -69495,7 +69881,7 @@ var require_pose3 = __commonJS({
69495
69881
  });
69496
69882
 
69497
69883
  // ../../node_modules/@luma.gl/engine/node_modules/@math.gl/core/dist/es5/index.js
69498
- var require_es510 = __commonJS({
69884
+ var require_es511 = __commonJS({
69499
69885
  "../../node_modules/@luma.gl/engine/node_modules/@math.gl/core/dist/es5/index.js"(exports) {
69500
69886
  "use strict";
69501
69887
  var _interopRequireDefault = require_interopRequireDefault();
@@ -69751,9 +70137,9 @@ var require_ico_sphere_geometry = __commonJS({
69751
70137
  var _inherits2 = _interopRequireDefault(require_inherits());
69752
70138
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
69753
70139
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
69754
- var _core = require_es510();
70140
+ var _core = require_es511();
69755
70141
  var _geometry = _interopRequireDefault(require_geometry());
69756
- var _webgl = require_es57();
70142
+ var _webgl = require_es58();
69757
70143
  function ownKeys(object, enumerableOnly) {
69758
70144
  var keys = Object.keys(object);
69759
70145
  if (Object.getOwnPropertySymbols) {
@@ -70030,7 +70416,7 @@ var require_plane_geometry = __commonJS({
70030
70416
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
70031
70417
  var _geometry = _interopRequireDefault(require_geometry());
70032
70418
  var _geometryUtils = require_geometry_utils();
70033
- var _webgl = require_es57();
70419
+ var _webgl = require_es58();
70034
70420
  function ownKeys(object, enumerableOnly) {
70035
70421
  var keys = Object.keys(object);
70036
70422
  if (Object.getOwnPropertySymbols) {
@@ -70212,7 +70598,7 @@ var require_sphere_geometry = __commonJS({
70212
70598
  var _possibleConstructorReturn2 = _interopRequireDefault(require_possibleConstructorReturn());
70213
70599
  var _getPrototypeOf2 = _interopRequireDefault(require_getPrototypeOf());
70214
70600
  var _geometry = _interopRequireDefault(require_geometry());
70215
- var _webgl = require_es57();
70601
+ var _webgl = require_es58();
70216
70602
  function ownKeys(object, enumerableOnly) {
70217
70603
  var keys = Object.keys(object);
70218
70604
  if (Object.getOwnPropertySymbols) {
@@ -70773,7 +71159,7 @@ var require_clip_space = __commonJS({
70773
71159
  });
70774
71160
 
70775
71161
  // ../../node_modules/@luma.gl/engine/dist/es5/index.js
70776
- var require_es511 = __commonJS({
71162
+ var require_es512 = __commonJS({
70777
71163
  "../../node_modules/@luma.gl/engine/dist/es5/index.js"(exports) {
70778
71164
  "use strict";
70779
71165
  var _interopRequireDefault = require_interopRequireDefault();
@@ -70889,7 +71275,7 @@ var require_es511 = __commonJS({
70889
71275
  });
70890
71276
 
70891
71277
  // ../../node_modules/@luma.gl/constants/dist/es5/index.js
70892
- var require_es512 = __commonJS({
71278
+ var require_es513 = __commonJS({
70893
71279
  "../../node_modules/@luma.gl/constants/dist/es5/index.js"(exports) {
70894
71280
  "use strict";
70895
71281
  Object.defineProperty(exports, "__esModule", {
@@ -71913,6 +72299,9 @@ function getWorkerURL(worker, options = {}) {
71913
72299
  const workerOptions = options[worker.id] || {};
71914
72300
  const workerFile = `${worker.id}-worker.js`;
71915
72301
  let url = workerOptions.workerUrl;
72302
+ if (!url && worker.id === "compression") {
72303
+ url = options.workerUrl;
72304
+ }
71916
72305
  if (options._workerType === "test") {
71917
72306
  url = `modules/${worker.module}/dist/${workerFile}`;
71918
72307
  }
@@ -74271,6 +74660,7 @@ var TileHeader = class {
74271
74660
  this.depth = 0;
74272
74661
  this.viewportIds = [];
74273
74662
  this.userData = {};
74663
+ this.extensions = null;
74274
74664
  this._priority = 0;
74275
74665
  this._touchedFrame = 0;
74276
74666
  this._visitedFrame = 0;
@@ -75176,7 +75566,8 @@ var TILE3D_TYPE = {
75176
75566
  BATCHED_3D_MODEL: "b3dm",
75177
75567
  INSTANCED_3D_MODEL: "i3dm",
75178
75568
  GEOMETRY: "geom",
75179
- VECTOR: "vect"
75569
+ VECTOR: "vect",
75570
+ GLTF: "glTF"
75180
75571
  };
75181
75572
  var TILE3D_TYPES = Object.keys(TILE3D_TYPE);
75182
75573
  var MAGIC_ARRAY = {
@@ -77925,7 +78316,7 @@ function parseKTX(arrayBuffer) {
77925
78316
  });
77926
78317
  }
77927
78318
 
77928
- // ../textures/src/lib/parsers/parse-basis.js
78319
+ // ../textures/src/lib/parsers/parse-basis.ts
77929
78320
  var OutputFormat = {
77930
78321
  etc1: {
77931
78322
  basisFormat: 0,
@@ -78475,7 +78866,7 @@ async function encodeKTX2BasisTexture(image, options = {}) {
78475
78866
  basisEncoder.setUASTC(encodeUASTC);
78476
78867
  basisEncoder.setMipGen(mipmaps);
78477
78868
  const numOutputBytes = basisEncoder.encode(basisFileData);
78478
- const actualKTX2FileData = new Uint8Array(basisFileData.buffer, 0, numOutputBytes);
78869
+ const actualKTX2FileData = basisFileData.subarray(0, numOutputBytes).buffer;
78479
78870
  return actualKTX2FileData;
78480
78871
  } catch (error) {
78481
78872
  console.error("Basis Universal Supercompressed GPU Texture encoder Error: ", error);
@@ -80543,16 +80934,19 @@ var GLTFPostProcessor = class {
80543
80934
  return image;
80544
80935
  }
80545
80936
  _resolveBufferView(bufferView, index) {
80546
- bufferView.id = bufferView.id || `bufferView-${index}`;
80547
80937
  const bufferIndex = bufferView.buffer;
80548
- bufferView.buffer = this.buffers[bufferIndex];
80938
+ const result = {
80939
+ id: `bufferView-${index}`,
80940
+ ...bufferView,
80941
+ buffer: this.buffers[bufferIndex]
80942
+ };
80549
80943
  const arrayBuffer = this.buffers[bufferIndex].arrayBuffer;
80550
80944
  let byteOffset = this.buffers[bufferIndex].byteOffset || 0;
80551
80945
  if ("byteOffset" in bufferView) {
80552
80946
  byteOffset += bufferView.byteOffset;
80553
80947
  }
80554
- bufferView.data = new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
80555
- return bufferView;
80948
+ result.data = new Uint8Array(arrayBuffer, byteOffset, bufferView.byteLength);
80949
+ return result;
80556
80950
  }
80557
80951
  _resolveCamera(camera, index) {
80558
80952
  camera.id = camera.id || `camera-${index}`;
@@ -80775,7 +81169,7 @@ async function loadImage(gltf, image, index, options, context) {
80775
81169
  arrayBuffer = sliceArrayBuffer(array.buffer, array.byteOffset, array.byteLength);
80776
81170
  }
80777
81171
  assert6(arrayBuffer, "glTF image has no data");
80778
- let parsedImage = await parse9(arrayBuffer, [ImageLoader, BasisLoader], { mimeType: image.mimeType, basis: { format: selectSupportedBasisFormat() } }, context);
81172
+ let parsedImage = await parse9(arrayBuffer, [ImageLoader, BasisLoader], { mimeType: image.mimeType, basis: options.basis || { format: selectSupportedBasisFormat() } }, context);
80779
81173
  if (parsedImage && parsedImage[0]) {
80780
81174
  parsedImage = {
80781
81175
  compressed: true,
@@ -81143,6 +81537,14 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
81143
81537
  return byteOffset;
81144
81538
  }
81145
81539
 
81540
+ // ../3d-tiles/src/lib/parsers/parse-3d-tile-gltf.js
81541
+ async function parseGltf3DTile(tile, arrayBuffer, options, context) {
81542
+ tile.rotateYtoZ = true;
81543
+ tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
81544
+ const { parse: parse9 } = context;
81545
+ tile.gltf = await parse9(arrayBuffer, GLTFLoader, options, context);
81546
+ }
81547
+
81146
81548
  // ../3d-tiles/src/lib/parsers/parse-3d-tile.ts
81147
81549
  async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile = {}) {
81148
81550
  tile.byteOffset = byteOffset;
@@ -81152,6 +81554,8 @@ async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile =
81152
81554
  return await parseComposite3DTile(tile, arrayBuffer, byteOffset, options, context, parse3DTile);
81153
81555
  case TILE3D_TYPE.BATCHED_3D_MODEL:
81154
81556
  return await parseBatchedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
81557
+ case TILE3D_TYPE.GLTF:
81558
+ return await parseGltf3DTile(tile, arrayBuffer, options, context);
81155
81559
  case TILE3D_TYPE.INSTANCED_3D_MODEL:
81156
81560
  return await parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context);
81157
81561
  case TILE3D_TYPE.POINT_CLOUD:
@@ -81161,6 +81565,198 @@ async function parse3DTile(arrayBuffer, byteOffset = 0, options, context, tile =
81161
81565
  }
81162
81566
  }
81163
81567
 
81568
+ // ../3d-tiles/src/lib/parsers/helpers/parse-3d-tile-subtree.ts
81569
+ var SUBTREE_FILE_MAGIC = 1952609651;
81570
+ var SUBTREE_FILE_VERSION = 1;
81571
+ async function parse3DTilesSubtree(data) {
81572
+ const magic = new Uint32Array(data.slice(0, 4));
81573
+ if (magic[0] !== SUBTREE_FILE_MAGIC) {
81574
+ throw new Error("Wrong subtree file magic number");
81575
+ }
81576
+ const version2 = new Uint32Array(data.slice(4, 8));
81577
+ if (version2[0] !== SUBTREE_FILE_VERSION) {
81578
+ throw new Error("Wrong subtree file verson, must be 1");
81579
+ }
81580
+ const jsonByteLength = parseUint64Value(data.slice(8, 16));
81581
+ const stringAttribute = new Uint8Array(data, 24, jsonByteLength);
81582
+ const textDecoder = new TextDecoder("utf8");
81583
+ const string = textDecoder.decode(stringAttribute);
81584
+ const subtree = JSON.parse(string);
81585
+ const binaryByteLength = parseUint64Value(data.slice(16, 24));
81586
+ let internalBinaryBuffer = new ArrayBuffer(0);
81587
+ if (binaryByteLength) {
81588
+ internalBinaryBuffer = data.slice(24 + jsonByteLength);
81589
+ }
81590
+ if ("bufferView" in subtree.tileAvailability) {
81591
+ subtree.tileAvailability.explicitBitstream = await getExplicitBitstream(subtree, "tileAvailability", internalBinaryBuffer);
81592
+ }
81593
+ if ("bufferView" in subtree.contentAvailability) {
81594
+ subtree.contentAvailability.explicitBitstream = await getExplicitBitstream(subtree, "contentAvailability", internalBinaryBuffer);
81595
+ }
81596
+ if ("bufferView" in subtree.childSubtreeAvailability) {
81597
+ subtree.childSubtreeAvailability.explicitBitstream = await getExplicitBitstream(subtree, "childSubtreeAvailability", internalBinaryBuffer);
81598
+ }
81599
+ return subtree;
81600
+ }
81601
+ async function getExplicitBitstream(subtree, name8, internalBinaryBuffer) {
81602
+ const bufferViewIndex = subtree[name8].bufferView;
81603
+ const bufferView = subtree.bufferViews[bufferViewIndex];
81604
+ const buffer = subtree.buffers[bufferView.buffer];
81605
+ if (buffer.uri) {
81606
+ const response = await fetchFile(buffer.uri);
81607
+ const data = await response.arrayBuffer();
81608
+ return new Uint8Array(data, bufferView.byteOffset, bufferView.byteLength);
81609
+ }
81610
+ return new Uint8Array(internalBinaryBuffer, bufferView.byteOffset, bufferView.byteLength);
81611
+ }
81612
+ function parseUint64Value(buffer) {
81613
+ const dataView = new DataView(buffer);
81614
+ const left = dataView.getUint32(0, true);
81615
+ const right = dataView.getUint32(4, true);
81616
+ return left + 2 ** 32 * right;
81617
+ }
81618
+
81619
+ // ../3d-tiles/src/tile-3d-subtree-loader.ts
81620
+ var Tile3DSubtreeLoader = {
81621
+ id: "3d-tiles-subtree",
81622
+ name: "3D Tiles Subtree",
81623
+ module: "3d-tiles",
81624
+ version: VERSION3,
81625
+ extensions: ["subtree"],
81626
+ mimeTypes: ["application/octet-stream"],
81627
+ tests: ["subtree"],
81628
+ parse: parse3DTilesSubtree,
81629
+ options: {}
81630
+ };
81631
+
81632
+ // ../3d-tiles/src/lib/parsers/helpers/parse-3d-implicit-tiles.ts
81633
+ var QUADTREE_DEVISION_COUNT = 4;
81634
+ var OCTREE_DEVISION_COUNT = 8;
81635
+ var SUBDIVISION_COUNT_MAP = {
81636
+ QUADTREE: QUADTREE_DEVISION_COUNT,
81637
+ OCTREE: OCTREE_DEVISION_COUNT
81638
+ };
81639
+ async function parseImplicitTiles(subtree, options, parentData = {
81640
+ mortonIndex: 0,
81641
+ x: 0,
81642
+ y: 0,
81643
+ z: 0
81644
+ }, childIndex = 0, level = 0, globalData = {
81645
+ level: 0,
81646
+ mortonIndex: 0,
81647
+ x: 0,
81648
+ y: 0,
81649
+ z: 0
81650
+ }) {
81651
+ const {
81652
+ subdivisionScheme,
81653
+ subtreeLevels,
81654
+ maximumLevel,
81655
+ contentUrlTemplate,
81656
+ subtreesUriTemplate,
81657
+ basePath
81658
+ } = options;
81659
+ const tile = { children: [], lodMetricValue: 0, contentUrl: "" };
81660
+ const childrenPerTile = SUBDIVISION_COUNT_MAP[subdivisionScheme];
81661
+ const childX = childIndex & 1;
81662
+ const childY = childIndex >> 1 & 1;
81663
+ const childZ = childIndex >> 2 & 1;
81664
+ const levelOffset = (childrenPerTile ** level - 1) / (childrenPerTile - 1);
81665
+ let childTileMortonIndex = concatBits(parentData.mortonIndex, childIndex);
81666
+ let tileAvailabilityIndex = levelOffset + childTileMortonIndex;
81667
+ let childTileX = concatBits(parentData.x, childX);
81668
+ let childTileY = concatBits(parentData.y, childY);
81669
+ let childTileZ = concatBits(parentData.z, childZ);
81670
+ let isChildSubtreeAvailable = false;
81671
+ if (level + 1 > subtreeLevels) {
81672
+ isChildSubtreeAvailable = getAvailabilityResult(subtree.childSubtreeAvailability, childTileMortonIndex);
81673
+ }
81674
+ const x = concatBits(globalData.x, childTileX);
81675
+ const y = concatBits(globalData.y, childTileY);
81676
+ const z = concatBits(globalData.z, childTileZ);
81677
+ const lev = level + globalData.level;
81678
+ if (isChildSubtreeAvailable) {
81679
+ const subtreePath = `${basePath}/${subtreesUriTemplate}`;
81680
+ const childSubtreeUrl = replaceContentUrlTemplate(subtreePath, lev, x, y, z);
81681
+ const childSubtree = await load(childSubtreeUrl, Tile3DSubtreeLoader);
81682
+ subtree = childSubtree;
81683
+ globalData.mortonIndex = childTileMortonIndex;
81684
+ globalData.x = childTileX;
81685
+ globalData.y = childTileY;
81686
+ globalData.z = childTileZ;
81687
+ globalData.level = level;
81688
+ childTileMortonIndex = 0;
81689
+ tileAvailabilityIndex = 0;
81690
+ childTileX = 0;
81691
+ childTileY = 0;
81692
+ childTileZ = 0;
81693
+ level = 0;
81694
+ }
81695
+ const isTileAvailable = getAvailabilityResult(subtree.tileAvailability, tileAvailabilityIndex);
81696
+ if (!isTileAvailable || level > maximumLevel) {
81697
+ return tile;
81698
+ }
81699
+ const isContentAvailable = getAvailabilityResult(subtree.contentAvailability, tileAvailabilityIndex);
81700
+ if (isContentAvailable) {
81701
+ tile.contentUrl = replaceContentUrlTemplate(contentUrlTemplate, lev, x, y, z);
81702
+ }
81703
+ const childTileLevel = level + 1;
81704
+ const pData = { mortonIndex: childTileMortonIndex, x: childTileX, y: childTileY, z: childTileZ };
81705
+ for (let index = 0; index < childrenPerTile; index++) {
81706
+ const currentTile = await parseImplicitTiles(subtree, options, pData, index, childTileLevel, globalData);
81707
+ if (currentTile.contentUrl || currentTile.children.length) {
81708
+ const globalLevel = lev + 1;
81709
+ const formattedTile = formatTileData(currentTile, globalLevel, options);
81710
+ tile.children.push(formattedTile);
81711
+ }
81712
+ }
81713
+ return tile;
81714
+ }
81715
+ function getAvailabilityResult(availabilityData, index) {
81716
+ if ("constant" in availabilityData) {
81717
+ return Boolean(availabilityData.constant);
81718
+ }
81719
+ if (availabilityData.explicitBitstream) {
81720
+ return getBooleanValueFromBitstream(index, availabilityData.explicitBitstream);
81721
+ }
81722
+ return false;
81723
+ }
81724
+ function formatTileData(tile, level, options) {
81725
+ const { basePath, refine, getRefine: getRefine2, lodMetricType, getTileType: getTileType2, rootLodMetricValue } = options;
81726
+ const uri = tile.contentUrl && tile.contentUrl.replace(`${basePath}/`, "");
81727
+ const lodMetricValue = rootLodMetricValue / 2 ** level;
81728
+ return {
81729
+ children: tile.children,
81730
+ contentUrl: tile.contentUrl,
81731
+ content: { uri },
81732
+ id: tile.contentUrl,
81733
+ refine: getRefine2(refine),
81734
+ type: getTileType2(tile),
81735
+ lodMetricType,
81736
+ lodMetricValue
81737
+ };
81738
+ }
81739
+ function concatBits(first, second) {
81740
+ return parseInt(first.toString(2) + second.toString(2), 2);
81741
+ }
81742
+ function replaceContentUrlTemplate(templateUrl, level, x, y, z) {
81743
+ const mapUrl = generateMapUrl({ level, x, y, z });
81744
+ return templateUrl.replace(/{level}|{x}|{y}|{z}/gi, (matched) => mapUrl[matched]);
81745
+ }
81746
+ function generateMapUrl(items) {
81747
+ const mapUrl = {};
81748
+ for (const key in items) {
81749
+ mapUrl[`{${key}}`] = items[key];
81750
+ }
81751
+ return mapUrl;
81752
+ }
81753
+ function getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {
81754
+ const byteIndex = Math.floor(availabilityIndex / 8);
81755
+ const bitIndex = availabilityIndex % 8;
81756
+ const bitValue = availabilityBuffer[byteIndex] >> bitIndex & 1;
81757
+ return bitValue === 1;
81758
+ }
81759
+
81164
81760
  // ../3d-tiles/src/lib/parsers/parse-3d-tile-header.ts
81165
81761
  function getTileType(tile) {
81166
81762
  if (!tile.contentUrl) {
@@ -81173,6 +81769,8 @@ function getTileType(tile) {
81173
81769
  return TILE_TYPE.POINTCLOUD;
81174
81770
  case "i3dm":
81175
81771
  case "b3dm":
81772
+ case "glb":
81773
+ case "gltf":
81176
81774
  return TILE_TYPE.SCENEGRAPH;
81177
81775
  default:
81178
81776
  return fileExtension;
@@ -81221,8 +81819,60 @@ function normalizeTileHeaders(tileset) {
81221
81819
  }
81222
81820
  return root;
81223
81821
  }
81822
+ async function normalizeImplicitTileHeaders(tileset) {
81823
+ if (!tileset.root) {
81824
+ return null;
81825
+ }
81826
+ const basePath = tileset.basePath;
81827
+ const implicitTilingExtension = tileset.root.extensions["3DTILES_implicit_tiling"];
81828
+ const {
81829
+ subdivisionScheme,
81830
+ maximumLevel,
81831
+ subtreeLevels,
81832
+ subtrees: { uri: subtreesUriTemplate }
81833
+ } = implicitTilingExtension;
81834
+ const subtreeUrl = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
81835
+ const rootSubtreeUrl = `${basePath}/${subtreeUrl}`;
81836
+ const rootSubtree = await load(rootSubtreeUrl, Tile3DSubtreeLoader);
81837
+ const contentUrlTemplate = `${basePath}/${tileset.root.content.uri}`;
81838
+ const refine = tileset.root.refine;
81839
+ const rootLodMetricValue = tileset.root.geometricError;
81840
+ const options = {
81841
+ contentUrlTemplate,
81842
+ subtreesUriTemplate,
81843
+ subdivisionScheme,
81844
+ subtreeLevels,
81845
+ maximumLevel,
81846
+ refine,
81847
+ basePath,
81848
+ lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
81849
+ rootLodMetricValue,
81850
+ getTileType,
81851
+ getRefine
81852
+ };
81853
+ return await normalizeImplicitTileData(tileset.root, rootSubtree, options);
81854
+ }
81855
+ async function normalizeImplicitTileData(tile, rootSubtree, options) {
81856
+ if (!tile) {
81857
+ return null;
81858
+ }
81859
+ tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
81860
+ tile.lodMetricValue = tile.geometricError;
81861
+ tile.transformMatrix = tile.transform;
81862
+ const { children, contentUrl } = await parseImplicitTiles(rootSubtree, options);
81863
+ if (contentUrl) {
81864
+ tile.contentUrl = contentUrl;
81865
+ tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
81866
+ }
81867
+ tile.refine = getRefine(tile.refine);
81868
+ tile.type = getTileType(tile);
81869
+ tile.children = children;
81870
+ tile.id = tile.contentUrl;
81871
+ return tile;
81872
+ }
81224
81873
 
81225
81874
  // ../3d-tiles/src/tiles-3d-loader.ts
81875
+ var IMPLICIT_TILING_EXTENSION_NAME = "3DTILES_implicit_tiling";
81226
81876
  var Tiles3DLoader = {
81227
81877
  id: "3d-tiles",
81228
81878
  name: "3D Tiles",
@@ -81259,7 +81909,7 @@ async function parseTileset(data, options, context) {
81259
81909
  tilesetJson.loader = options.loader || Tiles3DLoader;
81260
81910
  tilesetJson.url = context.url;
81261
81911
  tilesetJson.basePath = getBaseUri(tilesetJson);
81262
- tilesetJson.root = normalizeTileHeaders(tilesetJson);
81912
+ tilesetJson.root = hasImplicitTilingExtension(tilesetJson) ? await normalizeImplicitTileHeaders(tilesetJson) : normalizeTileHeaders(tilesetJson);
81263
81913
  tilesetJson.type = TILESET_TYPE.TILES3D;
81264
81914
  tilesetJson.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
81265
81915
  tilesetJson.lodMetricValue = tilesetJson.root?.lodMetricValue || 0;
@@ -81280,8 +81930,11 @@ async function parse4(data, options, context) {
81280
81930
  }
81281
81931
  return data;
81282
81932
  }
81933
+ function hasImplicitTilingExtension(tilesetJson) {
81934
+ return tilesetJson?.extensionsRequired?.includes(IMPLICIT_TILING_EXTENSION_NAME) && tilesetJson?.extensionsUsed?.includes(IMPLICIT_TILING_EXTENSION_NAME);
81935
+ }
81283
81936
 
81284
- // ../3d-tiles/src/lib/ion/ion.js
81937
+ // ../3d-tiles/src/lib/ion/ion.ts
81285
81938
  var CESIUM_ION_URL = "https://api.cesium.com/v1/assets";
81286
81939
  async function getIonTilesetMetadata(accessToken, assetId) {
81287
81940
  if (!assetId) {
@@ -81552,12 +82205,12 @@ var import_process = __toModule(require("process"));
81552
82205
  var import_json_map_transform6 = __toModule(require_json_map_transform());
81553
82206
  var import_md52 = __toModule(require_md52());
81554
82207
 
81555
- // src/i3s-converter/helpers/node-pages.js
82208
+ // src/i3s-converter/helpers/node-pages.ts
81556
82209
  var import_path2 = __toModule(require("path"));
81557
82210
  var import_json_map_transform = __toModule(require_json_map_transform());
81558
82211
 
81559
- // src/i3s-converter/json-templates/metadata.js
81560
- var METADATA = {
82212
+ // src/i3s-converter/json-templates/metadata.ts
82213
+ var METADATA = () => ({
81561
82214
  folderPattern: {
81562
82215
  path: "folderPattern",
81563
82216
  default: "BASIC"
@@ -81577,9 +82230,9 @@ var METADATA = {
81577
82230
  nodeCount: {
81578
82231
  path: "nodeCount"
81579
82232
  }
81580
- };
82233
+ });
81581
82234
 
81582
- // src/i3s-converter/helpers/node-pages.js
82235
+ // src/i3s-converter/helpers/node-pages.ts
81583
82236
  var NodePages = class {
81584
82237
  constructor(writeFileFunc, nodesPerPage) {
81585
82238
  this.nodesPerPage = nodesPerPage;
@@ -81635,18 +82288,18 @@ var NodePages = class {
81635
82288
  node3.mesh.material.texelCountHint = texelCountHint;
81636
82289
  }
81637
82290
  addChildRelation(parentId, childId) {
81638
- if (parentId === null) {
82291
+ if (parentId === null || parentId === void 0) {
81639
82292
  return;
81640
82293
  }
81641
82294
  const parentNode = this.getNodeById(parentId);
81642
- parentNode.children.push(childId);
82295
+ parentNode.children?.push(childId);
81643
82296
  }
81644
82297
  updateResourceInMesh(node3) {
81645
82298
  if (node3.mesh) {
81646
82299
  node3.mesh.geometry.resource = node3.index;
81647
82300
  }
81648
82301
  }
81649
- push(node3, parentId = null) {
82302
+ push(node3, parentId) {
81650
82303
  let currentNodePage = this.nodePages[this.nodePages.length - 1];
81651
82304
  if (currentNodePage.nodes.length === this.nodesPerPage) {
81652
82305
  currentNodePage = { nodes: [] };
@@ -81667,7 +82320,7 @@ var NodePages = class {
81667
82320
  promises.push(this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`));
81668
82321
  fileMap[`nodePages/${index.toString()}.json.gz`] = `${slpkPath}.json.gz`;
81669
82322
  }
81670
- const metadata = (0, import_json_map_transform.default)({ nodeCount: this.nodesCounter }, METADATA);
82323
+ const metadata = (0, import_json_map_transform.default)({ nodeCount: this.nodesCounter }, METADATA());
81671
82324
  const compress = false;
81672
82325
  fileMap["metadata.json"] = await this.writeFile(layers0Path, JSON.stringify(metadata), "metadata.json", compress);
81673
82326
  } else {
@@ -81836,11 +82489,11 @@ async function getTotalFilesSize(dirPath) {
81836
82489
  }
81837
82490
 
81838
82491
  // src/i3s-converter/helpers/geometry-converter.js
81839
- var import_core17 = __toModule(require_es53());
81840
- var import_geospatial7 = __toModule(require_es54());
82492
+ var import_core21 = __toModule(require_es53());
82493
+ var import_geospatial8 = __toModule(require_es54());
81841
82494
  var import_md5 = __toModule(require_md52());
81842
82495
 
81843
- // src/i3s-converter/helpers/geometry-attributes.js
82496
+ // src/i3s-converter/helpers/geometry-attributes.ts
81844
82497
  var VALUES_PER_VERTEX = 3;
81845
82498
  var POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
81846
82499
  function generateAttributes(attributes) {
@@ -81980,6 +82633,84 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects) {
81980
82633
  return { faceRange, featureIds, positions, normals, colors, texCoords };
81981
82634
  }
81982
82635
 
82636
+ // src/i3s-converter/helpers/coordinate-converter.ts
82637
+ var import_core20 = __toModule(require_es53());
82638
+ var import_geospatial7 = __toModule(require_es54());
82639
+ var import_culling4 = __toModule(require_es55());
82640
+ function createBoundingVolumes(tile, geoidHeightModel) {
82641
+ let radius;
82642
+ let halfSize;
82643
+ let quaternion;
82644
+ const boundingVolume = tile.boundingVolume;
82645
+ const cartographicCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core20.Vector3());
82646
+ cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
82647
+ if (boundingVolume instanceof import_culling4.OrientedBoundingBox) {
82648
+ halfSize = boundingVolume.halfSize;
82649
+ radius = new import_core20.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
82650
+ quaternion = boundingVolume.quaternion;
82651
+ } else {
82652
+ radius = tile.boundingVolume.radius;
82653
+ halfSize = [radius, radius, radius];
82654
+ quaternion = new import_core20.Quaternion().fromMatrix3(new import_core20.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
82655
+ }
82656
+ return {
82657
+ mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
82658
+ obb: {
82659
+ center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
82660
+ halfSize,
82661
+ quaternion
82662
+ }
82663
+ };
82664
+ }
82665
+ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel) {
82666
+ const positionVectors = convertPositionsToVectors(cartesianPositions);
82667
+ const geometryObb = (0, import_culling4.makeOrientedBoundingBoxFromPoints)(positionVectors);
82668
+ const geometryMbs = (0, import_culling4.makeBoundingSphereFromPoints)(positionVectors);
82669
+ let mbsCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core20.Vector3());
82670
+ let obbCenter = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core20.Vector3());
82671
+ mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
82672
+ obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
82673
+ return {
82674
+ mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
82675
+ obb: {
82676
+ center: obbCenter,
82677
+ halfSize: geometryObb.halfSize,
82678
+ quaternion: geometryObb.quaternion
82679
+ }
82680
+ };
82681
+ }
82682
+ function convertPositionsToVectors(positions) {
82683
+ const result = [];
82684
+ for (let i = 0; i < positions.length; i += 3) {
82685
+ const positionVector = new import_core20.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
82686
+ result.push(positionVector);
82687
+ }
82688
+ return result;
82689
+ }
82690
+ function convertCommonToI3SExtentCoordinate(tileset) {
82691
+ const cartesianCenter = tileset?.cartesianCenter;
82692
+ if (!cartesianCenter) {
82693
+ return null;
82694
+ }
82695
+ const radius = tileset?.lodMetricValue;
82696
+ const rightTop = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(new import_core20.Vector3(cartesianCenter[0] + radius, cartesianCenter[1] + radius, cartesianCenter[2]), new import_core20.Vector3());
82697
+ const leftBottom = import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic(new import_core20.Vector3(cartesianCenter[0] - radius, cartesianCenter[1] - radius, cartesianCenter[2]), new import_core20.Vector3());
82698
+ const isFirstRight = rightTop[0] < leftBottom[0];
82699
+ const isFirstTop = rightTop[1] < leftBottom[1];
82700
+ return [
82701
+ isFirstRight ? rightTop[0] : leftBottom[0],
82702
+ isFirstTop ? rightTop[1] : leftBottom[1],
82703
+ isFirstRight ? leftBottom[0] : rightTop[0],
82704
+ isFirstTop ? leftBottom[1] : rightTop[1]
82705
+ ];
82706
+ }
82707
+ function createObbFromMbs(mbs) {
82708
+ const radius = mbs[3];
82709
+ const center = new import_core20.Vector3(mbs[0], mbs[1], mbs[2]);
82710
+ const halfAxex = new import_core20.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
82711
+ return new import_culling4.OrientedBoundingBox(center, halfAxex);
82712
+ }
82713
+
81983
82714
  // src/i3s-converter/helpers/geometry-converter.js
81984
82715
  var VALUES_PER_VERTEX2 = 3;
81985
82716
  var VALUES_PER_TEX_COORD = 2;
@@ -81989,9 +82720,14 @@ var SHORT_INT_TYPE = "Int32";
81989
82720
  var DOUBLE_TYPE = "Float64";
81990
82721
  var OBJECT_ID_TYPE = "Oid32";
81991
82722
  var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
81992
- async function convertB3dmToI3sGeometry(tileContent, nodeId, featuresHashArray, attributeStorageInfo, draco) {
82723
+ var scratchVector4 = new import_core21.Vector3();
82724
+ async function convertB3dmToI3sGeometry(tileContent, nodeId, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel) {
82725
+ const useCartesianPositions = generateBoundingVolumes;
81993
82726
  const materialAndTextureList = convertMaterials(tileContent);
81994
- const convertedAttributesMap = convertAttributes(tileContent);
82727
+ const convertedAttributesMap = convertAttributes(tileContent, useCartesianPositions);
82728
+ if (generateBoundingVolumes) {
82729
+ _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
82730
+ }
81995
82731
  if (convertedAttributesMap.has("default")) {
81996
82732
  materialAndTextureList.push({
81997
82733
  material: getDefaultMaterial()
@@ -82000,7 +82736,7 @@ async function convertB3dmToI3sGeometry(tileContent, nodeId, featuresHashArray,
82000
82736
  const result = [];
82001
82737
  let nodesCounter = nodeId;
82002
82738
  let { materials = [] } = tileContent.gltf;
82003
- if (!materials.length === 0) {
82739
+ if (!materials?.length) {
82004
82740
  materials.push({ id: "default" });
82005
82741
  }
82006
82742
  for (let i = 0; i < materials.length; i++) {
@@ -82027,6 +82763,20 @@ async function convertB3dmToI3sGeometry(tileContent, nodeId, featuresHashArray,
82027
82763
  }
82028
82764
  return result;
82029
82765
  }
82766
+ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel) {
82767
+ for (const attributes of convertedAttributesMap.values()) {
82768
+ const boundingVolumes = createBoundingVolumesFromGeometry(attributes.positions, geoidHeightModel);
82769
+ attributes.boundingVolumes = boundingVolumes;
82770
+ const cartographicOrigin = boundingVolumes.obb.center;
82771
+ for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
82772
+ const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
82773
+ import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector4);
82774
+ scratchVector4[2] = scratchVector4[2] - geoidHeightModel.getHeight(scratchVector4[1], scratchVector4[0]);
82775
+ scratchVector4 = scratchVector4.subtract(cartographicOrigin);
82776
+ attributes.positions.set(scratchVector4, index);
82777
+ }
82778
+ }
82779
+ }
82030
82780
  async function _makeNodeResources({
82031
82781
  convertedAttributes,
82032
82782
  material,
@@ -82037,6 +82787,7 @@ async function _makeNodeResources({
82037
82787
  attributeStorageInfo,
82038
82788
  draco
82039
82789
  }) {
82790
+ const boundingVolumes = convertedAttributes.boundingVolumes;
82040
82791
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX2;
82041
82792
  const triangleCount = vertexCount / 3;
82042
82793
  const { faceRange, featureIds, positions, normals, colors, texCoords, featureCount } = generateAttributes({ triangleCount, ...convertedAttributes });
@@ -82064,10 +82815,11 @@ async function _makeNodeResources({
82064
82815
  meshMaterial: material,
82065
82816
  vertexCount,
82066
82817
  attributes,
82067
- featureCount
82818
+ featureCount,
82819
+ boundingVolumes
82068
82820
  };
82069
82821
  }
82070
- function convertAttributes(tileContent) {
82822
+ function convertAttributes(tileContent, useCartesianPositions) {
82071
82823
  const attributesMap = new Map();
82072
82824
  for (const material of tileContent.gltf.materials || [{ id: "default" }]) {
82073
82825
  attributesMap.set(material.id, {
@@ -82075,11 +82827,12 @@ function convertAttributes(tileContent) {
82075
82827
  normals: new Float32Array(0),
82076
82828
  texCoords: new Float32Array(0),
82077
82829
  colors: new Uint8Array(0),
82078
- featureIndices: []
82830
+ featureIndices: [],
82831
+ boundingVolumes: null
82079
82832
  });
82080
82833
  }
82081
82834
  const nodes = (tileContent.gltf.scene || tileContent.gltf.scenes?.[0] || tileContent.gltf).nodes;
82082
- convertNodes(nodes, tileContent, attributesMap);
82835
+ convertNodes(nodes, tileContent, attributesMap, useCartesianPositions);
82083
82836
  for (const attrKey of attributesMap.keys()) {
82084
82837
  const attributes = attributesMap.get(attrKey);
82085
82838
  if (attributes.positions.length === 0) {
@@ -82090,23 +82843,23 @@ function convertAttributes(tileContent) {
82090
82843
  }
82091
82844
  return attributesMap;
82092
82845
  }
82093
- function convertNodes(nodes, tileContent, attributesMap, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82846
+ function convertNodes(nodes, tileContent, attributesMap, useCartesianPositions, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82094
82847
  if (nodes) {
82095
82848
  for (const node3 of nodes) {
82096
- convertNode(node3, tileContent, attributesMap, matrix);
82849
+ convertNode(node3, tileContent, attributesMap, useCartesianPositions, matrix);
82097
82850
  }
82098
82851
  }
82099
82852
  }
82100
- function convertNode(node3, tileContent, attributesMap, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82853
+ function convertNode(node3, tileContent, attributesMap, useCartesianPositions, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82101
82854
  const nodeMatrix = node3.matrix;
82102
82855
  const compositeMatrix = nodeMatrix ? matrix.multiplyRight(nodeMatrix) : matrix;
82103
82856
  const mesh = node3.mesh;
82104
82857
  if (mesh) {
82105
- convertMesh(mesh, tileContent, attributesMap, compositeMatrix);
82858
+ convertMesh(mesh, tileContent, attributesMap, useCartesianPositions, compositeMatrix);
82106
82859
  }
82107
- convertNodes(node3.children, tileContent, attributesMap, compositeMatrix);
82860
+ convertNodes(node3.children, tileContent, attributesMap, useCartesianPositions, compositeMatrix);
82108
82861
  }
82109
- function convertMesh(mesh, content, attributesMap, matrix = new import_core17.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82862
+ function convertMesh(mesh, content, attributesMap, useCartesianPositions = false, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
82110
82863
  for (const primitive of mesh.primitives) {
82111
82864
  let outputAttributes = null;
82112
82865
  if (primitive.material) {
@@ -82122,7 +82875,8 @@ function convertMesh(mesh, content, attributesMap, matrix = new import_core17.Ma
82122
82875
  cartesianModelMatrix: content.cartesianModelMatrix,
82123
82876
  nodeMatrix: matrix,
82124
82877
  indices: primitive.indices.value,
82125
- attributeSpecificTransformation: transformVertexPositions
82878
+ attributeSpecificTransformation: transformVertexPositions,
82879
+ useCartesianPositions
82126
82880
  }));
82127
82881
  outputAttributes.normals = concatenateTypedArrays(outputAttributes.normals, transformVertexArray({
82128
82882
  vertices: attributes.NORMAL && attributes.NORMAL.value,
@@ -82130,7 +82884,8 @@ function convertMesh(mesh, content, attributesMap, matrix = new import_core17.Ma
82130
82884
  cartesianModelMatrix: content.cartesianModelMatrix,
82131
82885
  nodeMatrix: matrix,
82132
82886
  indices: primitive.indices.value,
82133
- attributeSpecificTransformation: transformVertexNormals
82887
+ attributeSpecificTransformation: transformVertexNormals,
82888
+ useCartesianPositions: false
82134
82889
  }));
82135
82890
  outputAttributes.texCoords = concatenateTypedArrays(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, primitive.indices.value));
82136
82891
  outputAttributes.colors = concatenateTypedArrays(outputAttributes.colors, flattenColors(attributes.COLOR_0, primitive.indices.value));
@@ -82146,7 +82901,7 @@ function transformVertexArray(args) {
82146
82901
  for (let i = 0; i < indices.length; i++) {
82147
82902
  const coordIndex = indices[i] * VALUES_PER_VERTEX2;
82148
82903
  const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
82149
- let vertexVector = new import_core17.Vector3(Array.from(vertex));
82904
+ let vertexVector = new import_core21.Vector3(Array.from(vertex));
82150
82905
  vertexVector = attributeSpecificTransformation(vertexVector, args);
82151
82906
  newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
82152
82907
  newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
@@ -82155,12 +82910,15 @@ function transformVertexArray(args) {
82155
82910
  return newVertices;
82156
82911
  }
82157
82912
  function transformVertexPositions(vertexVector, calleeArgs) {
82158
- const { cartesianModelMatrix, cartographicOrigin, nodeMatrix } = calleeArgs;
82913
+ const { cartesianModelMatrix, cartographicOrigin, nodeMatrix, useCartesianPositions } = calleeArgs;
82159
82914
  if (nodeMatrix) {
82160
82915
  vertexVector = vertexVector.transform(nodeMatrix);
82161
82916
  }
82162
82917
  vertexVector = vertexVector.transform(cartesianModelMatrix);
82163
- import_geospatial7.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
82918
+ if (useCartesianPositions) {
82919
+ return vertexVector;
82920
+ }
82921
+ import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
82164
82922
  vertexVector = vertexVector.subtract(cartographicOrigin);
82165
82923
  return vertexVector;
82166
82924
  }
@@ -82305,10 +83063,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
82305
83063
  }
82306
83064
  function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 0) {
82307
83065
  const matDielectricColorComponent = 0.04 / 255;
82308
- const black = new import_core17.Vector4(0, 0, 0, 1);
82309
- const unitVector = new import_core17.Vector4(1, 1, 1, 1);
82310
- const dielectricSpecular = new import_core17.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
82311
- const baseColorVector = new import_core17.Vector4(baseColorFactor);
83066
+ const black = new import_core21.Vector4(0, 0, 0, 1);
83067
+ const unitVector = new import_core21.Vector4(1, 1, 1, 1);
83068
+ const dielectricSpecular = new import_core21.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
83069
+ const baseColorVector = new import_core21.Vector4(baseColorFactor);
82312
83070
  const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
82313
83071
  const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
82314
83072
  dielectricSpecular[3] = 1;
@@ -82489,62 +83247,12 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
82489
83247
  return orderedFeatureIndices;
82490
83248
  }
82491
83249
 
82492
- // src/i3s-converter/helpers/coordinate-converter.ts
82493
- var import_core19 = __toModule(require_es53());
82494
- var import_geospatial8 = __toModule(require_es54());
82495
- var import_culling4 = __toModule(require_es55());
82496
- function createBoundingVolumes(tile, geoidHeightModel) {
82497
- let radius;
82498
- let halfSize;
82499
- let quaternion;
82500
- const boundingVolume = tile.boundingVolume;
82501
- const cartographicCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core19.Vector3());
82502
- cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
82503
- if (boundingVolume instanceof import_culling4.OrientedBoundingBox) {
82504
- halfSize = boundingVolume.halfSize;
82505
- radius = new import_core19.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
82506
- quaternion = boundingVolume.quaternion;
82507
- } else {
82508
- radius = tile.boundingVolume.radius;
82509
- halfSize = [radius, radius, radius];
82510
- quaternion = new import_core19.Quaternion().fromMatrix3(new import_core19.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
82511
- }
82512
- return {
82513
- mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
82514
- obb: {
82515
- center: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2]],
82516
- halfSize,
82517
- quaternion
82518
- }
82519
- };
82520
- }
82521
- function convertCommonToI3SExtentCoordinate(tileset) {
82522
- const cartesianCenter = tileset.cartesianCenter;
82523
- const radius = tileset.lodMetricValue;
82524
- const rightTop = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core19.Vector3(cartesianCenter[0] + radius, cartesianCenter[1] + radius, cartesianCenter[2]), new import_core19.Vector3());
82525
- const leftBottom = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core19.Vector3(cartesianCenter[0] - radius, cartesianCenter[1] - radius, cartesianCenter[2]), new import_core19.Vector3());
82526
- const isFirstRight = rightTop[0] < leftBottom[0];
82527
- const isFirstTop = rightTop[1] < leftBottom[1];
82528
- return [
82529
- isFirstRight ? rightTop[0] : leftBottom[0],
82530
- isFirstTop ? rightTop[1] : leftBottom[1],
82531
- isFirstRight ? leftBottom[0] : rightTop[0],
82532
- isFirstTop ? leftBottom[1] : rightTop[1]
82533
- ];
82534
- }
82535
- function createObbFromMbs(mbs) {
82536
- const radius = mbs[3];
82537
- const center = new import_core19.Vector3(mbs[0], mbs[1], mbs[2]);
82538
- const halfAxex = new import_core19.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
82539
- return new import_culling4.OrientedBoundingBox(center, halfAxex);
82540
- }
82541
-
82542
- // src/i3s-converter/helpers/create-scene-server-path.js
83250
+ // src/i3s-converter/helpers/create-scene-server-path.ts
82543
83251
  var import_json_map_transform2 = __toModule(require_json_map_transform());
82544
83252
  var import_path6 = __toModule(require("path"));
82545
83253
 
82546
- // src/i3s-converter/json-templates/scene-server.js
82547
- var SCENE_SERVER_TEMPLATE = {
83254
+ // src/i3s-converter/json-templates/scene-server.ts
83255
+ var SCENE_SERVER = () => ({
82548
83256
  serviceItemId: {
82549
83257
  path: "serviceItemId"
82550
83258
  },
@@ -82570,16 +83278,16 @@ var SCENE_SERVER_TEMPLATE = {
82570
83278
  path: "layers0",
82571
83279
  transform: (layers0) => [layers0]
82572
83280
  }
82573
- };
83281
+ });
82574
83282
 
82575
- // src/i3s-converter/helpers/create-scene-server-path.js
83283
+ // src/i3s-converter/helpers/create-scene-server-path.ts
82576
83284
  async function createSceneServerPath(layerName, layers0, rootPath) {
82577
83285
  const sceneServerData = {
82578
83286
  serviceItemId: v4().replace(/-/gi, ""),
82579
83287
  layerName,
82580
83288
  layers0
82581
83289
  };
82582
- const sceneServer = (0, import_json_map_transform2.default)(sceneServerData, SCENE_SERVER_TEMPLATE);
83290
+ const sceneServer = (0, import_json_map_transform2.default)(sceneServerData, SCENE_SERVER());
82583
83291
  const nodePagePath = (0, import_path6.join)(rootPath, "SceneServer");
82584
83292
  await writeFile3(nodePagePath, JSON.stringify(sceneServer));
82585
83293
  }
@@ -82622,644 +83330,8 @@ function convertScreenThresholdToGeometricError(node3) {
82622
83330
  return node3.header.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR / maxError;
82623
83331
  }
82624
83332
 
82625
- // src/lib/geoid-height-model.js
82626
- var c0_ = 240;
82627
- var c3_ = [
82628
- 9,
82629
- -18,
82630
- -88,
82631
- 0,
82632
- 96,
82633
- 90,
82634
- 0,
82635
- 0,
82636
- -60,
82637
- -20,
82638
- -9,
82639
- 18,
82640
- 8,
82641
- 0,
82642
- -96,
82643
- 30,
82644
- 0,
82645
- 0,
82646
- 60,
82647
- -20,
82648
- 9,
82649
- -88,
82650
- -18,
82651
- 90,
82652
- 96,
82653
- 0,
82654
- -20,
82655
- -60,
82656
- 0,
82657
- 0,
82658
- 186,
82659
- -42,
82660
- -42,
82661
- -150,
82662
- -96,
82663
- -150,
82664
- 60,
82665
- 60,
82666
- 60,
82667
- 60,
82668
- 54,
82669
- 162,
82670
- -78,
82671
- 30,
82672
- -24,
82673
- -90,
82674
- -60,
82675
- 60,
82676
- -60,
82677
- 60,
82678
- -9,
82679
- -32,
82680
- 18,
82681
- 30,
82682
- 24,
82683
- 0,
82684
- 20,
82685
- -60,
82686
- 0,
82687
- 0,
82688
- -9,
82689
- 8,
82690
- 18,
82691
- 30,
82692
- -96,
82693
- 0,
82694
- -20,
82695
- 60,
82696
- 0,
82697
- 0,
82698
- 54,
82699
- -78,
82700
- 162,
82701
- -90,
82702
- -24,
82703
- 30,
82704
- 60,
82705
- -60,
82706
- 60,
82707
- -60,
82708
- -54,
82709
- 78,
82710
- 78,
82711
- 90,
82712
- 144,
82713
- 90,
82714
- -60,
82715
- -60,
82716
- -60,
82717
- -60,
82718
- 9,
82719
- -8,
82720
- -18,
82721
- -30,
82722
- -24,
82723
- 0,
82724
- 20,
82725
- 60,
82726
- 0,
82727
- 0,
82728
- -9,
82729
- 18,
82730
- -32,
82731
- 0,
82732
- 24,
82733
- 30,
82734
- 0,
82735
- 0,
82736
- -60,
82737
- 20,
82738
- 9,
82739
- -18,
82740
- -8,
82741
- 0,
82742
- -24,
82743
- -30,
82744
- 0,
82745
- 0,
82746
- 60,
82747
- 20
82748
- ];
82749
- var c0n_ = 372;
82750
- var c3n_ = [
82751
- 0,
82752
- 0,
82753
- -131,
82754
- 0,
82755
- 138,
82756
- 144,
82757
- 0,
82758
- 0,
82759
- -102,
82760
- -31,
82761
- 0,
82762
- 0,
82763
- 7,
82764
- 0,
82765
- -138,
82766
- 42,
82767
- 0,
82768
- 0,
82769
- 102,
82770
- -31,
82771
- 62,
82772
- 0,
82773
- -31,
82774
- 0,
82775
- 0,
82776
- -62,
82777
- 0,
82778
- 0,
82779
- 0,
82780
- 31,
82781
- 124,
82782
- 0,
82783
- -62,
82784
- 0,
82785
- 0,
82786
- -124,
82787
- 0,
82788
- 0,
82789
- 0,
82790
- 62,
82791
- 124,
82792
- 0,
82793
- -62,
82794
- 0,
82795
- 0,
82796
- -124,
82797
- 0,
82798
- 0,
82799
- 0,
82800
- 62,
82801
- 62,
82802
- 0,
82803
- -31,
82804
- 0,
82805
- 0,
82806
- -62,
82807
- 0,
82808
- 0,
82809
- 0,
82810
- 31,
82811
- 0,
82812
- 0,
82813
- 45,
82814
- 0,
82815
- -183,
82816
- -9,
82817
- 0,
82818
- 93,
82819
- 18,
82820
- 0,
82821
- 0,
82822
- 0,
82823
- 216,
82824
- 0,
82825
- 33,
82826
- 87,
82827
- 0,
82828
- -93,
82829
- 12,
82830
- -93,
82831
- 0,
82832
- 0,
82833
- 156,
82834
- 0,
82835
- 153,
82836
- 99,
82837
- 0,
82838
- -93,
82839
- -12,
82840
- -93,
82841
- 0,
82842
- 0,
82843
- -45,
82844
- 0,
82845
- -3,
82846
- 9,
82847
- 0,
82848
- 93,
82849
- -18,
82850
- 0,
82851
- 0,
82852
- 0,
82853
- -55,
82854
- 0,
82855
- 48,
82856
- 42,
82857
- 0,
82858
- 0,
82859
- -84,
82860
- 31,
82861
- 0,
82862
- 0,
82863
- -7,
82864
- 0,
82865
- -48,
82866
- -42,
82867
- 0,
82868
- 0,
82869
- 84,
82870
- 31
82871
- ];
82872
- var c0s_ = 372;
82873
- var c3s_ = [
82874
- 18,
82875
- -36,
82876
- -122,
82877
- 0,
82878
- 120,
82879
- 135,
82880
- 0,
82881
- 0,
82882
- -84,
82883
- -31,
82884
- -18,
82885
- 36,
82886
- -2,
82887
- 0,
82888
- -120,
82889
- 51,
82890
- 0,
82891
- 0,
82892
- 84,
82893
- -31,
82894
- 36,
82895
- -165,
82896
- -27,
82897
- 93,
82898
- 147,
82899
- -9,
82900
- 0,
82901
- -93,
82902
- 18,
82903
- 0,
82904
- 210,
82905
- 45,
82906
- -111,
82907
- -93,
82908
- -57,
82909
- -192,
82910
- 0,
82911
- 93,
82912
- 12,
82913
- 93,
82914
- 162,
82915
- 141,
82916
- -75,
82917
- -93,
82918
- -129,
82919
- -180,
82920
- 0,
82921
- 93,
82922
- -12,
82923
- 93,
82924
- -36,
82925
- -21,
82926
- 27,
82927
- 93,
82928
- 39,
82929
- 9,
82930
- 0,
82931
- -93,
82932
- -18,
82933
- 0,
82934
- 0,
82935
- 0,
82936
- 62,
82937
- 0,
82938
- 0,
82939
- 31,
82940
- 0,
82941
- 0,
82942
- 0,
82943
- -31,
82944
- 0,
82945
- 0,
82946
- 124,
82947
- 0,
82948
- 0,
82949
- 62,
82950
- 0,
82951
- 0,
82952
- 0,
82953
- -62,
82954
- 0,
82955
- 0,
82956
- 124,
82957
- 0,
82958
- 0,
82959
- 62,
82960
- 0,
82961
- 0,
82962
- 0,
82963
- -62,
82964
- 0,
82965
- 0,
82966
- 62,
82967
- 0,
82968
- 0,
82969
- 31,
82970
- 0,
82971
- 0,
82972
- 0,
82973
- -31,
82974
- -18,
82975
- 36,
82976
- -64,
82977
- 0,
82978
- 66,
82979
- 51,
82980
- 0,
82981
- 0,
82982
- -102,
82983
- 31,
82984
- 18,
82985
- -36,
82986
- 2,
82987
- 0,
82988
- -66,
82989
- -51,
82990
- 0,
82991
- 0,
82992
- 102,
82993
- 31
82994
- ];
82995
- var stencilsize_ = 12;
82996
- var nterms_ = (3 + 1) * (3 + 2) / 2;
82997
- var PIXEL_SIZE = 2;
82998
- var GeoidHeightModel = class {
82999
- constructor(options) {
83000
- this.options = options;
83001
- this._v00 = 0;
83002
- this._v01 = 0;
83003
- this._v10 = 0;
83004
- this._v11 = 0;
83005
- this._t = [];
83006
- this._ix = this.options._width;
83007
- this._iy = this.options._height;
83008
- }
83009
- getHeight(lat, lon) {
83010
- lat = Math.abs(lat) > 90 ? NaN : lat;
83011
- if (isNaN(lat) || isNaN(lon)) {
83012
- return NaN;
83013
- }
83014
- const rem = _remainder(lon, 360);
83015
- lon = rem !== -180 ? rem : 180;
83016
- let fx = lon * this.options._rlonres;
83017
- let fy = -lat * this.options._rlatres;
83018
- let ix = Math.floor(fx);
83019
- let iy = Math.min(Math.round((this.options._height - 1) / 2 - 1), Math.floor(fy));
83020
- fx -= ix;
83021
- fy -= iy;
83022
- iy += (this.options._height - 1) / 2;
83023
- ix += ix < 0 ? this.options._width : ix >= this.options._width ? -this.options._width : 0;
83024
- let v00 = 0;
83025
- let v01 = 0;
83026
- let v10 = 0;
83027
- let v11 = 0;
83028
- let t = new Array(nterms_);
83029
- if (!(ix === this._ix && iy === this._iy)) {
83030
- if (!this.options.cubic) {
83031
- v00 = this._rawval(ix, iy);
83032
- v01 = this._rawval(ix + 1, iy);
83033
- v10 = this._rawval(ix, iy + 1);
83034
- v11 = this._rawval(ix + 1, iy + 1);
83035
- } else {
83036
- const v = [
83037
- this._rawval(ix, iy - 1),
83038
- this._rawval(ix + 1, iy - 1),
83039
- this._rawval(ix - 1, iy),
83040
- this._rawval(ix, iy),
83041
- this._rawval(ix + 1, iy),
83042
- this._rawval(ix + 2, iy),
83043
- this._rawval(ix - 1, iy + 1),
83044
- this._rawval(ix, iy + 1),
83045
- this._rawval(ix + 1, iy + 1),
83046
- this._rawval(ix + 2, iy + 1),
83047
- this._rawval(ix, iy + 2),
83048
- this._rawval(ix + 1, iy + 2)
83049
- ];
83050
- let c3x = c3n_;
83051
- if (iy !== 0) {
83052
- c3x = iy === this.options._height - 2 ? c3s_ : c3_;
83053
- }
83054
- let c0x = c0n_;
83055
- if (iy !== 0) {
83056
- c0x = iy === this.options._height - 2 ? c0s_ : c0_;
83057
- }
83058
- for (let i = 0; i < nterms_; ++i) {
83059
- t[i] = 0;
83060
- for (let j = 0; j < stencilsize_; ++j) {
83061
- t[i] += v[j] * c3x[nterms_ * j + i];
83062
- }
83063
- t[i] /= c0x;
83064
- }
83065
- }
83066
- } else if (!this.options.cubic) {
83067
- v00 = this._v00;
83068
- v01 = this._v01;
83069
- v10 = this._v10;
83070
- v11 = this._v11;
83071
- } else {
83072
- t = this._t;
83073
- }
83074
- if (!this.options.cubic) {
83075
- const a = (1 - fx) * v00 + fx * v01;
83076
- const b = (1 - fx) * v10 + fx * v11;
83077
- const c = (1 - fy) * a + fy * b;
83078
- const h2 = this.options._offset + this.options._scale * c;
83079
- this._ix = ix;
83080
- this._iy = iy;
83081
- this._v00 = v00;
83082
- this._v01 = v01;
83083
- this._v10 = v10;
83084
- this._v11 = v11;
83085
- return h2;
83086
- }
83087
- let h = t[0] + fx * (t[1] + fx * (t[3] + fx * t[6])) + fy * (t[2] + fx * (t[4] + fx * t[7]) + fy * (t[5] + fx * t[8] + fy * t[9]));
83088
- h = this.options._offset + this.options._scale * h;
83089
- this._ix = ix;
83090
- this._iy = iy;
83091
- this._t = t;
83092
- return h;
83093
- }
83094
- _rawval(ix, iy) {
83095
- if (ix < 0) {
83096
- ix += this.options._width;
83097
- } else if (ix >= this.options._width) {
83098
- ix -= this.options._width;
83099
- }
83100
- if (iy < 0 || iy >= this.options._height) {
83101
- iy = iy < 0 ? -iy : 2 * (this.options._height - 1) - iy;
83102
- ix += (ix < this.options._width / 2 ? 1 : -1) * this.options._width / 2;
83103
- }
83104
- const bufferPosition = this.options._datastart + PIXEL_SIZE * (iy * this.options._swidth + ix);
83105
- const a = this.options.data[bufferPosition];
83106
- const b = this.options.data[bufferPosition + 1];
83107
- const r = a << 8 | b;
83108
- return r;
83109
- }
83110
- };
83111
- function _remainder(x, y) {
83112
- y = Math.abs(y);
83113
- let z = _fmod(x, y);
83114
- if (2 * Math.abs(z) === y)
83115
- z -= _fmod(x, 2 * y) - z;
83116
- else if (2 * Math.abs(z) > y)
83117
- z += z < 0 ? y : -y;
83118
- return z;
83119
- }
83120
- function _fmod(x, y) {
83121
- return x - Math.floor(x / y) * y;
83122
- }
83123
-
83124
- // src/lib/pgm-parser.js
83125
- var ENDL = 10;
83126
- var PIXEL_MAX = 65535;
83127
- function parsePgm(data, options) {
83128
- const getline = _getLineGenerator(data);
83129
- let currentLine = getline.next();
83130
- if (currentLine.done || currentLine.value.line !== "P5") {
83131
- throw new Error("Geoid model file: File not in PGM format");
83132
- }
83133
- let _offset = Number.MAX_VALUE;
83134
- let _scale = 0;
83135
- let _maxerror = -1;
83136
- let _rmserror = -1;
83137
- let _description = "NONE";
83138
- let _datetime = "UNKNOWN";
83139
- let _width = 0;
83140
- let _height = 0;
83141
- let _datastart = null;
83142
- let _swidth = null;
83143
- do {
83144
- currentLine = getline.next();
83145
- const s = currentLine.value.line;
83146
- if (!s.length) {
83147
- continue;
83148
- }
83149
- if (s[0] === "#") {
83150
- const sArr = s.split(" ");
83151
- const commentId = sArr[0];
83152
- const key = sArr[1];
83153
- if (commentId !== "#" || !key) {
83154
- continue;
83155
- }
83156
- const infoArr = sArr.length > 2 ? sArr.slice(2) : [];
83157
- if (key === "Description") {
83158
- _description = infoArr.join(" ");
83159
- } else if (key === "DateTime") {
83160
- _datetime = infoArr.join(" ");
83161
- } else if (key === "Offset") {
83162
- if (!sArr[2]) {
83163
- throw new Error("Geoid model file: Error reading offset");
83164
- }
83165
- _offset = parseInt(sArr[2], 10);
83166
- } else if (key === "Scale") {
83167
- if (!sArr[2]) {
83168
- throw new Error("Geoid model file: Error reading scale");
83169
- }
83170
- _scale = parseFloat(sArr[2]);
83171
- } else if (key === (options.cubic ? "MaxCubicError" : "MaxBilinearError")) {
83172
- if (isFinite(parseFloat(sArr[2]))) {
83173
- _maxerror = parseFloat(sArr[2]);
83174
- }
83175
- } else if (key === (options.cubic ? "RMSCubicError" : "RMSBilinearError")) {
83176
- if (isFinite(parseFloat(sArr[2]))) {
83177
- _rmserror = parseFloat(sArr[2]);
83178
- }
83179
- }
83180
- } else {
83181
- let sArr = s.split(" ");
83182
- sArr = sArr.filter((testString) => testString !== "");
83183
- _width = parseInt(sArr[0], 10);
83184
- _height = parseInt(sArr[1], 10);
83185
- if (!(_width && _height)) {
83186
- throw new Error("Geoid model file: Error reading raster size");
83187
- }
83188
- break;
83189
- }
83190
- } while (!currentLine.done);
83191
- currentLine = getline.next();
83192
- const maxval = parseInt(currentLine.value.line, 10);
83193
- if (currentLine.done) {
83194
- throw new Error("Geoid model file: Error reading maxval");
83195
- }
83196
- if (maxval !== PIXEL_MAX) {
83197
- throw new Error("Geoid model file: Incorrect value of maxval");
83198
- }
83199
- _datastart = currentLine.value.offset;
83200
- _swidth = _width;
83201
- if (_offset === Number.MAX_VALUE) {
83202
- throw new Error("Geoid model file: Offset not set");
83203
- }
83204
- if (_scale === 0) {
83205
- throw new Error("Geoid model file: Scale not set");
83206
- }
83207
- if (_scale < 0) {
83208
- throw new Error("Geoid model file: Scale must be positive");
83209
- }
83210
- if (_height < 2 || _width < 2) {
83211
- throw new Error("Geoid model file: Raster size too small");
83212
- }
83213
- if (_width & 1) {
83214
- throw new Error("Geoid model file: Raster width is odd");
83215
- }
83216
- if (!(_height & 1)) {
83217
- throw new Error("Geoid model file: Raster height is even");
83218
- }
83219
- const _rlonres = _width / 360;
83220
- const _rlatres = (_height - 1) / 180;
83221
- return new GeoidHeightModel({
83222
- cubic: options.cubic,
83223
- _width,
83224
- _height,
83225
- _rlonres,
83226
- _rlatres,
83227
- _offset,
83228
- _scale,
83229
- _swidth,
83230
- _datastart,
83231
- _maxerror,
83232
- _rmserror,
83233
- _description,
83234
- _datetime,
83235
- data
83236
- });
83237
- }
83238
- function* _getLineGenerator(data) {
83239
- let offset = 0;
83240
- do {
83241
- const endLineIndex = data.indexOf(ENDL, offset);
83242
- if (endLineIndex !== -1) {
83243
- const line = data.subarray(offset, endLineIndex);
83244
- offset = endLineIndex + 1;
83245
- yield { offset, line: _getStringFromCharArray(line) };
83246
- } else {
83247
- const line = data.subarray(offset, data.length);
83248
- offset = data.length;
83249
- yield { offset, line: _getStringFromCharArray(line) };
83250
- }
83251
- } while (offset < data.length);
83252
- return { offset, line: "" };
83253
- }
83254
- function _getStringFromCharArray(array) {
83255
- let s = "";
83256
- for (const char of array) {
83257
- s += String.fromCharCode(char);
83258
- }
83259
- return s;
83260
- }
83261
-
83262
83333
  // src/pgm-loader.ts
83334
+ var import_geoid = __toModule(require_es56());
83263
83335
  var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
83264
83336
  var PGMLoader = {
83265
83337
  name: "PGM - Netpbm grayscale image format",
@@ -83267,17 +83339,17 @@ var PGMLoader = {
83267
83339
  module: "tile-converter",
83268
83340
  version: VERSION9,
83269
83341
  mimeTypes: ["image/x-portable-graymap"],
83270
- parse: (arrayBuffer, options) => parsePgm(new Uint8Array(arrayBuffer), options),
83342
+ parse: async (arrayBuffer, options) => (0, import_geoid.parsePGM)(new Uint8Array(arrayBuffer), options),
83271
83343
  extensions: ["pgm"],
83272
83344
  options: {
83273
83345
  cubic: false
83274
83346
  }
83275
83347
  };
83276
83348
 
83277
- // src/i3s-converter/json-templates/layers.js
83349
+ // src/i3s-converter/json-templates/layers.ts
83278
83350
  var import_json_map_transform3 = __toModule(require_json_map_transform());
83279
83351
 
83280
- // src/i3s-converter/json-templates/store.js
83352
+ // src/i3s-converter/json-templates/store.ts
83281
83353
  var STORE = {
83282
83354
  id: {
83283
83355
  path: "id",
@@ -83379,8 +83451,8 @@ var STORE = {
83379
83451
  }
83380
83452
  };
83381
83453
 
83382
- // src/i3s-converter/json-templates/layers.js
83383
- var PLAIN_GEOMETRY_DEFINITION = {
83454
+ // src/i3s-converter/json-templates/layers.ts
83455
+ var PLAIN_GEOMETRY_DEFINITION = () => ({
83384
83456
  offset: 8,
83385
83457
  position: {
83386
83458
  type: "Float32",
@@ -83408,8 +83480,8 @@ var PLAIN_GEOMETRY_DEFINITION = {
83408
83480
  type: "UInt32",
83409
83481
  component: 2
83410
83482
  }
83411
- };
83412
- var PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0 = {
83483
+ });
83484
+ var PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0 = () => ({
83413
83485
  offset: 8,
83414
83486
  position: {
83415
83487
  type: "Float32",
@@ -83433,20 +83505,20 @@ var PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0 = {
83433
83505
  type: "UInt32",
83434
83506
  component: 2
83435
83507
  }
83436
- };
83437
- var COMPRESSED_GEOMETRY_DEFINITION = {
83508
+ });
83509
+ var COMPRESSED_GEOMETRY_DEFINITION = () => ({
83438
83510
  compressedAttributes: {
83439
83511
  encoding: "draco",
83440
83512
  attributes: ["position", "normal", "uv0", "color", "feature-index"]
83441
83513
  }
83442
- };
83443
- var COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0 = {
83514
+ });
83515
+ var COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0 = () => ({
83444
83516
  compressedAttributes: {
83445
83517
  encoding: "draco",
83446
83518
  attributes: ["position", "normal", "color", "feature-index"]
83447
83519
  }
83448
- };
83449
- var SPATIAL_REFERENCE = {
83520
+ });
83521
+ var SPATIAL_REFERENCE = () => ({
83450
83522
  wkid: {
83451
83523
  path: "wkid",
83452
83524
  default: 4326
@@ -83463,8 +83535,8 @@ var SPATIAL_REFERENCE = {
83463
83535
  path: "latestVcsWkid",
83464
83536
  default: 5773
83465
83537
  }
83466
- };
83467
- var HEIGHT_MODEL_INFO = {
83538
+ });
83539
+ var HEIGHT_MODEL_INFO = () => ({
83468
83540
  heightModel: {
83469
83541
  path: "heightModel",
83470
83542
  default: "gravity_related_height"
@@ -83477,8 +83549,8 @@ var HEIGHT_MODEL_INFO = {
83477
83549
  path: "heightUnit",
83478
83550
  default: "meter"
83479
83551
  }
83480
- };
83481
- var NODE_PAGES = {
83552
+ });
83553
+ var NODE_PAGES = () => ({
83482
83554
  nodesPerPage: {
83483
83555
  path: "nodesPerPage"
83484
83556
  },
@@ -83486,8 +83558,8 @@ var NODE_PAGES = {
83486
83558
  path: "lodSelectionMetricType",
83487
83559
  default: "maxScreenThresholdSQ"
83488
83560
  }
83489
- };
83490
- var LAYERS = {
83561
+ });
83562
+ var LAYERS = () => ({
83491
83563
  version: {
83492
83564
  path: "version",
83493
83565
  transform: (val) => val.toUpperCase()
@@ -83509,7 +83581,7 @@ var LAYERS = {
83509
83581
  },
83510
83582
  spatialReference: {
83511
83583
  path: "spatialReference",
83512
- transform: (val) => (0, import_json_map_transform3.default)(val, SPATIAL_REFERENCE)
83584
+ transform: (val) => (0, import_json_map_transform3.default)(val, SPATIAL_REFERENCE())
83513
83585
  },
83514
83586
  capabilities: {
83515
83587
  path: "capabilities",
@@ -83521,11 +83593,11 @@ var LAYERS = {
83521
83593
  },
83522
83594
  heightModelInfo: {
83523
83595
  path: "heightModelInfo",
83524
- transform: (val) => (0, import_json_map_transform3.default)(val, HEIGHT_MODEL_INFO)
83596
+ transform: (val) => (0, import_json_map_transform3.default)(val, HEIGHT_MODEL_INFO())
83525
83597
  },
83526
83598
  nodePages: {
83527
83599
  path: "nodePages",
83528
- transform: (val) => (0, import_json_map_transform3.default)(val, NODE_PAGES)
83600
+ transform: (val) => (0, import_json_map_transform3.default)(val, NODE_PAGES())
83529
83601
  },
83530
83602
  materialDefinitions: {
83531
83603
  path: "materialDefinitions",
@@ -83538,20 +83610,18 @@ var LAYERS = {
83538
83610
  geometryDefinitions: {
83539
83611
  path: "compressGeometry",
83540
83612
  transform: (val) => {
83541
- const result = [{}, {}];
83542
- result[0].geometryBuffers = [];
83543
- result[1].geometryBuffers = [];
83544
- result[0].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION);
83545
- result[1].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0);
83613
+ const result = [{ geometryBuffers: [] }, { geometryBuffers: [] }];
83614
+ result[0].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION());
83615
+ result[1].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0());
83546
83616
  if (val) {
83547
- result[0].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION);
83548
- result[1].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0);
83617
+ result[0].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION());
83618
+ result[1].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0());
83549
83619
  }
83550
83620
  return result;
83551
83621
  },
83552
83622
  default: [
83553
83623
  {
83554
- geometryBuffers: [PLAIN_GEOMETRY_DEFINITION, PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0]
83624
+ geometryBuffers: [PLAIN_GEOMETRY_DEFINITION(), PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0()]
83555
83625
  }
83556
83626
  ]
83557
83627
  },
@@ -83567,31 +83637,31 @@ var LAYERS = {
83567
83637
  path: "popupInfo",
83568
83638
  default: null
83569
83639
  }
83570
- };
83640
+ });
83571
83641
 
83572
- // src/i3s-converter/json-templates/node.js
83642
+ // src/i3s-converter/json-templates/node.ts
83573
83643
  var import_json_map_transform4 = __toModule(require_json_map_transform());
83574
- var COORDINATES = {
83644
+ var COORDINATES = () => ({
83575
83645
  mbs: {
83576
83646
  path: "mbs"
83577
83647
  },
83578
83648
  obb: {
83579
83649
  path: "obb"
83580
83650
  }
83581
- };
83582
- var _href = {
83651
+ });
83652
+ var HREF = () => ({
83583
83653
  href: {
83584
83654
  path: "href"
83585
83655
  }
83586
- };
83587
- var PARENT_NODE = {
83656
+ });
83657
+ var PARENT_NODE = () => ({
83588
83658
  id: {
83589
83659
  path: "id"
83590
83660
  },
83591
- ..._href,
83592
- ...COORDINATES
83593
- };
83594
- var NODE = {
83661
+ ...HREF(),
83662
+ ...COORDINATES()
83663
+ });
83664
+ var NODE = () => ({
83595
83665
  version: {
83596
83666
  path: "version"
83597
83667
  },
@@ -83604,7 +83674,7 @@ var NODE = {
83604
83674
  level: {
83605
83675
  path: "level"
83606
83676
  },
83607
- ...COORDINATES,
83677
+ ...COORDINATES(),
83608
83678
  lodSelection: {
83609
83679
  path: "lodSelection",
83610
83680
  default: [
@@ -83628,7 +83698,7 @@ var NODE = {
83628
83698
  },
83629
83699
  parentNode: {
83630
83700
  path: "parentNode",
83631
- transform: (val) => (0, import_json_map_transform4.default)(val, PARENT_NODE),
83701
+ transform: (val) => (0, import_json_map_transform4.default)(val, PARENT_NODE()),
83632
83702
  default: null
83633
83703
  },
83634
83704
  sharedResource: {
@@ -83651,11 +83721,11 @@ var NODE = {
83651
83721
  path: "attributeData",
83652
83722
  default: null
83653
83723
  }
83654
- };
83724
+ });
83655
83725
 
83656
- // src/i3s-converter/json-templates/shared-resources.js
83726
+ // src/i3s-converter/json-templates/shared-resources.ts
83657
83727
  var import_json_map_transform5 = __toModule(require_json_map_transform());
83658
- var MATERIAL_DEFINITION_INFO_PARAMS = {
83728
+ var MATERIAL_DEFINITION_INFO_PARAMS = () => ({
83659
83729
  renderMode: {
83660
83730
  path: "renderMode",
83661
83731
  default: "solid"
@@ -83692,8 +83762,8 @@ var MATERIAL_DEFINITION_INFO_PARAMS = {
83692
83762
  path: "vertexColors",
83693
83763
  default: true
83694
83764
  }
83695
- };
83696
- var MATERIAL_DEFINITION_INFO = {
83765
+ });
83766
+ var MATERIAL_DEFINITION_INFO = () => ({
83697
83767
  name: {
83698
83768
  path: "name",
83699
83769
  default: "standard"
@@ -83704,10 +83774,10 @@ var MATERIAL_DEFINITION_INFO = {
83704
83774
  },
83705
83775
  params: {
83706
83776
  path: "params",
83707
- transform: (val, thisObject, originalObject) => (0, import_json_map_transform5.default)(originalObject, MATERIAL_DEFINITION_INFO_PARAMS)
83777
+ transform: (val, thisObject, originalObject) => (0, import_json_map_transform5.default)(originalObject, MATERIAL_DEFINITION_INFO_PARAMS())
83708
83778
  }
83709
- };
83710
- var TEXTURE_DEFINITION_IMAGE = {
83779
+ });
83780
+ var TEXTURE_DEFINITION_IMAGE = () => ({
83711
83781
  id: {
83712
83782
  path: "id"
83713
83783
  },
@@ -83721,8 +83791,8 @@ var TEXTURE_DEFINITION_IMAGE = {
83721
83791
  length: {
83722
83792
  path: "length"
83723
83793
  }
83724
- };
83725
- var TEXTURE_DEFINITION_INFO = {
83794
+ });
83795
+ var TEXTURE_DEFINITION_INFO = () => ({
83726
83796
  encoding: {
83727
83797
  path: "encoding"
83728
83798
  },
@@ -83744,10 +83814,10 @@ var TEXTURE_DEFINITION_INFO = {
83744
83814
  },
83745
83815
  images: {
83746
83816
  path: "images",
83747
- transform: (val, thisObject, originalObject) => val.map((image) => (0, import_json_map_transform5.default)(image, TEXTURE_DEFINITION_IMAGE))
83817
+ transform: (val, thisObject, originalObject) => val.map((image) => (0, import_json_map_transform5.default)(image, TEXTURE_DEFINITION_IMAGE()))
83748
83818
  }
83749
- };
83750
- var SHARED_RESOURCES_TEMPLATE = {
83819
+ });
83820
+ var SHARED_RESOURCES = () => ({
83751
83821
  materialDefinitions: {
83752
83822
  path: "materialDefinitionInfos",
83753
83823
  transform: transfromMaterialDefinitions
@@ -83756,11 +83826,11 @@ var SHARED_RESOURCES_TEMPLATE = {
83756
83826
  path: "textureDefinitionInfos",
83757
83827
  transform: transfromTextureDefinitions
83758
83828
  }
83759
- };
83829
+ });
83760
83830
  function transfromMaterialDefinitions(materialDefinitionInfos, thisObject, originalObject) {
83761
83831
  const result = {};
83762
83832
  for (const [index, materialDefinitionInfo] of materialDefinitionInfos.entries()) {
83763
- result[`Mat${originalObject.nodePath}${index}`] = (0, import_json_map_transform5.default)(materialDefinitionInfo, MATERIAL_DEFINITION_INFO);
83833
+ result[`Mat${originalObject.nodePath}${index}`] = (0, import_json_map_transform5.default)(materialDefinitionInfo, MATERIAL_DEFINITION_INFO());
83764
83834
  }
83765
83835
  return result;
83766
83836
  }
@@ -83772,19 +83842,19 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
83772
83842
  for (const [index, textureDefinitionInfo] of textureDefinitionInfos.entries()) {
83773
83843
  const imageIndex = `${originalObject.nodePath}${index}`;
83774
83844
  textureDefinitionInfo.imageIndex = imageIndex;
83775
- result[imageIndex] = (0, import_json_map_transform5.default)(textureDefinitionInfo, TEXTURE_DEFINITION_INFO);
83845
+ result[imageIndex] = (0, import_json_map_transform5.default)(textureDefinitionInfo, TEXTURE_DEFINITION_INFO());
83776
83846
  }
83777
83847
  return result;
83778
83848
  }
83779
83849
 
83780
- // src/i3s-converter/helpers/node-debug.js
83850
+ // src/i3s-converter/helpers/node-debug.ts
83781
83851
  var import_culling5 = __toModule(require_es55());
83782
- var import_engine = __toModule(require_es511());
83783
- var import_core20 = __toModule(require_es53());
83852
+ var import_engine = __toModule(require_es512());
83853
+ var import_core23 = __toModule(require_es53());
83784
83854
  var import_geospatial9 = __toModule(require_es54());
83785
83855
  function validateNodeBoundingVolumes(node3) {
83786
83856
  if (!node3.parentNode.obb || !node3.parentNode.mbs) {
83787
- return null;
83857
+ return [];
83788
83858
  }
83789
83859
  const tileWarnings = [];
83790
83860
  validateObb(tileWarnings, node3);
@@ -83820,12 +83890,12 @@ function createBoundingBoxFromTileObb(obb) {
83820
83890
  function getTileObbVertices(node3) {
83821
83891
  const geometry = new import_engine.CubeGeometry();
83822
83892
  const halfSize = node3.obb.halfSize;
83823
- const { attributes } = geometry;
83893
+ const attributes = geometry.getAttributes();
83824
83894
  const positions = new Float32Array(attributes.POSITION.value);
83825
83895
  const obbCenterCartesian = import_geospatial9.Ellipsoid.WGS84.cartographicToCartesian(node3.obb.center);
83826
83896
  let vertices = [];
83827
83897
  for (let i = 0; i < positions.length; i += 3) {
83828
- const positionsVector = new import_core20.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
83898
+ const positionsVector = new import_core23.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
83829
83899
  const rotatedPositions = positionsVector.transformByQuaternion(node3.obb.quaternion).add(obbCenterCartesian);
83830
83900
  vertices = vertices.concat(rotatedPositions);
83831
83901
  }
@@ -83858,6 +83928,11 @@ var REFRESH_TOKEN_TIMEOUT = 1800;
83858
83928
  var CESIUM_DATASET_PREFIX = "https://";
83859
83929
  var I3SConverter = class {
83860
83930
  constructor() {
83931
+ this.boundingVolumeWarnings = [];
83932
+ this.conversionStartTime = [0, 0];
83933
+ this.refreshTokenTime = [0, 0];
83934
+ this.sourceTileset = null;
83935
+ this.geoidHeightModel = null;
83861
83936
  this.Loader = Tiles3DLoader;
83862
83937
  this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE);
83863
83938
  this.fileMap = {};
@@ -83873,7 +83948,8 @@ var I3SConverter = class {
83873
83948
  tilesWithAddRefineCount: 0
83874
83949
  };
83875
83950
  this.validate = false;
83876
- this.boundingVolumeWarnings = null;
83951
+ this.generateTextures = false;
83952
+ this.generateBoundingVolumes = false;
83877
83953
  }
83878
83954
  async convert(options) {
83879
83955
  this.conversionStartTime = import_process.default.hrtime();
@@ -83887,11 +83963,15 @@ var I3SConverter = class {
83887
83963
  draco,
83888
83964
  sevenZipExe,
83889
83965
  maxDepth,
83890
- token
83966
+ token,
83967
+ generateTextures,
83968
+ generateBoundingVolumes
83891
83969
  } = options;
83892
83970
  this.options = { maxDepth, slpk, sevenZipExe, egmFilePath, draco, token, inputUrl };
83893
- this.validate = validate2;
83971
+ this.validate = Boolean(validate2);
83894
83972
  this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;
83973
+ this.generateTextures = Boolean(generateTextures);
83974
+ this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
83895
83975
  console.log("Loading egm file...");
83896
83976
  this.geoidHeightModel = await load(egmFilePath, PGMLoader);
83897
83977
  console.log("Loading egm file completed!");
@@ -83899,7 +83979,7 @@ var I3SConverter = class {
83899
83979
  this.nodePages.useWriteFunction(writeFileForSlpk);
83900
83980
  }
83901
83981
  const preloadOptions = await this._fetchPreloadOptions();
83902
- const tilesetOptions = { loadOptions: {} };
83982
+ const tilesetOptions = { loadOptions: { basis: { format: "rgba32" } } };
83903
83983
  if (preloadOptions.headers) {
83904
83984
  tilesetOptions.loadOptions.fetch = { headers: preloadOptions.headers };
83905
83985
  }
@@ -83907,7 +83987,7 @@ var I3SConverter = class {
83907
83987
  const sourceTilesetJson = await load(inputUrl, this.Loader, tilesetOptions.loadOptions);
83908
83988
  this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);
83909
83989
  await this._createAndSaveTileset(outputPath, tilesetName);
83910
- await this._finishConversion({ slpk, outputPath, tilesetName });
83990
+ await this._finishConversion({ slpk: Boolean(slpk), outputPath, tilesetName });
83911
83991
  return sourceTilesetJson;
83912
83992
  }
83913
83993
  async _createAndSaveTileset(outputPath, tilesetName) {
@@ -83923,6 +84003,7 @@ var I3SConverter = class {
83923
84003
  const sourceRootTile = this.sourceTileset.root;
83924
84004
  const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);
83925
84005
  const parentId = this.nodePages.push({
84006
+ index: 0,
83926
84007
  lodThreshold: 0,
83927
84008
  obb: boundingVolumes.obb,
83928
84009
  children: []
@@ -83953,7 +84034,7 @@ var I3SConverter = class {
83953
84034
  },
83954
84035
  compressGeometry: this.options.draco
83955
84036
  };
83956
- this.layers0 = (0, import_json_map_transform6.default)(layers0data, LAYERS);
84037
+ this.layers0 = (0, import_json_map_transform6.default)(layers0data, LAYERS());
83957
84038
  }
83958
84039
  _formRootNodeIndexDocument(boundingVolumes) {
83959
84040
  const root0data = {
@@ -83973,11 +84054,12 @@ var I3SConverter = class {
83973
84054
  ...boundingVolumes,
83974
84055
  children: []
83975
84056
  };
83976
- return (0, import_json_map_transform6.default)(root0data, NODE);
84057
+ return (0, import_json_map_transform6.default)(root0data, NODE());
83977
84058
  }
83978
84059
  async _convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes) {
83979
84060
  await this.sourceTileset._loadTile(sourceRootTile);
83980
- if (sourceRootTile.content && sourceRootTile.content.type === "b3dm") {
84061
+ if (this.isContentSupported(sourceRootTile)) {
84062
+ root0.children = root0.children || [];
83981
84063
  root0.children.push({
83982
84064
  id: "1",
83983
84065
  href: "./1",
@@ -84047,13 +84129,14 @@ var I3SConverter = class {
84047
84129
  });
84048
84130
  await sourceTile.unloadContent();
84049
84131
  } else {
84050
- const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
84051
84132
  const children = await this._createNode(parentNode, sourceTile, parentId, level);
84133
+ parentNode.children = parentNode.children || [];
84052
84134
  for (const child of children) {
84053
84135
  parentNode.children.push({
84054
84136
  id: child.id,
84055
84137
  href: `../${child.path}`,
84056
- ...boundingVolumes
84138
+ obb: child.obb,
84139
+ mbs: child.mbs
84057
84140
  });
84058
84141
  childNodes.push(child);
84059
84142
  }
@@ -84068,12 +84151,14 @@ var I3SConverter = class {
84068
84151
  const childPath = (0, import_path7.join)(this.layers0Path, "nodes", node3.path);
84069
84152
  const nodePath = node3.path;
84070
84153
  delete node3.path;
84071
- if (parentNode.children.length < 1e3) {
84072
- for (const neighbor of parentNode.children) {
84154
+ if (Number(parentNode?.children?.length) < 1e3) {
84155
+ for (const neighbor of parentNode.children || []) {
84073
84156
  if (node3.id === neighbor.id) {
84074
84157
  continue;
84075
84158
  }
84076
- node3.neighbors.push({ ...neighbor });
84159
+ if (node3.neighbors) {
84160
+ node3.neighbors.push({ ...neighbor });
84161
+ }
84077
84162
  }
84078
84163
  } else {
84079
84164
  console.warn(`Node ${node3.id}: neighbors attribute is omited because of large number of neigbors`);
@@ -84089,15 +84174,14 @@ var I3SConverter = class {
84089
84174
  }
84090
84175
  await this._updateTilesetOptions();
84091
84176
  await this.sourceTileset._loadTile(sourceTile);
84092
- const boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
84093
- const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
84094
- const maxScreenThresholdSQ = lodSelection.find((val) => val.metricType === "maxScreenThresholdSQ") || { maxError: 0 };
84177
+ let boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
84095
84178
  const batchTable = sourceTile?.content?.batchTableJson;
84096
84179
  if (batchTable) {
84097
84180
  this._convertAttributeStorageInfo(sourceTile.content);
84098
84181
  }
84099
84182
  const resourcesData = await this._convertResources(sourceTile);
84100
84183
  const nodes = [];
84184
+ const nodesInPage = [];
84101
84185
  const emptyResources = {
84102
84186
  geometry: null,
84103
84187
  compressedGeometry: null,
@@ -84106,9 +84190,15 @@ var I3SConverter = class {
84106
84190
  meshMaterial: null,
84107
84191
  vertexCount: null,
84108
84192
  attributes: null,
84109
- featureCount: null
84193
+ featureCount: null,
84194
+ boundingVolumes: null
84110
84195
  };
84111
84196
  for (const resources of resourcesData || [emptyResources]) {
84197
+ if (this.generateBoundingVolumes && resources.boundingVolumes) {
84198
+ boundingVolumes = resources.boundingVolumes;
84199
+ }
84200
+ const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
84201
+ const maxScreenThresholdSQ = lodSelection.find((val) => val.metricType === "maxScreenThresholdSQ") || { maxError: 0 };
84112
84202
  const nodeInPage = this._createNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
84113
84203
  const node3 = this._createNodeIndexDocument(parentTile, boundingVolumes, lodSelection, nodeInPage, resources);
84114
84204
  if (nodeInPage.mesh) {
@@ -84121,44 +84211,50 @@ var I3SConverter = class {
84121
84211
  }
84122
84212
  }
84123
84213
  nodes.push(node3);
84214
+ nodesInPage.push(nodeInPage);
84124
84215
  }
84125
84216
  sourceTile.unloadContent();
84126
- const firstNode = nodes[0];
84127
84217
  await this._addChildrenWithNeighborsAndWriteFile({
84128
- parentNode: firstNode,
84218
+ parentNode: nodes[0],
84129
84219
  sourceTiles: sourceTile.children,
84130
- parentId: firstNode.id,
84220
+ parentId: nodesInPage[0].index,
84131
84221
  level: level + 1
84132
84222
  });
84133
84223
  return nodes;
84134
84224
  }
84135
84225
  _convertAttributeStorageInfo(sourceTileContent) {
84136
84226
  const batchTable = sourceTileContent && sourceTileContent.batchTableJson;
84137
- if (batchTable && !this.layers0.attributeStorageInfo.length) {
84227
+ if (batchTable && !this.layers0?.attributeStorageInfo?.length) {
84138
84228
  this._convertBatchTableInfoToNodeAttributes(batchTable);
84139
84229
  }
84140
84230
  }
84141
84231
  async _convertResources(sourceTile) {
84142
- if (!sourceTile.content || sourceTile.content.type !== "b3dm") {
84232
+ if (!this.isContentSupported(sourceTile)) {
84143
84233
  return null;
84144
84234
  }
84145
- const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, this.layers0.attributeStorageInfo, this.options.draco);
84235
+ const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel);
84146
84236
  return resourcesData;
84147
84237
  }
84148
84238
  _createNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
84149
84239
  const { meshMaterial, texture, vertexCount, featureCount, geometry } = resources;
84150
84240
  const nodeInPage = {
84241
+ index: 0,
84151
84242
  lodThreshold: maxScreenThresholdSQ.maxError,
84152
84243
  obb: boundingVolumes.obb,
84153
- children: [],
84154
- mesh: null
84244
+ children: []
84155
84245
  };
84156
- if (geometry && sourceTile.content && sourceTile.content.type === "b3dm") {
84246
+ if (geometry && this.isContentSupported(sourceTile)) {
84157
84247
  nodeInPage.mesh = {
84158
84248
  geometry: {
84159
- definition: texture ? 0 : 1
84249
+ definition: texture ? 0 : 1,
84250
+ resource: 0
84251
+ },
84252
+ attribute: {
84253
+ resource: 0
84160
84254
  },
84161
- attribute: {}
84255
+ material: {
84256
+ definition: 0
84257
+ }
84162
84258
  };
84163
84259
  }
84164
84260
  const nodeId = this.nodePages.push(nodeInPage, parentId);
@@ -84198,14 +84294,14 @@ var I3SConverter = class {
84198
84294
  children: [],
84199
84295
  neighbors: []
84200
84296
  };
84201
- const node3 = (0, import_json_map_transform6.default)(nodeData, NODE);
84297
+ const node3 = (0, import_json_map_transform6.default)(nodeData, NODE());
84202
84298
  if (nodeInPage.mesh) {
84203
84299
  node3.geometryData = [{ href: "./geometries/0" }];
84204
84300
  node3.sharedResource = { href: "./shared" };
84205
84301
  if (texture) {
84206
84302
  node3.textureData = [{ href: "./textures/0" }, { href: "./textures/1" }];
84207
84303
  }
84208
- if (attributes && attributes.length && this.layers0.attributeStorageInfo && this.layers0.attributeStorageInfo.length) {
84304
+ if (attributes && attributes.length && this.layers0?.attributeStorageInfo?.length) {
84209
84305
  node3.attributeData = [];
84210
84306
  for (let index = 0; index < attributes.length; index++) {
84211
84307
  const folderName = this.layers0.attributeStorageInfo[index].key;
@@ -84250,7 +84346,7 @@ var I3SConverter = class {
84250
84346
  }
84251
84347
  async _writeShared(sharedResources, childPath, slpkChildPath, nodePath) {
84252
84348
  sharedResources.nodePath = nodePath;
84253
- const sharedData = (0, import_json_map_transform6.default)(sharedResources, SHARED_RESOURCES_TEMPLATE);
84349
+ const sharedData = (0, import_json_map_transform6.default)(sharedResources, SHARED_RESOURCES());
84254
84350
  const sharedDataStr = JSON.stringify(sharedData);
84255
84351
  if (this.options.slpk) {
84256
84352
  const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
@@ -84262,38 +84358,47 @@ var I3SConverter = class {
84262
84358
  }
84263
84359
  async _writeTexture(texture, childPath, slpkChildPath) {
84264
84360
  if (texture) {
84265
- const format = this._getFormatByMimeType(texture.mimeType);
84266
- if (!this.layers0.textureSetDefinitions.length) {
84267
- this.layers0.textureSetDefinitions.push({
84268
- formats: [
84269
- {
84270
- name: "0",
84271
- format
84272
- },
84273
- {
84274
- name: "1",
84275
- format: "ktx2"
84276
- }
84277
- ]
84278
- });
84279
- }
84361
+ const format = this._getFormatByMimeType(texture?.mimeType);
84362
+ const formats2 = [];
84280
84363
  const textureData = texture.bufferView.data;
84281
- const ktx2TextureData = await encode(texture.image, KTX2BasisUniversalTextureWriter);
84282
- if (this.options.slpk) {
84283
- const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
84284
- const compress = false;
84285
- this.fileMap[`${slpkChildPath}/textures/0.${format}`] = await writeFileForSlpk(slpkTexturePath, textureData, `0.${format}`, compress);
84286
- this.fileMap[`${slpkChildPath}/textures/1.ktx2`] = await writeFileForSlpk(slpkTexturePath, ktx2TextureData, `1.ktx2`, compress);
84287
- } else {
84288
- const texturePath = (0, import_path7.join)(childPath, "textures/0/");
84289
- await writeFile3(texturePath, textureData, `index.${format}`);
84290
- const ktx2TexturePath = (0, import_path7.join)(childPath, "textures/1/");
84291
- await writeFile3(ktx2TexturePath, ktx2TextureData, `index.ktx2`);
84364
+ switch (format) {
84365
+ case "jpg":
84366
+ case "png": {
84367
+ formats2.push({ name: "0", format });
84368
+ await this.writeTextureFile(textureData, "0", format, childPath, slpkChildPath);
84369
+ if (this.generateTextures) {
84370
+ formats2.push({ name: "1", format: "ktx2" });
84371
+ const ktx2TextureData = new Uint8Array(await encode(texture.image, KTX2BasisUniversalTextureWriter));
84372
+ await this.writeTextureFile(ktx2TextureData, "1", "ktx2", childPath, slpkChildPath);
84373
+ }
84374
+ break;
84375
+ }
84376
+ case "ktx2": {
84377
+ formats2.push({ name: "1", format });
84378
+ await this.writeTextureFile(textureData, "1", format, childPath, slpkChildPath);
84379
+ if (this.generateTextures) {
84380
+ formats2.push({ name: "0", format: "jpg" });
84381
+ const decodedFromKTX2TextureData = new Uint8Array(await encode(texture.image.data[0], ImageWriter));
84382
+ await this.writeTextureFile(decodedFromKTX2TextureData, "0", "jpg", childPath, slpkChildPath);
84383
+ }
84384
+ }
84385
+ }
84386
+ if (!this.layers0.textureSetDefinitions.length) {
84387
+ this.layers0.textureSetDefinitions.push({ formats: formats2 });
84292
84388
  }
84293
84389
  }
84294
84390
  }
84391
+ async writeTextureFile(textureData, name8, format, childPath, slpkChildPath) {
84392
+ const texturePath = (0, import_path7.join)(childPath, `textures/${name8}/`);
84393
+ await writeFile3(texturePath, textureData, `index.${format}`);
84394
+ if (this.options.slpk) {
84395
+ const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
84396
+ const compress = false;
84397
+ this.fileMap[`${slpkChildPath}/textures/${name8}.${format}`] = await writeFileForSlpk(slpkTexturePath, textureData, `${name8}.${format}`, compress);
84398
+ }
84399
+ }
84295
84400
  async _writeAttributes(attributes, childPath, slpkChildPath) {
84296
- if (attributes.length && this.layers0.attributeStorageInfo && this.layers0.attributeStorageInfo.length) {
84401
+ if (attributes.length && this.layers0?.attributeStorageInfo?.length) {
84297
84402
  for (let index = 0; index < attributes.length; index++) {
84298
84403
  const folderName = this.layers0.attributeStorageInfo[index].key;
84299
84404
  const fileBuffer = new Uint8Array(attributes[index]);
@@ -84313,6 +84418,8 @@ var I3SConverter = class {
84313
84418
  return "jpg";
84314
84419
  case "image/png":
84315
84420
  return "png";
84421
+ case "image/ktx2":
84422
+ return "ktx2";
84316
84423
  default:
84317
84424
  return "jpg";
84318
84425
  }
@@ -84503,6 +84610,9 @@ var I3SConverter = class {
84503
84610
  }
84504
84611
  this.refinementCounter.tilesCount += 1;
84505
84612
  }
84613
+ isContentSupported(sourceRootTile) {
84614
+ return ["b3dm", "glTF"].includes(sourceRootTile?.content?.type);
84615
+ }
84506
84616
  };
84507
84617
 
84508
84618
  // src/3d-tiles-converter/3d-tiles-converter.ts
@@ -84511,15 +84621,34 @@ var import_process2 = __toModule(require("process"));
84511
84621
  var import_json_map_transform8 = __toModule(require_json_map_transform());
84512
84622
 
84513
84623
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
84514
- var import_core23 = __toModule(require_es53());
84624
+ var import_core26 = __toModule(require_es53());
84515
84625
  var import_geospatial10 = __toModule(require_es54());
84516
84626
 
84627
+ // ../i3s/src/types.ts
84628
+ var DATA_TYPE;
84629
+ (function(DATA_TYPE2) {
84630
+ DATA_TYPE2["UInt8"] = "UInt8";
84631
+ DATA_TYPE2["UInt16"] = "UInt16";
84632
+ DATA_TYPE2["UInt32"] = "UInt32";
84633
+ DATA_TYPE2["UInt64"] = "UInt64";
84634
+ DATA_TYPE2["Int16"] = "Int16";
84635
+ DATA_TYPE2["Int32"] = "Int32";
84636
+ DATA_TYPE2["Int64"] = "Int64";
84637
+ DATA_TYPE2["Float32"] = "Float32";
84638
+ DATA_TYPE2["Float64"] = "Float64";
84639
+ })(DATA_TYPE || (DATA_TYPE = {}));
84640
+ var HeaderAttributeProperty;
84641
+ (function(HeaderAttributeProperty2) {
84642
+ HeaderAttributeProperty2["vertexCount"] = "vertexCount";
84643
+ HeaderAttributeProperty2["featureCount"] = "featureCount";
84644
+ })(HeaderAttributeProperty || (HeaderAttributeProperty = {}));
84645
+
84517
84646
  // ../i3s/src/lib/utils/url-utils.ts
84518
84647
  function getUrlWithToken(url, token = null) {
84519
84648
  return token ? `${url}?token=${token}` : url;
84520
84649
  }
84521
- function generateTileAttributeUrls(tile) {
84522
- const { url, attributeData } = tile;
84650
+ function generateTileAttributeUrls(url, tile) {
84651
+ const { attributeData = [] } = tile;
84523
84652
  const attributeUrls = [];
84524
84653
  for (let index = 0; index < attributeData.length; index++) {
84525
84654
  const attributeUrl = attributeData[index].href.replace("./", "");
@@ -84538,23 +84667,7 @@ function generateTilesetAttributeUrls(tileset, resource) {
84538
84667
  }
84539
84668
 
84540
84669
  // ../i3s/src/lib/parsers/constants.ts
84541
- var import_constants14 = __toModule(require_es512());
84542
-
84543
- // ../i3s/src/types.ts
84544
- var DATA_TYPE;
84545
- (function(DATA_TYPE2) {
84546
- DATA_TYPE2["UInt8"] = "UInt8";
84547
- DATA_TYPE2["UInt16"] = "UInt16";
84548
- DATA_TYPE2["UInt32"] = "UInt32";
84549
- DATA_TYPE2["UInt64"] = "UInt64";
84550
- DATA_TYPE2["Int16"] = "Int16";
84551
- DATA_TYPE2["Int32"] = "Int32";
84552
- DATA_TYPE2["Int64"] = "Int64";
84553
- DATA_TYPE2["Float32"] = "Float32";
84554
- DATA_TYPE2["Float64"] = "Float64";
84555
- })(DATA_TYPE || (DATA_TYPE = {}));
84556
-
84557
- // ../i3s/src/lib/parsers/constants.ts
84670
+ var import_constants14 = __toModule(require_es513());
84558
84671
  function getConstructorForDataFormat(dataType) {
84559
84672
  switch (dataType) {
84560
84673
  case DATA_TYPE.UInt8:
@@ -84568,7 +84681,7 @@ function getConstructorForDataFormat(dataType) {
84568
84681
  case DATA_TYPE.UInt64:
84569
84682
  return Float64Array;
84570
84683
  default:
84571
- return null;
84684
+ throw new Error(`parse i3s tile content: unknown type of data: ${dataType}`);
84572
84685
  }
84573
84686
  }
84574
84687
  var GL_TYPE_MAP = {
@@ -84578,22 +84691,6 @@ var GL_TYPE_MAP = {
84578
84691
  UInt32: import_constants14.default.UNSIGNED_INT,
84579
84692
  UInt64: import_constants14.default.DOUBLE
84580
84693
  };
84581
- var I3S_NAMED_VERTEX_ATTRIBUTES = {
84582
- position: "position",
84583
- normal: "normal",
84584
- uv0: "uv0",
84585
- color: "color",
84586
- region: "region"
84587
- };
84588
- var I3S_NAMED_GEOMETRY_ATTRIBUTES = {
84589
- vertexAttributes: "vertexAttributes",
84590
- featureAttributeOrder: "featureAttributeOrder",
84591
- featureAttributes: "featureAttributes"
84592
- };
84593
- var I3S_NAMED_HEADER_ATTRIBUTES = {
84594
- vertexCount: "vertexCount",
84595
- featureCount: "featureCount"
84596
- };
84597
84694
  function sizeOf(dataType) {
84598
84695
  switch (dataType) {
84599
84696
  case DATA_TYPE.UInt8:
@@ -84610,7 +84707,7 @@ function sizeOf(dataType) {
84610
84707
  case DATA_TYPE.Float64:
84611
84708
  return 8;
84612
84709
  default:
84613
- return NaN;
84710
+ throw new Error(`parse i3s tile content: unknown size of data: ${dataType}`);
84614
84711
  }
84615
84712
  }
84616
84713
  var STRING_ATTRIBUTE_TYPE = "String";
@@ -84627,30 +84724,28 @@ var COORDINATE_SYSTEM;
84627
84724
  })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
84628
84725
 
84629
84726
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
84630
- var scratchVector4 = new import_core23.Vector3([0, 0, 0]);
84727
+ var scratchVector5 = new import_core26.Vector3([0, 0, 0]);
84631
84728
  function getLoaderForTextureFormat(textureFormat) {
84632
84729
  switch (textureFormat) {
84633
- case "jpeg":
84634
- case "png":
84635
- return ImageLoader;
84636
84730
  case "ktx-etc2":
84637
84731
  case "dds":
84638
84732
  return CompressedTextureLoader;
84639
84733
  case "ktx2":
84640
84734
  return BasisLoader;
84735
+ case "jpg":
84736
+ case "png":
84641
84737
  default:
84642
- return null;
84738
+ return ImageLoader;
84643
84739
  }
84644
84740
  }
84645
84741
  var I3S_ATTRIBUTE_TYPE = "i3s-attribute-type";
84646
84742
  async function parseI3STileContent(arrayBuffer, tile, tileset, options, context) {
84647
84743
  tile.content = tile.content || {};
84648
84744
  tile.content.featureIds = tile.content.featureIds || null;
84649
- tile.content.featureData = constructFeatureDataStruct(tileset);
84650
84745
  tile.content.attributes = {};
84651
84746
  if (tile.textureUrl) {
84652
84747
  const url = getUrlWithToken(tile.textureUrl, options?.i3s?.token);
84653
- const loader = getLoaderForTextureFormat(tile.textureFormat) || ImageLoader;
84748
+ const loader = getLoaderForTextureFormat(tile.textureFormat);
84654
84749
  const response = await fetch(url);
84655
84750
  const arrayBuffer2 = await response.arrayBuffer();
84656
84751
  if (options?.i3s.decodeTextures) {
@@ -84679,9 +84774,9 @@ async function parseI3STileContent(arrayBuffer, tile, tileset, options, context)
84679
84774
  if (tile.content.material) {
84680
84775
  tile.content.texture = null;
84681
84776
  }
84682
- return await parseI3SNodeGeometry(arrayBuffer, tile, options);
84777
+ return await parseI3SNodeGeometry(arrayBuffer, tile, tileset, options);
84683
84778
  }
84684
- async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84779
+ async function parseI3SNodeGeometry(arrayBuffer, tile, tileset, options) {
84685
84780
  if (!tile.content) {
84686
84781
  return tile;
84687
84782
  }
@@ -84690,6 +84785,7 @@ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84690
84785
  let vertexCount;
84691
84786
  let byteOffset = 0;
84692
84787
  let featureCount = 0;
84788
+ let indices;
84693
84789
  if (tile.isDracoGeometry) {
84694
84790
  const decompressedGeometry = await parse(arrayBuffer, DracoLoader2, {
84695
84791
  draco: {
@@ -84697,7 +84793,7 @@ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84697
84793
  }
84698
84794
  });
84699
84795
  vertexCount = decompressedGeometry.header.vertexCount;
84700
- const indices = decompressedGeometry.indices.value;
84796
+ indices = decompressedGeometry.indices?.value;
84701
84797
  const {
84702
84798
  POSITION,
84703
84799
  NORMAL,
@@ -84712,8 +84808,7 @@ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84712
84808
  color: COLOR_0,
84713
84809
  uv0: TEXCOORD_0,
84714
84810
  uvRegion,
84715
- id: featureIndex,
84716
- indices
84811
+ id: featureIndex
84717
84812
  };
84718
84813
  updateAttributesMetadata(attributes, decompressedGeometry);
84719
84814
  const featureIds = getFeatureIdsFromFeatureIndexMetadata(featureIndex);
@@ -84721,8 +84816,13 @@ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84721
84816
  flattenFeatureIdsByFeatureIndices(attributes, featureIds);
84722
84817
  }
84723
84818
  } else {
84724
- const { vertexAttributes, attributesOrder, featureAttributes, featureAttributeOrder } = content.featureData;
84725
- const headers = parseHeaders(content, arrayBuffer);
84819
+ const {
84820
+ vertexAttributes,
84821
+ ordering: attributesOrder,
84822
+ featureAttributes,
84823
+ featureAttributeOrder
84824
+ } = tileset.store.defaultGeometrySchema;
84825
+ const headers = parseHeaders(tileset, arrayBuffer);
84726
84826
  byteOffset = headers.byteOffset;
84727
84827
  vertexCount = headers.vertexCount;
84728
84828
  featureCount = headers.featureCount;
@@ -84746,7 +84846,7 @@ async function parseI3SNodeGeometry(arrayBuffer, tile, options) {
84746
84846
  texCoords: attributes.uv0,
84747
84847
  uvRegions: normalizeAttribute(attributes.uvRegion)
84748
84848
  };
84749
- content.indices = attributes.indices || null;
84849
+ content.indices = indices || null;
84750
84850
  if (attributes.id && attributes.id.value) {
84751
84851
  tile.content.featureIds = attributes.id.value;
84752
84852
  }
@@ -84784,41 +84884,25 @@ function normalizeAttribute(attribute) {
84784
84884
  attribute.normalized = true;
84785
84885
  return attribute;
84786
84886
  }
84787
- function constructFeatureDataStruct(tileset) {
84788
- const defaultGeometrySchema = tileset.store.defaultGeometrySchema;
84789
- const featureData = defaultGeometrySchema;
84790
- for (const geometryAttribute in I3S_NAMED_GEOMETRY_ATTRIBUTES) {
84791
- for (const namedAttribute in I3S_NAMED_VERTEX_ATTRIBUTES) {
84792
- const attribute = defaultGeometrySchema[geometryAttribute][namedAttribute];
84793
- if (attribute) {
84794
- const { byteOffset = 0, count = 0, valueType, valuesPerElement } = attribute;
84795
- featureData[geometryAttribute][namedAttribute] = {
84796
- valueType,
84797
- valuesPerElement,
84798
- byteOffset,
84799
- count
84800
- };
84801
- }
84802
- }
84803
- }
84804
- featureData.attributesOrder = defaultGeometrySchema.ordering;
84805
- return featureData;
84806
- }
84807
- function parseHeaders(content, arrayBuffer) {
84887
+ function parseHeaders(tileset, arrayBuffer) {
84808
84888
  let byteOffset = 0;
84809
84889
  let vertexCount = 0;
84810
84890
  let featureCount = 0;
84811
- content.featureData.header.forEach(({ property, type }) => {
84891
+ for (const { property, type } of tileset.store.defaultGeometrySchema.header) {
84812
84892
  const TypedArrayTypeHeader = getConstructorForDataFormat(type);
84813
- if (property === I3S_NAMED_HEADER_ATTRIBUTES.vertexCount) {
84814
- vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
84815
- byteOffset += sizeOf(type);
84816
- }
84817
- if (property === I3S_NAMED_HEADER_ATTRIBUTES.featureCount) {
84818
- featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
84819
- byteOffset += sizeOf(type);
84893
+ switch (property) {
84894
+ case HeaderAttributeProperty.vertexCount:
84895
+ vertexCount = new TypedArrayTypeHeader(arrayBuffer, 0, 4)[0];
84896
+ byteOffset += sizeOf(type);
84897
+ break;
84898
+ case HeaderAttributeProperty.featureCount:
84899
+ featureCount = new TypedArrayTypeHeader(arrayBuffer, 4, 4)[0];
84900
+ byteOffset += sizeOf(type);
84901
+ break;
84902
+ default:
84903
+ break;
84820
84904
  }
84821
- });
84905
+ }
84822
84906
  return {
84823
84907
  vertexCount,
84824
84908
  featureCount,
@@ -84835,7 +84919,7 @@ function normalizeAttributes(arrayBuffer, byteOffset, vertexAttributes, vertexCo
84835
84919
  break;
84836
84920
  }
84837
84921
  const buffer = arrayBuffer.slice(byteOffset);
84838
- let value = [];
84922
+ let value;
84839
84923
  if (valueType === "UInt64") {
84840
84924
  value = parseUint64Values(buffer, count * valuesPerElement, sizeOf(valueType));
84841
84925
  } else {
@@ -84872,15 +84956,15 @@ function parseUint64Values(buffer, elementsCount, attributeSize) {
84872
84956
  values.push(value);
84873
84957
  offset += attributeSize;
84874
84958
  }
84875
- return values;
84959
+ return new Uint32Array(values);
84876
84960
  }
84877
84961
  function parsePositions2(attribute, tile) {
84878
84962
  const mbs = tile.mbs;
84879
84963
  const value = attribute.value;
84880
84964
  const metadata = attribute.metadata;
84881
- const enuMatrix = new import_core23.Matrix4();
84882
- const cartographicOrigin = new import_core23.Vector3(mbs[0], mbs[1], mbs[2]);
84883
- const cartesianOrigin = new import_core23.Vector3();
84965
+ const enuMatrix = new import_core26.Matrix4();
84966
+ const cartographicOrigin = new import_core26.Vector3(mbs[0], mbs[1], mbs[2]);
84967
+ const cartesianOrigin = new import_core26.Vector3();
84884
84968
  import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
84885
84969
  import_geospatial10.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
84886
84970
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
@@ -84896,10 +84980,10 @@ function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
84896
84980
  positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;
84897
84981
  }
84898
84982
  for (let i = 0; i < positions.length; i += 3) {
84899
- import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector4);
84900
- positions[i] = scratchVector4.x;
84901
- positions[i + 1] = scratchVector4.y;
84902
- positions[i + 2] = scratchVector4.z;
84983
+ import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector5);
84984
+ positions[i] = scratchVector5.x;
84985
+ positions[i + 1] = scratchVector5.y;
84986
+ positions[i + 2] = scratchVector5.z;
84903
84987
  }
84904
84988
  return positions;
84905
84989
  }
@@ -84907,7 +84991,7 @@ function getModelMatrix(positions) {
84907
84991
  const metadata = positions.metadata;
84908
84992
  const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
84909
84993
  const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
84910
- const modelMatrix = new import_core23.Matrix4();
84994
+ const modelMatrix = new import_core26.Matrix4();
84911
84995
  modelMatrix[0] = scaleX;
84912
84996
  modelMatrix[5] = scaleY;
84913
84997
  return modelMatrix;
@@ -84939,7 +85023,9 @@ function makePbrMaterial(materialDefinition, texture) {
84939
85023
  if (pbrMaterial.pbrMetallicRoughness && pbrMaterial.pbrMetallicRoughness.baseColorFactor) {
84940
85024
  pbrMaterial.pbrMetallicRoughness.baseColorFactor = convertColorFormat(pbrMaterial.pbrMetallicRoughness.baseColorFactor);
84941
85025
  }
84942
- setMaterialTexture(pbrMaterial, texture);
85026
+ if (texture) {
85027
+ setMaterialTexture(pbrMaterial, texture);
85028
+ }
84943
85029
  return pbrMaterial;
84944
85030
  }
84945
85031
  function convertColorFormat(colorFactor) {
@@ -85001,7 +85087,7 @@ function flattenFeatureIdsByFeatureIndices(attributes, featureIds) {
85001
85087
  attributes.id.value = result;
85002
85088
  }
85003
85089
  function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
85004
- return featureIndex && featureIndex.metadata && featureIndex.metadata["i3s-feature-ids"] && featureIndex.metadata["i3s-feature-ids"].intArray;
85090
+ return featureIndex?.metadata?.["i3s-feature-ids"]?.intArray;
85005
85091
  }
85006
85092
 
85007
85093
  // ../i3s/src/i3s-content-loader.ts
@@ -85057,8 +85143,8 @@ var I3SNodePagesTiles = class {
85057
85143
  this.textureDefinitionsSelectedFormats = [];
85058
85144
  this.textureLoaderOptions = {};
85059
85145
  this.tileset = { ...tileset };
85060
- this.nodesPerPage = tileset.nodePages.nodesPerPage;
85061
- this.lodSelectionMetricType = tileset.nodePages.lodSelectionMetricType;
85146
+ this.nodesPerPage = tileset.nodePages?.nodesPerPage || 64;
85147
+ this.lodSelectionMetricType = tileset.nodePages?.lodSelectionMetricType;
85062
85148
  this.options = options;
85063
85149
  this.initSelectedFormatsForTextureDefinitions(tileset);
85064
85150
  }
@@ -85085,21 +85171,21 @@ var I3SNodePagesTiles = class {
85085
85171
  for (const child of node3.children || []) {
85086
85172
  const childNode = await this.getNodeById(child);
85087
85173
  children.push({
85088
- id: child,
85174
+ id: child.toString(),
85089
85175
  obb: childNode.obb
85090
85176
  });
85091
85177
  }
85092
- let contentUrl = null;
85093
- let textureUrl = null;
85094
- let materialDefinition = null;
85095
- let textureFormat = "jpeg";
85178
+ let contentUrl;
85179
+ let textureUrl;
85180
+ let materialDefinition;
85181
+ let textureFormat = "jpg";
85096
85182
  let attributeUrls = [];
85097
85183
  let isDracoGeometry = false;
85098
85184
  if (node3 && node3.mesh) {
85099
- const { url, isDracoGeometry: isDracoGeometryResult } = node3.mesh.geometry && this.getContentUrl(node3.mesh.geometry) || { url: null, isDracoGeometry: null };
85185
+ const { url, isDracoGeometry: isDracoGeometryResult } = node3.mesh.geometry && this.getContentUrl(node3.mesh.geometry) || { isDracoGeometry: false };
85100
85186
  contentUrl = url;
85101
85187
  isDracoGeometry = isDracoGeometryResult;
85102
- const [textureData, nodeMaterialDefinition] = this.getInformationFromMaterial(node3.mesh.material);
85188
+ const { textureData, materialDefinition: nodeMaterialDefinition } = this.getInformationFromMaterial(node3.mesh.material);
85103
85189
  materialDefinition = nodeMaterialDefinition;
85104
85190
  textureFormat = textureData.format || textureFormat;
85105
85191
  if (textureData.name) {
@@ -85111,7 +85197,7 @@ var I3SNodePagesTiles = class {
85111
85197
  }
85112
85198
  const lodSelection = this.getLodSelection(node3);
85113
85199
  return normalizeTileNonUrlData({
85114
- id,
85200
+ id: id.toString(),
85115
85201
  lodSelection,
85116
85202
  obb: node3.obb,
85117
85203
  contentUrl,
@@ -85125,7 +85211,7 @@ var I3SNodePagesTiles = class {
85125
85211
  });
85126
85212
  }
85127
85213
  getContentUrl(meshGeometryData) {
85128
- let result = {};
85214
+ let result = null;
85129
85215
  const geometryDefinition = this.tileset.geometryDefinitions[meshGeometryData.definition];
85130
85216
  let geometryIndex = -1;
85131
85217
  if (this.options.i3s && this.options.i3s.useDracoGeometry) {
@@ -85158,17 +85244,18 @@ var I3SNodePagesTiles = class {
85158
85244
  return lodSelection;
85159
85245
  }
85160
85246
  getInformationFromMaterial(material) {
85161
- const textureDataDefault = { name: null, format: null };
85247
+ const informationFromMaterial = { textureData: { name: null } };
85162
85248
  if (material) {
85163
- const materialDefinition = this.tileset.materialDefinitions[material.definition];
85164
- const textureSetDefinitionIndex = materialDefinition && materialDefinition.pbrMetallicRoughness && materialDefinition.pbrMetallicRoughness.baseColorTexture && materialDefinition.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId;
85165
- if (textureSetDefinitionIndex || textureSetDefinitionIndex === 0) {
85166
- const textureData = this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] || textureDataDefault;
85167
- return [textureData, materialDefinition];
85249
+ const materialDefinition = this.tileset.materialDefinitions?.[material.definition];
85250
+ if (materialDefinition) {
85251
+ informationFromMaterial.materialDefinition = materialDefinition;
85252
+ const textureSetDefinitionIndex = materialDefinition?.pbrMetallicRoughness?.baseColorTexture?.textureSetDefinitionId;
85253
+ if (typeof textureSetDefinitionIndex === "number") {
85254
+ informationFromMaterial.textureData = this.textureDefinitionsSelectedFormats[textureSetDefinitionIndex] || informationFromMaterial.textureData;
85255
+ }
85168
85256
  }
85169
- return [textureDataDefault, materialDefinition];
85170
85257
  }
85171
- return [textureDataDefault, null];
85258
+ return informationFromMaterial;
85172
85259
  }
85173
85260
  initSelectedFormatsForTextureDefinitions(tileset) {
85174
85261
  this.textureDefinitionsSelectedFormats = [];
@@ -85214,49 +85301,54 @@ var I3SNodePagesTiles = class {
85214
85301
 
85215
85302
  // ../i3s/src/lib/parsers/parse-i3s.ts
85216
85303
  function normalizeTileData2(tile, options, context) {
85217
- tile.url = context.url;
85218
- if (tile.featureData) {
85219
- tile.featureUrl = `${tile.url}/${tile.featureData[0].href}`;
85220
- }
85304
+ const url = context.url || "";
85305
+ let contentUrl;
85221
85306
  if (tile.geometryData) {
85222
- tile.contentUrl = `${tile.url}/${tile.geometryData[0].href}`;
85307
+ contentUrl = `${url}/${tile.geometryData[0].href}`;
85223
85308
  }
85309
+ let textureUrl;
85224
85310
  if (tile.textureData) {
85225
- tile.textureUrl = `${tile.url}/${tile.textureData[0].href}`;
85311
+ textureUrl = `${url}/${tile.textureData[0].href}`;
85226
85312
  }
85313
+ let attributeUrls;
85227
85314
  if (tile.attributeData) {
85228
- tile.attributeUrls = generateTileAttributeUrls(tile);
85229
- }
85230
- return normalizeTileNonUrlData(tile);
85315
+ attributeUrls = generateTileAttributeUrls(url, tile);
85316
+ }
85317
+ return normalizeTileNonUrlData({
85318
+ ...tile,
85319
+ url,
85320
+ contentUrl,
85321
+ textureUrl,
85322
+ attributeUrls,
85323
+ isDracoGeometry: false
85324
+ });
85231
85325
  }
85232
85326
  function normalizeTileNonUrlData(tile) {
85233
- const box = tile.obb ? [
85234
- ...import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
85235
- ...tile.obb.halfSize,
85236
- ...tile.obb.quaternion
85237
- ] : void 0;
85238
- let sphere;
85327
+ const boundingVolume = {};
85328
+ let mbs = [0, 0, 0, 1];
85239
85329
  if (tile.mbs) {
85240
- sphere = [
85330
+ mbs = tile.mbs;
85331
+ boundingVolume.sphere = [
85241
85332
  ...import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
85242
85333
  tile.mbs[3]
85243
85334
  ];
85244
- } else if (box) {
85245
- const obb = new import_culling6.OrientedBoundingBox().fromCenterHalfSizeQuaternion(box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
85335
+ } else if (tile.obb) {
85336
+ boundingVolume.box = [
85337
+ ...import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
85338
+ ...tile.obb.halfSize,
85339
+ ...tile.obb.quaternion
85340
+ ];
85341
+ const obb = new import_culling6.OrientedBoundingBox().fromCenterHalfSizeQuaternion(boundingVolume.box.slice(0, 3), tile.obb.halfSize, tile.obb.quaternion);
85246
85342
  const boundingSphere = obb.getBoundingSphere();
85247
- sphere = [...boundingSphere.center, boundingSphere.radius];
85248
- tile.mbs = [...tile.obb.center, boundingSphere.radius];
85249
- }
85250
- tile.boundingVolume = {
85251
- sphere,
85252
- box
85253
- };
85254
- tile.lodMetricType = tile.lodSelection[0].metricType;
85255
- tile.lodMetricValue = tile.lodSelection[0].maxError;
85256
- tile.transformMatrix = tile.transform;
85257
- tile.type = TILE_TYPE.MESH;
85258
- tile.refine = TILE_REFINEMENT.REPLACE;
85259
- return tile;
85343
+ boundingVolume.sphere = [...boundingSphere.center, boundingSphere.radius];
85344
+ mbs = [...tile.obb.center, boundingSphere.radius];
85345
+ }
85346
+ const lodMetricType = tile.lodSelection?.[0].metricType;
85347
+ const lodMetricValue = tile.lodSelection?.[0].maxError;
85348
+ const transformMatrix = tile.transform;
85349
+ const type = TILE_TYPE.MESH;
85350
+ const refine = TILE_REFINEMENT.REPLACE;
85351
+ return { ...tile, mbs, boundingVolume, lodMetricType, lodMetricValue, transformMatrix, type, refine };
85260
85352
  }
85261
85353
  async function normalizeTilesetData(tileset, options, context) {
85262
85354
  tileset.url = context.url;
@@ -85430,8 +85522,8 @@ async function parse8(data, options) {
85430
85522
  return data;
85431
85523
  }
85432
85524
 
85433
- // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js
85434
- var import_core27 = __toModule(require_es53());
85525
+ // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
85526
+ var import_core30 = __toModule(require_es53());
85435
85527
  var import_geospatial12 = __toModule(require_es54());
85436
85528
  var import_culling7 = __toModule(require_es55());
85437
85529
  function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
@@ -85440,20 +85532,20 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
85440
85532
  i3SObb.center[1],
85441
85533
  i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
85442
85534
  ];
85443
- const cartesianCenter = import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core27.Vector3());
85535
+ const cartesianCenter = import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core30.Vector3());
85444
85536
  const tiles3DObb = new import_culling7.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
85445
85537
  return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
85446
85538
  }
85447
85539
 
85448
- // src/3d-tiles-converter/json-templates/tileset.js
85540
+ // src/3d-tiles-converter/json-templates/tileset.ts
85449
85541
  var import_json_map_transform7 = __toModule(require_json_map_transform());
85450
- var ASSET = {
85542
+ var ASSET = () => ({
85451
85543
  version: {
85452
85544
  path: "version",
85453
85545
  default: "1.0"
85454
85546
  }
85455
- };
85456
- var TILE = {
85547
+ });
85548
+ var TILE = () => ({
85457
85549
  boundingVolume: {
85458
85550
  path: "boundingVolume"
85459
85551
  },
@@ -85465,13 +85557,13 @@ var TILE = {
85465
85557
  },
85466
85558
  children: {
85467
85559
  path: "children",
85468
- transform: (val) => val.map((tile) => (0, import_json_map_transform7.default)(tile, TILE))
85560
+ transform: (val) => val.map((tile) => (0, import_json_map_transform7.default)(tile, TILE()))
85469
85561
  }
85470
- };
85471
- var TILESET = {
85562
+ });
85563
+ var TILESET = () => ({
85472
85564
  asset: {
85473
85565
  path: "asset",
85474
- transform: (val) => (0, import_json_map_transform7.default)(val, ASSET)
85566
+ transform: (val) => (0, import_json_map_transform7.default)(val, ASSET())
85475
85567
  },
85476
85568
  geometricError: {
85477
85569
  path: "root",
@@ -85479,12 +85571,12 @@ var TILESET = {
85479
85571
  },
85480
85572
  root: {
85481
85573
  path: "root",
85482
- transform: (val) => (0, import_json_map_transform7.default)(val, TILE)
85574
+ transform: (val) => (0, import_json_map_transform7.default)(val, TILE())
85483
85575
  }
85484
- };
85576
+ });
85485
85577
 
85486
- // src/3d-tiles-converter/helpers/b3dm-converter.js
85487
- var import_core29 = __toModule(require_es53());
85578
+ // src/3d-tiles-converter/helpers/b3dm-converter.ts
85579
+ var import_core32 = __toModule(require_es53());
85488
85580
  var import_geospatial13 = __toModule(require_es54());
85489
85581
 
85490
85582
  // src/3d-tiles-converter/helpers/texture-atlas.ts
@@ -85494,7 +85586,7 @@ function convertTextureAtlas(texCoords, uvRegions) {
85494
85586
  for (let index = 0; index < texCoords.length; index += 2) {
85495
85587
  const uv = texCoords.subarray(index, index + 2);
85496
85588
  const regions = normalisedRegions.slice(index * 2, index * 2 + 4);
85497
- const fractatedUV = fract(uv);
85589
+ const fractatedUV = fract([uv[0], uv[1]]);
85498
85590
  const subtracted = [regions[2] - regions[0], regions[3] - regions[1]];
85499
85591
  const multiplicationResult = [fractatedUV[0] * subtracted[0], fractatedUV[1] * subtracted[1]];
85500
85592
  const convertedUV = [
@@ -85518,9 +85610,9 @@ function normalizeRegions(regions) {
85518
85610
  return normalizedRegions;
85519
85611
  }
85520
85612
 
85521
- // src/3d-tiles-converter/helpers/b3dm-converter.js
85522
- var Z_UP_TO_Y_UP_MATRIX = new import_core29.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
85523
- var scratchVector5 = new import_core29.Vector3();
85613
+ // src/3d-tiles-converter/helpers/b3dm-converter.ts
85614
+ var Z_UP_TO_Y_UP_MATRIX = new import_core32.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
85615
+ var scratchVector6 = new import_core32.Vector3();
85524
85616
  var B3dmConverter = class {
85525
85617
  async convert(i3sTile, attributes = null) {
85526
85618
  this.i3sTile = i3sTile;
@@ -85592,16 +85684,16 @@ var B3dmConverter = class {
85592
85684
  const newPositionsValue = new Float32Array(positionsValue.length);
85593
85685
  for (let index = 0; index < positionsValue.length; index += 3) {
85594
85686
  const vertex = positionsValue.subarray(index, index + 3);
85595
- const cartesianOriginVector = new import_core29.Vector3(cartesianOrigin);
85596
- let vertexVector = new import_core29.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
85597
- import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector5);
85598
- vertexVector = scratchVector5.subtract(cartesianOriginVector);
85687
+ const cartesianOriginVector = new import_core32.Vector3(cartesianOrigin);
85688
+ let vertexVector = new import_core32.Vector3(Array.from(vertex)).transform(modelMatrix).add(cartographicOrigin);
85689
+ import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(vertexVector, scratchVector6);
85690
+ vertexVector = scratchVector6.subtract(cartesianOriginVector);
85599
85691
  newPositionsValue.set(vertexVector, index);
85600
85692
  }
85601
85693
  return newPositionsValue;
85602
85694
  }
85603
85695
  _generateTransformMatrix(cartesianOrigin) {
85604
- const translateOriginMatrix = new import_core29.Matrix4().translate(cartesianOrigin);
85696
+ const translateOriginMatrix = new import_core32.Matrix4().translate(cartesianOrigin);
85605
85697
  const result = translateOriginMatrix.multiplyLeft(Z_UP_TO_Y_UP_MATRIX);
85606
85698
  return result;
85607
85699
  }
@@ -85731,8 +85823,9 @@ var Tiles3DConverter = class {
85731
85823
  this.sourceTileset = new Tileset3D(sourceTilesetJson, {
85732
85824
  loadOptions: { i3s: { coordinateSystem: COORDINATE_SYSTEM.LNGLAT_OFFSETS } }
85733
85825
  });
85734
- if (!this.sourceTileset.root.header.obb) {
85735
- this.sourceTileset.root.header.obb = createObbFromMbs(this.sourceTileset.root.header.mbs);
85826
+ const rootNode = this.sourceTileset.root;
85827
+ if (!rootNode.header.obb) {
85828
+ rootNode.header.obb = createObbFromMbs(rootNode.header.mbs);
85736
85829
  }
85737
85830
  this.tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
85738
85831
  this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
@@ -85742,13 +85835,13 @@ var Tiles3DConverter = class {
85742
85835
  }
85743
85836
  const rootTile = {
85744
85837
  boundingVolume: {
85745
- box: i3sObbTo3dTilesObb(this.sourceTileset.root.header.obb, this.geoidHeightModel)
85838
+ box: i3sObbTo3dTilesObb(rootNode.header.obb, this.geoidHeightModel)
85746
85839
  },
85747
- geometricError: convertScreenThresholdToGeometricError(this.sourceTileset.root),
85840
+ geometricError: convertScreenThresholdToGeometricError(rootNode),
85748
85841
  children: []
85749
85842
  };
85750
- await this._addChildren(this.sourceTileset.root, rootTile, 1);
85751
- const tileset = (0, import_json_map_transform8.default)({ root: rootTile }, TILESET);
85843
+ await this._addChildren(rootNode, rootTile, 1);
85844
+ const tileset = (0, import_json_map_transform8.default)({ root: rootTile }, TILESET());
85752
85845
  await writeFile3(this.tilesetPath, JSON.stringify(tileset), "tileset.json");
85753
85846
  this._finishConversion({ slpk: false, outputPath, tilesetName });
85754
85847
  }
@@ -85919,11 +86012,11 @@ async function loadZipEntry(jsZip, subFilename, options = {}) {
85919
86012
 
85920
86013
  // src/deps-installer/deps-installer.js
85921
86014
  var import_path9 = __toModule(require("path"));
85922
- var PGM_LINK = "https://github.com/visgl/deck.gl-data/raw/master/egm/egm2008-5.zip";
86015
+ var PGM_LINK = "https://raw.githubusercontent.com/visgl/deck.gl-data/master/egm/egm2008-5.zip";
85923
86016
  var DepsInstaller = class {
85924
86017
  async install(path2 = "") {
85925
86018
  console.log('Installing "EGM2008-5" model...');
85926
- const fileMap = await load(PGM_LINK, ZipLoader, { fetch: { followRedirect: true } });
86019
+ const fileMap = await load(PGM_LINK, ZipLoader, {});
85927
86020
  let depsPath = process.cwd();
85928
86021
  if (path2) {
85929
86022
  depsPath = (0, import_path9.join)(depsPath, path2);