@loaders.gl/tile-converter 4.0.0-alpha.7 → 4.0.0-alpha.9

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 (149) hide show
  1. package/dist/3d-tiles-attributes-worker.js +2 -2
  2. package/dist/3d-tiles-attributes-worker.js.map +2 -2
  3. package/dist/converter.min.js +67 -67
  4. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  5. package/dist/deps-installer/deps-installer.js +3 -2
  6. package/dist/dist.min.js +698 -340
  7. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  8. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  9. package/dist/es5/deps-installer/deps-installer.js +4 -3
  10. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  11. package/dist/es5/i3s-attributes-worker.js +1 -1
  12. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +2 -2
  13. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  14. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +6 -7
  15. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  16. package/dist/es5/i3s-converter/helpers/geometry-converter.js +25 -14
  17. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  18. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +45 -12
  19. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  20. package/dist/es5/i3s-converter/helpers/load-3d-tiles.js +82 -0
  21. package/dist/es5/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
  22. package/dist/es5/i3s-converter/helpers/node-index-document.js +74 -45
  23. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
  24. package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js +111 -0
  25. package/dist/es5/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
  26. package/dist/es5/i3s-converter/helpers/tileset-traversal.js +82 -0
  27. package/dist/es5/i3s-converter/helpers/tileset-traversal.js.map +1 -0
  28. package/dist/es5/i3s-converter/i3s-converter.js +545 -516
  29. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  30. package/dist/es5/i3s-converter/types.js +16 -0
  31. package/dist/es5/i3s-converter/types.js.map +1 -1
  32. package/dist/es5/i3s-server/README.md +19 -0
  33. package/dist/es5/i3s-server/app.js +10 -1
  34. package/dist/es5/i3s-server/app.js.map +1 -1
  35. package/dist/es5/i3s-server/controllers/slpk-controller.js +84 -0
  36. package/dist/es5/i3s-server/controllers/slpk-controller.js.map +1 -0
  37. package/dist/es5/i3s-server/routes/slpk-router.js +71 -0
  38. package/dist/es5/i3s-server/routes/slpk-router.js.map +1 -0
  39. package/dist/es5/i3s-server/utils/create-scene-server.js +17 -0
  40. package/dist/es5/i3s-server/utils/create-scene-server.js.map +1 -0
  41. package/dist/es5/lib/utils/file-utils.js +1 -1
  42. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  43. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  44. package/dist/es5/pgm-loader.js +1 -1
  45. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  46. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  47. package/dist/esm/deps-installer/deps-installer.js +4 -3
  48. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  49. package/dist/esm/i3s-attributes-worker.js +1 -1
  50. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +2 -2
  51. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  52. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +6 -7
  53. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  54. package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -8
  55. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  56. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +49 -12
  57. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  58. package/dist/esm/i3s-converter/helpers/load-3d-tiles.js +35 -0
  59. package/dist/esm/i3s-converter/helpers/load-3d-tiles.js.map +1 -0
  60. package/dist/esm/i3s-converter/helpers/node-index-document.js +14 -1
  61. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
  62. package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js +48 -0
  63. package/dist/esm/i3s-converter/helpers/preprocess-3d-tiles.js.map +1 -0
  64. package/dist/esm/i3s-converter/helpers/tileset-traversal.js +14 -0
  65. package/dist/esm/i3s-converter/helpers/tileset-traversal.js.map +1 -0
  66. package/dist/esm/i3s-converter/i3s-converter.js +134 -120
  67. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  68. package/dist/esm/i3s-converter/types.js +10 -1
  69. package/dist/esm/i3s-converter/types.js.map +1 -1
  70. package/dist/esm/i3s-server/README.md +19 -0
  71. package/dist/esm/i3s-server/app.js +11 -1
  72. package/dist/esm/i3s-server/app.js.map +1 -1
  73. package/dist/esm/i3s-server/controllers/slpk-controller.js +36 -0
  74. package/dist/esm/i3s-server/controllers/slpk-controller.js.map +1 -0
  75. package/dist/esm/i3s-server/routes/slpk-router.js +33 -0
  76. package/dist/esm/i3s-server/routes/slpk-router.js.map +1 -0
  77. package/dist/esm/i3s-server/utils/create-scene-server.js +16 -0
  78. package/dist/esm/i3s-server/utils/create-scene-server.js.map +1 -0
  79. package/dist/esm/lib/utils/file-utils.js +1 -1
  80. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  81. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
  82. package/dist/esm/pgm-loader.js +1 -1
  83. package/dist/i3s-attributes-worker.js +2 -2
  84. package/dist/i3s-attributes-worker.js.map +2 -2
  85. package/dist/i3s-converter/helpers/batch-ids-extensions.js +2 -5
  86. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +3 -4
  87. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
  88. package/dist/i3s-converter/helpers/coordinate-converter.js +8 -9
  89. package/dist/i3s-converter/helpers/geometry-converter.d.ts +9 -4
  90. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  91. package/dist/i3s-converter/helpers/geometry-converter.js +34 -12
  92. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +22 -3
  93. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  94. package/dist/i3s-converter/helpers/gltf-attributes.js +61 -18
  95. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts +18 -0
  96. package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -0
  97. package/dist/i3s-converter/helpers/load-3d-tiles.js +53 -0
  98. package/dist/i3s-converter/helpers/node-index-document.d.ts +8 -0
  99. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  100. package/dist/i3s-converter/helpers/node-index-document.js +20 -2
  101. package/dist/i3s-converter/helpers/node-pages.js +1 -1
  102. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +23 -0
  103. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -0
  104. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +76 -0
  105. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +25 -0
  106. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -0
  107. package/dist/i3s-converter/helpers/tileset-traversal.js +29 -0
  108. package/dist/i3s-converter/i3s-converter.d.ts +40 -40
  109. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  110. package/dist/i3s-converter/i3s-converter.js +150 -126
  111. package/dist/i3s-converter/types.d.ts +18 -0
  112. package/dist/i3s-converter/types.d.ts.map +1 -1
  113. package/dist/i3s-converter/types.js +15 -0
  114. package/dist/i3s-server/app.d.ts.map +1 -1
  115. package/dist/i3s-server/app.js +9 -1
  116. package/dist/i3s-server/controllers/slpk-controller.d.ts +3 -0
  117. package/dist/i3s-server/controllers/slpk-controller.d.ts.map +1 -0
  118. package/dist/i3s-server/controllers/slpk-controller.js +32 -0
  119. package/dist/i3s-server/routes/slpk-router.d.ts +3 -0
  120. package/dist/i3s-server/routes/slpk-router.d.ts.map +1 -0
  121. package/dist/i3s-server/routes/slpk-router.js +33 -0
  122. package/dist/i3s-server/utils/create-scene-server.d.ts +11 -0
  123. package/dist/i3s-server/utils/create-scene-server.d.ts.map +1 -0
  124. package/dist/i3s-server/utils/create-scene-server.js +14 -0
  125. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  126. package/dist/lib/utils/file-utils.js +2 -1
  127. package/dist/lib/utils/lod-conversion-utils.d.ts +3 -2
  128. package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -1
  129. package/dist/lib/utils/lod-conversion-utils.js +1 -1
  130. package/package.json +15 -15
  131. package/src/3d-tiles-converter/3d-tiles-converter.ts +5 -5
  132. package/src/deps-installer/deps-installer.ts +3 -2
  133. package/src/i3s-converter/helpers/batch-ids-extensions.ts +2 -5
  134. package/src/i3s-converter/helpers/coordinate-converter.ts +11 -10
  135. package/src/i3s-converter/helpers/geometry-converter.ts +51 -19
  136. package/src/i3s-converter/helpers/gltf-attributes.ts +84 -21
  137. package/src/i3s-converter/helpers/load-3d-tiles.ts +68 -0
  138. package/src/i3s-converter/helpers/node-index-document.ts +22 -2
  139. package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +81 -0
  140. package/src/i3s-converter/helpers/tileset-traversal.ts +51 -0
  141. package/src/i3s-converter/i3s-converter.ts +228 -178
  142. package/src/i3s-converter/types.ts +20 -0
  143. package/src/i3s-server/README.md +19 -0
  144. package/src/i3s-server/app.js +8 -1
  145. package/src/i3s-server/controllers/slpk-controller.js +38 -0
  146. package/src/i3s-server/routes/slpk-router.js +33 -0
  147. package/src/i3s-server/utils/create-scene-server.js +15 -0
  148. package/src/lib/utils/file-utils.ts +2 -1
  149. package/src/lib/utils/lod-conversion-utils.ts +6 -2
package/dist/dist.min.js CHANGED
@@ -2173,15 +2173,15 @@ var require_vector3 = __commonJS({
2173
2173
  }
2174
2174
  var ORIGIN = [0, 0, 0];
2175
2175
  var ZERO2;
2176
- var Vector322 = function(_Vector) {
2177
- (0, _inherits2.default)(Vector323, _Vector);
2178
- var _super = _createSuper(Vector323);
2179
- function Vector323() {
2176
+ var Vector323 = function(_Vector) {
2177
+ (0, _inherits2.default)(Vector324, _Vector);
2178
+ var _super = _createSuper(Vector324);
2179
+ function Vector324() {
2180
2180
  var _this;
2181
2181
  var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
2182
2182
  var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
2183
2183
  var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
2184
- (0, _classCallCheck2.default)(this, Vector323);
2184
+ (0, _classCallCheck2.default)(this, Vector324);
2185
2185
  _this = _super.call(this, -0, -0, -0);
2186
2186
  if (arguments.length === 1 && (0, _common.isArray)(x)) {
2187
2187
  _this.copy(x);
@@ -2197,7 +2197,7 @@ var require_vector3 = __commonJS({
2197
2197
  }
2198
2198
  return _this;
2199
2199
  }
2200
- (0, _createClass2.default)(Vector323, [{
2200
+ (0, _createClass2.default)(Vector324, [{
2201
2201
  key: "set",
2202
2202
  value: function set(x, y, z) {
2203
2203
  this[0] = x;
@@ -2318,15 +2318,15 @@ var require_vector3 = __commonJS({
2318
2318
  key: "ZERO",
2319
2319
  get: function get() {
2320
2320
  if (!ZERO2) {
2321
- ZERO2 = new Vector323(0, 0, 0);
2321
+ ZERO2 = new Vector324(0, 0, 0);
2322
2322
  Object.freeze(ZERO2);
2323
2323
  }
2324
2324
  return ZERO2;
2325
2325
  }
2326
2326
  }]);
2327
- return Vector323;
2327
+ return Vector324;
2328
2328
  }(_vector.default);
2329
- exports.default = Vector322;
2329
+ exports.default = Vector323;
2330
2330
  }
2331
2331
  });
2332
2332
 
@@ -5290,12 +5290,12 @@ var require_matrix4 = __commonJS({
5290
5290
  var DEFAULT_NEAR = 0.1;
5291
5291
  var DEFAULT_FAR = 500;
5292
5292
  var IDENTITY_MATRIX = Object.freeze([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
5293
- var Matrix410 = function(_Matrix) {
5294
- (0, _inherits2.default)(Matrix411, _Matrix);
5295
- var _super = _createSuper(Matrix411);
5296
- function Matrix411(array) {
5293
+ var Matrix412 = function(_Matrix) {
5294
+ (0, _inherits2.default)(Matrix413, _Matrix);
5295
+ var _super = _createSuper(Matrix413);
5296
+ function Matrix413(array) {
5297
5297
  var _this;
5298
- (0, _classCallCheck2.default)(this, Matrix411);
5298
+ (0, _classCallCheck2.default)(this, Matrix413);
5299
5299
  _this = _super.call(this, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0, -0);
5300
5300
  if (arguments.length === 1 && Array.isArray(array)) {
5301
5301
  _this.copy(array);
@@ -5304,7 +5304,7 @@ var require_matrix4 = __commonJS({
5304
5304
  }
5305
5305
  return _this;
5306
5306
  }
5307
- (0, _createClass2.default)(Matrix411, [{
5307
+ (0, _createClass2.default)(Matrix413, [{
5308
5308
  key: "ELEMENTS",
5309
5309
  get: function get() {
5310
5310
  return 16;
@@ -5685,21 +5685,21 @@ var require_matrix4 = __commonJS({
5685
5685
  return getZeroMatrix();
5686
5686
  }
5687
5687
  }]);
5688
- return Matrix411;
5688
+ return Matrix413;
5689
5689
  }(_matrix.default);
5690
- exports.default = Matrix410;
5690
+ exports.default = Matrix412;
5691
5691
  var ZERO2;
5692
5692
  var IDENTITY;
5693
5693
  function getZeroMatrix() {
5694
5694
  if (!ZERO2) {
5695
- ZERO2 = new Matrix410([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
5695
+ ZERO2 = new Matrix412([0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]);
5696
5696
  Object.freeze(ZERO2);
5697
5697
  }
5698
5698
  return ZERO2;
5699
5699
  }
5700
5700
  function getIdentityMatrix() {
5701
5701
  if (!IDENTITY) {
5702
- IDENTITY = new Matrix410();
5702
+ IDENTITY = new Matrix412();
5703
5703
  Object.freeze(IDENTITY);
5704
5704
  }
5705
5705
  return IDENTITY;
@@ -8167,12 +8167,12 @@ var require_ellipsoid = __commonJS({
8167
8167
  var scratchPosition3 = new _core.Vector3();
8168
8168
  var scratchHeight = new _core.Vector3();
8169
8169
  var scratchCartesian = new _core.Vector3();
8170
- var Ellipsoid15 = function() {
8171
- function Ellipsoid16() {
8170
+ var Ellipsoid16 = function() {
8171
+ function Ellipsoid17() {
8172
8172
  var x = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 0;
8173
8173
  var y = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
8174
8174
  var z = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : 0;
8175
- (0, _classCallCheck2.default)(this, Ellipsoid16);
8175
+ (0, _classCallCheck2.default)(this, Ellipsoid17);
8176
8176
  (0, _defineProperty2.default)(this, "radii", void 0);
8177
8177
  (0, _defineProperty2.default)(this, "radiiSquared", void 0);
8178
8178
  (0, _defineProperty2.default)(this, "radiiToTheFourth", void 0);
@@ -8197,7 +8197,7 @@ var require_ellipsoid = __commonJS({
8197
8197
  }
8198
8198
  Object.freeze(this);
8199
8199
  }
8200
- (0, _createClass2.default)(Ellipsoid16, [{
8200
+ (0, _createClass2.default)(Ellipsoid17, [{
8201
8201
  key: "equals",
8202
8202
  value: function equals2(right) {
8203
8203
  return this === right || Boolean(right && this.radii.equals(right.radii));
@@ -8318,10 +8318,10 @@ var require_ellipsoid = __commonJS({
8318
8318
  return scratchPosition3.set(0, 0, z).to(result);
8319
8319
  }
8320
8320
  }]);
8321
- return Ellipsoid16;
8321
+ return Ellipsoid17;
8322
8322
  }();
8323
- exports.default = Ellipsoid15;
8324
- (0, _defineProperty2.default)(Ellipsoid15, "WGS84", new Ellipsoid15(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
8323
+ exports.default = Ellipsoid16;
8324
+ (0, _defineProperty2.default)(Ellipsoid16, "WGS84", new Ellipsoid16(_constants.WGS84_RADIUS_X, _constants.WGS84_RADIUS_Y, _constants.WGS84_RADIUS_Z));
8325
8325
  }
8326
8326
  });
8327
8327
 
@@ -47225,8 +47225,10 @@ var ChildProcessProxy = class {
47225
47225
  });
47226
47226
  childProcess.stderr.on("data", (data) => {
47227
47227
  console.log(`Child process wrote to stderr: "${data}".`);
47228
- this._clearTimeout();
47229
- reject(new Error(data));
47228
+ if (!props.ignoreStderr) {
47229
+ this._clearTimeout();
47230
+ reject(new Error(data));
47231
+ }
47230
47232
  });
47231
47233
  childProcess.on("error", (error) => {
47232
47234
  console.log(`Child process errored with ${error}`);
@@ -50030,24 +50032,28 @@ var TILE_CONTENT_STATE = {
50030
50032
  EXPIRED: 4,
50031
50033
  FAILED: 5
50032
50034
  };
50033
- var TILE_REFINEMENT = {
50034
- ADD: 1,
50035
- REPLACE: 2
50036
- };
50037
- var TILE_TYPE = {
50038
- EMPTY: "empty",
50039
- SCENEGRAPH: "scenegraph",
50040
- POINTCLOUD: "pointcloud",
50041
- MESH: "mesh"
50042
- };
50043
- var TILESET_TYPE = {
50044
- I3S: "I3S",
50045
- TILES3D: "TILES3D"
50046
- };
50047
- var LOD_METRIC_TYPE = {
50048
- GEOMETRIC_ERROR: "geometricError",
50049
- MAX_SCREEN_THRESHOLD: "maxScreenThreshold"
50050
- };
50035
+ var TILE_REFINEMENT;
50036
+ (function(TILE_REFINEMENT2) {
50037
+ TILE_REFINEMENT2[TILE_REFINEMENT2["ADD"] = 1] = "ADD";
50038
+ TILE_REFINEMENT2[TILE_REFINEMENT2["REPLACE"] = 2] = "REPLACE";
50039
+ })(TILE_REFINEMENT || (TILE_REFINEMENT = {}));
50040
+ var TILE_TYPE;
50041
+ (function(TILE_TYPE2) {
50042
+ TILE_TYPE2["EMPTY"] = "empty";
50043
+ TILE_TYPE2["SCENEGRAPH"] = "scenegraph";
50044
+ TILE_TYPE2["POINTCLOUD"] = "pointcloud";
50045
+ TILE_TYPE2["MESH"] = "mesh";
50046
+ })(TILE_TYPE || (TILE_TYPE = {}));
50047
+ var TILESET_TYPE;
50048
+ (function(TILESET_TYPE2) {
50049
+ TILESET_TYPE2["I3S"] = "I3S";
50050
+ TILESET_TYPE2["TILES3D"] = "TILES3D";
50051
+ })(TILESET_TYPE || (TILESET_TYPE = {}));
50052
+ var LOD_METRIC_TYPE;
50053
+ (function(LOD_METRIC_TYPE2) {
50054
+ LOD_METRIC_TYPE2["GEOMETRIC_ERROR"] = "geometricError";
50055
+ LOD_METRIC_TYPE2["MAX_SCREEN_THRESHOLD"] = "maxScreenThreshold";
50056
+ })(LOD_METRIC_TYPE || (LOD_METRIC_TYPE = {}));
50051
50057
  var TILE3D_OPTIMIZATION_HINT = {
50052
50058
  NOT_COMPUTED: -1,
50053
50059
  USE_OPTIMIZATION: 1,
@@ -51700,7 +51706,7 @@ var Tileset3D = class {
51700
51706
  throw new Error("Tileset must have an asset property.");
51701
51707
  }
51702
51708
  if (this.asset.version !== "0.0" && this.asset.version !== "1.0" && this.asset.version !== "1.1") {
51703
- throw new Error("The tileset must be 3D Tiles version 0.0 or 1.0.");
51709
+ throw new Error("The tileset must be 3D Tiles version either 0.0 or 1.0 or 1.1.");
51704
51710
  }
51705
51711
  if ("tilesetVersion" in this.asset) {
51706
51712
  this._queryParams.v = this.asset.tilesetVersion;
@@ -53096,26 +53102,26 @@ function parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options) {
53096
53102
  return byteOffset;
53097
53103
  }
53098
53104
  function parse3DTileFeatureTable(tile, arrayBuffer, byteOffset, options) {
53099
- const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header;
53105
+ const { featureTableJsonByteLength, featureTableBinaryByteLength, batchLength } = tile.header || {};
53100
53106
  tile.featureTableJson = {
53101
53107
  BATCH_LENGTH: batchLength || 0
53102
53108
  };
53103
- if (featureTableJsonByteLength > 0) {
53109
+ if (featureTableJsonByteLength && featureTableJsonByteLength > 0) {
53104
53110
  const featureTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, featureTableJsonByteLength);
53105
53111
  tile.featureTableJson = JSON.parse(featureTableString);
53106
53112
  }
53107
- byteOffset += featureTableJsonByteLength;
53113
+ byteOffset += featureTableJsonByteLength || 0;
53108
53114
  tile.featureTableBinary = new Uint8Array(arrayBuffer, byteOffset, featureTableBinaryByteLength);
53109
- byteOffset += featureTableBinaryByteLength;
53115
+ byteOffset += featureTableBinaryByteLength || 0;
53110
53116
  return byteOffset;
53111
53117
  }
53112
53118
  function parse3DTileBatchTable(tile, arrayBuffer, byteOffset, options) {
53113
- const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header;
53114
- if (batchTableJsonByteLength > 0) {
53119
+ const { batchTableJsonByteLength, batchTableBinaryByteLength } = tile.header || {};
53120
+ if (batchTableJsonByteLength && batchTableJsonByteLength > 0) {
53115
53121
  const batchTableString = getStringFromArrayBuffer(arrayBuffer, byteOffset, batchTableJsonByteLength);
53116
53122
  tile.batchTableJson = JSON.parse(batchTableString);
53117
53123
  byteOffset += batchTableJsonByteLength;
53118
- if (batchTableBinaryByteLength > 0) {
53124
+ if (batchTableBinaryByteLength && batchTableBinaryByteLength > 0) {
53119
53125
  tile.batchTableBinary = new Uint8Array(arrayBuffer, byteOffset, batchTableBinaryByteLength);
53120
53126
  tile.batchTableBinary = new Uint8Array(tile.batchTableBinary);
53121
53127
  byteOffset += batchTableBinaryByteLength;
@@ -53129,7 +53135,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
53129
53135
  if (!colors && (!tile || !tile.batchIds || !batchTable)) {
53130
53136
  return null;
53131
53137
  }
53132
- const { batchIds, isRGB565, pointCount } = tile;
53138
+ const { batchIds, isRGB565, pointCount = 0 } = tile;
53133
53139
  if (batchIds && batchTable) {
53134
53140
  const colorArray = new Uint8ClampedArray(pointCount * 3);
53135
53141
  for (let i = 0; i < pointCount; i++) {
@@ -53147,7 +53153,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
53147
53153
  normalized: true
53148
53154
  };
53149
53155
  }
53150
- if (isRGB565) {
53156
+ if (colors && isRGB565) {
53151
53157
  const colorArray = new Uint8ClampedArray(pointCount * 3);
53152
53158
  for (let i = 0; i < pointCount; i++) {
53153
53159
  const color = decodeRGB565(colors[i]);
@@ -53172,7 +53178,7 @@ function normalize3DTileColorAttribute(tile, colors, batchTable) {
53172
53178
  }
53173
53179
  return {
53174
53180
  type: GL2.UNSIGNED_BYTE,
53175
- value: colors,
53181
+ value: colors || new Uint8ClampedArray(),
53176
53182
  size: 4,
53177
53183
  normalized: true
53178
53184
  };
@@ -53186,8 +53192,8 @@ function normalize3DTileNormalAttribute(tile, normals) {
53186
53192
  return null;
53187
53193
  }
53188
53194
  if (tile.isOctEncoded16P) {
53189
- const decodedArray = new Float32Array(tile.pointsLength * 3);
53190
- for (let i = 0; i < tile.pointsLength; i++) {
53195
+ const decodedArray = new Float32Array((tile.pointsLength || 0) * 3);
53196
+ for (let i = 0; i < (tile.pointsLength || 0); i++) {
53191
53197
  octDecode(normals[i * 2], normals[i * 2 + 1], scratchNormal);
53192
53198
  scratchNormal.toArray(decodedArray, i * 3);
53193
53199
  }
@@ -53270,6 +53276,12 @@ function parsePointCloudTables(tile) {
53270
53276
  return { featureTable, batchTable };
53271
53277
  }
53272
53278
  function parsePositions(tile, featureTable, options) {
53279
+ tile.attributes = tile.attributes || {
53280
+ positions: null,
53281
+ colors: null,
53282
+ normals: null,
53283
+ batchIds: null
53284
+ };
53273
53285
  if (!tile.attributes.positions) {
53274
53286
  if (featureTable.hasProperty("POSITION")) {
53275
53287
  tile.attributes.positions = featureTable.getPropertyArray("POSITION", GL2.FLOAT, 3);
@@ -53293,6 +53305,12 @@ function parsePositions(tile, featureTable, options) {
53293
53305
  }
53294
53306
  }
53295
53307
  function parseColors(tile, featureTable, batchTable) {
53308
+ tile.attributes = tile.attributes || {
53309
+ positions: null,
53310
+ colors: null,
53311
+ normals: null,
53312
+ batchIds: null
53313
+ };
53296
53314
  if (!tile.attributes.colors) {
53297
53315
  let colors = null;
53298
53316
  if (featureTable.hasProperty("RGBA")) {
@@ -53311,6 +53329,12 @@ function parseColors(tile, featureTable, batchTable) {
53311
53329
  }
53312
53330
  }
53313
53331
  function parseNormals(tile, featureTable) {
53332
+ tile.attributes = tile.attributes || {
53333
+ positions: null,
53334
+ colors: null,
53335
+ normals: null,
53336
+ batchIds: null
53337
+ };
53314
53338
  if (!tile.attributes.normals) {
53315
53339
  let normals = null;
53316
53340
  if (featureTable.hasProperty("NORMAL")) {
@@ -53353,7 +53377,7 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
53353
53377
  if (!dracoFeatureTableProperties || !Number.isFinite(dracoByteOffset) || !dracoByteLength) {
53354
53378
  throw new Error("Draco properties, byteOffset, and byteLength must be defined");
53355
53379
  }
53356
- dracoBuffer = tile.featureTableBinary.slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
53380
+ dracoBuffer = (tile.featureTableBinary || []).slice(dracoByteOffset, dracoByteOffset + dracoByteLength);
53357
53381
  tile.hasPositions = Number.isFinite(dracoFeatureTableProperties.POSITION);
53358
53382
  tile.hasColors = Number.isFinite(dracoFeatureTableProperties.RGB) || Number.isFinite(dracoFeatureTableProperties.RGBA);
53359
53383
  tile.hasNormals = Number.isFinite(dracoFeatureTableProperties.NORMAL);
@@ -53373,11 +53397,14 @@ async function parseDraco(tile, featureTable, batchTable, options, context) {
53373
53397
  return await loadDraco(tile, dracoData, options, context);
53374
53398
  }
53375
53399
  async function loadDraco(tile, dracoData, options, context) {
53400
+ if (!context) {
53401
+ return;
53402
+ }
53376
53403
  const { parse: parse7 } = context;
53377
53404
  const dracoOptions = {
53378
53405
  ...options,
53379
53406
  draco: {
53380
- ...options.draco,
53407
+ ...options?.draco,
53381
53408
  extraAttributes: dracoData.batchTableProperties || {}
53382
53409
  }
53383
53410
  };
@@ -55023,7 +55050,8 @@ var GLTFScenegraph = class {
55023
55050
  constructor(gltf) {
55024
55051
  this.gltf = {
55025
55052
  json: gltf?.json || makeDefaultGLTFJson(),
55026
- buffers: gltf?.buffers || []
55053
+ buffers: gltf?.buffers || [],
55054
+ images: gltf?.images || []
55027
55055
  };
55028
55056
  this.sourceBuffers = [];
55029
55057
  this.byteLength = 0;
@@ -55279,14 +55307,14 @@ var GLTFScenegraph = class {
55279
55307
  this.json.images.push(glTFImage);
55280
55308
  return this.json.images.length - 1;
55281
55309
  }
55282
- addBufferView(buffer) {
55310
+ addBufferView(buffer, bufferIndex = 0, byteOffset = this.byteLength) {
55283
55311
  const byteLength = buffer.byteLength;
55284
55312
  assert6(Number.isFinite(byteLength));
55285
55313
  this.sourceBuffers = this.sourceBuffers || [];
55286
55314
  this.sourceBuffers.push(buffer);
55287
55315
  const glTFBufferView = {
55288
- buffer: 0,
55289
- byteOffset: this.byteLength,
55316
+ buffer: bufferIndex,
55317
+ byteOffset,
55290
55318
  byteLength
55291
55319
  };
55292
55320
  this.byteLength += padToNBytes(byteLength, 4);
@@ -56171,18 +56199,16 @@ __export(EXT_feature_metadata_exports, {
56171
56199
  });
56172
56200
  var EXT_FEATURE_METADATA = "EXT_feature_metadata";
56173
56201
  var name9 = EXT_FEATURE_METADATA;
56174
- async function decode8(gltfData) {
56202
+ async function decode8(gltfData, options) {
56175
56203
  const scenegraph = new GLTFScenegraph(gltfData);
56176
- decodeExtFeatureMetadata(scenegraph);
56204
+ decodeExtFeatureMetadata(scenegraph, options);
56177
56205
  }
56178
- function decodeExtFeatureMetadata(scenegraph) {
56206
+ function decodeExtFeatureMetadata(scenegraph, options) {
56179
56207
  const extension = scenegraph.getExtension(EXT_FEATURE_METADATA);
56180
- const schemaClasses = extension?.schema?.classes;
56181
- const featureTables = extension?.featureTables;
56182
- const featureTextures = extension?.featureTextures;
56183
- if (featureTextures) {
56184
- console.warn('featureTextures is not yet supported in the "EXT_feature_metadata" extension.');
56185
- }
56208
+ if (!extension)
56209
+ return;
56210
+ const schemaClasses = extension.schema?.classes;
56211
+ const { featureTables } = extension;
56186
56212
  if (schemaClasses && featureTables) {
56187
56213
  for (const schemaName in schemaClasses) {
56188
56214
  const schemaClass = schemaClasses[schemaName];
@@ -56192,6 +56218,16 @@ function decodeExtFeatureMetadata(scenegraph) {
56192
56218
  }
56193
56219
  }
56194
56220
  }
56221
+ const { featureTextures } = extension;
56222
+ if (schemaClasses && featureTextures && options.gltf?.loadImages) {
56223
+ for (const schemaName in schemaClasses) {
56224
+ const schemaClass = schemaClasses[schemaName];
56225
+ const featureTexture = findFeatureTextureByName(featureTextures, schemaName);
56226
+ if (featureTexture) {
56227
+ handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass);
56228
+ }
56229
+ }
56230
+ }
56195
56231
  }
56196
56232
  function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
56197
56233
  for (const propertyName in schemaClass.properties) {
@@ -56204,19 +56240,128 @@ function handleFeatureTableProperties(scenegraph, featureTable, schemaClass) {
56204
56240
  }
56205
56241
  }
56206
56242
  }
56243
+ function handleFeatureTextureProperties(scenegraph, featureTexture, schemaClass) {
56244
+ const attributeName = featureTexture.class;
56245
+ for (const propertyName in schemaClass.properties) {
56246
+ const featureTextureProperty = featureTexture?.properties?.[propertyName];
56247
+ if (featureTextureProperty) {
56248
+ const data = getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName);
56249
+ featureTextureProperty.data = data;
56250
+ }
56251
+ }
56252
+ }
56207
56253
  function getPropertyDataFromBinarySource(scenegraph, schemaProperty, numberOfFeatures, featureTableProperty) {
56208
56254
  const bufferView = featureTableProperty.bufferView;
56209
- let data = scenegraph.getTypedArrayForBufferView(bufferView);
56255
+ const dataArray = scenegraph.getTypedArrayForBufferView(bufferView);
56210
56256
  switch (schemaProperty.type) {
56211
56257
  case "STRING": {
56212
56258
  const stringOffsetBufferView = featureTableProperty.stringOffsetBufferView;
56213
56259
  const offsetsData = scenegraph.getTypedArrayForBufferView(stringOffsetBufferView);
56214
- data = getStringAttributes(data, offsetsData, numberOfFeatures);
56215
- break;
56260
+ return getStringAttributes(dataArray, offsetsData, numberOfFeatures);
56216
56261
  }
56217
56262
  default:
56218
56263
  }
56219
- return data;
56264
+ return dataArray;
56265
+ }
56266
+ function getPropertyDataFromTexture(scenegraph, featureTextureProperty, attributeName) {
56267
+ const json = scenegraph.gltf.json;
56268
+ if (!json.meshes) {
56269
+ return [];
56270
+ }
56271
+ const featureTextureTable = [];
56272
+ for (const mesh of json.meshes) {
56273
+ for (const primitive of mesh.primitives) {
56274
+ processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive);
56275
+ }
56276
+ }
56277
+ return featureTextureTable;
56278
+ }
56279
+ function processPrimitiveTextures(scenegraph, attributeName, featureTextureProperty, featureTextureTable, primitive) {
56280
+ const json = scenegraph.gltf.json;
56281
+ const textureData = [];
56282
+ const texCoordAccessorKey = `TEXCOORD_${featureTextureProperty.texture.texCoord}`;
56283
+ const texCoordAccessorIndex = primitive.attributes[texCoordAccessorKey];
56284
+ const texCoordBufferView = scenegraph.getBufferView(texCoordAccessorIndex);
56285
+ const texCoordArray = scenegraph.getTypedArrayForBufferView(texCoordBufferView);
56286
+ const textureCoordinates = new Float32Array(texCoordArray.buffer, texCoordArray.byteOffset, texCoordArray.length / 4);
56287
+ const textureIndex = featureTextureProperty.texture.index;
56288
+ const texture = json.textures?.[textureIndex];
56289
+ const imageIndex = texture?.source;
56290
+ if (typeof imageIndex !== "undefined") {
56291
+ const image = json.images?.[imageIndex];
56292
+ const mimeType = image?.mimeType;
56293
+ const parsedImage = scenegraph.gltf.images?.[imageIndex];
56294
+ if (parsedImage) {
56295
+ for (let index = 0; index < textureCoordinates.length; index += 2) {
56296
+ const value = getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, featureTextureProperty.channels);
56297
+ textureData.push(value);
56298
+ }
56299
+ }
56300
+ }
56301
+ const featureIndices = [];
56302
+ for (const texelData of textureData) {
56303
+ let index = featureTextureTable.findIndex((item) => item === texelData);
56304
+ if (index === -1) {
56305
+ index = featureTextureTable.push(texelData) - 1;
56306
+ }
56307
+ featureIndices.push(index);
56308
+ }
56309
+ const typedArray = new Uint32Array(featureIndices);
56310
+ const bufferIndex = scenegraph.gltf.buffers.push({
56311
+ arrayBuffer: typedArray.buffer,
56312
+ byteOffset: 0,
56313
+ byteLength: typedArray.byteLength
56314
+ }) - 1;
56315
+ const bufferViewIndex = scenegraph.addBufferView(typedArray, bufferIndex, 0);
56316
+ const accessorIndex = scenegraph.addAccessor(bufferViewIndex, {
56317
+ size: 1,
56318
+ componentType: getComponentTypeFromArray(typedArray),
56319
+ count: typedArray.length
56320
+ });
56321
+ primitive.attributes[attributeName] = accessorIndex;
56322
+ }
56323
+ function getImageValueByCoordinates(parsedImage, mimeType, textureCoordinates, index, channels) {
56324
+ const CHANNELS_MAP = {
56325
+ r: { offset: 0, shift: 0 },
56326
+ g: { offset: 1, shift: 8 },
56327
+ b: { offset: 2, shift: 16 },
56328
+ a: { offset: 3, shift: 24 }
56329
+ };
56330
+ const u = textureCoordinates[index];
56331
+ const v = textureCoordinates[index + 1];
56332
+ let components = 1;
56333
+ if (mimeType && (mimeType.indexOf("image/jpeg") !== -1 || mimeType.indexOf("image/png") !== -1))
56334
+ components = 4;
56335
+ const offset = coordinatesToOffset(u, v, parsedImage, components);
56336
+ let value = 0;
56337
+ for (const c of channels) {
56338
+ const map = CHANNELS_MAP[c];
56339
+ const val = getVal(parsedImage, offset + map.offset);
56340
+ value |= val << map.shift;
56341
+ }
56342
+ return value;
56343
+ }
56344
+ function getVal(parsedImage, offset) {
56345
+ const imageData = getImageData(parsedImage);
56346
+ if (imageData.data.length <= offset) {
56347
+ throw new Error(`${imageData.data.length} <= ${offset}`);
56348
+ }
56349
+ return imageData.data[offset];
56350
+ }
56351
+ function coordinatesToOffset(u, v, parsedImage, componentsCount = 1) {
56352
+ const w = parsedImage.width;
56353
+ const iX = emod(u) * (w - 1);
56354
+ const indX = Math.round(iX);
56355
+ const h = parsedImage.height;
56356
+ const iY = emod(v) * (h - 1);
56357
+ const indY = Math.round(iY);
56358
+ const components = parsedImage.components ? parsedImage.components : componentsCount;
56359
+ const offset = (indY * w + indX) * components;
56360
+ return offset;
56361
+ }
56362
+ function emod(n) {
56363
+ const a = (n % 1 + 1) % 1;
56364
+ return a;
56220
56365
  }
56221
56366
  function findFeatureTableByName(featureTables, schemaClassName) {
56222
56367
  for (const featureTableName in featureTables) {
@@ -56227,6 +56372,15 @@ function findFeatureTableByName(featureTables, schemaClassName) {
56227
56372
  }
56228
56373
  return null;
56229
56374
  }
56375
+ function findFeatureTextureByName(featureTextures, schemaClassName) {
56376
+ for (const featureTexturesName in featureTextures) {
56377
+ const featureTable = featureTextures[featureTexturesName];
56378
+ if (featureTable.class === schemaClassName) {
56379
+ return featureTable;
56380
+ }
56381
+ }
56382
+ return null;
56383
+ }
56230
56384
  function getStringAttributes(data, offsetsData, stringsCount) {
56231
56385
  const stringsArray = [];
56232
56386
  const textDecoder = new TextDecoder("utf8");
@@ -56489,17 +56643,13 @@ async function parseGLTF(gltf, arrayBufferOrString, byteOffset = 0, options, con
56489
56643
  parseGLTFContainerSync(gltf, arrayBufferOrString, byteOffset, options);
56490
56644
  normalizeGLTFV1(gltf, { normalize: options?.gltf?.normalize });
56491
56645
  preprocessExtensions(gltf, options, context);
56492
- const promises = [];
56493
56646
  if (options?.gltf?.loadBuffers && gltf.json.buffers) {
56494
56647
  await loadBuffers(gltf, options, context);
56495
56648
  }
56496
56649
  if (options?.gltf?.loadImages) {
56497
- const promise2 = loadImages(gltf, options, context);
56498
- promises.push(promise2);
56650
+ await loadImages(gltf, options, context);
56499
56651
  }
56500
- const promise = decodeExtensions(gltf, options, context);
56501
- promises.push(promise);
56502
- await Promise.all(promises);
56652
+ await decodeExtensions(gltf, options, context);
56503
56653
  return gltf;
56504
56654
  }
56505
56655
  function parseGLTFContainerSync(gltf, data, byteOffset, options) {
@@ -57022,11 +57172,11 @@ var GLTF_FORMAT = {
57022
57172
  };
57023
57173
  function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {
57024
57174
  tile.rotateYtoZ = true;
57025
- const gltfByteLength = tile.byteOffset + tile.byteLength - byteOffset;
57175
+ const gltfByteLength = (tile.byteOffset || 0) + (tile.byteLength || 0) - byteOffset;
57026
57176
  if (gltfByteLength === 0) {
57027
57177
  throw new Error("glTF byte length must be greater than 0.");
57028
57178
  }
57029
- tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
57179
+ tile.gltfUpAxis = options?.["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
57030
57180
  tile.gltfArrayBuffer = sliceArrayBuffer(arrayBuffer, byteOffset, gltfByteLength);
57031
57181
  tile.gltfByteOffset = 0;
57032
57182
  tile.gltfByteLength = gltfByteLength;
@@ -57034,15 +57184,19 @@ function parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options) {
57034
57184
  } else {
57035
57185
  console.warn(`${tile.type}: embedded glb is not aligned to a 4-byte boundary.`);
57036
57186
  }
57037
- return tile.byteOffset + tile.byteLength;
57187
+ return (tile.byteOffset || 0) + (tile.byteLength || 0);
57038
57188
  }
57039
57189
  async function extractGLTF(tile, gltfFormat, options, context) {
57040
- const tile3DOptions = options["3d-tiles"] || {};
57190
+ const tile3DOptions = options?.["3d-tiles"] || {};
57041
57191
  extractGLTFBufferOrURL(tile, gltfFormat, options);
57042
57192
  if (tile3DOptions.loadGLTF) {
57193
+ if (!context) {
57194
+ return;
57195
+ }
57043
57196
  const { parse: parse7, fetch: fetch2 } = context;
57044
57197
  if (tile.gltfUrl) {
57045
- tile.gltfArrayBuffer = await fetch2(tile.gltfUrl, options);
57198
+ const response = await fetch2(tile.gltfUrl, options);
57199
+ tile.gltfArrayBuffer = await response.arrayBuffer();
57046
57200
  tile.gltfByteOffset = 0;
57047
57201
  }
57048
57202
  if (tile.gltfArrayBuffer) {
@@ -57058,10 +57212,12 @@ async function extractGLTF(tile, gltfFormat, options, context) {
57058
57212
  function extractGLTFBufferOrURL(tile, gltfFormat, options) {
57059
57213
  switch (gltfFormat) {
57060
57214
  case GLTF_FORMAT.URI:
57061
- const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);
57062
- const textDecoder = new TextDecoder();
57063
- const gltfUrl = textDecoder.decode(gltfUrlBytes);
57064
- tile.gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
57215
+ if (tile.gltfArrayBuffer) {
57216
+ const gltfUrlBytes = new Uint8Array(tile.gltfArrayBuffer, tile.gltfByteOffset);
57217
+ const textDecoder = new TextDecoder();
57218
+ const gltfUrl = textDecoder.decode(gltfUrlBytes);
57219
+ tile.gltfUrl = gltfUrl.replace(/[\s\0]+$/, "");
57220
+ }
57065
57221
  delete tile.gltfArrayBuffer;
57066
57222
  delete tile.gltfByteOffset;
57067
57223
  delete tile.gltfByteLength;
@@ -57098,7 +57254,7 @@ var import_core16 = __toModule(require_es5());
57098
57254
  var import_geospatial7 = __toModule(require_es52());
57099
57255
  async function parseInstancedModel3DTile(tile, arrayBuffer, byteOffset, options, context) {
57100
57256
  byteOffset = parseInstancedModel(tile, arrayBuffer, byteOffset, options, context);
57101
- await extractGLTF(tile, tile.gltfFormat, options, context);
57257
+ await extractGLTF(tile, tile.gltfFormat || 0, options, context);
57102
57258
  return byteOffset;
57103
57259
  }
57104
57260
  function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
@@ -57112,7 +57268,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
57112
57268
  byteOffset += 4;
57113
57269
  byteOffset = parse3DTileTablesSync(tile, arrayBuffer, byteOffset, options);
57114
57270
  byteOffset = parse3DTileGLTFViewSync(tile, arrayBuffer, byteOffset, options);
57115
- if (tile.featureTableJsonByteLength === 0) {
57271
+ if (!tile?.header?.featureTableJsonByteLength || tile.header.featureTableJsonByteLength === 0) {
57116
57272
  throw new Error("i3dm parser: featureTableJsonByteLength is zero.");
57117
57273
  }
57118
57274
  const featureTable = new Tile3DFeatureTable(tile.featureTableJson, tile.featureTableBinary);
@@ -57128,17 +57284,7 @@ function parseInstancedModel(tile, arrayBuffer, byteOffset, options, context) {
57128
57284
  return byteOffset;
57129
57285
  }
57130
57286
  function extractInstancedAttributes(tile, featureTable, batchTable, instancesLength) {
57131
- const collectionOptions = {
57132
- instances: new Array(instancesLength),
57133
- batchTable: tile._batchTable,
57134
- cull: false,
57135
- url: void 0,
57136
- gltf: void 0,
57137
- basePath: void 0,
57138
- incrementallyLoadTextures: false,
57139
- forwardAxis: [1, 0, 0]
57140
- };
57141
- const instances = collectionOptions.instances;
57287
+ const instances = new Array(instancesLength);
57142
57288
  const instancePosition = new import_core16.Vector3();
57143
57289
  const instanceNormalRight = new import_core16.Vector3();
57144
57290
  const instanceNormalUp = new import_core16.Vector3();
@@ -57150,19 +57296,19 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
57150
57296
  const instanceTransform = new import_core16.Matrix4();
57151
57297
  const scratch1 = [];
57152
57298
  const scratch2 = [];
57153
- const scratchVector1 = new import_core16.Vector3();
57154
- const scratchVector23 = new import_core16.Vector3();
57299
+ const scratch3 = [];
57300
+ const scratch4 = [];
57155
57301
  for (let i = 0; i < instancesLength; i++) {
57156
57302
  let position;
57157
57303
  if (featureTable.hasProperty("POSITION")) {
57158
57304
  position = featureTable.getProperty("POSITION", GL2.FLOAT, 3, i, instancePosition);
57159
57305
  } else if (featureTable.hasProperty("POSITION_QUANTIZED")) {
57160
57306
  position = featureTable.getProperty("POSITION_QUANTIZED", GL2.UNSIGNED_SHORT, 3, i, instancePosition);
57161
- const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", GL2.FLOAT, 3, scratchVector1);
57307
+ const quantizedVolumeOffset = featureTable.getGlobalProperty("QUANTIZED_VOLUME_OFFSET", GL2.FLOAT, 3);
57162
57308
  if (!quantizedVolumeOffset) {
57163
57309
  throw new Error("i3dm parser: QUANTIZED_VOLUME_OFFSET must be defined for quantized positions.");
57164
57310
  }
57165
- const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3, scratchVector23);
57311
+ const quantizedVolumeScale = featureTable.getGlobalProperty("QUANTIZED_VOLUME_SCALE", GL2.FLOAT, 3);
57166
57312
  if (!quantizedVolumeScale) {
57167
57313
  throw new Error("i3dm parser: QUANTIZED_VOLUME_SCALE must be defined for quantized positions.");
57168
57314
  }
@@ -57185,8 +57331,8 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
57185
57331
  }
57186
57332
  tile.hasCustomOrientation = true;
57187
57333
  } else {
57188
- tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", GL2.UNSIGNED_SHORT, 2, scratch1);
57189
- tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", GL2.UNSIGNED_SHORT, 2, scratch2);
57334
+ tile.octNormalUp = featureTable.getProperty("NORMAL_UP_OCT32P", GL2.UNSIGNED_SHORT, 2, i, scratch1);
57335
+ tile.octNormalRight = featureTable.getProperty("NORMAL_RIGHT_OCT32P", GL2.UNSIGNED_SHORT, 2, i, scratch2);
57190
57336
  if (tile.octNormalUp) {
57191
57337
  if (!tile.octNormalRight) {
57192
57338
  throw new Error("i3dm: oct-encoded orientation requires NORMAL_UP_OCT32P and NORMAL_RIGHT_OCT32P");
@@ -57208,7 +57354,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
57208
57354
  instanceQuaternion.fromMatrix3(instanceRotation);
57209
57355
  instanceTranslationRotationScale.rotation = instanceQuaternion;
57210
57356
  instanceScale.set(1, 1, 1);
57211
- const scale = featureTable.getProperty("SCALE", GL2.FLOAT, 1, i);
57357
+ const scale = featureTable.getProperty("SCALE", GL2.FLOAT, 1, i, scratch3);
57212
57358
  if (Number.isFinite(scale)) {
57213
57359
  instanceScale.multiplyByScalar(scale);
57214
57360
  }
@@ -57217,7 +57363,7 @@ function extractInstancedAttributes(tile, featureTable, batchTable, instancesLen
57217
57363
  instanceScale.scale(nonUniformScale);
57218
57364
  }
57219
57365
  instanceTranslationRotationScale.scale = instanceScale;
57220
- let batchId = featureTable.getProperty("BATCH_ID", GL2.UNSIGNED_SHORT, 1, i);
57366
+ let batchId = featureTable.getProperty("BATCH_ID", GL2.UNSIGNED_SHORT, 1, i, scratch4);
57221
57367
  if (batchId === void 0) {
57222
57368
  batchId = i;
57223
57369
  }
@@ -57242,7 +57388,7 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
57242
57388
  tile.tilesLength = view.getUint32(byteOffset, true);
57243
57389
  byteOffset += 4;
57244
57390
  tile.tiles = [];
57245
- while (tile.tiles.length < tile.tilesLength && tile.byteLength - byteOffset > 12) {
57391
+ while (tile.tiles.length < tile.tilesLength && (tile.byteLength || 0) - byteOffset > 12) {
57246
57392
  const subtile = {};
57247
57393
  tile.tiles.push(subtile);
57248
57394
  byteOffset = await parse3DTile2(arrayBuffer, byteOffset, options, context, subtile);
@@ -57253,11 +57399,18 @@ async function parseComposite3DTile(tile, arrayBuffer, byteOffset, options, cont
57253
57399
  // ../3d-tiles/src/lib/parsers/parse-3d-tile-gltf.ts
57254
57400
  async function parseGltf3DTile(tile, arrayBuffer, options, context) {
57255
57401
  tile.rotateYtoZ = true;
57256
- tile.gltfUpAxis = options["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
57257
- const { parse: parse7 } = context;
57258
- const gltfWithBuffers = await parse7(arrayBuffer, GLTFLoader, options, context);
57259
- tile.gltf = postProcessGLTF(gltfWithBuffers);
57260
- tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
57402
+ tile.gltfUpAxis = options?.["3d-tiles"] && options["3d-tiles"].assetGltfUpAxis ? options["3d-tiles"].assetGltfUpAxis : "Y";
57403
+ if (options?.["3d-tiles"]?.loadGLTF) {
57404
+ if (!context) {
57405
+ return;
57406
+ }
57407
+ const { parse: parse7 } = context;
57408
+ const gltfWithBuffers = await parse7(arrayBuffer, GLTFLoader, options, context);
57409
+ tile.gltf = postProcessGLTF(gltfWithBuffers);
57410
+ tile.gpuMemoryUsageInBytes = getMemoryUsageGLTF(tile.gltf);
57411
+ } else {
57412
+ tile.gltfArrayBuffer = arrayBuffer;
57413
+ }
57261
57414
  }
57262
57415
 
57263
57416
  // ../3d-tiles/src/lib/parsers/parse-3d-tile.ts
@@ -58735,11 +58888,11 @@ function getBooleanValueFromBitstream(availabilityIndex, availabilityBuffer) {
58735
58888
  }
58736
58889
 
58737
58890
  // ../3d-tiles/src/lib/parsers/parse-3d-tile-header.ts
58738
- function getTileType(tile) {
58739
- if (!tile.contentUrl) {
58891
+ function getTileType(tile, tileContentUrl = "") {
58892
+ if (!tileContentUrl) {
58740
58893
  return TILE_TYPE.EMPTY;
58741
58894
  }
58742
- const contentUrl = tile.contentUrl.split("?")[0];
58895
+ const contentUrl = tileContentUrl.split("?")[0];
58743
58896
  const fileExtension = contentUrl.split(".").pop();
58744
58897
  switch (fileExtension) {
58745
58898
  case "pnts":
@@ -58750,7 +58903,7 @@ function getTileType(tile) {
58750
58903
  case "gltf":
58751
58904
  return TILE_TYPE.SCENEGRAPH;
58752
58905
  default:
58753
- return fileExtension;
58906
+ return fileExtension || TILE_TYPE.EMPTY;
58754
58907
  }
58755
58908
  }
58756
58909
  function getRefine(refine) {
@@ -58765,7 +58918,7 @@ function getRefine(refine) {
58765
58918
  return refine;
58766
58919
  }
58767
58920
  }
58768
- function resolveUri(uri, basePath) {
58921
+ function resolveUri(uri = "", basePath) {
58769
58922
  const urlSchemeRegex = /^[a-z][0-9a-z+.-]*:/i;
58770
58923
  if (urlSchemeRegex.test(basePath)) {
58771
58924
  const url = new URL(uri, `${basePath}/`);
@@ -58775,50 +58928,59 @@ function resolveUri(uri, basePath) {
58775
58928
  }
58776
58929
  return `${basePath}/${uri}`;
58777
58930
  }
58778
- function normalizeTileData(tile, options) {
58931
+ function normalizeTileData(tile, basePath) {
58779
58932
  if (!tile) {
58780
58933
  return null;
58781
58934
  }
58935
+ let tileContentUrl;
58782
58936
  if (tile.content) {
58783
- const contentUri = tile.content.uri || tile.content.url;
58784
- tile.contentUrl = resolveUri(contentUri, options.basePath);
58785
- }
58786
- tile.id = tile.contentUrl;
58787
- tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
58788
- tile.lodMetricValue = tile.geometricError;
58789
- tile.transformMatrix = tile.transform;
58790
- tile.type = getTileType(tile);
58791
- tile.refine = getRefine(tile.refine);
58792
- return tile;
58937
+ const contentUri = tile.content.uri || tile.content?.url;
58938
+ tileContentUrl = resolveUri(contentUri, basePath);
58939
+ }
58940
+ const tilePostprocessed = {
58941
+ ...tile,
58942
+ id: tileContentUrl,
58943
+ contentUrl: tileContentUrl,
58944
+ lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
58945
+ lodMetricValue: tile.geometricError,
58946
+ transformMatrix: tile.transform,
58947
+ type: getTileType(tile, tileContentUrl),
58948
+ refine: getRefine(tile.refine)
58949
+ };
58950
+ return tilePostprocessed;
58793
58951
  }
58794
- async function normalizeTileHeaders(tileset, options) {
58795
- const basePath = tileset.basePath;
58796
- let root;
58797
- const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset?.root);
58952
+ async function normalizeTileHeaders(tileset, basePath, options) {
58953
+ let root = null;
58954
+ const rootImplicitTilingExtension = getImplicitTilingExtensionData(tileset.root);
58798
58955
  if (rootImplicitTilingExtension && tileset.root) {
58799
- root = await normalizeImplicitTileHeaders(tileset.root, tileset, rootImplicitTilingExtension, options);
58956
+ root = await normalizeImplicitTileHeaders(tileset.root, tileset, basePath, rootImplicitTilingExtension, options);
58800
58957
  } else {
58801
- root = normalizeTileData(tileset.root, tileset);
58958
+ root = normalizeTileData(tileset.root, basePath);
58802
58959
  }
58803
58960
  const stack2 = [];
58804
58961
  stack2.push(root);
58805
58962
  while (stack2.length > 0) {
58806
58963
  const tile = stack2.pop() || {};
58807
58964
  const children = tile.children || [];
58808
- for (let childHeader of children) {
58965
+ const childrenPostprocessed = [];
58966
+ for (const childHeader of children) {
58809
58967
  const childImplicitTilingExtension = getImplicitTilingExtensionData(childHeader);
58968
+ let childHeaderPostprocessed;
58810
58969
  if (childImplicitTilingExtension) {
58811
- childHeader = await normalizeImplicitTileHeaders(childHeader, tileset, childImplicitTilingExtension, options);
58970
+ childHeaderPostprocessed = await normalizeImplicitTileHeaders(childHeader, tileset, basePath, childImplicitTilingExtension, options);
58812
58971
  } else {
58813
- normalizeTileData(childHeader, { basePath });
58972
+ childHeaderPostprocessed = normalizeTileData(childHeader, basePath);
58973
+ }
58974
+ if (childHeaderPostprocessed) {
58975
+ childrenPostprocessed.push(childHeaderPostprocessed);
58976
+ stack2.push(childHeaderPostprocessed);
58814
58977
  }
58815
- stack2.push(childHeader);
58816
58978
  }
58979
+ tile.children = childrenPostprocessed;
58817
58980
  }
58818
58981
  return root;
58819
58982
  }
58820
- async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtension, options) {
58821
- const basePath = tileset.basePath;
58983
+ async function normalizeImplicitTileHeaders(tile, tileset, basePath, implicitTilingExtension, options) {
58822
58984
  const {
58823
58985
  subdivisionScheme,
58824
58986
  maximumLevel,
@@ -58828,7 +58990,7 @@ async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtensi
58828
58990
  const replacedUrlTemplate = replaceContentUrlTemplate(subtreesUriTemplate, 0, 0, 0, 0);
58829
58991
  const subtreeUrl = resolveUri(replacedUrlTemplate, basePath);
58830
58992
  const subtree = await load(subtreeUrl, Tile3DSubtreeLoader, options);
58831
- const contentUrlTemplate = resolveUri(tile.content.uri, basePath);
58993
+ const contentUrlTemplate = resolveUri(tile.content?.uri, basePath);
58832
58994
  const refine = tileset?.root?.refine;
58833
58995
  const rootLodMetricValue = tile.geometricError;
58834
58996
  const s2VolumeInfo = tile.boundingVolume.extensions?.["3DTILES_bounding_volume_S2"];
@@ -58852,29 +59014,35 @@ async function normalizeImplicitTileHeaders(tile, tileset, implicitTilingExtensi
58852
59014
  getTileType,
58853
59015
  getRefine
58854
59016
  };
58855
- return await normalizeImplicitTileData(tile, subtree, implicitOptions);
59017
+ return await normalizeImplicitTileData(tile, basePath, subtree, implicitOptions);
58856
59018
  }
58857
- async function normalizeImplicitTileData(tile, rootSubtree, options) {
59019
+ async function normalizeImplicitTileData(tile, basePath, rootSubtree, options) {
58858
59020
  if (!tile) {
58859
59021
  return null;
58860
59022
  }
58861
- tile.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
58862
- tile.lodMetricValue = tile.geometricError;
58863
- tile.transformMatrix = tile.transform;
58864
59023
  const { children, contentUrl } = await parseImplicitTiles({
58865
59024
  subtree: rootSubtree,
58866
- options,
58867
- s2VolumeBox: tile
59025
+ options
58868
59026
  });
59027
+ let tileContentUrl;
59028
+ let tileContent = null;
58869
59029
  if (contentUrl) {
58870
- tile.contentUrl = contentUrl;
58871
- tile.content = { uri: contentUrl.replace(`${options.basePath}/`, "") };
59030
+ tileContentUrl = contentUrl;
59031
+ tileContent = { uri: contentUrl.replace(`${basePath}/`, "") };
58872
59032
  }
58873
- tile.refine = getRefine(tile.refine);
58874
- tile.type = getTileType(tile);
58875
- tile.children = children;
58876
- tile.id = tile.contentUrl;
58877
- return tile;
59033
+ const tilePostprocessed = {
59034
+ ...tile,
59035
+ id: tileContentUrl,
59036
+ contentUrl: tileContentUrl,
59037
+ lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
59038
+ lodMetricValue: tile.geometricError,
59039
+ transformMatrix: tile.transform,
59040
+ type: getTileType(tile, tileContentUrl),
59041
+ refine: getRefine(tile.refine),
59042
+ content: tileContent || tile.content,
59043
+ children
59044
+ };
59045
+ return tilePostprocessed;
58878
59046
  }
58879
59047
  function getImplicitTilingExtensionData(tile) {
58880
59048
  return tile?.extensions?.["3DTILES_implicit_tiling"] || tile?.implicitTiling;
@@ -58907,19 +59075,25 @@ async function parse4(data, options = {}, context) {
58907
59075
  } else {
58908
59076
  isTileset = loaderOptions.isTileset;
58909
59077
  }
58910
- return await isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);
59078
+ return isTileset ? parseTileset(data, options, context) : parseTile(data, options, context);
58911
59079
  }
58912
59080
  async function parseTileset(data, options, context) {
58913
59081
  const tilesetJson = JSON.parse(new TextDecoder().decode(data));
58914
- tilesetJson.loader = options?.loader || Tiles3DLoader;
58915
- tilesetJson.url = context?.url || "";
58916
- tilesetJson.queryString = context?.queryString || "";
58917
- tilesetJson.basePath = getBaseUri(tilesetJson);
58918
- tilesetJson.root = await normalizeTileHeaders(tilesetJson, options || {});
58919
- tilesetJson.type = TILESET_TYPE.TILES3D;
58920
- tilesetJson.lodMetricType = LOD_METRIC_TYPE.GEOMETRIC_ERROR;
58921
- tilesetJson.lodMetricValue = tilesetJson.root?.lodMetricValue || 0;
58922
- return tilesetJson;
59082
+ const tilesetUrl = context?.url || "";
59083
+ const basePath = getBaseUri(tilesetUrl);
59084
+ const normalizedRoot = await normalizeTileHeaders(tilesetJson, basePath, options || {});
59085
+ const tilesetJsonPostprocessed = {
59086
+ ...tilesetJson,
59087
+ loader: Tiles3DLoader,
59088
+ url: tilesetUrl,
59089
+ queryString: context?.queryString || "",
59090
+ basePath,
59091
+ root: normalizedRoot || tilesetJson.root,
59092
+ type: TILESET_TYPE.TILES3D,
59093
+ lodMetricType: LOD_METRIC_TYPE.GEOMETRIC_ERROR,
59094
+ lodMetricValue: tilesetJson.root?.geometricError || 0
59095
+ };
59096
+ return tilesetJsonPostprocessed;
58923
59097
  }
58924
59098
  async function parseTile(arrayBuffer, options, context) {
58925
59099
  const tile = {
@@ -58931,8 +59105,8 @@ async function parseTile(arrayBuffer, options, context) {
58931
59105
  await parse3DTile(arrayBuffer, byteOffset, options, context, tile.content);
58932
59106
  return tile.content;
58933
59107
  }
58934
- function getBaseUri(tileset) {
58935
- return path_exports.dirname(tileset.url);
59108
+ function getBaseUri(tilesetUrl) {
59109
+ return path_exports.dirname(tilesetUrl);
58936
59110
  }
58937
59111
 
58938
59112
  // ../3d-tiles/src/lib/ion/ion.ts
@@ -59193,7 +59367,7 @@ async function isFileExists(fileName) {
59193
59367
  }
59194
59368
  }
59195
59369
  function removeDir(path2) {
59196
- return import_fs3.promises.rmdir(path2, { recursive: true });
59370
+ return import_fs3.promises.rm(path2, { recursive: true });
59197
59371
  }
59198
59372
  function removeFile(path2) {
59199
59373
  return import_fs3.promises.unlink(path2);
@@ -59440,8 +59614,8 @@ async function getTotalFilesSize(dirPath) {
59440
59614
  }
59441
59615
 
59442
59616
  // src/i3s-converter/helpers/geometry-converter.ts
59443
- var import_core24 = __toModule(require_es5());
59444
- var import_geospatial10 = __toModule(require_es52());
59617
+ var import_core25 = __toModule(require_es5());
59618
+ var import_geospatial11 = __toModule(require_es52());
59445
59619
  var import_md5 = __toModule(require_md52());
59446
59620
 
59447
59621
  // src/i3s-converter/helpers/geometry-attributes.ts
@@ -59615,19 +59789,18 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
59615
59789
  var import_core23 = __toModule(require_es5());
59616
59790
  var import_geospatial9 = __toModule(require_es52());
59617
59791
  var import_culling6 = __toModule(require_es53());
59618
- function createBoundingVolumes(tile, geoidHeightModel) {
59792
+ function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
59619
59793
  let radius;
59620
59794
  let halfSize;
59621
59795
  let quaternion;
59622
- const boundingVolume = tile.boundingVolume;
59623
- const cartographicCenter = import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core23.Vector3());
59796
+ const cartographicCenter = import_geospatial9.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core23.Vector3());
59624
59797
  cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
59625
- if (boundingVolume instanceof import_culling6.OrientedBoundingBox) {
59626
- halfSize = boundingVolume.halfSize;
59798
+ if (sourceBoundingVolume instanceof import_culling6.OrientedBoundingBox) {
59799
+ halfSize = sourceBoundingVolume.halfSize;
59627
59800
  radius = new import_core23.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
59628
- quaternion = boundingVolume.quaternion;
59801
+ quaternion = sourceBoundingVolume.quaternion;
59629
59802
  } else {
59630
- radius = tile.boundingVolume.radius;
59803
+ radius = sourceBoundingVolume.radius;
59631
59804
  halfSize = [radius, radius, radius];
59632
59805
  quaternion = new import_core23.Quaternion().fromMatrix3(new import_core23.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
59633
59806
  }
@@ -59693,16 +59866,9 @@ function createObbFromMbs(mbs) {
59693
59866
  }
59694
59867
 
59695
59868
  // src/i3s-converter/helpers/gltf-attributes.ts
59696
- function getB3DMAttributesWithoutBufferView(attributes) {
59697
- const attributesWithoutBufferView = {};
59698
- for (const attributeName in attributes) {
59699
- attributesWithoutBufferView[attributeName] = {
59700
- value: attributes[attributeName].value
59701
- };
59702
- }
59703
- return attributesWithoutBufferView;
59704
- }
59705
- function prepareDataForAttributesConversion(tileContent) {
59869
+ var import_core24 = __toModule(require_es5());
59870
+ var import_geospatial10 = __toModule(require_es52());
59871
+ function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
59706
59872
  let nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
59707
59873
  const images = tileContent.gltf?.images?.map((imageObject) => {
59708
59874
  if (imageObject?.image?.compressed) {
@@ -59722,8 +59888,7 @@ function prepareDataForAttributesConversion(tileContent) {
59722
59888
  }
59723
59889
  }) || [];
59724
59890
  prepareNodes(nodes);
59725
- const cartographicOrigin = tileContent.cartographicOrigin;
59726
- const cartesianModelMatrix = tileContent.cartesianModelMatrix;
59891
+ const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps2(tileContent, tileTransform, boundingVolume);
59727
59892
  return {
59728
59893
  nodes,
59729
59894
  images,
@@ -59731,6 +59896,40 @@ function prepareDataForAttributesConversion(tileContent) {
59731
59896
  cartesianModelMatrix
59732
59897
  };
59733
59898
  }
59899
+ function getB3DMAttributesWithoutBufferView(attributes) {
59900
+ const attributesWithoutBufferView = {};
59901
+ for (const attributeName in attributes) {
59902
+ attributesWithoutBufferView[attributeName] = {
59903
+ value: attributes[attributeName].value
59904
+ };
59905
+ }
59906
+ return attributesWithoutBufferView;
59907
+ }
59908
+ function calculateTransformProps2(tileContent, tileTransform, boundingVolume) {
59909
+ const { rtcCenter, gltfUpAxis } = tileContent;
59910
+ const { center } = boundingVolume;
59911
+ let modelMatrix = new import_core24.Matrix4(tileTransform);
59912
+ if (rtcCenter) {
59913
+ modelMatrix.translate(rtcCenter);
59914
+ }
59915
+ switch (gltfUpAxis) {
59916
+ case "Z":
59917
+ break;
59918
+ case "Y":
59919
+ const rotationY = new import_core24.Matrix4().rotateX(Math.PI / 2);
59920
+ modelMatrix = modelMatrix.multiplyRight(rotationY);
59921
+ break;
59922
+ case "X":
59923
+ const rotationX = new import_core24.Matrix4().rotateY(-Math.PI / 2);
59924
+ modelMatrix = modelMatrix.multiplyRight(rotationX);
59925
+ break;
59926
+ default:
59927
+ break;
59928
+ }
59929
+ const cartesianOrigin = new import_core24.Vector3(center);
59930
+ const cartographicOrigin = import_geospatial10.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core24.Vector3());
59931
+ return { modelMatrix, cartographicOrigin };
59932
+ }
59734
59933
  function prepareNodes(nodes) {
59735
59934
  for (let index = 0; index < nodes.length; index++) {
59736
59935
  const node2 = nodes[index];
@@ -59797,8 +59996,8 @@ function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, image
59797
59996
  }
59798
59997
  const featureTexture = extFeatureMetadata?.featureTextures && extFeatureMetadata?.featureTextures[0];
59799
59998
  if (featureTexture) {
59800
- console.warn("EXT_feature_metadata doesn't yet support featureTextures in primitive");
59801
- return [];
59999
+ const batchIdsAttribute = attributes[featureTexture];
60000
+ return batchIdsAttribute.value;
59802
60001
  }
59803
60002
  return [];
59804
60003
  }
@@ -59842,8 +60041,8 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
59842
60041
  for (let index = 0; index < textureCoordinates.length; index += 2) {
59843
60042
  const u = textureCoordinates[index];
59844
60043
  const v = textureCoordinates[index + 1];
59845
- const tx = Math.min(emod(u) * image.width | 0, image.width - 1);
59846
- const ty = Math.min(emod(v) * image.height | 0, image.height - 1);
60044
+ const tx = Math.min(emod2(u) * image.width | 0, image.width - 1);
60045
+ const ty = Math.min(emod2(v) * image.height | 0, image.height - 1);
59847
60046
  const offset = (ty * image.width + tx) * image.components + channels;
59848
60047
  const batchId = new Uint8Array(image.data)[offset];
59849
60048
  batchIds.push(batchId);
@@ -59853,7 +60052,7 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
59853
60052
  }
59854
60053
  return batchIds;
59855
60054
  }
59856
- function emod(n) {
60055
+ function emod2(n) {
59857
60056
  return (n % 1 + 1) % 1;
59858
60057
  }
59859
60058
 
@@ -60018,11 +60217,11 @@ var OBJECT_ID_TYPE2 = "Oid32";
60018
60217
  var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
60019
60218
  var EXT_FEATURE_METADATA3 = "EXT_feature_metadata";
60020
60219
  var EXT_MESH_FEATURES2 = "EXT_mesh_features";
60021
- var scratchVector5 = new import_core24.Vector3();
60022
- async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
60220
+ var scratchVector5 = new import_core25.Vector3();
60221
+ async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
60023
60222
  const useCartesianPositions = generateBoundingVolumes;
60024
60223
  const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
60025
- const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
60224
+ const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent, tileTransform, tileBoundingVolume);
60026
60225
  const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
60027
60226
  if (generateBoundingVolumes) {
60028
60227
  _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
@@ -60064,7 +60263,7 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
60064
60263
  const cartographicOrigin = boundingVolumes.obb.center;
60065
60264
  for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
60066
60265
  const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
60067
- import_geospatial10.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector5);
60266
+ import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector5);
60068
60267
  scratchVector5[2] = scratchVector5[2] - geoidHeightModel.getHeight(scratchVector5[1], scratchVector5[0]);
60069
60268
  scratchVector5 = scratchVector5.subtract(cartographicOrigin);
60070
60269
  attributes.positions.set(scratchVector5, index);
@@ -60156,7 +60355,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
60156
60355
  }
60157
60356
  return attributesMap;
60158
60357
  }
60159
- function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core24.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60358
+ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60160
60359
  if (nodes) {
60161
60360
  for (const node2 of nodes) {
60162
60361
  convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
@@ -60180,7 +60379,7 @@ function getCompositeTransformationMatrix(node2, matrix) {
60180
60379
  }
60181
60380
  return transformationMatrix;
60182
60381
  }
60183
- function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core24.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60382
+ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60184
60383
  const transformationMatrix = getCompositeTransformationMatrix(node2, matrix);
60185
60384
  const mesh = node2.mesh;
60186
60385
  if (mesh) {
@@ -60188,7 +60387,7 @@ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, at
60188
60387
  }
60189
60388
  convertNodes(node2.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
60190
60389
  }
60191
- function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core24.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60390
+ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core25.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
60192
60391
  for (const primitive of mesh.primitives) {
60193
60392
  let outputAttributes = null;
60194
60393
  let materialUvRegion;
@@ -60199,7 +60398,7 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
60199
60398
  outputAttributes = attributesMap.get("default");
60200
60399
  }
60201
60400
  assert2(outputAttributes !== null, "Primitive - material mapping failed");
60202
- assert2(primitive.mode === GL2.TRIANGLES || primitive.mode === GL2.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
60401
+ assert2(primitive.mode === void 0 || primitive.mode === GL2.TRIANGLES || primitive.mode === GL2.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
60203
60402
  const attributes = primitive.attributes;
60204
60403
  if (!outputAttributes) {
60205
60404
  continue;
@@ -60266,7 +60465,7 @@ function transformVertexArray(args) {
60266
60465
  for (let i = 0; i < indices.length; i++) {
60267
60466
  const coordIndex = indices[i] * VALUES_PER_VERTEX2;
60268
60467
  const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
60269
- let vertexVector = new import_core24.Vector3(Array.from(vertex));
60468
+ let vertexVector = new import_core25.Vector3(Array.from(vertex));
60270
60469
  vertexVector = attributeSpecificTransformation(vertexVector, args);
60271
60470
  newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
60272
60471
  newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
@@ -60283,7 +60482,7 @@ function transformVertexPositions(vertexVector, calleeArgs) {
60283
60482
  if (useCartesianPositions) {
60284
60483
  return vertexVector;
60285
60484
  }
60286
- import_geospatial10.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
60485
+ import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
60287
60486
  vertexVector = vertexVector.subtract(cartographicOrigin);
60288
60487
  return vertexVector;
60289
60488
  }
@@ -60518,10 +60717,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
60518
60717
  }
60519
60718
  function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1) {
60520
60719
  const matDielectricColorComponent = 0.04 / 255;
60521
- const black = new import_core24.Vector4(0, 0, 0, 1);
60522
- const unitVector = new import_core24.Vector4(1, 1, 1, 1);
60523
- const dielectricSpecular = new import_core24.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
60524
- const baseColorVector = new import_core24.Vector4(baseColorFactor);
60720
+ const black = new import_core25.Vector4(0, 0, 0, 1);
60721
+ const unitVector = new import_core25.Vector4(1, 1, 1, 1);
60722
+ const dielectricSpecular = new import_core25.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
60723
+ const baseColorVector = new import_core25.Vector4(baseColorFactor);
60525
60724
  const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
60526
60725
  const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
60527
60726
  dielectricSpecular[3] = 1;
@@ -60723,6 +60922,9 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
60723
60922
  return orderedFeatureIndices;
60724
60923
  }
60725
60924
  function getPropertyTable(tileContent) {
60925
+ if (!tileContent) {
60926
+ return null;
60927
+ }
60726
60928
  const batchTableJson = tileContent?.batchTableJson;
60727
60929
  if (batchTableJson) {
60728
60930
  return batchTableJson;
@@ -60757,10 +60959,6 @@ function getPropertyTableExtension(tileContent) {
60757
60959
  return { extensionName, extension };
60758
60960
  }
60759
60961
  function getPropertyTableFromExtFeatureMetadata(extension) {
60760
- if (extension?.featureTextures) {
60761
- console.warn("The I3S converter does not yet support the EXT_feature_metadata feature textures");
60762
- return null;
60763
- }
60764
60962
  if (extension?.featureTables) {
60765
60963
  const firstFeatureTableName = Object.keys(extension.featureTables)?.[0];
60766
60964
  if (firstFeatureTableName) {
@@ -60772,7 +60970,18 @@ function getPropertyTableFromExtFeatureMetadata(extension) {
60772
60970
  return propertyTable;
60773
60971
  }
60774
60972
  }
60775
- console.warn("The I3S converter couldn't handle EXT_feature_metadata extension");
60973
+ if (extension?.featureTextures) {
60974
+ const firstTextureName = Object.keys(extension.featureTextures)?.[0];
60975
+ if (firstTextureName) {
60976
+ const featureTable = extension?.featureTextures[firstTextureName];
60977
+ const propertyTable = {};
60978
+ for (const propertyName in featureTable.properties) {
60979
+ propertyTable[propertyName] = featureTable.properties[propertyName].data;
60980
+ }
60981
+ return propertyTable;
60982
+ }
60983
+ }
60984
+ console.warn("The I3S converter couldn't handle EXT_feature_metadata extension: There is neither featureTables, no featureTextures in the extension.");
60776
60985
  return null;
60777
60986
  }
60778
60987
 
@@ -61320,8 +61529,8 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
61320
61529
 
61321
61530
  // src/i3s-converter/helpers/node-debug.ts
61322
61531
  var import_culling7 = __toModule(require_es53());
61323
- var import_core26 = __toModule(require_es5());
61324
- var import_geospatial11 = __toModule(require_es52());
61532
+ var import_core27 = __toModule(require_es5());
61533
+ var import_geospatial12 = __toModule(require_es52());
61325
61534
  var CUBE_POSITIONS = new Float32Array([
61326
61535
  -1,
61327
61536
  -1,
@@ -61434,10 +61643,10 @@ function createBoundingBoxFromTileObb(obb) {
61434
61643
  function getTileObbVertices(node2) {
61435
61644
  const halfSize = node2.obb.halfSize;
61436
61645
  const positions = CUBE_POSITIONS;
61437
- const obbCenterCartesian = import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
61646
+ const obbCenterCartesian = import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
61438
61647
  let vertices = [];
61439
61648
  for (let i = 0; i < positions.length; i += 3) {
61440
- const positionsVector = new import_core26.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
61649
+ const positionsVector = new import_core27.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
61441
61650
  const rotatedPositions = positionsVector.transformByQuaternion(node2.obb.quaternion).add(obbCenterCartesian);
61442
61651
  vertices = vertices.concat(rotatedPositions);
61443
61652
  }
@@ -61447,7 +61656,7 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
61447
61656
  let isVerticesInsideObb = true;
61448
61657
  for (let index = 0; index < positions.length / 3; index += 3) {
61449
61658
  const point = [positions[index], positions[index + 1], positions[index + 2]];
61450
- const cartographicPoint = import_geospatial11.Ellipsoid.WGS84.cartesianToCartographic(point);
61659
+ const cartographicPoint = import_geospatial12.Ellipsoid.WGS84.cartesianToCartographic(point);
61451
61660
  const distance = boundingVolume.distanceTo(cartographicPoint);
61452
61661
  if (distance > 0) {
61453
61662
  isVerticesInsideObb = false;
@@ -61457,6 +61666,18 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
61457
61666
  return isVerticesInsideObb;
61458
61667
  }
61459
61668
 
61669
+ // src/i3s-converter/types.ts
61670
+ var GltfPrimitiveModeString;
61671
+ (function(GltfPrimitiveModeString2) {
61672
+ GltfPrimitiveModeString2["POINTS"] = "POINTS";
61673
+ GltfPrimitiveModeString2["LINES"] = "LINES";
61674
+ GltfPrimitiveModeString2["LINE_LOOP"] = "LINE_LOOP";
61675
+ GltfPrimitiveModeString2["LINE_STRIP"] = "LINE_STRIP";
61676
+ GltfPrimitiveModeString2["TRIANGLES"] = "TRIANGLES";
61677
+ GltfPrimitiveModeString2["TRIANGLE_STRIP"] = "TRIANGLE_STRIP";
61678
+ GltfPrimitiveModeString2["TRIANGLE_FAN"] = "TRIANGLE_FAN";
61679
+ })(GltfPrimitiveModeString || (GltfPrimitiveModeString = {}));
61680
+
61460
61681
  // src/lib/utils/queue.ts
61461
61682
  var Queue = class extends Array {
61462
61683
  enqueue(val) {
@@ -61653,10 +61874,14 @@ var NodeIndexDocument = class {
61653
61874
  constructor(id, converter) {
61654
61875
  this.data = null;
61655
61876
  this.children = [];
61877
+ this._finalized = false;
61656
61878
  this.inPageId = id;
61657
61879
  this.id = id === 0 ? "root" : id.toString();
61658
61880
  this.converter = converter;
61659
61881
  }
61882
+ get finalized() {
61883
+ return this._finalized;
61884
+ }
61660
61885
  async addData(data) {
61661
61886
  if (this.converter.options.instantNodeWriting) {
61662
61887
  await this.write(data);
@@ -61690,6 +61915,9 @@ var NodeIndexDocument = class {
61690
61915
  }
61691
61916
  }
61692
61917
  async addNeighbors() {
61918
+ if (this.finalized) {
61919
+ return;
61920
+ }
61693
61921
  const nodeData = await this.load();
61694
61922
  for (const childNode of this.children) {
61695
61923
  const childNodeData = await childNode.load();
@@ -61709,14 +61937,20 @@ var NodeIndexDocument = class {
61709
61937
  await childNode.write(childNodeData);
61710
61938
  }
61711
61939
  await childNode.save();
61712
- childNode.flush();
61713
61940
  }
61941
+ this.finalize();
61714
61942
  }
61715
61943
  async save() {
61716
61944
  if (this.data) {
61717
61945
  await this.write(this.data);
61718
61946
  }
61719
61947
  }
61948
+ finalize() {
61949
+ this._finalized = true;
61950
+ for (const child of this.children) {
61951
+ child.flush();
61952
+ }
61953
+ }
61720
61954
  async write(node2) {
61721
61955
  const path2 = (0, import_path7.join)(this.converter.layers0Path, "nodes", this.id);
61722
61956
  if (this.converter.options.slpk) {
@@ -61811,6 +62045,105 @@ var NodeIndexDocument = class {
61811
62045
  }
61812
62046
  };
61813
62047
 
62048
+ // src/i3s-converter/helpers/load-3d-tiles.ts
62049
+ var loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
62050
+ const isTileset = sourceTile.type === "json";
62051
+ if (!sourceTileset || !sourceTile.contentUrl || !isTileset) {
62052
+ return;
62053
+ }
62054
+ const loadOptions = {
62055
+ ...tilesetLoadOptions,
62056
+ [sourceTileset.loader.id]: {
62057
+ isTileset,
62058
+ assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
62059
+ }
62060
+ };
62061
+ const tileContent = await load(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
62062
+ if (tileContent.root) {
62063
+ sourceTile.children = [tileContent.root];
62064
+ }
62065
+ };
62066
+ var loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) => {
62067
+ const isTileset = sourceTile.type === "json";
62068
+ if (!sourceTileset || !sourceTile.contentUrl || isTileset) {
62069
+ return null;
62070
+ }
62071
+ const loadOptions = {
62072
+ ...tilesetLoadOptions,
62073
+ [sourceTileset.loader.id]: {
62074
+ ...tilesetLoadOptions[sourceTileset.loader.id] || {},
62075
+ isTileset,
62076
+ assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
62077
+ }
62078
+ };
62079
+ const tileContent = await load(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
62080
+ return tileContent;
62081
+ };
62082
+
62083
+ // src/i3s-converter/i3s-converter.ts
62084
+ var import_core31 = __toModule(require_es5());
62085
+
62086
+ // src/i3s-converter/helpers/tileset-traversal.ts
62087
+ var traverseDatasetWith = async (tile, traversalProps, processTile, postprocessTile, maxDepth, level = 0) => {
62088
+ if (maxDepth && level > maxDepth) {
62089
+ return;
62090
+ }
62091
+ const processResults = [];
62092
+ const newTraversalProps = await processTile(tile, traversalProps);
62093
+ processResults.push(newTraversalProps);
62094
+ for (const childTile of tile.children) {
62095
+ await traverseDatasetWith(childTile, newTraversalProps, processTile, postprocessTile, maxDepth, level + 1);
62096
+ }
62097
+ postprocessTile && await postprocessTile(processResults, traversalProps);
62098
+ };
62099
+
62100
+ // src/i3s-converter/helpers/preprocess-3d-tiles.ts
62101
+ var GLTF_PRIMITIVE_MODES = [
62102
+ GltfPrimitiveModeString.POINTS,
62103
+ GltfPrimitiveModeString.LINES,
62104
+ GltfPrimitiveModeString.LINE_LOOP,
62105
+ GltfPrimitiveModeString.LINE_STRIP,
62106
+ GltfPrimitiveModeString.TRIANGLES,
62107
+ GltfPrimitiveModeString.TRIANGLE_STRIP,
62108
+ GltfPrimitiveModeString.TRIANGLE_FAN
62109
+ ];
62110
+ var analyzeTileContent = async (tile, tileContent) => {
62111
+ const result = {
62112
+ meshTopologyTypes: new Set()
62113
+ };
62114
+ if (!tileContent?.gltfArrayBuffer) {
62115
+ return result;
62116
+ }
62117
+ const gltfData = await parse(tileContent.gltfArrayBuffer, GLTFLoader, {
62118
+ gltf: { normalize: false, loadBuffers: false, loadImages: false, decompressMeshes: false }
62119
+ });
62120
+ const gltf = gltfData.json;
62121
+ if (!gltf) {
62122
+ return result;
62123
+ }
62124
+ const meshTypes = getMeshTypesFromGltf(gltf);
62125
+ result.meshTopologyTypes = meshTypes;
62126
+ return result;
62127
+ };
62128
+ var getMeshTypesFromGltf = (gltfJson) => {
62129
+ const result = new Set();
62130
+ for (const mesh of gltfJson.meshes || []) {
62131
+ for (const primitive of mesh.primitives) {
62132
+ let { mode } = primitive;
62133
+ if (typeof mode !== "number") {
62134
+ mode = 4;
62135
+ }
62136
+ result.add(GLTF_PRIMITIVE_MODES[mode]);
62137
+ }
62138
+ }
62139
+ return result;
62140
+ };
62141
+ var mergePreprocessData = (object1, object2) => {
62142
+ for (const type of object2.meshTopologyTypes) {
62143
+ object1.meshTopologyTypes.add(type);
62144
+ }
62145
+ };
62146
+
61814
62147
  // src/i3s-converter/i3s-converter.ts
61815
62148
  var ION_DEFAULT_TOKEN = import_process2.default.env?.IonToken || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";
61816
62149
  var HARDCODED_NODES_PER_PAGE = 64;
@@ -61824,11 +62157,24 @@ var I3SConverter = class {
61824
62157
  this.conversionStartTime = [0, 0];
61825
62158
  this.refreshTokenTime = [0, 0];
61826
62159
  this.sourceTileset = null;
62160
+ this.loadOptions = {
62161
+ _nodeWorkers: true,
62162
+ reuseWorkers: true,
62163
+ basis: {
62164
+ format: "rgba32",
62165
+ workerUrl: "./modules/textures/dist/basis-worker-node.js"
62166
+ },
62167
+ draco: { workerUrl: "./modules/draco/dist/draco-worker-node.js" },
62168
+ fetch: {}
62169
+ };
61827
62170
  this.geoidHeightModel = null;
61828
62171
  this.Loader = Tiles3DLoader;
61829
62172
  this.workerSource = {};
61830
62173
  this.writeQueue = new WriteQueue();
61831
62174
  this.compressList = null;
62175
+ this.preprocessData = {
62176
+ meshTopologyTypes: new Set()
62177
+ };
61832
62178
  this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE, this);
61833
62179
  this.options = {};
61834
62180
  this.layers0Path = "";
@@ -61898,41 +62244,69 @@ var I3SConverter = class {
61898
62244
  await this.loadWorkers();
61899
62245
  try {
61900
62246
  const preloadOptions = await this._fetchPreloadOptions();
61901
- const tilesetOptions = {
61902
- loadOptions: {
61903
- _nodeWorkers: true,
61904
- reuseWorkers: true,
61905
- basis: { format: "rgba32" }
61906
- }
61907
- };
61908
62247
  if (preloadOptions.headers) {
61909
- tilesetOptions.loadOptions.fetch = { headers: preloadOptions.headers };
61910
- }
61911
- Object.assign(tilesetOptions, preloadOptions);
61912
- const sourceTilesetJson = await load(inputUrl, this.Loader, tilesetOptions.loadOptions);
61913
- this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);
61914
- await this._createAndSaveTileset(outputPath, tilesetName, sourceTilesetJson?.root?.boundingVolume?.region);
61915
- await this._finishConversion({ slpk: Boolean(slpk), outputPath, tilesetName });
61916
- return sourceTilesetJson;
62248
+ this.loadOptions.fetch = { headers: preloadOptions.headers };
62249
+ }
62250
+ this.sourceTileset = await load(inputUrl, this.Loader, this.loadOptions);
62251
+ const preprocessResult = await this.preprocessConversion();
62252
+ if (preprocessResult) {
62253
+ await this._createAndSaveTileset(outputPath, tilesetName);
62254
+ await this._finishConversion({ slpk: Boolean(slpk), outputPath, tilesetName });
62255
+ }
61917
62256
  } catch (error) {
61918
62257
  throw error;
61919
62258
  } finally {
62259
+ await this.writeQueue.finalize();
61920
62260
  const workerFarm = WorkerFarm.getWorkerFarm({});
61921
62261
  workerFarm.destroy();
61922
62262
  }
62263
+ return "success";
62264
+ }
62265
+ async preprocessConversion() {
62266
+ console.log(`Analyze source tileset`);
62267
+ const sourceRootTile = this.sourceTileset.root;
62268
+ await traverseDatasetWith(sourceRootTile, null, this.analyzeTile.bind(this), void 0, this.options.maxDepth);
62269
+ const { meshTopologyTypes } = this.preprocessData;
62270
+ console.log(`------------------------------------------------`);
62271
+ console.log(`Preprocess results:`);
62272
+ console.log(`glTF mesh topology types: ${Array.from(meshTopologyTypes).join(", ")}`);
62273
+ console.log(`------------------------------------------------`);
62274
+ if (!meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLES) && !meshTopologyTypes.has(GltfPrimitiveModeString.TRIANGLE_STRIP)) {
62275
+ console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted.");
62276
+ console.log(`------------------------------------------------`);
62277
+ return false;
62278
+ }
62279
+ return true;
61923
62280
  }
61924
- async _createAndSaveTileset(outputPath, tilesetName, boundingVolumeRegion) {
62281
+ async analyzeTile(sourceTile, traversalProps) {
62282
+ if (sourceTile.type === "json") {
62283
+ await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);
62284
+ return null;
62285
+ }
62286
+ if (sourceTile.id) {
62287
+ console.log(`[analyze]: ${sourceTile.id}`);
62288
+ }
62289
+ const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, {
62290
+ ...this.loadOptions,
62291
+ "3d-tiles": { ...this.loadOptions["3d-tiles"], loadGLTF: false }
62292
+ });
62293
+ const tilePreprocessData = await analyzeTileContent(sourceTile, tileContent);
62294
+ mergePreprocessData(this.preprocessData, tilePreprocessData);
62295
+ return null;
62296
+ }
62297
+ async _createAndSaveTileset(outputPath, tilesetName) {
61925
62298
  const tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
61926
62299
  try {
61927
62300
  await removeDir(tilesetPath);
61928
62301
  } catch (e) {
61929
62302
  }
61930
62303
  this.layers0Path = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
61931
- this._formLayers0(tilesetName, boundingVolumeRegion);
61932
62304
  this.materialDefinitions = [];
61933
62305
  this.materialMap = new Map();
61934
62306
  const sourceRootTile = this.sourceTileset.root;
61935
- const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);
62307
+ const sourceBoundingVolume = createBoundingVolume(sourceRootTile.boundingVolume, new import_core31.Matrix4(sourceRootTile.transform), null);
62308
+ this._formLayers0(tilesetName, sourceBoundingVolume, this.sourceTileset?.root?.boundingVolume?.region);
62309
+ const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
61936
62310
  await this.nodePages.push({
61937
62311
  index: 0,
61938
62312
  lodThreshold: 0,
@@ -61940,7 +62314,10 @@ var I3SConverter = class {
61940
62314
  children: []
61941
62315
  });
61942
62316
  const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
61943
- await this._convertNodesTree(rootNode, sourceRootTile);
62317
+ await traverseDatasetWith(sourceRootTile, {
62318
+ transform: new import_core31.Matrix4(sourceRootTile.transform),
62319
+ parentNodes: [rootNode]
62320
+ }, this.convertTile.bind(this), this.finalizeTile.bind(this), this.options.maxDepth);
61944
62321
  this.layers0.materialDefinitions = this.materialDefinitions;
61945
62322
  this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(this.geometryConfigs.map((config) => ({
61946
62323
  geometryConfig: { ...config, draco: this.options.draco }
@@ -61958,8 +62335,11 @@ var I3SConverter = class {
61958
62335
  await this.writeQueue.finalize();
61959
62336
  await this._createSlpk(tilesetPath);
61960
62337
  }
61961
- _formLayers0(tilesetName, boundingVolumeRegion) {
61962
- const fullExtent = convertBoundingVolumeToI3SFullExtent(this.sourceTileset?.boundingVolume || this.sourceTileset?.root?.boundingVolume);
62338
+ _formLayers0(tilesetName, sourceBoundingVolume, boundingVolumeRegion) {
62339
+ if (!this.sourceTileset?.root) {
62340
+ return;
62341
+ }
62342
+ const fullExtent = convertBoundingVolumeToI3SFullExtent(sourceBoundingVolume);
61963
62343
  if (boundingVolumeRegion) {
61964
62344
  fullExtent.zmin = boundingVolumeRegion[4];
61965
62345
  fullExtent.zmax = boundingVolumeRegion[5];
@@ -61982,24 +62362,6 @@ var I3SConverter = class {
61982
62362
  };
61983
62363
  this.layers0 = (0, import_json_map_transform8.default)(layers0data, LAYERS());
61984
62364
  }
61985
- async _convertNodesTree(rootNode, sourceRootTile) {
61986
- await this.sourceTileset._loadTile(sourceRootTile);
61987
- if (this.isContentSupported(sourceRootTile)) {
61988
- const childNodes = await this._createNode(rootNode, sourceRootTile, 0);
61989
- for (const childNode of childNodes) {
61990
- await childNode.save();
61991
- }
61992
- await rootNode.addChildren(childNodes);
61993
- } else {
61994
- await this._addChildrenWithNeighborsAndWriteFile({
61995
- parentNode: rootNode,
61996
- sourceTiles: sourceRootTile.children,
61997
- level: 1
61998
- });
61999
- }
62000
- await sourceRootTile.unloadContent();
62001
- await rootNode.save();
62002
- }
62003
62365
  async _writeLayers0() {
62004
62366
  if (this.options.slpk) {
62005
62367
  await this.writeQueue.enqueue({
@@ -62023,57 +62385,54 @@ var I3SConverter = class {
62023
62385
  }
62024
62386
  }
62025
62387
  }
62026
- async _addChildrenWithNeighborsAndWriteFile(data) {
62027
- await this._addChildren(data);
62028
- await data.parentNode.addNeighbors();
62029
- }
62030
- async convertNestedTileset({
62031
- parentNode,
62032
- sourceTile,
62033
- level
62034
- }) {
62035
- await this.sourceTileset._loadTile(sourceTile);
62036
- await this._addChildren({
62037
- parentNode,
62038
- sourceTiles: sourceTile.children,
62039
- level: level + 1
62040
- });
62041
- await sourceTile.unloadContent();
62042
- }
62043
- async convertNode({
62044
- parentNode,
62045
- sourceTile,
62046
- level
62047
- }) {
62048
- const childNodes = await this._createNode(parentNode, sourceTile, level);
62049
- await parentNode.addChildren(childNodes);
62050
- }
62051
- async _addChildren(data) {
62052
- const { sourceTiles, parentNode, level } = data;
62053
- if (this.options.maxDepth && level > this.options.maxDepth) {
62054
- return;
62055
- }
62056
- for (const sourceTile of sourceTiles) {
62388
+ async convertTile(sourceTile, traversalProps) {
62389
+ if (sourceTile.type === "json" || sourceTile.type === "empty") {
62057
62390
  if (sourceTile.type === "json") {
62058
- await this.convertNestedTileset({ parentNode, sourceTile, level });
62059
- } else {
62060
- await this.convertNode({ parentNode, sourceTile, level });
62391
+ if (sourceTile.id) {
62392
+ console.log(`[load]: ${sourceTile.id}`);
62393
+ }
62394
+ await loadNestedTileset(this.sourceTileset, sourceTile, this.loadOptions);
62061
62395
  }
62062
- if (sourceTile.id) {
62063
- console.log(sourceTile.id);
62396
+ return traversalProps;
62397
+ }
62398
+ if (sourceTile.id) {
62399
+ console.log(`[convert]: ${sourceTile.id}`);
62400
+ }
62401
+ const { parentNodes, transform: transform11 } = traversalProps;
62402
+ let transformationMatrix = transform11.clone();
62403
+ if (sourceTile.transform) {
62404
+ transformationMatrix = transformationMatrix.multiplyRight(sourceTile.transform);
62405
+ }
62406
+ const parentNode = parentNodes[0];
62407
+ const childNodes = await this._createNode(parentNode, sourceTile, transformationMatrix);
62408
+ await parentNode.addChildren(childNodes);
62409
+ const newTraversalProps = {
62410
+ transform: transformationMatrix,
62411
+ parentNodes: childNodes
62412
+ };
62413
+ return newTraversalProps;
62414
+ }
62415
+ async finalizeTile(conversionResults, currentTraversalProps) {
62416
+ for (const result of conversionResults) {
62417
+ for (const node2 of result.parentNodes) {
62418
+ await node2.addNeighbors();
62064
62419
  }
62065
62420
  }
62421
+ for (const node2 of currentTraversalProps.parentNodes) {
62422
+ await node2.save();
62423
+ }
62066
62424
  }
62067
- async _createNode(parentNode, sourceTile, level) {
62425
+ async _createNode(parentNode, sourceTile, transformationMatrix) {
62068
62426
  this._checkAddRefinementTypeForTile(sourceTile);
62069
62427
  await this._updateTilesetOptions();
62070
- await this.sourceTileset._loadTile(sourceTile);
62071
- let boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
62072
- const propertyTable = getPropertyTable(sourceTile.content);
62428
+ const tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);
62429
+ const sourceBoundingVolume = createBoundingVolume(sourceTile.boundingVolume, transformationMatrix, null);
62430
+ let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
62431
+ const propertyTable = getPropertyTable(tileContent);
62073
62432
  if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {
62074
62433
  this._convertPropertyTableToNodeAttributes(propertyTable);
62075
62434
  }
62076
- const resourcesData = await this._convertResources(sourceTile, parentNode.inPageId, propertyTable);
62435
+ const resourcesData = await this._convertResources(sourceTile, transformationMatrix, sourceBoundingVolume, tileContent, parentNode.inPageId, propertyTable);
62077
62436
  const nodes = [];
62078
62437
  const nodeIds = [];
62079
62438
  const nodesInPage = [];
@@ -62112,16 +62471,10 @@ var I3SConverter = class {
62112
62471
  nodeIds.push(nodeInPage.index);
62113
62472
  nodesInPage.push(nodeInPage);
62114
62473
  }
62115
- sourceTile.unloadContent();
62116
- await this._addChildrenWithNeighborsAndWriteFile({
62117
- parentNode: nodes[0],
62118
- sourceTiles: sourceTile.children,
62119
- level: level + 1
62120
- });
62121
62474
  return nodes;
62122
62475
  }
62123
- async _convertResources(sourceTile, parentId, propertyTable) {
62124
- if (!this.isContentSupported(sourceTile)) {
62476
+ async _convertResources(sourceTile, transformationMatrix, boundingVolume, tileContent, parentId, propertyTable) {
62477
+ if (!this.isContentSupported(sourceTile) || !tileContent) {
62125
62478
  return null;
62126
62479
  }
62127
62480
  const draftObb = {
@@ -62129,7 +62482,7 @@ var I3SConverter = class {
62129
62482
  halfSize: [],
62130
62483
  quaternion: []
62131
62484
  };
62132
- const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
62485
+ const resourcesData = await convertB3dmToI3sGeometry(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
62133
62486
  return resourcesData;
62134
62487
  }
62135
62488
  async _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
@@ -62399,10 +62752,9 @@ var I3SConverter = class {
62399
62752
  }
62400
62753
  this.refreshTokenTime = import_process2.default.hrtime();
62401
62754
  const preloadOptions = await this._fetchPreloadOptions();
62402
- this.sourceTileset.options = { ...this.sourceTileset.options, ...preloadOptions };
62403
62755
  if (preloadOptions.headers) {
62404
- this.sourceTileset.loadOptions.fetch = {
62405
- ...this.sourceTileset.loadOptions.fetch,
62756
+ this.loadOptions.fetch = {
62757
+ ...this.loadOptions.fetch,
62406
62758
  headers: preloadOptions.headers
62407
62759
  };
62408
62760
  console.log("Authorization Bearer token has been updated");
@@ -62416,8 +62768,8 @@ var I3SConverter = class {
62416
62768
  }
62417
62769
  this.refinementCounter.tilesCount += 1;
62418
62770
  }
62419
- isContentSupported(sourceRootTile) {
62420
- return ["b3dm", "glTF"].includes(sourceRootTile?.content?.type);
62771
+ isContentSupported(sourceTile) {
62772
+ return ["b3dm", "glTF", "scenegraph"].includes(sourceTile.type || "");
62421
62773
  }
62422
62774
  async loadWorkers() {
62423
62775
  console.log(`Loading workers source...`);
@@ -62525,8 +62877,8 @@ var COORDINATE_SYSTEM;
62525
62877
  })(COORDINATE_SYSTEM || (COORDINATE_SYSTEM = {}));
62526
62878
 
62527
62879
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
62528
- var import_core30 = __toModule(require_es5());
62529
- var import_geospatial12 = __toModule(require_es52());
62880
+ var import_core34 = __toModule(require_es5());
62881
+ var import_geospatial13 = __toModule(require_es52());
62530
62882
 
62531
62883
  // ../i3s/src/lib/utils/url-utils.ts
62532
62884
  function getUrlWithToken(url, token = null) {
@@ -62630,7 +62982,7 @@ function getAttributeValueType(attribute) {
62630
62982
  return "";
62631
62983
  }
62632
62984
 
62633
- // ../i3s/src/lib/utils/customizeColors.ts
62985
+ // ../i3s/src/lib/utils/customize-сolors.ts
62634
62986
  async function customizeColors(colors, featureIds, tileOptions, tilesetOptions, options) {
62635
62987
  if (!options?.i3s?.colorsByAttribute) {
62636
62988
  return colors;
@@ -62660,7 +63012,13 @@ async function customizeColors(colors, featureIds, tileOptions, tilesetOptions,
62660
63012
  if (!color) {
62661
63013
  continue;
62662
63014
  }
62663
- colors.value.set(color, i * 4);
63015
+ if (options.i3s.colorsByAttribute.mode === "multiply") {
63016
+ color.forEach((colorItem, index) => {
63017
+ colors.value[i * 4 + index] = colors.value[i * 4 + index] * colorItem / 255;
63018
+ });
63019
+ } else {
63020
+ colors.value.set(color, i * 4);
63021
+ }
62664
63022
  }
62665
63023
  return colors;
62666
63024
  }
@@ -62691,7 +63049,7 @@ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attr
62691
63049
  }
62692
63050
 
62693
63051
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
62694
- var scratchVector6 = new import_core30.Vector3([0, 0, 0]);
63052
+ var scratchVector6 = new import_core34.Vector3([0, 0, 0]);
62695
63053
  function getLoaderForTextureFormat(textureFormat) {
62696
63054
  switch (textureFormat) {
62697
63055
  case "ktx-etc2":
@@ -62712,7 +63070,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
62712
63070
  indices: null,
62713
63071
  featureIds: [],
62714
63072
  vertexCount: 0,
62715
- modelMatrix: new import_core30.Matrix4(),
63073
+ modelMatrix: new import_core34.Matrix4(),
62716
63074
  coordinateSystem: 0,
62717
63075
  byteLength: 0,
62718
63076
  texture: null
@@ -62937,11 +63295,11 @@ function parsePositions2(attribute, options) {
62937
63295
  const mbs = options.mbs;
62938
63296
  const value = attribute.value;
62939
63297
  const metadata = attribute.metadata;
62940
- const enuMatrix = new import_core30.Matrix4();
62941
- const cartographicOrigin = new import_core30.Vector3(mbs[0], mbs[1], mbs[2]);
62942
- const cartesianOrigin = new import_core30.Vector3();
62943
- import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
62944
- import_geospatial12.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
63298
+ const enuMatrix = new import_core34.Matrix4();
63299
+ const cartographicOrigin = new import_core34.Vector3(mbs[0], mbs[1], mbs[2]);
63300
+ const cartesianOrigin = new import_core34.Vector3();
63301
+ import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
63302
+ import_geospatial13.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
62945
63303
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
62946
63304
  return enuMatrix;
62947
63305
  }
@@ -62955,7 +63313,7 @@ function offsetsToCartesians(vertices, metadata = {}, cartographicOrigin) {
62955
63313
  positions[i + 2] = vertices[i + 2] + cartographicOrigin.z;
62956
63314
  }
62957
63315
  for (let i = 0; i < positions.length; i += 3) {
62958
- import_geospatial12.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector6);
63316
+ import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(positions.subarray(i, i + 3), scratchVector6);
62959
63317
  positions[i] = scratchVector6.x;
62960
63318
  positions[i + 1] = scratchVector6.y;
62961
63319
  positions[i + 2] = scratchVector6.z;
@@ -62966,7 +63324,7 @@ function getModelMatrix(positions) {
62966
63324
  const metadata = positions.metadata;
62967
63325
  const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
62968
63326
  const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
62969
- const modelMatrix = new import_core30.Matrix4();
63327
+ const modelMatrix = new import_core34.Matrix4();
62970
63328
  modelMatrix[0] = scaleX;
62971
63329
  modelMatrix[5] = scaleY;
62972
63330
  return modelMatrix;
@@ -63092,7 +63450,7 @@ async function parse6(data, options, context) {
63092
63450
 
63093
63451
  // ../i3s/src/lib/parsers/parse-i3s.ts
63094
63452
  var import_culling8 = __toModule(require_es53());
63095
- var import_geospatial13 = __toModule(require_es52());
63453
+ var import_geospatial14 = __toModule(require_es52());
63096
63454
 
63097
63455
  // ../i3s/src/i3s-node-page-loader.ts
63098
63456
  var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
@@ -63310,12 +63668,12 @@ function normalizeTileNonUrlData(tile) {
63310
63668
  if (tile.mbs) {
63311
63669
  mbs = tile.mbs;
63312
63670
  boundingVolume.sphere = [
63313
- ...import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
63671
+ ...import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(tile.mbs.slice(0, 3)),
63314
63672
  tile.mbs[3]
63315
63673
  ];
63316
63674
  } else if (tile.obb) {
63317
63675
  boundingVolume.box = [
63318
- ...import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
63676
+ ...import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(tile.obb.center),
63319
63677
  ...tile.obb.halfSize,
63320
63678
  ...tile.obb.quaternion
63321
63679
  ];
@@ -63437,8 +63795,8 @@ function getMagicNumber(data) {
63437
63795
  }
63438
63796
 
63439
63797
  // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
63440
- var import_core34 = __toModule(require_es5());
63441
- var import_geospatial14 = __toModule(require_es52());
63798
+ var import_core38 = __toModule(require_es5());
63799
+ var import_geospatial15 = __toModule(require_es52());
63442
63800
  var import_culling9 = __toModule(require_es53());
63443
63801
  function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
63444
63802
  const tiles3DCenter = [
@@ -63446,7 +63804,7 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
63446
63804
  i3SObb.center[1],
63447
63805
  i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
63448
63806
  ];
63449
- const cartesianCenter = import_geospatial14.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core34.Vector3());
63807
+ const cartesianCenter = import_geospatial15.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core38.Vector3());
63450
63808
  const tiles3DObb = new import_culling9.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
63451
63809
  return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
63452
63810
  }