@loaders.gl/tile-converter 4.2.0-alpha.4 → 4.2.0-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (144) hide show
  1. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +3 -3
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  3. package/dist/3d-tiles-converter/3d-tiles-converter.js +329 -293
  4. package/dist/3d-tiles-converter/helpers/b3dm-converter.js +257 -200
  5. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +14 -5
  6. package/dist/3d-tiles-converter/helpers/load-i3s.js +106 -75
  7. package/dist/3d-tiles-converter/helpers/texture-atlas.js +44 -21
  8. package/dist/3d-tiles-converter/json-templates/tileset.js +32 -33
  9. package/dist/constants.js +0 -1
  10. package/dist/converter-cli.js +255 -234
  11. package/dist/converter.min.cjs +80 -90
  12. package/dist/deps-installer/deps-installer.js +72 -58
  13. package/dist/i3s-converter/helpers/attribute-metadata-info.js +207 -153
  14. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +1 -1
  15. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  16. package/dist/i3s-converter/helpers/batch-ids-extensions.js +145 -103
  17. package/dist/i3s-converter/helpers/coordinate-converter.js +100 -65
  18. package/dist/i3s-converter/helpers/create-scene-server-path.js +14 -9
  19. package/dist/i3s-converter/helpers/feature-attributes.js +168 -105
  20. package/dist/i3s-converter/helpers/geometry-attributes.d.ts +1 -1
  21. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  22. package/dist/i3s-converter/helpers/geometry-attributes.js +204 -212
  23. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -2
  24. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  25. package/dist/i3s-converter/helpers/geometry-converter.js +1148 -829
  26. package/dist/i3s-converter/helpers/gltf-attributes.d.ts +1 -1
  27. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  28. package/dist/i3s-converter/helpers/gltf-attributes.js +111 -97
  29. package/dist/i3s-converter/helpers/load-3d-tiles.js +103 -66
  30. package/dist/i3s-converter/helpers/node-debug.js +98 -54
  31. package/dist/i3s-converter/helpers/node-index-document.d.ts +3 -3
  32. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
  33. package/dist/i3s-converter/helpers/node-index-document.js +248 -177
  34. package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
  35. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  36. package/dist/i3s-converter/helpers/node-pages.js +299 -194
  37. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts +1 -1
  38. package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
  39. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +92 -60
  40. package/dist/i3s-converter/helpers/progress.js +134 -83
  41. package/dist/i3s-converter/helpers/tileset-traversal.d.ts +1 -1
  42. package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
  43. package/dist/i3s-converter/helpers/tileset-traversal.js +24 -13
  44. package/dist/i3s-converter/i3s-converter.d.ts +7 -7
  45. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  46. package/dist/i3s-converter/i3s-converter.js +1044 -898
  47. package/dist/i3s-converter/json-templates/geometry-definitions.js +70 -79
  48. package/dist/i3s-converter/json-templates/layers.js +120 -121
  49. package/dist/i3s-converter/json-templates/metadata.js +19 -20
  50. package/dist/i3s-converter/json-templates/node.js +73 -71
  51. package/dist/i3s-converter/json-templates/scene-server.js +25 -26
  52. package/dist/i3s-converter/json-templates/shared-resources.js +107 -108
  53. package/dist/i3s-converter/json-templates/store.js +96 -94
  54. package/dist/i3s-converter/types.js +35 -23
  55. package/dist/i3s-server/app.js +15 -12
  56. package/dist/i3s-server/bin/www.js +14 -7
  57. package/dist/i3s-server/controllers/index-controller.js +18 -15
  58. package/dist/i3s-server/controllers/slpk-controller.js +22 -11
  59. package/dist/i3s-server/routes/index.js +9 -8
  60. package/dist/i3s-server/routes/slpk-router.js +18 -17
  61. package/dist/i3s-server/utils/create-scene-server.js +15 -10
  62. package/dist/i3s-server/utils/server-utils.js +49 -32
  63. package/dist/index.cjs +292 -851
  64. package/dist/index.cjs.map +7 -0
  65. package/dist/index.d.ts +2 -2
  66. package/dist/index.d.ts.map +1 -1
  67. package/dist/index.js +0 -1
  68. package/dist/lib/json-schemas/conversion-dump-json-schema.js +243 -421
  69. package/dist/lib/utils/cli-utils.js +63 -36
  70. package/dist/lib/utils/compress-util.js +20 -15
  71. package/dist/lib/utils/conversion-dump.d.ts +1 -1
  72. package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
  73. package/dist/lib/utils/conversion-dump.js +209 -187
  74. package/dist/lib/utils/file-utils.js +122 -74
  75. package/dist/lib/utils/geometry-utils.js +13 -7
  76. package/dist/lib/utils/lod-conversion-utils.js +65 -33
  77. package/dist/lib/utils/queue.js +12 -13
  78. package/dist/lib/utils/statistic-utills.d.ts +6 -23
  79. package/dist/lib/utils/statistic-utills.js +64 -59
  80. package/dist/lib/utils/write-queue.d.ts +2 -2
  81. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  82. package/dist/lib/utils/write-queue.js +68 -86
  83. package/dist/pgm-loader.js +16 -12
  84. package/dist/slpk-extractor/slpk-extractor.js +59 -50
  85. package/dist/slpk-extractor-cli.js +82 -59
  86. package/package.json +18 -18
  87. package/dist/3d-tiles-converter/3d-tiles-converter.js.map +0 -1
  88. package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +0 -1
  89. package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +0 -1
  90. package/dist/3d-tiles-converter/helpers/load-i3s.js.map +0 -1
  91. package/dist/3d-tiles-converter/helpers/texture-atlas.js.map +0 -1
  92. package/dist/3d-tiles-converter/json-templates/tileset.js.map +0 -1
  93. package/dist/constants.js.map +0 -1
  94. package/dist/converter-cli.js.map +0 -1
  95. package/dist/deps-installer/deps-installer.js.map +0 -1
  96. package/dist/i3s-converter/helpers/attribute-metadata-info.js.map +0 -1
  97. package/dist/i3s-converter/helpers/batch-ids-extensions.js.map +0 -1
  98. package/dist/i3s-converter/helpers/coordinate-converter.js.map +0 -1
  99. package/dist/i3s-converter/helpers/create-scene-server-path.js.map +0 -1
  100. package/dist/i3s-converter/helpers/feature-attributes.js.map +0 -1
  101. package/dist/i3s-converter/helpers/geometry-attributes.js.map +0 -1
  102. package/dist/i3s-converter/helpers/geometry-converter.js.map +0 -1
  103. package/dist/i3s-converter/helpers/gltf-attributes.js.map +0 -1
  104. package/dist/i3s-converter/helpers/load-3d-tiles.js.map +0 -1
  105. package/dist/i3s-converter/helpers/node-debug.js.map +0 -1
  106. package/dist/i3s-converter/helpers/node-index-document.js.map +0 -1
  107. package/dist/i3s-converter/helpers/node-pages.js.map +0 -1
  108. package/dist/i3s-converter/helpers/preprocess-3d-tiles.js.map +0 -1
  109. package/dist/i3s-converter/helpers/progress.js.map +0 -1
  110. package/dist/i3s-converter/helpers/tileset-traversal.js.map +0 -1
  111. package/dist/i3s-converter/i3s-converter.js.map +0 -1
  112. package/dist/i3s-converter/json-templates/geometry-definitions.js.map +0 -1
  113. package/dist/i3s-converter/json-templates/layers.js.map +0 -1
  114. package/dist/i3s-converter/json-templates/metadata.js.map +0 -1
  115. package/dist/i3s-converter/json-templates/node.js.map +0 -1
  116. package/dist/i3s-converter/json-templates/scene-server.js.map +0 -1
  117. package/dist/i3s-converter/json-templates/shared-resources.js.map +0 -1
  118. package/dist/i3s-converter/json-templates/store.js.map +0 -1
  119. package/dist/i3s-converter/types.js.map +0 -1
  120. package/dist/i3s-server/README.md +0 -63
  121. package/dist/i3s-server/app.js.map +0 -1
  122. package/dist/i3s-server/bin/www.js.map +0 -1
  123. package/dist/i3s-server/certs/cert.pem +0 -19
  124. package/dist/i3s-server/certs/key.pem +0 -27
  125. package/dist/i3s-server/controllers/index-controller.js.map +0 -1
  126. package/dist/i3s-server/controllers/slpk-controller.js.map +0 -1
  127. package/dist/i3s-server/routes/index.js.map +0 -1
  128. package/dist/i3s-server/routes/slpk-router.js.map +0 -1
  129. package/dist/i3s-server/utils/create-scene-server.js.map +0 -1
  130. package/dist/i3s-server/utils/server-utils.js.map +0 -1
  131. package/dist/index.js.map +0 -1
  132. package/dist/lib/json-schemas/conversion-dump-json-schema.js.map +0 -1
  133. package/dist/lib/utils/cli-utils.js.map +0 -1
  134. package/dist/lib/utils/compress-util.js.map +0 -1
  135. package/dist/lib/utils/conversion-dump.js.map +0 -1
  136. package/dist/lib/utils/file-utils.js.map +0 -1
  137. package/dist/lib/utils/geometry-utils.js.map +0 -1
  138. package/dist/lib/utils/lod-conversion-utils.js.map +0 -1
  139. package/dist/lib/utils/queue.js.map +0 -1
  140. package/dist/lib/utils/statistic-utills.js.map +0 -1
  141. package/dist/lib/utils/write-queue.js.map +0 -1
  142. package/dist/pgm-loader.js.map +0 -1
  143. package/dist/slpk-extractor/slpk-extractor.js.map +0 -1
  144. package/dist/slpk-extractor-cli.js.map +0 -1
package/dist/index.cjs CHANGED
@@ -27,15 +27,25 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
27
27
  ));
28
28
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
29
 
30
- // src/index.ts
31
- var src_exports = {};
32
- __export(src_exports, {
30
+ // dist/index.js
31
+ var dist_exports = {};
32
+ __export(dist_exports, {
33
33
  I3SConverter: () => I3SConverter,
34
34
  Tiles3DConverter: () => Tiles3DConverter
35
35
  });
36
- module.exports = __toCommonJS(src_exports);
36
+ module.exports = __toCommonJS(dist_exports);
37
37
 
38
- // src/i3s-converter/types.ts
38
+ // dist/i3s-converter/types.js
39
+ var GLTFPrimitiveModeString;
40
+ (function(GLTFPrimitiveModeString2) {
41
+ GLTFPrimitiveModeString2["POINTS"] = "POINTS";
42
+ GLTFPrimitiveModeString2["LINES"] = "LINES";
43
+ GLTFPrimitiveModeString2["LINE_LOOP"] = "LINE_LOOP";
44
+ GLTFPrimitiveModeString2["LINE_STRIP"] = "LINE_STRIP";
45
+ GLTFPrimitiveModeString2["TRIANGLES"] = "TRIANGLES";
46
+ GLTFPrimitiveModeString2["TRIANGLE_STRIP"] = "TRIANGLE_STRIP";
47
+ GLTFPrimitiveModeString2["TRIANGLE_FAN"] = "TRIANGLE_FAN";
48
+ })(GLTFPrimitiveModeString || (GLTFPrimitiveModeString = {}));
39
49
  var AttributeType = {
40
50
  /** Type of attribute that is linked with feature ids */
41
51
  OBJECT_ID_TYPE: "OBJECTID",
@@ -46,8 +56,16 @@ var AttributeType = {
46
56
  /** Integer data type name for feature attributes */
47
57
  SHORT_INT_TYPE: "Int32"
48
58
  };
59
+ var ResourceType;
60
+ (function(ResourceType2) {
61
+ ResourceType2["ATTRIBUTES"] = "ATTRIBUTES";
62
+ ResourceType2["DRACO_GEOMETRY"] = "DRACO_GEOMETRY";
63
+ ResourceType2["GEOMETRY"] = "GEOMETRY";
64
+ ResourceType2["SHARED"] = "SHARED";
65
+ ResourceType2["TEXTURE"] = "TEXTURE";
66
+ })(ResourceType || (ResourceType = {}));
49
67
 
50
- // src/i3s-converter/helpers/attribute-metadata-info.ts
68
+ // dist/i3s-converter/helpers/attribute-metadata-info.js
51
69
  var AttributeMetadataInfo = class {
52
70
  constructor() {
53
71
  this._attributeStorageInfo = [];
@@ -256,7 +274,7 @@ var AttributeMetadataInfo = class {
256
274
  }
257
275
  };
258
276
 
259
- // src/i3s-converter/i3s-converter.ts
277
+ // dist/i3s-converter/i3s-converter.js
260
278
  var import_core9 = require("@loaders.gl/core");
261
279
  var import_d_tiles2 = require("@loaders.gl/3d-tiles");
262
280
  var import_path7 = require("path");
@@ -265,11 +283,11 @@ var import_process4 = __toESM(require("process"), 1);
265
283
  var import_json_map_transform8 = __toESM(require("json-map-transform"), 1);
266
284
  var import_md52 = __toESM(require("md5"), 1);
267
285
 
268
- // src/i3s-converter/helpers/node-pages.ts
286
+ // dist/i3s-converter/helpers/node-pages.js
269
287
  var import_path2 = require("path");
270
288
  var import_json_map_transform = __toESM(require("json-map-transform"), 1);
271
289
 
272
- // src/i3s-converter/json-templates/metadata.ts
290
+ // dist/i3s-converter/json-templates/metadata.js
273
291
  var METADATA = () => ({
274
292
  folderPattern: {
275
293
  path: "folderPattern",
@@ -292,13 +310,13 @@ var METADATA = () => ({
292
310
  }
293
311
  });
294
312
 
295
- // src/lib/utils/file-utils.ts
313
+ // dist/lib/utils/file-utils.js
296
314
  var import_core = require("@loaders.gl/core");
297
315
  var import_loader_utils = require("@loaders.gl/loader-utils");
298
316
  var import_fs2 = require("fs");
299
317
  var import_path = require("path");
300
318
 
301
- // src/lib/utils/compress-util.ts
319
+ // dist/lib/utils/compress-util.js
302
320
  var import_zlib = require("zlib");
303
321
  var import_fs = require("fs");
304
322
  function compressFileWithGzip(pathFile) {
@@ -319,7 +337,7 @@ function compressFileWithGzip(pathFile) {
319
337
  });
320
338
  }
321
339
 
322
- // src/lib/utils/file-utils.ts
340
+ // dist/lib/utils/file-utils.js
323
341
  async function writeFile(path, data, fileName = "index.json") {
324
342
  let toWriteData;
325
343
  if (data instanceof Promise) {
@@ -401,7 +419,7 @@ async function renameFile(oldPath, newPath) {
401
419
  }
402
420
  }
403
421
 
404
- // src/i3s-converter/helpers/node-pages.ts
422
+ // dist/i3s-converter/helpers/node-pages.js
405
423
  var NodePages = class {
406
424
  /**
407
425
  * @constructs
@@ -542,20 +560,14 @@ var NodePages = class {
542
560
  }
543
561
  const nodePageStr = JSON.stringify(nodePage);
544
562
  if (this.converter.options.slpk) {
545
- await this.converter.writeQueue.enqueue(
546
- {
547
- archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
548
- writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
549
- },
550
- true
551
- );
563
+ await this.converter.writeQueue.enqueue({
564
+ archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
565
+ writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
566
+ }, true);
552
567
  } else {
553
- await this.converter.writeQueue.enqueue(
554
- {
555
- writePromise: () => this.writeFile(filePath, nodePageStr)
556
- },
557
- true
558
- );
568
+ await this.converter.writeQueue.enqueue({
569
+ writePromise: () => this.writeFile(filePath, nodePageStr)
570
+ }, true);
559
571
  }
560
572
  }
561
573
  }
@@ -567,12 +579,7 @@ var NodePages = class {
567
579
  const compress = false;
568
580
  await this.converter.writeQueue.enqueue({
569
581
  archiveKey: "metadata.json",
570
- writePromise: () => this.writeFile(
571
- this.converter.layers0Path,
572
- JSON.stringify(metadata),
573
- "metadata.json",
574
- compress
575
- )
582
+ writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), "metadata.json", compress)
576
583
  });
577
584
  }
578
585
  /**
@@ -682,7 +689,7 @@ var NodePages = class {
682
689
  }
683
690
  };
684
691
 
685
- // src/lib/utils/statistic-utills.ts
692
+ // dist/lib/utils/statistic-utills.js
686
693
  var import_path3 = require("path");
687
694
  var import_fs3 = require("fs");
688
695
  function timeConverter(time) {
@@ -750,7 +757,7 @@ async function getTotalFilesSize(dirPath) {
750
757
  return totalFileSize;
751
758
  }
752
759
 
753
- // src/i3s-converter/helpers/geometry-converter.ts
760
+ // dist/i3s-converter/helpers/geometry-converter.js
754
761
  var import_core4 = require("@math.gl/core");
755
762
  var import_geospatial3 = require("@math.gl/geospatial");
756
763
  var import_draco = require("@loaders.gl/draco");
@@ -759,7 +766,7 @@ var import_loader_utils3 = require("@loaders.gl/loader-utils");
759
766
  var import_md5 = __toESM(require("md5"), 1);
760
767
  var import_uuid = require("uuid");
761
768
 
762
- // src/i3s-converter/helpers/geometry-attributes.ts
769
+ // dist/i3s-converter/helpers/geometry-attributes.js
763
770
  var import_loader_utils2 = require("@loaders.gl/loader-utils");
764
771
  var VALUES_PER_VERTEX = 3;
765
772
  var POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
@@ -781,10 +788,7 @@ function generateAttributes(attributes) {
781
788
  const data = calculateFaceRangesAndFeaturesCount(featureIndices);
782
789
  const attributeObjects = makeAttributeObjects({ ...data, ...attributes });
783
790
  const unifiedAttributeObjectsByFeatureIds = unifyObjectsByFeatureId(attributeObjects);
784
- const groupedAttributes = groupAttributesAndRangesByFeatureId(
785
- unifiedAttributeObjectsByFeatureIds,
786
- data.featureCount
787
- );
791
+ const groupedAttributes = groupAttributesAndRangesByFeatureId(unifiedAttributeObjectsByFeatureIds, data.featureCount);
788
792
  return groupedAttributes;
789
793
  }
790
794
  function calculateFaceRangesAndFeaturesCount(featureIndices) {
@@ -827,15 +831,7 @@ function getFrequentValue(values) {
827
831
  return mostFrequentValue;
828
832
  }
829
833
  function makeAttributeObjects(attributes) {
830
- const {
831
- featureIds,
832
- positions,
833
- normals,
834
- colors,
835
- uvRegions,
836
- texCoords,
837
- faceRange = new Uint32Array(0)
838
- } = attributes;
834
+ const { featureIds, positions, normals, colors, uvRegions, texCoords, faceRange = new Uint32Array(0) } = attributes;
839
835
  const groupedData = [];
840
836
  let positionsList = new Float32Array(positions);
841
837
  let normalsList = new Float32Array(normals);
@@ -952,7 +948,7 @@ function concatenateAttributes(attributes) {
952
948
  };
953
949
  }
954
950
 
955
- // src/i3s-converter/helpers/coordinate-converter.ts
951
+ // dist/i3s-converter/helpers/coordinate-converter.js
956
952
  var import_core2 = require("@math.gl/core");
957
953
  var import_geospatial = require("@math.gl/geospatial");
958
954
  var import_culling = require("@math.gl/culling");
@@ -960,10 +956,7 @@ function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
960
956
  let radius;
961
957
  let halfSize;
962
958
  let quaternion;
963
- const cartographicCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(
964
- sourceBoundingVolume.center,
965
- new import_core2.Vector3()
966
- );
959
+ const cartographicCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core2.Vector3());
967
960
  cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
968
961
  if (sourceBoundingVolume instanceof import_culling.OrientedBoundingBox) {
969
962
  halfSize = sourceBoundingVolume.halfSize;
@@ -1017,14 +1010,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
1017
1010
  }
1018
1011
  const center = sphere.center;
1019
1012
  const radius = sphere.radius;
1020
- const vertexMax = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(
1021
- new import_core2.Vector3(center[0] + radius, center[1] + radius, center[2] + radius),
1022
- new import_core2.Vector3()
1023
- );
1024
- const vertexMin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(
1025
- new import_core2.Vector3(center[0] - radius, center[1] - radius, center[2] - radius),
1026
- new import_core2.Vector3()
1027
- );
1013
+ const vertexMax = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(new import_core2.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new import_core2.Vector3());
1014
+ const vertexMin = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(new import_core2.Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new import_core2.Vector3());
1028
1015
  return {
1029
1016
  xmin: Math.min(vertexMin[0], vertexMax[0]),
1030
1017
  xmax: Math.max(vertexMin[0], vertexMax[0]),
@@ -1041,7 +1028,7 @@ function createObbFromMbs(mbs) {
1041
1028
  return new import_culling.OrientedBoundingBox(center, halfAxex);
1042
1029
  }
1043
1030
 
1044
- // src/i3s-converter/helpers/gltf-attributes.ts
1031
+ // dist/i3s-converter/helpers/gltf-attributes.js
1045
1032
  var import_core3 = require("@math.gl/core");
1046
1033
  var import_geospatial2 = require("@math.gl/geospatial");
1047
1034
  function prepareDataForAttributesConversion(tileContent, tileTransform, boundingVolume) {
@@ -1066,11 +1053,7 @@ function prepareDataForAttributesConversion(tileContent, tileTransform, bounding
1066
1053
  }
1067
1054
  })) || [];
1068
1055
  prepareNodes(nodes);
1069
- const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps(
1070
- tileContent,
1071
- tileTransform,
1072
- boundingVolume
1073
- );
1056
+ const { cartographicOrigin, modelMatrix: cartesianModelMatrix } = calculateTransformProps(tileContent, tileTransform, boundingVolume);
1074
1057
  return {
1075
1058
  nodes,
1076
1059
  images,
@@ -1109,10 +1092,7 @@ function calculateTransformProps(tileContent, tileTransform, boundingVolume) {
1109
1092
  break;
1110
1093
  }
1111
1094
  const cartesianOrigin = new import_core3.Vector3(center);
1112
- const cartographicOrigin = import_geospatial2.Ellipsoid.WGS84.cartesianToCartographic(
1113
- cartesianOrigin,
1114
- new import_core3.Vector3()
1115
- );
1095
+ const cartographicOrigin = import_geospatial2.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core3.Vector3());
1116
1096
  return { modelMatrix, cartographicOrigin };
1117
1097
  }
1118
1098
  function prepareNodes(nodes) {
@@ -1145,7 +1125,7 @@ function prepareNodes(nodes) {
1145
1125
  }
1146
1126
  }
1147
1127
 
1148
- // src/i3s-converter/helpers/batch-ids-extensions.ts
1128
+ // dist/i3s-converter/helpers/batch-ids-extensions.js
1149
1129
  var import_math = require("@loaders.gl/math");
1150
1130
  var import_gltf = require("@loaders.gl/gltf");
1151
1131
  function getTextureByMetadataClass(tileContent, metadataClass) {
@@ -1170,12 +1150,7 @@ function handleBatchIdsExtensions(attributes, primitive, images, featureTexture)
1170
1150
  for (const [extensionName, extensionData] of Object.entries(extensions || {})) {
1171
1151
  switch (extensionName) {
1172
1152
  case import_gltf.EXT_FEATURE_METADATA:
1173
- return handleExtFeatureMetadataExtension(
1174
- attributes,
1175
- extensionData,
1176
- images,
1177
- featureTexture
1178
- );
1153
+ return handleExtFeatureMetadataExtension(attributes, extensionData, images, featureTexture);
1179
1154
  case import_gltf.EXT_MESH_FEATURES:
1180
1155
  return handleExtMeshFeaturesExtension(attributes, extensionData);
1181
1156
  default:
@@ -1201,11 +1176,7 @@ function handleExtFeatureMetadataExtension(attributes, extFeatureMetadata, image
1201
1176
  }
1202
1177
  if (((_c = featureIdAttribute == null ? void 0 : featureIdAttribute.featureIds) == null ? void 0 : _c.hasOwnProperty("constant")) && ((_d = featureIdAttribute == null ? void 0 : featureIdAttribute.featureIds) == null ? void 0 : _d.hasOwnProperty("divisor"))) {
1203
1178
  const featuresCount = ((_e = attributes == null ? void 0 : attributes.POSITIONS) == null ? void 0 : _e.value.length) / 3 || 0;
1204
- return generateImplicitFeatureIds(
1205
- featuresCount,
1206
- featureIdAttribute.featureIds.constant,
1207
- featureIdAttribute.featureIds.divisor
1208
- );
1179
+ return generateImplicitFeatureIds(featuresCount, featureIdAttribute.featureIds.constant, featureIdAttribute.featureIds.divisor);
1209
1180
  }
1210
1181
  const featureIdTexture = (extFeatureMetadata == null ? void 0 : extFeatureMetadata.featureIdTextures) && (extFeatureMetadata == null ? void 0 : extFeatureMetadata.featureIdTextures[0]);
1211
1182
  if (featureIdTexture) {
@@ -1273,7 +1244,7 @@ function generateBatchIdsFromTexture(featureIdTexture, textureCoordinates, image
1273
1244
  return batchIds;
1274
1245
  }
1275
1246
 
1276
- // src/i3s-converter/helpers/feature-attributes.ts
1247
+ // dist/i3s-converter/helpers/feature-attributes.js
1277
1248
  var import_gltf2 = require("@loaders.gl/gltf");
1278
1249
  function flattenPropertyTableByFeatureIds(featureIdsMap, propertyTable) {
1279
1250
  const resultPropertyTable = {};
@@ -1401,10 +1372,10 @@ var getAttributeTypeFromExtStructuralMetadata = (property) => {
1401
1372
  return attributeType;
1402
1373
  };
1403
1374
 
1404
- // src/i3s-converter/helpers/geometry-converter.ts
1375
+ // dist/i3s-converter/helpers/geometry-converter.js
1405
1376
  var import_math2 = require("@loaders.gl/math");
1406
1377
 
1407
- // src/lib/utils/geometry-utils.ts
1378
+ // dist/lib/utils/geometry-utils.js
1408
1379
  var generateSyntheticIndices = (vertexCount) => {
1409
1380
  const result = new Uint32Array(vertexCount);
1410
1381
  for (let index = 0; index < vertexCount; index++) {
@@ -1413,7 +1384,7 @@ var generateSyntheticIndices = (vertexCount) => {
1413
1384
  return result;
1414
1385
  };
1415
1386
 
1416
- // src/i3s-converter/helpers/geometry-converter.ts
1387
+ // dist/i3s-converter/helpers/geometry-converter.js
1417
1388
  var import_gltf3 = require("@loaders.gl/gltf");
1418
1389
  var DEFAULT_ROUGHNESS_FACTOR = 1;
1419
1390
  var DEFAULT_METALLIC_FACTOR = 1;
@@ -1429,22 +1400,10 @@ var scratchVector = new import_core4.Vector3();
1429
1400
  async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBoundingVolume, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, libraries, metadataClass) {
1430
1401
  var _a2;
1431
1402
  const useCartesianPositions = generateBoundingVolumes;
1432
- const materialAndTextureList = await convertMaterials(
1433
- (_a2 = tileContent.gltf) == null ? void 0 : _a2.materials,
1434
- shouldMergeMaterials
1435
- );
1436
- const dataForAttributesConversion = prepareDataForAttributesConversion(
1437
- tileContent,
1438
- tileTransform,
1439
- tileBoundingVolume
1440
- );
1403
+ const materialAndTextureList = await convertMaterials((_a2 = tileContent.gltf) == null ? void 0 : _a2.materials, shouldMergeMaterials);
1404
+ const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent, tileTransform, tileBoundingVolume);
1441
1405
  const featureTexture = getTextureByMetadataClass(tileContent, metadataClass);
1442
- const convertedAttributesMap = await convertAttributes(
1443
- dataForAttributesConversion,
1444
- materialAndTextureList,
1445
- useCartesianPositions,
1446
- featureTexture
1447
- );
1406
+ const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions, featureTexture);
1448
1407
  if (generateBoundingVolumes) {
1449
1408
  _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
1450
1409
  }
@@ -1460,20 +1419,18 @@ async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBounding
1460
1419
  }
1461
1420
  const { material, texture } = materialAndTexture;
1462
1421
  const nodeId = await addNodeToNodePage();
1463
- result.push(
1464
- await _makeNodeResources({
1465
- convertedAttributes,
1466
- material,
1467
- texture,
1468
- tileContent,
1469
- nodeId,
1470
- featuresHashArray,
1471
- propertyTable,
1472
- attributeStorageInfo,
1473
- draco,
1474
- libraries
1475
- })
1476
- );
1422
+ result.push(await _makeNodeResources({
1423
+ convertedAttributes,
1424
+ material,
1425
+ texture,
1426
+ tileContent,
1427
+ nodeId,
1428
+ featuresHashArray,
1429
+ propertyTable,
1430
+ attributeStorageInfo,
1431
+ draco,
1432
+ libraries
1433
+ }));
1477
1434
  }
1478
1435
  if (!result.length) {
1479
1436
  return null;
@@ -1482,10 +1439,7 @@ async function convertB3dmToI3sGeometry(tileContent, tileTransform, tileBounding
1482
1439
  }
1483
1440
  function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel) {
1484
1441
  for (const attributes of convertedAttributesMap.values()) {
1485
- const boundingVolumes = createBoundingVolumesFromGeometry(
1486
- attributes.positions,
1487
- geoidHeightModel
1488
- );
1442
+ const boundingVolumes = createBoundingVolumesFromGeometry(attributes.positions, geoidHeightModel);
1489
1443
  attributes.boundingVolumes = boundingVolumes;
1490
1444
  const cartographicOrigin = boundingVolumes.obb.center;
1491
1445
  for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
@@ -1497,68 +1451,31 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
1497
1451
  }
1498
1452
  }
1499
1453
  }
1500
- async function _makeNodeResources({
1501
- convertedAttributes,
1502
- material,
1503
- texture,
1504
- tileContent,
1505
- nodeId,
1506
- featuresHashArray,
1507
- propertyTable,
1508
- attributeStorageInfo,
1509
- draco,
1510
- libraries
1511
- }) {
1454
+ async function _makeNodeResources({ convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, libraries }) {
1512
1455
  var _a2;
1513
1456
  const boundingVolumes = convertedAttributes.boundingVolumes;
1514
1457
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX2;
1515
1458
  const { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount } = generateAttributes(convertedAttributes);
1516
1459
  let featureIdsMap = {};
1517
1460
  if (propertyTable) {
1518
- featureIdsMap = makeFeatureIdsUnique(
1519
- featureIds,
1520
- convertedAttributes.featureIndices,
1521
- featuresHashArray,
1522
- propertyTable
1523
- );
1461
+ featureIdsMap = makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, propertyTable);
1524
1462
  }
1525
1463
  const header = new Uint32Array(2);
1526
1464
  const typedFeatureIds = generateBigUint64Array(featureIds);
1527
1465
  header.set([vertexCount, featureCount], 0);
1528
- const fileBuffer = new Uint8Array(
1529
- (0, import_loader_utils3.concatenateArrayBuffers)(
1530
- header.buffer,
1531
- positions.buffer,
1532
- normals.buffer,
1533
- texture ? texCoords.buffer : new ArrayBuffer(0),
1534
- colors.buffer,
1535
- uvRegions,
1536
- typedFeatureIds.buffer,
1537
- faceRange.buffer
1538
- )
1539
- );
1540
- const compressedGeometry = draco ? generateCompressedGeometry(
1541
- vertexCount,
1542
- convertedAttributes,
1543
- {
1544
- positions,
1545
- normals,
1546
- texCoords: texture ? texCoords : new Float32Array(0),
1547
- colors,
1548
- uvRegions,
1549
- featureIds,
1550
- faceRange
1551
- },
1552
- libraries
1553
- ) : null;
1466
+ const fileBuffer = new Uint8Array((0, import_loader_utils3.concatenateArrayBuffers)(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, uvRegions, typedFeatureIds.buffer, faceRange.buffer));
1467
+ const compressedGeometry = draco ? generateCompressedGeometry(vertexCount, convertedAttributes, {
1468
+ positions,
1469
+ normals,
1470
+ texCoords: texture ? texCoords : new Float32Array(0),
1471
+ colors,
1472
+ uvRegions,
1473
+ featureIds,
1474
+ faceRange
1475
+ }, libraries) : null;
1554
1476
  let attributes = [];
1555
1477
  if (attributeStorageInfo && propertyTable) {
1556
- attributes = convertPropertyTableToAttributeBuffers(
1557
- featureIds,
1558
- featureIdsMap,
1559
- propertyTable,
1560
- attributeStorageInfo
1561
- );
1478
+ attributes = convertPropertyTableToAttributeBuffers(featureIds, featureIdsMap, propertyTable, attributeStorageInfo);
1562
1479
  }
1563
1480
  return {
1564
1481
  nodeId,
@@ -1593,16 +1510,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
1593
1510
  attributesMap.set(mergedMaterial.originalMaterialId, attributes);
1594
1511
  }
1595
1512
  }
1596
- convertNodes(
1597
- nodes,
1598
- images,
1599
- cartographicOrigin,
1600
- cartesianModelMatrix,
1601
- attributesMap,
1602
- useCartesianPositions,
1603
- void 0,
1604
- featureTexture
1605
- );
1513
+ convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, void 0, featureTexture);
1606
1514
  for (const attrKey of attributesMap.keys()) {
1607
1515
  const attributes = attributesMap.get(attrKey);
1608
1516
  if (!attributes) {
@@ -1613,9 +1521,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
1613
1521
  continue;
1614
1522
  }
1615
1523
  if (attributes.featureIndicesGroups) {
1616
- attributes.featureIndices = attributes.featureIndicesGroups.reduce(
1617
- (acc, value) => acc.concat(value)
1618
- );
1524
+ attributes.featureIndices = attributes.featureIndicesGroups.reduce((acc, value) => acc.concat(value));
1619
1525
  delete attributes.featureIndicesGroups;
1620
1526
  }
1621
1527
  }
@@ -1624,16 +1530,7 @@ async function convertAttributes(attributesData, materialAndTextureList, useCart
1624
1530
  function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core4.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
1625
1531
  if (nodes) {
1626
1532
  for (const node of nodes) {
1627
- convertNode(
1628
- node,
1629
- images,
1630
- cartographicOrigin,
1631
- cartesianModelMatrix,
1632
- attributesMap,
1633
- useCartesianPositions,
1634
- matrix,
1635
- featureTexture
1636
- );
1533
+ convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix, featureTexture);
1637
1534
  }
1638
1535
  }
1639
1536
  }
@@ -1658,27 +1555,9 @@ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, att
1658
1555
  const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
1659
1556
  const mesh = node.mesh;
1660
1557
  if (mesh) {
1661
- convertMesh(
1662
- mesh,
1663
- images,
1664
- cartographicOrigin,
1665
- cartesianModelMatrix,
1666
- attributesMap,
1667
- useCartesianPositions,
1668
- transformationMatrix,
1669
- featureTexture
1670
- );
1671
- }
1672
- convertNodes(
1673
- node.children || [],
1674
- images,
1675
- cartographicOrigin,
1676
- cartesianModelMatrix,
1677
- attributesMap,
1678
- useCartesianPositions,
1679
- transformationMatrix,
1680
- featureTexture
1681
- );
1558
+ convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix, featureTexture);
1559
+ }
1560
+ convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix, featureTexture);
1682
1561
  }
1683
1562
  function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core4.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]), featureTexture) {
1684
1563
  var _a2;
@@ -1687,67 +1566,45 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
1687
1566
  let materialUvRegion;
1688
1567
  if (primitive.material) {
1689
1568
  outputAttributes = attributesMap.get(primitive.material.id);
1690
- materialUvRegion = (_a2 = outputAttributes == null ? void 0 : outputAttributes.mergedMaterials.find(
1691
- ({ originalMaterialId }) => {
1692
- var _a3;
1693
- return originalMaterialId === ((_a3 = primitive.material) == null ? void 0 : _a3.id);
1694
- }
1695
- )) == null ? void 0 : _a2.uvRegion;
1569
+ materialUvRegion = (_a2 = outputAttributes == null ? void 0 : outputAttributes.mergedMaterials.find(({ originalMaterialId }) => {
1570
+ var _a3;
1571
+ return originalMaterialId === ((_a3 = primitive.material) == null ? void 0 : _a3.id);
1572
+ })) == null ? void 0 : _a2.uvRegion;
1696
1573
  } else if (attributesMap.has("default")) {
1697
1574
  outputAttributes = attributesMap.get("default");
1698
1575
  }
1699
1576
  (0, import_core5.assert)(outputAttributes !== null, "Primitive - material mapping failed");
1700
- (0, import_core5.assert)(
1701
- primitive.mode === void 0 || primitive.mode === import_math2.GL.TRIANGLES || primitive.mode === import_math2.GL.TRIANGLE_STRIP,
1702
- `Primitive - unsupported mode ${primitive.mode}`
1703
- );
1577
+ (0, import_core5.assert)(primitive.mode === void 0 || primitive.mode === import_math2.GL.TRIANGLES || primitive.mode === import_math2.GL.TRIANGLE_STRIP, `Primitive - unsupported mode ${primitive.mode}`);
1704
1578
  const attributes = primitive.attributes;
1705
1579
  if (!outputAttributes) {
1706
1580
  continue;
1707
1581
  }
1708
1582
  const indices = normalizeIndices(primitive);
1709
- outputAttributes.positions = (0, import_loader_utils3.concatenateTypedArrays)(
1710
- outputAttributes.positions,
1711
- transformVertexArray({
1712
- vertices: attributes.POSITION.value,
1713
- cartographicOrigin,
1714
- cartesianModelMatrix,
1715
- nodeMatrix: matrix,
1716
- indices,
1717
- attributeSpecificTransformation: transformVertexPositions,
1718
- useCartesianPositions
1719
- })
1720
- );
1721
- outputAttributes.normals = (0, import_loader_utils3.concatenateTypedArrays)(
1722
- outputAttributes.normals,
1723
- transformVertexArray({
1724
- vertices: attributes.NORMAL && attributes.NORMAL.value,
1725
- cartographicOrigin,
1726
- cartesianModelMatrix,
1727
- nodeMatrix: matrix,
1728
- indices,
1729
- attributeSpecificTransformation: transformVertexNormals,
1730
- useCartesianPositions: false
1731
- })
1732
- );
1733
- outputAttributes.texCoords = (0, import_loader_utils3.concatenateTypedArrays)(
1734
- outputAttributes.texCoords,
1735
- flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, indices)
1736
- );
1737
- outputAttributes.colors = (0, import_loader_utils3.concatenateTypedArrays)(
1738
- outputAttributes.colors,
1739
- flattenColors(attributes.COLOR_0, indices)
1740
- );
1583
+ outputAttributes.positions = (0, import_loader_utils3.concatenateTypedArrays)(outputAttributes.positions, transformVertexArray({
1584
+ vertices: attributes.POSITION.value,
1585
+ cartographicOrigin,
1586
+ cartesianModelMatrix,
1587
+ nodeMatrix: matrix,
1588
+ indices,
1589
+ attributeSpecificTransformation: transformVertexPositions,
1590
+ useCartesianPositions
1591
+ }));
1592
+ outputAttributes.normals = (0, import_loader_utils3.concatenateTypedArrays)(outputAttributes.normals, transformVertexArray({
1593
+ vertices: attributes.NORMAL && attributes.NORMAL.value,
1594
+ cartographicOrigin,
1595
+ cartesianModelMatrix,
1596
+ nodeMatrix: matrix,
1597
+ indices,
1598
+ attributeSpecificTransformation: transformVertexNormals,
1599
+ useCartesianPositions: false
1600
+ }));
1601
+ outputAttributes.texCoords = (0, import_loader_utils3.concatenateTypedArrays)(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, indices));
1602
+ outputAttributes.colors = (0, import_loader_utils3.concatenateTypedArrays)(outputAttributes.colors, flattenColors(attributes.COLOR_0, indices));
1741
1603
  if (materialUvRegion) {
1742
- outputAttributes.uvRegions = (0, import_loader_utils3.concatenateTypedArrays)(
1743
- outputAttributes.uvRegions,
1744
- createUvRegion(materialUvRegion, indices)
1745
- );
1604
+ outputAttributes.uvRegions = (0, import_loader_utils3.concatenateTypedArrays)(outputAttributes.uvRegions, createUvRegion(materialUvRegion, indices));
1746
1605
  }
1747
1606
  outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
1748
- outputAttributes.featureIndicesGroups.push(
1749
- flattenBatchIds(getBatchIds(attributes, primitive, images, featureTexture), indices)
1750
- );
1607
+ outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images, featureTexture), indices));
1751
1608
  }
1752
1609
  }
1753
1610
  function normalizeIndices(primitive) {
@@ -1802,10 +1659,7 @@ function transformVertexPositions(vertexVector, calleeArgs) {
1802
1659
  if (useCartesianPositions) {
1803
1660
  return vertexVector;
1804
1661
  }
1805
- import_geospatial3.Ellipsoid.WGS84.cartesianToCartographic(
1806
- [vertexVector[0], vertexVector[1], vertexVector[2]],
1807
- vertexVector
1808
- );
1662
+ import_geospatial3.Ellipsoid.WGS84.cartesianToCartographic([vertexVector[0], vertexVector[1], vertexVector[2]], vertexVector);
1809
1663
  vertexVector = vertexVector.subtract(cartographicOrigin);
1810
1664
  return vertexVector;
1811
1665
  }
@@ -1869,12 +1723,7 @@ function flattenBatchIds(batchedIds, indices) {
1869
1723
  return newBatchIds;
1870
1724
  }
1871
1725
  function getBatchIds(attributes, primitive, images, featureTexture) {
1872
- const batchIds = handleBatchIdsExtensions(
1873
- attributes,
1874
- primitive,
1875
- images,
1876
- featureTexture
1877
- );
1726
+ const batchIds = handleBatchIdsExtensions(attributes, primitive, images, featureTexture);
1878
1727
  if (batchIds.length) {
1879
1728
  return batchIds;
1880
1729
  }
@@ -1910,14 +1759,8 @@ async function mergeAllMaterials(materials) {
1910
1759
  }
1911
1760
  }
1912
1761
  if (newMaterial.texture && mergedIndices.length) {
1913
- const newWidth = (_a2 = newMaterial.mergedMaterials) == null ? void 0 : _a2.reduce(
1914
- (accum, { textureSize }) => accum + ((textureSize == null ? void 0 : textureSize.width) || 0),
1915
- 0
1916
- );
1917
- const newHeight = (_b = newMaterial.mergedMaterials) == null ? void 0 : _b.reduce(
1918
- (accum, { textureSize }) => Math.max(accum, (textureSize == null ? void 0 : textureSize.height) || 0),
1919
- 0
1920
- );
1762
+ const newWidth = (_a2 = newMaterial.mergedMaterials) == null ? void 0 : _a2.reduce((accum, { textureSize }) => accum + ((textureSize == null ? void 0 : textureSize.width) || 0), 0);
1763
+ const newHeight = (_b = newMaterial.mergedMaterials) == null ? void 0 : _b.reduce((accum, { textureSize }) => Math.max(accum, (textureSize == null ? void 0 : textureSize.height) || 0), 0);
1921
1764
  let currentX = -1;
1922
1765
  for (const aTextureMetadata of newMaterial.mergedMaterials) {
1923
1766
  if (aTextureMetadata.textureSize) {
@@ -1957,9 +1800,7 @@ async function mergeMaterials(material1, material2) {
1957
1800
  const sharpData = await joinImages([buffer1, buffer2], { direction: "horizontal" });
1958
1801
  material1.texture.bufferView.data = await sharpData.toFormat(material1.texture.mimeType === "image/png" ? "png" : "jpeg").toBuffer();
1959
1802
  } catch (error) {
1960
- console.log(
1961
- "Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)"
1962
- );
1803
+ console.log("Join images into a texture atlas has failed. Consider usage `--split-nodes` option. (See documentation https://loaders.gl/modules/tile-converter/docs/cli-reference/tile-converter)");
1963
1804
  throw error;
1964
1805
  }
1965
1806
  material1.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId = 1;
@@ -2030,10 +1871,7 @@ function getSharedResources(gltfMaterials, nodeId) {
2030
1871
  }
2031
1872
  i3sResources.materialDefinitionInfos = [];
2032
1873
  for (const gltfMaterial of gltfMaterials) {
2033
- const { materialDefinitionInfo, textureDefinitionInfo } = convertGLTFMaterialToI3sSharedResources(
2034
- gltfMaterial,
2035
- nodeId
2036
- );
1874
+ const { materialDefinitionInfo, textureDefinitionInfo } = convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId);
2037
1875
  i3sResources.materialDefinitionInfos.push(materialDefinitionInfo);
2038
1876
  if (textureDefinitionInfo) {
2039
1877
  i3sResources.textureDefinitionInfos = i3sResources.textureDefinitionInfos || [];
@@ -2056,10 +1894,7 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
2056
1894
  colorFactor[3] = colorFactor[3] || 1;
2057
1895
  }
2058
1896
  return {
2059
- materialDefinitionInfo: extractSharedResourcesMaterialInfo(
2060
- colorFactor || [1, 1, 1, 1],
2061
- metallicFactor
2062
- ),
1897
+ materialDefinitionInfo: extractSharedResourcesMaterialInfo(colorFactor || [1, 1, 1, 1], metallicFactor),
2063
1898
  textureDefinitionInfo
2064
1899
  };
2065
1900
  }
@@ -2067,12 +1902,7 @@ function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1)
2067
1902
  const matDielectricColorComponent = 0.04 / 255;
2068
1903
  const black = new import_core4.Vector4(0, 0, 0, 1);
2069
1904
  const unitVector = new import_core4.Vector4(1, 1, 1, 1);
2070
- const dielectricSpecular = new import_core4.Vector4(
2071
- matDielectricColorComponent,
2072
- matDielectricColorComponent,
2073
- matDielectricColorComponent,
2074
- 0
2075
- );
1905
+ const dielectricSpecular = new import_core4.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
2076
1906
  const baseColorVector = new import_core4.Vector4(baseColorFactor);
2077
1907
  const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
2078
1908
  const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
@@ -2196,13 +2026,7 @@ function generateAttributeBuffer(type, value) {
2196
2026
  function getAttributeType2(key, attributeStorageInfo) {
2197
2027
  const attribute = attributeStorageInfo.find((attr) => attr.name === key);
2198
2028
  if (!attribute) {
2199
- console.error(
2200
- `attribute is null, key=${key}, attributeStorageInfo=${JSON.stringify(
2201
- attributeStorageInfo,
2202
- null,
2203
- 2
2204
- )}`
2205
- );
2029
+ console.error(`attribute is null, key=${key}, attributeStorageInfo=${JSON.stringify(attributeStorageInfo, null, 2)}`);
2206
2030
  return "";
2207
2031
  }
2208
2032
  if (!attribute.attributeValues) {
@@ -2236,12 +2060,7 @@ function generateStringAttributeBuffer(batchAttributes) {
2236
2060
  stringBufferArray.push(currentStringBuffer);
2237
2061
  }
2238
2062
  const totalBytes = new Uint32Array([totalNumberOfBytes]);
2239
- return (0, import_loader_utils3.concatenateArrayBuffers)(
2240
- stringCountArray.buffer,
2241
- totalBytes.buffer,
2242
- stringSizesArray.buffer,
2243
- ...stringBufferArray
2244
- );
2063
+ return (0, import_loader_utils3.concatenateArrayBuffers)(stringCountArray.buffer, totalBytes.buffer, stringSizesArray.buffer, ...stringBufferArray);
2245
2064
  }
2246
2065
  function generateBigUint64Array(featureIds) {
2247
2066
  const typedFeatureIds = new BigUint64Array(featureIds.length);
@@ -2256,9 +2075,7 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
2256
2075
  for (let index = 0; index < indices.length; index++) {
2257
2076
  indices.set([index], index);
2258
2077
  }
2259
- const featureIndices = new Uint32Array(
2260
- convertedAttributes.featureIndices.length ? convertedAttributes.featureIndices : vertexCount
2261
- );
2078
+ const featureIndices = new Uint32Array(convertedAttributes.featureIndices.length ? convertedAttributes.featureIndices : vertexCount);
2262
2079
  const featureIndex = generateFeatureIndexAttribute(featureIndices, faceRange);
2263
2080
  const compressedAttributes = {
2264
2081
  positions,
@@ -2326,17 +2143,11 @@ function getPropertyTable(tileContent, metadataClass) {
2326
2143
  const { extensionName, extension } = getPropertyTableExtension(tileContent);
2327
2144
  switch (extensionName) {
2328
2145
  case import_gltf3.EXT_STRUCTURAL_METADATA: {
2329
- propertyTable = getPropertyTableFromExtStructuralMetadata(
2330
- extension,
2331
- metadataClass
2332
- );
2146
+ propertyTable = getPropertyTableFromExtStructuralMetadata(extension, metadataClass);
2333
2147
  return propertyTable;
2334
2148
  }
2335
2149
  case import_gltf3.EXT_FEATURE_METADATA: {
2336
- propertyTable = getPropertyTableFromExtFeatureMetadata(
2337
- extension,
2338
- metadataClass
2339
- );
2150
+ propertyTable = getPropertyTableFromExtFeatureMetadata(extension, metadataClass);
2340
2151
  return propertyTable;
2341
2152
  }
2342
2153
  default:
@@ -2407,12 +2218,12 @@ function getPropertyTableExtension(tileContent) {
2407
2218
  return { extensionName, extension };
2408
2219
  }
2409
2220
 
2410
- // src/i3s-converter/helpers/create-scene-server-path.ts
2221
+ // dist/i3s-converter/helpers/create-scene-server-path.js
2411
2222
  var import_uuid2 = require("uuid");
2412
2223
  var import_json_map_transform2 = __toESM(require("json-map-transform"), 1);
2413
2224
  var import_path4 = require("path");
2414
2225
 
2415
- // src/i3s-converter/json-templates/scene-server.ts
2226
+ // dist/i3s-converter/json-templates/scene-server.js
2416
2227
  var SCENE_SERVER = () => ({
2417
2228
  serviceItemId: {
2418
2229
  path: "serviceItemId"
@@ -2441,7 +2252,7 @@ var SCENE_SERVER = () => ({
2441
2252
  }
2442
2253
  });
2443
2254
 
2444
- // src/i3s-converter/helpers/create-scene-server-path.ts
2255
+ // dist/i3s-converter/helpers/create-scene-server-path.js
2445
2256
  async function createSceneServerPath(layerName, layers0, rootPath) {
2446
2257
  const sceneServerData = {
2447
2258
  serviceItemId: (0, import_uuid2.v4)().replace(/-/gi, ""),
@@ -2453,7 +2264,7 @@ async function createSceneServerPath(layerName, layers0, rootPath) {
2453
2264
  await writeFile(nodePagePath, JSON.stringify(sceneServer));
2454
2265
  }
2455
2266
 
2456
- // src/lib/utils/lod-conversion-utils.ts
2267
+ // dist/lib/utils/lod-conversion-utils.js
2457
2268
  var DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR = 16;
2458
2269
  function convertGeometricErrorToScreenThreshold(tile, coordinates) {
2459
2270
  const lodSelection = [];
@@ -2478,14 +2289,10 @@ function convertGeometricErrorToScreenThreshold(tile, coordinates) {
2478
2289
  }
2479
2290
  function convertScreenThresholdToGeometricError(node) {
2480
2291
  var _a2, _b;
2481
- const metricData = (_a2 = node.lodSelection) == null ? void 0 : _a2.find(
2482
- (metric) => metric.metricType === "maxScreenThreshold"
2483
- );
2292
+ const metricData = (_a2 = node.lodSelection) == null ? void 0 : _a2.find((metric) => metric.metricType === "maxScreenThreshold");
2484
2293
  let maxError = metricData == null ? void 0 : metricData.maxError;
2485
2294
  if (!maxError) {
2486
- const sqMetricData = (_b = node.lodSelection) == null ? void 0 : _b.find(
2487
- (metric) => metric.metricType === "maxScreenThresholdSQ"
2488
- );
2295
+ const sqMetricData = (_b = node.lodSelection) == null ? void 0 : _b.find((metric) => metric.metricType === "maxScreenThresholdSQ");
2489
2296
  if (sqMetricData) {
2490
2297
  maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
2491
2298
  }
@@ -2496,9 +2303,9 @@ function convertScreenThresholdToGeometricError(node) {
2496
2303
  return node.mbs[3] * 2 * DEFAULT_MAXIMUM_SCREEN_SPACE_ERROR / maxError;
2497
2304
  }
2498
2305
 
2499
- // src/pgm-loader.ts
2306
+ // dist/pgm-loader.js
2500
2307
  var import_geoid = require("@math.gl/geoid");
2501
- var VERSION = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
2308
+ var VERSION = true ? "4.2.0-alpha.4" : "latest";
2502
2309
  var PGMLoader = {
2503
2310
  name: "PGM - Netpbm grayscale image format",
2504
2311
  id: "pgm",
@@ -2514,10 +2321,10 @@ var PGMLoader = {
2514
2321
  }
2515
2322
  };
2516
2323
 
2517
- // src/i3s-converter/json-templates/layers.ts
2324
+ // dist/i3s-converter/json-templates/layers.js
2518
2325
  var import_json_map_transform3 = __toESM(require("json-map-transform"), 1);
2519
2326
 
2520
- // src/i3s-converter/json-templates/store.ts
2327
+ // dist/i3s-converter/json-templates/store.js
2521
2328
  var STORE = {
2522
2329
  id: {
2523
2330
  path: "id",
@@ -2619,7 +2426,7 @@ var STORE = {
2619
2426
  }
2620
2427
  };
2621
2428
 
2622
- // src/i3s-converter/json-templates/layers.ts
2429
+ // dist/i3s-converter/json-templates/layers.js
2623
2430
  var SPATIAL_REFERENCE = () => ({
2624
2431
  wkid: {
2625
2432
  path: "wkid",
@@ -2751,7 +2558,7 @@ var LAYERS = () => ({
2751
2558
  }
2752
2559
  });
2753
2560
 
2754
- // src/i3s-converter/json-templates/geometry-definitions.ts
2561
+ // dist/i3s-converter/json-templates/geometry-definitions.js
2755
2562
  var import_json_map_transform4 = __toESM(require("json-map-transform"), 1);
2756
2563
  var PLAIN_GEOMETRY_DEFINITION = () => ({
2757
2564
  offset: {
@@ -2833,7 +2640,7 @@ var GEOMETRY_DEFINITION = () => ({
2833
2640
  }
2834
2641
  });
2835
2642
 
2836
- // src/i3s-converter/json-templates/shared-resources.ts
2643
+ // dist/i3s-converter/json-templates/shared-resources.js
2837
2644
  var import_json_map_transform5 = __toESM(require("json-map-transform"), 1);
2838
2645
  var MATERIAL_DEFINITION_INFO_PARAMS = () => ({
2839
2646
  renderMode: {
@@ -2940,10 +2747,7 @@ var SHARED_RESOURCES = () => ({
2940
2747
  function transfromMaterialDefinitions(materialDefinitionInfos, thisObject, originalObject) {
2941
2748
  const result = {};
2942
2749
  for (const [index, materialDefinitionInfo] of materialDefinitionInfos.entries()) {
2943
- result[`Mat${originalObject.nodePath}${index}`] = (0, import_json_map_transform5.default)(
2944
- materialDefinitionInfo,
2945
- MATERIAL_DEFINITION_INFO()
2946
- );
2750
+ result[`Mat${originalObject.nodePath}${index}`] = (0, import_json_map_transform5.default)(materialDefinitionInfo, MATERIAL_DEFINITION_INFO());
2947
2751
  }
2948
2752
  return result;
2949
2753
  }
@@ -2960,7 +2764,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
2960
2764
  return result;
2961
2765
  }
2962
2766
 
2963
- // src/i3s-converter/helpers/node-debug.ts
2767
+ // dist/i3s-converter/helpers/node-debug.js
2964
2768
  var import_culling2 = require("@math.gl/culling");
2965
2769
  var import_core6 = require("@math.gl/core");
2966
2770
  var import_geospatial4 = require("@math.gl/geospatial");
@@ -3082,11 +2886,7 @@ function getTileObbVertices(node) {
3082
2886
  const obbCenterCartesian = import_geospatial4.Ellipsoid.WGS84.cartographicToCartesian(node.obb.center);
3083
2887
  let vertices = [];
3084
2888
  for (let i = 0; i < positions.length; i += 3) {
3085
- const positionsVector = new import_core6.Vector3(
3086
- positions[i] *= halfSize[0],
3087
- positions[i + 1] *= halfSize[1],
3088
- positions[i + 2] *= halfSize[2]
3089
- );
2889
+ const positionsVector = new import_core6.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
3090
2890
  const rotatedPositions = positionsVector.transformByQuaternion(node.obb.quaternion).add(obbCenterCartesian);
3091
2891
  vertices = vertices.concat(rotatedPositions);
3092
2892
  }
@@ -3106,12 +2906,12 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
3106
2906
  return isVerticesInsideObb;
3107
2907
  }
3108
2908
 
3109
- // src/i3s-converter/i3s-converter.ts
2909
+ // dist/i3s-converter/i3s-converter.js
3110
2910
  var import_textures = require("@loaders.gl/textures");
3111
2911
  var import_images = require("@loaders.gl/images");
3112
2912
  var import_worker_utils = require("@loaders.gl/worker-utils");
3113
2913
 
3114
- // src/lib/utils/queue.ts
2914
+ // dist/lib/utils/queue.js
3115
2915
  var Queue = class extends Array {
3116
2916
  enqueue(val) {
3117
2917
  this.push(val);
@@ -3127,7 +2927,7 @@ var Queue = class extends Array {
3127
2927
  }
3128
2928
  };
3129
2929
 
3130
- // src/lib/utils/write-queue.ts
2930
+ // dist/lib/utils/write-queue.js
3131
2931
  var import_process = __toESM(require("process"), 1);
3132
2932
  var MEMORY_LIMIT = 4 * 1024 * 1024 * 1024;
3133
2933
  var WriteQueue = class extends Queue {
@@ -3203,16 +3003,16 @@ var WriteQueue = class extends Queue {
3203
3003
  }
3204
3004
  };
3205
3005
 
3206
- // src/constants.ts
3006
+ // dist/constants.js
3207
3007
  var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in node js environment";
3208
3008
  var DUMP_FILE_SUFFIX = ".dump.json";
3209
3009
 
3210
- // src/i3s-converter/helpers/node-index-document.ts
3010
+ // dist/i3s-converter/helpers/node-index-document.js
3211
3011
  var import_path5 = require("path");
3212
3012
  var import_json_map_transform7 = __toESM(require("json-map-transform"), 1);
3213
3013
  var import_uuid3 = require("uuid");
3214
3014
 
3215
- // src/i3s-converter/json-templates/node.ts
3015
+ // dist/i3s-converter/json-templates/node.js
3216
3016
  var import_json_map_transform6 = __toESM(require("json-map-transform"), 1);
3217
3017
  var COORDINATES = () => ({
3218
3018
  mbs: {
@@ -3296,30 +3096,24 @@ var NODE = () => ({
3296
3096
  }
3297
3097
  });
3298
3098
 
3299
- // src/i3s-converter/helpers/node-index-document.ts
3099
+ // dist/i3s-converter/helpers/node-index-document.js
3300
3100
  var NodeIndexDocument = class {
3101
+ get finalized() {
3102
+ return this._finalized;
3103
+ }
3301
3104
  /**
3302
3105
  * Constructor
3303
3106
  * @param id - id of the node in node pages
3304
3107
  * @param converter - converter instance
3305
3108
  */
3306
3109
  constructor(id, converter) {
3307
- /** 3DNodeIndexDocument data */
3308
3110
  this.data = null;
3309
- /** children */
3310
3111
  this.children = [];
3311
- /**
3312
- * Finalized property. It means that all child nodes are saved and their data
3313
- * is unloaded
3314
- */
3315
3112
  this._finalized = false;
3316
3113
  this.inPageId = id;
3317
3114
  this.id = id === 0 ? "root" : id.toString();
3318
3115
  this.converter = converter;
3319
3116
  }
3320
- get finalized() {
3321
- return this._finalized;
3322
- }
3323
3117
  /**
3324
3118
  * Add Node3DIndexDocument data to the node
3325
3119
  * @param data Node3DIndexDocument data
@@ -3381,9 +3175,7 @@ var NodeIndexDocument = class {
3381
3175
  childNodeData.neighbors.push({ ...neighbor });
3382
3176
  }
3383
3177
  } else {
3384
- console.warn(
3385
- `Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`
3386
- );
3178
+ console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
3387
3179
  delete childNodeData.neighbors;
3388
3180
  }
3389
3181
  if (this.converter.options.instantNodeWriting && childNodeData) {
@@ -3413,24 +3205,12 @@ var NodeIndexDocument = class {
3413
3205
  async write(node) {
3414
3206
  const path = (0, import_path5.join)(this.converter.layers0Path, "nodes", this.id);
3415
3207
  if (this.converter.options.slpk) {
3416
- await this.converter.writeQueue.enqueue(
3417
- {
3418
- archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
3419
- writePromise: () => writeFileForSlpk(
3420
- path,
3421
- JSON.stringify(node),
3422
- "3dNodeIndexDocument.json",
3423
- true,
3424
- this.converter.compressList
3425
- )
3426
- },
3427
- true
3428
- );
3208
+ await this.converter.writeQueue.enqueue({
3209
+ archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
3210
+ writePromise: () => writeFileForSlpk(path, JSON.stringify(node), "3dNodeIndexDocument.json", true, this.converter.compressList)
3211
+ }, true);
3429
3212
  } else {
3430
- await this.converter.writeQueue.enqueue(
3431
- { writePromise: () => writeFile(path, JSON.stringify(node)) },
3432
- true
3433
- );
3213
+ await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
3434
3214
  }
3435
3215
  }
3436
3216
  /**
@@ -3477,13 +3257,7 @@ var NodeIndexDocument = class {
3477
3257
  * @returns NodeIndexDocument instance
3478
3258
  */
3479
3259
  static async createNode(parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter) {
3480
- const data = await NodeIndexDocument.createNodeIndexDocument(
3481
- parentNode,
3482
- boundingVolumes,
3483
- lodSelection,
3484
- nodeInPage,
3485
- resources
3486
- );
3260
+ const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
3487
3261
  const node = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
3488
3262
  return node;
3489
3263
  }
@@ -3563,7 +3337,7 @@ var NodeIndexDocument = class {
3563
3337
  }
3564
3338
  };
3565
3339
 
3566
- // src/i3s-converter/helpers/load-3d-tiles.ts
3340
+ // dist/i3s-converter/helpers/load-3d-tiles.js
3567
3341
  var import_d_tiles = require("@loaders.gl/3d-tiles");
3568
3342
  var import_core7 = require("@loaders.gl/core");
3569
3343
  var import_loader_utils4 = require("@loaders.gl/loader-utils");
@@ -3580,11 +3354,7 @@ var loadNestedTileset = async (sourceTileset, sourceTile, tilesetLoadOptions) =>
3580
3354
  assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
3581
3355
  }
3582
3356
  };
3583
- const tileContent = await loadFromArchive(
3584
- sourceTile.contentUrl,
3585
- sourceTileset.loader,
3586
- loadOptions
3587
- );
3357
+ const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
3588
3358
  if (tileContent.root) {
3589
3359
  sourceTile.children = [tileContent.root];
3590
3360
  }
@@ -3603,11 +3373,7 @@ var loadTile3DContent = async (sourceTileset, sourceTile, tilesetLoadOptions) =>
3603
3373
  assetGltfUpAxis: sourceTileset.asset && sourceTileset.asset.gltfUpAxis || "Y"
3604
3374
  }
3605
3375
  };
3606
- const tileContent = await loadFromArchive(
3607
- sourceTile.contentUrl,
3608
- sourceTileset.loader,
3609
- loadOptions
3610
- );
3376
+ const tileContent = await loadFromArchive(sourceTile.contentUrl, sourceTileset.loader, loadOptions);
3611
3377
  return tileContent;
3612
3378
  };
3613
3379
  async function loadFromArchive(url, loader, loadOptions) {
@@ -3646,28 +3412,22 @@ async function loadHashTable(fileProvider) {
3646
3412
  const hashCDOffset = await (0, import_zip.searchFromTheEnd)(fileProvider, import_zip.CD_HEADER_SIGNATURE);
3647
3413
  const cdFileHeader = await (0, import_zip.parseZipCDFileHeader)(hashCDOffset, fileProvider);
3648
3414
  if ((cdFileHeader == null ? void 0 : cdFileHeader.fileName) === "@3dtilesIndex1@") {
3649
- const localFileHeader = await (0, import_zip.parseZipLocalFileHeader)(
3650
- cdFileHeader.localHeaderOffset,
3651
- fileProvider
3652
- );
3415
+ const localFileHeader = await (0, import_zip.parseZipLocalFileHeader)(cdFileHeader.localHeaderOffset, fileProvider);
3653
3416
  if (!localFileHeader) {
3654
3417
  throw new Error("corrupted 3tz");
3655
3418
  }
3656
3419
  const fileDataOffset = localFileHeader.fileDataOffset;
3657
- const hashFile = await fileProvider.slice(
3658
- fileDataOffset,
3659
- fileDataOffset + localFileHeader.compressedSize
3660
- );
3420
+ const hashFile = await fileProvider.slice(fileDataOffset, fileDataOffset + localFileHeader.compressedSize);
3661
3421
  hashTable = (0, import_zip.parseHashTable)(hashFile);
3662
3422
  }
3663
3423
  return hashTable;
3664
3424
  }
3665
3425
 
3666
- // src/i3s-converter/i3s-converter.ts
3426
+ // dist/i3s-converter/i3s-converter.js
3667
3427
  var import_core10 = require("@math.gl/core");
3668
3428
  var import_tiles = require("@loaders.gl/tiles");
3669
3429
 
3670
- // src/i3s-converter/helpers/tileset-traversal.ts
3430
+ // dist/i3s-converter/helpers/tileset-traversal.js
3671
3431
  var traverseDatasetWith = async (tile, traversalProps, processTile, postprocessTile, maxDepth, level = 0) => {
3672
3432
  if (maxDepth && level > maxDepth) {
3673
3433
  return;
@@ -3676,36 +3436,29 @@ var traverseDatasetWith = async (tile, traversalProps, processTile, postprocessT
3676
3436
  const newTraversalProps = await processTile(tile, traversalProps);
3677
3437
  processResults.push(newTraversalProps);
3678
3438
  for (const childTile of tile.children) {
3679
- await traverseDatasetWith(
3680
- childTile,
3681
- newTraversalProps,
3682
- processTile,
3683
- postprocessTile,
3684
- maxDepth,
3685
- level + 1
3686
- );
3439
+ await traverseDatasetWith(childTile, newTraversalProps, processTile, postprocessTile, maxDepth, level + 1);
3687
3440
  }
3688
3441
  postprocessTile && await postprocessTile(processResults, traversalProps);
3689
3442
  };
3690
3443
 
3691
- // src/i3s-converter/helpers/preprocess-3d-tiles.ts
3444
+ // dist/i3s-converter/helpers/preprocess-3d-tiles.js
3692
3445
  var import_gltf4 = require("@loaders.gl/gltf");
3693
3446
  var import_core8 = require("@loaders.gl/core");
3694
3447
  var import_gltf5 = require("@loaders.gl/gltf");
3695
3448
  var GLTF_PRIMITIVE_MODES = [
3696
- "POINTS" /* POINTS */,
3449
+ GLTFPrimitiveModeString.POINTS,
3697
3450
  // 0
3698
- "LINES" /* LINES */,
3451
+ GLTFPrimitiveModeString.LINES,
3699
3452
  // 1
3700
- "LINE_LOOP" /* LINE_LOOP */,
3453
+ GLTFPrimitiveModeString.LINE_LOOP,
3701
3454
  // 2
3702
- "LINE_STRIP" /* LINE_STRIP */,
3455
+ GLTFPrimitiveModeString.LINE_STRIP,
3703
3456
  // 3
3704
- "TRIANGLES" /* TRIANGLES */,
3457
+ GLTFPrimitiveModeString.TRIANGLES,
3705
3458
  // 4
3706
- "TRIANGLE_STRIP" /* TRIANGLE_STRIP */,
3459
+ GLTFPrimitiveModeString.TRIANGLE_STRIP,
3707
3460
  // 5
3708
- "TRIANGLE_FAN" /* TRIANGLE_FAN */
3461
+ GLTFPrimitiveModeString.TRIANGLE_FAN
3709
3462
  // 6
3710
3463
  ];
3711
3464
  var analyzeTileContent = async (tileContent) => {
@@ -3769,28 +3522,18 @@ var mergePreprocessData = (object1, object2) => {
3769
3522
  }
3770
3523
  };
3771
3524
 
3772
- // src/i3s-converter/helpers/progress.ts
3525
+ // dist/i3s-converter/helpers/progress.js
3773
3526
  var import_process2 = __toESM(require("process"), 1);
3774
3527
  var THRESHOLD_DEFAULT = 0.2;
3775
3528
  var Progress = class {
3776
3529
  constructor(options = {}) {
3777
- /** Total amount of work, e.g. number of files to save or number of bytes to send */
3778
3530
  this._stepsTotal = 0;
3779
- /** Amount of work already done */
3780
3531
  this._stepsDone = 0;
3781
- /** Time in milli-seconds when the process started */
3782
3532
  this.startTime = 0;
3783
- /** Time in milli-seconds when the process stopped */
3784
3533
  this.stopTime = 0;
3785
- /** Time in milli-seconds when stepsDone was updated */
3786
3534
  this.timeOfUpdatingStepsDone = 0;
3787
- /** Time in milli-seconds spent for performing one step*/
3788
3535
  this.milliSecForOneStep = 0;
3789
3536
  this.trust = false;
3790
- /**
3791
- * The number of digits to appear after decimal point in the string representation of the count of steps already done.
3792
- * It's calculated based on the total count of steps.
3793
- */
3794
3537
  this.numberOfDigitsInPercentage = 0;
3795
3538
  this.getTime = options.getTime || import_process2.default.hrtime.bigint;
3796
3539
  this.threshold = options.threshold || THRESHOLD_DEFAULT;
@@ -3907,16 +3650,16 @@ var Progress = class {
3907
3650
  }
3908
3651
  };
3909
3652
 
3910
- // src/i3s-converter/i3s-converter.ts
3653
+ // dist/i3s-converter/i3s-converter.js
3911
3654
  var import_zip2 = require("@loaders.gl/zip");
3912
3655
 
3913
- // src/lib/utils/conversion-dump.ts
3656
+ // dist/lib/utils/conversion-dump.js
3914
3657
  var import_util = require("util");
3915
3658
  var import_path6 = require("path");
3916
3659
  var import_process3 = __toESM(require("process"), 1);
3917
3660
  var import_ajv = __toESM(require("ajv"), 1);
3918
3661
 
3919
- // src/lib/json-schemas/conversion-dump-json-schema.ts
3662
+ // dist/lib/json-schemas/conversion-dump-json-schema.js
3920
3663
  var dumpJsonSchema = {
3921
3664
  type: "object",
3922
3665
  properties: {
@@ -4203,10 +3946,9 @@ var dumpJsonSchema = {
4203
3946
  }
4204
3947
  };
4205
3948
 
4206
- // src/lib/utils/conversion-dump.ts
3949
+ // dist/lib/utils/conversion-dump.js
4207
3950
  var ConversionDump = class {
4208
3951
  constructor() {
4209
- /**Restored/resumed dump indicator */
4210
3952
  this.restored = false;
4211
3953
  this.tilesConverted = {};
4212
3954
  }
@@ -4215,21 +3957,7 @@ var ConversionDump = class {
4215
3957
  * @param currentOptions - converter options
4216
3958
  */
4217
3959
  async createDump(currentOptions) {
4218
- const {
4219
- tilesetName,
4220
- slpk,
4221
- egmFilePath,
4222
- inputUrl,
4223
- outputPath,
4224
- draco = true,
4225
- maxDepth,
4226
- token,
4227
- generateTextures,
4228
- generateBoundingVolumes,
4229
- mergeMaterials: mergeMaterials2 = true,
4230
- metadataClass,
4231
- analyze = false
4232
- } = currentOptions;
3960
+ const { tilesetName, slpk, egmFilePath, inputUrl, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, mergeMaterials: mergeMaterials2 = true, metadataClass, analyze = false } = currentOptions;
4233
3961
  this.options = {
4234
3962
  tilesetName,
4235
3963
  slpk,
@@ -4245,24 +3973,11 @@ var ConversionDump = class {
4245
3973
  metadataClass,
4246
3974
  analyze
4247
3975
  };
4248
- const dumpFilename = (0, import_path6.join)(
4249
- this.options.outputPath,
4250
- this.options.tilesetName,
4251
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`
4252
- );
3976
+ const dumpFilename = (0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`);
4253
3977
  if (await isFileExists(dumpFilename)) {
4254
3978
  try {
4255
- const dump = await openJson(
4256
- (0, import_path6.join)(this.options.outputPath, this.options.tilesetName),
4257
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`
4258
- );
4259
- const {
4260
- options,
4261
- tilesConverted,
4262
- textureSetDefinitions,
4263
- attributeMetadataInfo,
4264
- materialDefinitions
4265
- } = dump;
3979
+ const dump = await openJson((0, import_path6.join)(this.options.outputPath, this.options.tilesetName), `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`);
3980
+ const { options, tilesConverted, textureSetDefinitions, attributeMetadataInfo, materialDefinitions } = dump;
4266
3981
  const ajv = new import_ajv.default();
4267
3982
  const dumpJsonValidate = ajv.compile(dumpJsonSchema);
4268
3983
  const isDumpValid = dumpJsonValidate(dump);
@@ -4304,29 +4019,14 @@ var ConversionDump = class {
4304
4019
  if (((_a2 = this.options) == null ? void 0 : _a2.outputPath) && this.options.tilesetName) {
4305
4020
  try {
4306
4021
  const time = import_process3.default.hrtime();
4307
- await writeFile(
4308
- (0, import_path6.join)(this.options.outputPath, this.options.tilesetName),
4309
- JSON.stringify({
4310
- options: this.options,
4311
- tilesConverted: this.tilesConverted,
4312
- textureSetDefinitions: this.textureSetDefinitions,
4313
- attributeMetadataInfo: this.attributeMetadataInfo,
4314
- materialDefinitions: this.materialDefinitions
4315
- }),
4316
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`
4317
- );
4318
- await renameFile(
4319
- (0, import_path6.join)(
4320
- this.options.outputPath,
4321
- this.options.tilesetName,
4322
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`
4323
- ),
4324
- (0, import_path6.join)(
4325
- this.options.outputPath,
4326
- this.options.tilesetName,
4327
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`
4328
- )
4329
- );
4022
+ await writeFile((0, import_path6.join)(this.options.outputPath, this.options.tilesetName), JSON.stringify({
4023
+ options: this.options,
4024
+ tilesConverted: this.tilesConverted,
4025
+ textureSetDefinitions: this.textureSetDefinitions,
4026
+ attributeMetadataInfo: this.attributeMetadataInfo,
4027
+ materialDefinitions: this.materialDefinitions
4028
+ }), `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`);
4029
+ await renameFile((0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}.${time[0]}.${time[1]}`), (0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
4330
4030
  } catch (error) {
4331
4031
  console.log("Can't update dump file", error);
4332
4032
  }
@@ -4337,20 +4037,8 @@ var ConversionDump = class {
4337
4037
  */
4338
4038
  async deleteDumpFile() {
4339
4039
  var _a2;
4340
- if (((_a2 = this.options) == null ? void 0 : _a2.outputPath) && this.options.tilesetName && await isFileExists(
4341
- (0, import_path6.join)(
4342
- this.options.outputPath,
4343
- this.options.tilesetName,
4344
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`
4345
- )
4346
- )) {
4347
- await removeFile(
4348
- (0, import_path6.join)(
4349
- this.options.outputPath,
4350
- this.options.tilesetName,
4351
- `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`
4352
- )
4353
- );
4040
+ if (((_a2 = this.options) == null ? void 0 : _a2.outputPath) && this.options.tilesetName && await isFileExists((0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`))) {
4041
+ await removeFile((0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`));
4354
4042
  }
4355
4043
  }
4356
4044
  /**
@@ -4405,9 +4093,7 @@ var ConversionDump = class {
4405
4093
  */
4406
4094
  updateDoneStatus(filename, nodeId, resourceType, value) {
4407
4095
  var _a2;
4408
- const nodeDump = (_a2 = this.tilesConverted[filename]) == null ? void 0 : _a2.nodes.find(
4409
- (element) => element.nodeId === nodeId
4410
- );
4096
+ const nodeDump = (_a2 = this.tilesConverted[filename]) == null ? void 0 : _a2.nodes.find((element) => element.nodeId === nodeId);
4411
4097
  if (nodeDump) {
4412
4098
  if (!nodeDump.progress) {
4413
4099
  nodeDump.progress = {};
@@ -4457,9 +4143,7 @@ var ConversionDump = class {
4457
4143
  */
4458
4144
  async updateConvertedNodesDumpFile(filename, nodeId, done) {
4459
4145
  var _a2;
4460
- const nodeDump = (_a2 = this.tilesConverted[filename]) == null ? void 0 : _a2.nodes.find(
4461
- (element) => element.nodeId === nodeId
4462
- );
4146
+ const nodeDump = (_a2 = this.tilesConverted[filename]) == null ? void 0 : _a2.nodes.find((element) => element.nodeId === nodeId);
4463
4147
  if (nodeDump) {
4464
4148
  nodeDump.done = done;
4465
4149
  await this.updateDumpFile();
@@ -4490,7 +4174,7 @@ var ConversionDump = class {
4490
4174
  }
4491
4175
  };
4492
4176
 
4493
- // src/i3s-converter/i3s-converter.ts
4177
+ // dist/i3s-converter/i3s-converter.js
4494
4178
  var _a;
4495
4179
  var ION_DEFAULT_TOKEN = (_a = import_process4.default.env) == null ? void 0 : _a.IonToken;
4496
4180
  var HARDCODED_NODES_PER_PAGE = 64;
@@ -4574,25 +4258,7 @@ var I3SConverter = class {
4574
4258
  return BROWSER_ERROR_MESSAGE;
4575
4259
  }
4576
4260
  this.conversionStartTime = import_process4.default.hrtime();
4577
- const {
4578
- tilesetName,
4579
- slpk,
4580
- egmFilePath,
4581
- inputUrl,
4582
- validate,
4583
- outputPath,
4584
- draco = true,
4585
- sevenZipExe,
4586
- maxDepth,
4587
- token,
4588
- generateTextures,
4589
- generateBoundingVolumes,
4590
- instantNodeWriting = false,
4591
- mergeMaterials: mergeMaterials2 = true,
4592
- inquirer,
4593
- metadataClass,
4594
- analyze = false
4595
- } = options;
4261
+ const { tilesetName, slpk, egmFilePath, inputUrl, validate, outputPath, draco = true, sevenZipExe, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials: mergeMaterials2 = true, inquirer, metadataClass, analyze = false } = options;
4596
4262
  this.options = {
4597
4263
  outputPath,
4598
4264
  tilesetName,
@@ -4657,29 +4323,19 @@ var I3SConverter = class {
4657
4323
  async preprocessConversion() {
4658
4324
  console.log(`Analyze source tileset`);
4659
4325
  const sourceRootTile = this.sourceTileset.root;
4660
- await traverseDatasetWith(
4661
- sourceRootTile,
4662
- null,
4663
- this.analyzeTile.bind(this),
4664
- void 0,
4665
- this.options.maxDepth
4666
- );
4326
+ await traverseDatasetWith(sourceRootTile, null, this.analyzeTile.bind(this), void 0, this.options.maxDepth);
4667
4327
  const { meshTopologyTypes, metadataClasses } = this.preprocessData;
4668
4328
  console.log(`------------------------------------------------`);
4669
4329
  console.log(`Preprocess results:`);
4670
4330
  console.log(`Tile count: ${this.progresses[PROGRESS_PHASE1_COUNT].stepsTotal}`);
4671
4331
  console.log(`glTF mesh topology types: ${Array.from(meshTopologyTypes).join(", ")}`);
4672
4332
  if (metadataClasses.size) {
4673
- console.log(
4674
- `Feature metadata classes have been found: ${Array.from(metadataClasses).join(", ")}`
4675
- );
4333
+ console.log(`Feature metadata classes have been found: ${Array.from(metadataClasses).join(", ")}`);
4676
4334
  } else {
4677
4335
  console.log("Feature metadata classes have not been found");
4678
4336
  }
4679
- if (!meshTopologyTypes.has("TRIANGLES" /* TRIANGLES */) && !meshTopologyTypes.has("TRIANGLE_STRIP" /* TRIANGLE_STRIP */)) {
4680
- console.log(
4681
- "The tileset is of unsupported mesh topology types. The conversion will be interrupted."
4682
- );
4337
+ if (!meshTopologyTypes.has(GLTFPrimitiveModeString.TRIANGLES) && !meshTopologyTypes.has(GLTFPrimitiveModeString.TRIANGLE_STRIP)) {
4338
+ console.log("The tileset is of unsupported mesh topology types. The conversion will be interrupted.");
4683
4339
  console.log(`------------------------------------------------`);
4684
4340
  return false;
4685
4341
  }
@@ -4709,9 +4365,7 @@ var I3SConverter = class {
4709
4365
  "3d-tiles": { ...this.loadOptions["3d-tiles"], loadGLTF: false }
4710
4366
  });
4711
4367
  } catch (error) {
4712
- console.log(
4713
- `[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`
4714
- );
4368
+ console.log(`[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`);
4715
4369
  }
4716
4370
  const tilePreprocessData = await analyzeTileContent(tileContent);
4717
4371
  mergePreprocessData(this.preprocessData, tilePreprocessData);
@@ -4739,9 +4393,7 @@ var I3SConverter = class {
4739
4393
  this.options.metadataClass = result.metadataClass;
4740
4394
  console.log(`${result.metadataClass} has been selected`);
4741
4395
  } else {
4742
- console.log(
4743
- `A feature metadata class has not been selected. Start the converter with option "--metadata-class". For example, "npx tile-converter ... --metadata-class ${Array.from(metadataClasses)[0]}"`
4744
- );
4396
+ console.log(`A feature metadata class has not been selected. Start the converter with option "--metadata-class". For example, "npx tile-converter ... --metadata-class ${Array.from(metadataClasses)[0]}"`);
4745
4397
  console.log(`------------------------------------------------`);
4746
4398
  return false;
4747
4399
  }
@@ -4788,16 +4440,8 @@ var I3SConverter = class {
4788
4440
  this.materialDefinitions = this.conversionDump.materialDefinitions;
4789
4441
  }
4790
4442
  const sourceRootTile = this.sourceTileset.root;
4791
- const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(
4792
- sourceRootTile.boundingVolume,
4793
- new import_core10.Matrix4(sourceRootTile.transform),
4794
- null
4795
- );
4796
- this._formLayers0(
4797
- tilesetName,
4798
- sourceBoundingVolume,
4799
- (_c = (_b = (_a2 = this.sourceTileset) == null ? void 0 : _a2.root) == null ? void 0 : _b.boundingVolume) == null ? void 0 : _c.region
4800
- );
4443
+ const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(sourceRootTile.boundingVolume, new import_core10.Matrix4(sourceRootTile.transform), null);
4444
+ this._formLayers0(tilesetName, sourceBoundingVolume, (_c = (_b = (_a2 = this.sourceTileset) == null ? void 0 : _a2.root) == null ? void 0 : _b.boundingVolume) == null ? void 0 : _c.region);
4801
4445
  const boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
4802
4446
  await this.nodePages.push({
4803
4447
  index: 0,
@@ -4807,16 +4451,10 @@ var I3SConverter = class {
4807
4451
  });
4808
4452
  this.progresses[PROGRESS_PHASE1_COUNT].startMonitoring();
4809
4453
  const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
4810
- await traverseDatasetWith(
4811
- sourceRootTile,
4812
- {
4813
- transform: new import_core10.Matrix4(sourceRootTile.transform),
4814
- parentNodes: [rootNode]
4815
- },
4816
- this.convertTile.bind(this),
4817
- this.finalizeTile.bind(this),
4818
- this.options.maxDepth
4819
- );
4454
+ await traverseDatasetWith(sourceRootTile, {
4455
+ transform: new import_core10.Matrix4(sourceRootTile.transform),
4456
+ parentNodes: [rootNode]
4457
+ }, this.convertTile.bind(this), this.finalizeTile.bind(this), this.options.maxDepth);
4820
4458
  this.progresses[PROGRESS_PHASE1_COUNT].stopMonitoring();
4821
4459
  console.log(`[finalizing conversion]`);
4822
4460
  this.layers0.attributeStorageInfo = this.attributeMetadataInfo.attributeStorageInfo;
@@ -4829,16 +4467,11 @@ var I3SConverter = class {
4829
4467
  this.layers0.textureSetDefinitions = this.conversionDump.textureSetDefinitions;
4830
4468
  }
4831
4469
  this.layers0.materialDefinitions = this.materialDefinitions;
4832
- this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(
4833
- this.geometryConfigs.map((config) => ({
4834
- geometryConfig: { ...config, draco: this.options.draco }
4835
- })),
4836
- GEOMETRY_DEFINITION()
4837
- );
4470
+ this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(this.geometryConfigs.map((config) => ({
4471
+ geometryConfig: { ...config, draco: this.options.draco }
4472
+ })), GEOMETRY_DEFINITION());
4838
4473
  if (this.layersHasTexture === false) {
4839
- this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter(
4840
- (attribute) => attribute !== "uv0"
4841
- );
4474
+ this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter((attribute) => attribute !== "uv0");
4842
4475
  }
4843
4476
  await this._writeLayers0();
4844
4477
  createSceneServerPath(tilesetName, this.layers0, tilesetPath);
@@ -4995,16 +4628,12 @@ var I3SConverter = class {
4995
4628
  * @return NodeIndexDocument, nodeInPage and node data
4996
4629
  */
4997
4630
  async _generateNodeIndexDocument(boundingVolumes, resources, parentNode, sourceTile, isDumped) {
4998
- this.layersHasTexture = this.layersHasTexture || Boolean(
4999
- "texture" in resources && resources.texture || "texelCountHint" in resources && resources.texelCountHint
5000
- );
4631
+ this.layersHasTexture = this.layersHasTexture || Boolean("texture" in resources && resources.texture || "texelCountHint" in resources && resources.texelCountHint);
5001
4632
  if (this.generateBoundingVolumes && resources.boundingVolumes) {
5002
4633
  boundingVolumes = resources.boundingVolumes;
5003
4634
  }
5004
4635
  const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
5005
- const maxScreenThresholdSQ = lodSelection.find(
5006
- (val) => val.metricType === "maxScreenThresholdSQ"
5007
- ) || { maxError: 0 };
4636
+ const maxScreenThresholdSQ = lodSelection.find((val) => val.metricType === "maxScreenThresholdSQ") || { maxError: 0 };
5008
4637
  if (isDumped) {
5009
4638
  const draftObb = {
5010
4639
  center: [],
@@ -5013,20 +4642,8 @@ var I3SConverter = class {
5013
4642
  };
5014
4643
  await this.nodePages.push({ index: 0, obb: draftObb }, parentNode.inPageId);
5015
4644
  }
5016
- const nodeInPage = await this._updateNodeInNodePages(
5017
- maxScreenThresholdSQ,
5018
- boundingVolumes,
5019
- sourceTile,
5020
- parentNode.inPageId,
5021
- resources
5022
- );
5023
- const nodeData = await NodeIndexDocument.createNodeIndexDocument(
5024
- parentNode,
5025
- boundingVolumes,
5026
- lodSelection,
5027
- nodeInPage,
5028
- resources
5029
- );
4645
+ const nodeInPage = await this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentNode.inPageId, resources);
4646
+ const nodeData = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
5030
4647
  const node = await new NodeIndexDocument(nodeInPage.index, this).addData(nodeData);
5031
4648
  return { node, nodeInPage, nodeData };
5032
4649
  }
@@ -5041,24 +4658,14 @@ var I3SConverter = class {
5041
4658
  this._checkAddRefinementTypeForTile(sourceTile);
5042
4659
  await this._updateTilesetOptions();
5043
4660
  if (this.conversionDump.restored && sourceTile.id && this.conversionDump.isFileConversionComplete(sourceTile.id)) {
5044
- const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(
5045
- sourceTile.boundingVolume,
5046
- transformationMatrix,
5047
- null
5048
- );
4661
+ const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(sourceTile.boundingVolume, transformationMatrix, null);
5049
4662
  let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
5050
4663
  const nodes = [];
5051
4664
  for (const convertedNode of this.conversionDump.tilesConverted[sourceTile.id].nodes) {
5052
- const { node } = await this._generateNodeIndexDocument(
5053
- boundingVolumes,
5054
- {
5055
- ...convertedNode.dumpMetadata,
5056
- nodeId: convertedNode.nodeId
5057
- },
5058
- parentNode,
5059
- sourceTile,
5060
- true
5061
- );
4665
+ const { node } = await this._generateNodeIndexDocument(boundingVolumes, {
4666
+ ...convertedNode.dumpMetadata,
4667
+ nodeId: convertedNode.nodeId
4668
+ }, parentNode, sourceTile, true);
5062
4669
  nodes.push(node);
5063
4670
  }
5064
4671
  return nodes;
@@ -5085,11 +4692,7 @@ var I3SConverter = class {
5085
4692
  } catch (error) {
5086
4693
  console.log(`[warning]: Failed to load ${sourceTile.contentUrl}`);
5087
4694
  }
5088
- const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(
5089
- sourceTile.boundingVolume,
5090
- transformationMatrix,
5091
- null
5092
- );
4695
+ const sourceBoundingVolume = (0, import_tiles.createBoundingVolume)(sourceTile.boundingVolume, transformationMatrix, null);
5093
4696
  let boundingVolumes = createBoundingVolumes(sourceBoundingVolume, this.geoidHeightModel);
5094
4697
  const propertyTable = getPropertyTable(tileContent, this.options.metadataClass);
5095
4698
  this.createAttributeStorageInfo(tileContent, propertyTable);
@@ -5098,14 +4701,7 @@ var I3SConverter = class {
5098
4701
  fields: this.attributeMetadataInfo.fields,
5099
4702
  popupInfo: this.attributeMetadataInfo.popupInfo
5100
4703
  };
5101
- const resourcesData = await this._convertResources(
5102
- sourceTile,
5103
- transformationMatrix,
5104
- sourceBoundingVolume,
5105
- tileContent,
5106
- parentNode.inPageId,
5107
- propertyTable
5108
- );
4704
+ const resourcesData = await this._convertResources(sourceTile, transformationMatrix, sourceBoundingVolume, tileContent, parentNode.inPageId, propertyTable);
5109
4705
  const nodes = [];
5110
4706
  const nodeIds = [];
5111
4707
  const nodesInPage = [];
@@ -5122,13 +4718,7 @@ var I3SConverter = class {
5122
4718
  boundingVolumes: null
5123
4719
  };
5124
4720
  for (const resources of resourcesData || [emptyResources]) {
5125
- const { node, nodeInPage, nodeData } = await this._generateNodeIndexDocument(
5126
- boundingVolumes,
5127
- resources,
5128
- parentNode,
5129
- sourceTile,
5130
- false
5131
- );
4721
+ const { node, nodeInPage, nodeData } = await this._generateNodeIndexDocument(boundingVolumes, resources, parentNode, sourceTile, false);
5132
4722
  nodes.push(node);
5133
4723
  if (nodeInPage.mesh) {
5134
4724
  if (sourceTile.id) {
@@ -5178,21 +4768,7 @@ var I3SConverter = class {
5178
4768
  halfSize: [],
5179
4769
  quaternion: []
5180
4770
  };
5181
- const resourcesData = await convertB3dmToI3sGeometry(
5182
- tileContent,
5183
- transformationMatrix,
5184
- boundingVolume,
5185
- async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index,
5186
- propertyTable,
5187
- this.featuresHashArray,
5188
- this.attributeMetadataInfo.attributeStorageInfo,
5189
- this.options.draco,
5190
- this.generateBoundingVolumes,
5191
- this.options.mergeMaterials,
5192
- this.geoidHeightModel,
5193
- this.loadOptions.modules,
5194
- this.options.metadataClass
5195
- );
4771
+ const resourcesData = await convertB3dmToI3sGeometry(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.attributeMetadataInfo.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.loadOptions.modules, this.options.metadataClass);
5196
4772
  return resourcesData;
5197
4773
  }
5198
4774
  /**
@@ -5221,12 +4797,7 @@ var I3SConverter = class {
5221
4797
  if (geometry && this.isContentSupported(sourceTile)) {
5222
4798
  nodeInPage.mesh = {
5223
4799
  geometry: {
5224
- definition: this.findOrCreateGeometryDefinition(
5225
- Boolean(
5226
- "texture" in resources && resources.texture || "texelCountHint" in resources && resources.texelCountHint
5227
- ),
5228
- hasUvRegions
5229
- ),
4800
+ definition: this.findOrCreateGeometryDefinition(Boolean("texture" in resources && resources.texture || "texelCountHint" in resources && resources.texelCountHint), hasUvRegions),
5230
4801
  resource: 0
5231
4802
  },
5232
4803
  attribute: {
@@ -5283,45 +4854,13 @@ var I3SConverter = class {
5283
4854
  * @return {Promise<void>}
5284
4855
  */
5285
4856
  async _writeResources(resources, nodePath, sourceTile) {
5286
- const {
5287
- geometry: geometryBuffer,
5288
- compressedGeometry,
5289
- texture,
5290
- sharedResources,
5291
- attributes
5292
- } = resources;
4857
+ const { geometry: geometryBuffer, compressedGeometry, texture, sharedResources, attributes } = resources;
5293
4858
  const childPath = (0, import_path7.join)(this.layers0Path, "nodes", nodePath);
5294
4859
  const slpkChildPath = (0, import_path7.join)("nodes", nodePath);
5295
- await this._writeGeometries(
5296
- geometryBuffer,
5297
- compressedGeometry,
5298
- childPath,
5299
- slpkChildPath,
5300
- sourceTile.id || "",
5301
- parseInt(nodePath)
5302
- );
5303
- await this._writeShared(
5304
- sharedResources,
5305
- childPath,
5306
- slpkChildPath,
5307
- nodePath,
5308
- sourceTile.id || "",
5309
- parseInt(nodePath)
5310
- );
5311
- await this._writeTexture(
5312
- texture,
5313
- childPath,
5314
- slpkChildPath,
5315
- sourceTile.id || "",
5316
- parseInt(nodePath)
5317
- );
5318
- await this._writeAttributes(
5319
- attributes,
5320
- childPath,
5321
- slpkChildPath,
5322
- sourceTile.id || "",
5323
- parseInt(nodePath)
5324
- );
4860
+ await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath, sourceTile.id || "", parseInt(nodePath));
4861
+ await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath, sourceTile.id || "", parseInt(nodePath));
4862
+ await this._writeTexture(texture, childPath, slpkChildPath, sourceTile.id || "", parseInt(nodePath));
4863
+ await this._writeAttributes(attributes, childPath, slpkChildPath, sourceTile.id || "", parseInt(nodePath));
5325
4864
  }
5326
4865
  /**
5327
4866
  * Write non-compressed and compressed geometries in files
@@ -5333,14 +4872,14 @@ var I3SConverter = class {
5333
4872
  * @param nodeId - nodeId of a converted node for the writing
5334
4873
  */
5335
4874
  async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath, sourceId, nodeId) {
5336
- this.conversionDump.updateDoneStatus(sourceId, nodeId, "GEOMETRY" /* GEOMETRY */, false);
4875
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.GEOMETRY, false);
5337
4876
  if (this.options.slpk) {
5338
4877
  const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
5339
4878
  await this.writeQueue.enqueue({
5340
4879
  archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
5341
4880
  sourceId,
5342
4881
  outputId: nodeId,
5343
- resourceType: "GEOMETRY" /* GEOMETRY */,
4882
+ resourceType: ResourceType.GEOMETRY,
5344
4883
  writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
5345
4884
  });
5346
4885
  } else {
@@ -5348,19 +4887,19 @@ var I3SConverter = class {
5348
4887
  await this.writeQueue.enqueue({
5349
4888
  sourceId,
5350
4889
  outputId: nodeId,
5351
- resourceType: "GEOMETRY" /* GEOMETRY */,
4890
+ resourceType: ResourceType.GEOMETRY,
5352
4891
  writePromise: () => writeFile(geometryPath, geometryBuffer, "index.bin")
5353
4892
  });
5354
4893
  }
5355
4894
  if (this.options.draco) {
5356
- this.conversionDump.updateDoneStatus(sourceId, nodeId, "DRACO_GEOMETRY" /* DRACO_GEOMETRY */, false);
4895
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
5357
4896
  if (this.options.slpk) {
5358
4897
  const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
5359
4898
  await this.writeQueue.enqueue({
5360
4899
  archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
5361
4900
  sourceId,
5362
4901
  outputId: nodeId,
5363
- resourceType: "DRACO_GEOMETRY" /* DRACO_GEOMETRY */,
4902
+ resourceType: ResourceType.DRACO_GEOMETRY,
5364
4903
  writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
5365
4904
  });
5366
4905
  } else {
@@ -5368,7 +4907,7 @@ var I3SConverter = class {
5368
4907
  await this.writeQueue.enqueue({
5369
4908
  sourceId,
5370
4909
  outputId: nodeId,
5371
- resourceType: "DRACO_GEOMETRY" /* DRACO_GEOMETRY */,
4910
+ resourceType: ResourceType.DRACO_GEOMETRY,
5372
4911
  writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, "index.bin")
5373
4912
  });
5374
4913
  }
@@ -5390,14 +4929,14 @@ var I3SConverter = class {
5390
4929
  sharedResources.nodePath = nodePath;
5391
4930
  const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
5392
4931
  const sharedDataStr = JSON.stringify(sharedData);
5393
- this.conversionDump.updateDoneStatus(sourceId, nodeId, "SHARED" /* SHARED */, false);
4932
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.SHARED, false);
5394
4933
  if (this.options.slpk) {
5395
4934
  const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
5396
4935
  await this.writeQueue.enqueue({
5397
4936
  archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
5398
4937
  sourceId,
5399
4938
  outputId: nodeId,
5400
- resourceType: "SHARED" /* SHARED */,
4939
+ resourceType: ResourceType.SHARED,
5401
4940
  writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
5402
4941
  });
5403
4942
  } else {
@@ -5405,7 +4944,7 @@ var I3SConverter = class {
5405
4944
  await this.writeQueue.enqueue({
5406
4945
  sourceId,
5407
4946
  outputId: nodeId,
5408
- resourceType: "SHARED" /* SHARED */,
4947
+ resourceType: ResourceType.SHARED,
5409
4948
  writePromise: () => writeFile(sharedPath, sharedDataStr)
5410
4949
  });
5411
4950
  }
@@ -5427,21 +4966,8 @@ var I3SConverter = class {
5427
4966
  case "jpg":
5428
4967
  case "png": {
5429
4968
  formats.push({ name: "0", format });
5430
- this.conversionDump.updateDoneStatus(
5431
- sourceId,
5432
- nodeId,
5433
- `${"TEXTURE" /* TEXTURE */}/${format}`,
5434
- false
5435
- );
5436
- await this.writeTextureFile(
5437
- textureData,
5438
- "0",
5439
- format,
5440
- childPath,
5441
- slpkChildPath,
5442
- sourceId,
5443
- nodeId
5444
- );
4969
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.TEXTURE}/${format}`, false);
4970
+ await this.writeTextureFile(textureData, "0", format, childPath, slpkChildPath, sourceId, nodeId);
5445
4971
  if (this.generateTextures) {
5446
4972
  formats.push({ name: "1", format: "ktx2" });
5447
4973
  const copyArrayBuffer = texture.image.data.subarray();
@@ -5461,59 +4987,20 @@ var I3SConverter = class {
5461
4987
  useLocalLibraries: true
5462
4988
  }
5463
4989
  );
5464
- this.conversionDump.updateDoneStatus(
5465
- sourceId,
5466
- nodeId,
5467
- `${"TEXTURE" /* TEXTURE */}/ktx2`,
5468
- false
5469
- );
5470
- await this.writeTextureFile(
5471
- ktx2TextureData,
5472
- "1",
5473
- "ktx2",
5474
- childPath,
5475
- slpkChildPath,
5476
- sourceId,
5477
- nodeId
5478
- );
4990
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.TEXTURE}/ktx2`, false);
4991
+ await this.writeTextureFile(ktx2TextureData, "1", "ktx2", childPath, slpkChildPath, sourceId, nodeId);
5479
4992
  }
5480
4993
  break;
5481
4994
  }
5482
4995
  case "ktx2": {
5483
4996
  formats.push({ name: "1", format });
5484
- this.conversionDump.updateDoneStatus(
5485
- sourceId,
5486
- nodeId,
5487
- `${"TEXTURE" /* TEXTURE */}/${format}`,
5488
- false
5489
- );
5490
- await this.writeTextureFile(
5491
- textureData,
5492
- "1",
5493
- format,
5494
- childPath,
5495
- slpkChildPath,
5496
- sourceId,
5497
- nodeId
5498
- );
4997
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.TEXTURE}/${format}`, false);
4998
+ await this.writeTextureFile(textureData, "1", format, childPath, slpkChildPath, sourceId, nodeId);
5499
4999
  if (this.generateTextures) {
5500
5000
  formats.push({ name: "0", format: "jpg" });
5501
5001
  const decodedFromKTX2TextureData = (0, import_core9.encode)(texture.image.data[0], import_images.ImageWriter);
5502
- this.conversionDump.updateDoneStatus(
5503
- sourceId,
5504
- nodeId,
5505
- `${"TEXTURE" /* TEXTURE */}/jpg`,
5506
- false
5507
- );
5508
- await this.writeTextureFile(
5509
- decodedFromKTX2TextureData,
5510
- "0",
5511
- "jpg",
5512
- childPath,
5513
- slpkChildPath,
5514
- sourceId,
5515
- nodeId
5516
- );
5002
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.TEXTURE}/jpg`, false);
5003
+ await this.writeTextureFile(decodedFromKTX2TextureData, "0", "jpg", childPath, slpkChildPath, sourceId, nodeId);
5517
5004
  }
5518
5005
  }
5519
5006
  }
@@ -5544,7 +5031,7 @@ var I3SConverter = class {
5544
5031
  archiveKey: `${slpkChildPath}/textures/${name}.${format}`,
5545
5032
  sourceId,
5546
5033
  outputId: nodeId,
5547
- resourceType: `${"TEXTURE" /* TEXTURE */}/${format}`,
5034
+ resourceType: `${ResourceType.TEXTURE}/${format}`,
5548
5035
  writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)
5549
5036
  });
5550
5037
  } else {
@@ -5552,7 +5039,7 @@ var I3SConverter = class {
5552
5039
  await this.writeQueue.enqueue({
5553
5040
  sourceId,
5554
5041
  outputId: nodeId,
5555
- resourceType: `${"TEXTURE" /* TEXTURE */}/${format}`,
5042
+ resourceType: `${ResourceType.TEXTURE}/${format}`,
5556
5043
  writePromise: () => writeFile(texturePath, textureData, `index.${format}`)
5557
5044
  });
5558
5045
  }
@@ -5571,19 +5058,14 @@ var I3SConverter = class {
5571
5058
  for (let index = 0; index < minimumLength; index++) {
5572
5059
  const folderName = this.attributeMetadataInfo.attributeStorageInfo[index].key;
5573
5060
  const fileBuffer = new Uint8Array(attributes[index]);
5574
- this.conversionDump.updateDoneStatus(
5575
- sourceId,
5576
- nodeId,
5577
- `${"ATTRIBUTES" /* ATTRIBUTES */}/${folderName}`,
5578
- false
5579
- );
5061
+ this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.ATTRIBUTES}/${folderName}`, false);
5580
5062
  if (this.options.slpk) {
5581
5063
  const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
5582
5064
  await this.writeQueue.enqueue({
5583
5065
  archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
5584
5066
  sourceId,
5585
5067
  outputId: nodeId,
5586
- resourceType: `${"ATTRIBUTES" /* ATTRIBUTES */}/${folderName}`,
5068
+ resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
5587
5069
  writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
5588
5070
  });
5589
5071
  } else {
@@ -5591,7 +5073,7 @@ var I3SConverter = class {
5591
5073
  await this.writeQueue.enqueue({
5592
5074
  sourceId,
5593
5075
  outputId: nodeId,
5594
- resourceType: `${"ATTRIBUTES" /* ATTRIBUTES */}/${folderName}`,
5076
+ resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
5595
5077
  writePromise: () => writeFile(attributesPath, fileBuffer, "index.bin")
5596
5078
  });
5597
5079
  }
@@ -5654,10 +5136,7 @@ var I3SConverter = class {
5654
5136
  let attributeTypesMap = null;
5655
5137
  if (this.options.metadataClass) {
5656
5138
  if (!this.attributeMetadataInfo.attributeStorageInfo.length && (tileContent == null ? void 0 : tileContent.gltf)) {
5657
- attributeTypesMap = getAttributeTypesMapFromSchema(
5658
- tileContent.gltf,
5659
- this.options.metadataClass
5660
- );
5139
+ attributeTypesMap = getAttributeTypesMapFromSchema(tileContent.gltf, this.options.metadataClass);
5661
5140
  }
5662
5141
  } else if (propertyTable) {
5663
5142
  attributeTypesMap = getAttributeTypesMapFromPropertyTable(propertyTable);
@@ -5737,14 +5216,14 @@ var I3SConverter = class {
5737
5216
  }
5738
5217
  };
5739
5218
 
5740
- // src/3d-tiles-converter/3d-tiles-converter.ts
5219
+ // dist/3d-tiles-converter/3d-tiles-converter.js
5741
5220
  var import_path8 = require("path");
5742
5221
  var import_process5 = __toESM(require("process"), 1);
5743
5222
  var import_json_map_transform10 = __toESM(require("json-map-transform"), 1);
5744
5223
  var import_core15 = require("@loaders.gl/core");
5745
5224
  var import_i3s2 = require("@loaders.gl/i3s");
5746
5225
 
5747
- // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
5226
+ // dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js
5748
5227
  var import_core11 = require("@math.gl/core");
5749
5228
  var import_geospatial5 = require("@math.gl/geospatial");
5750
5229
  var import_culling3 = require("@math.gl/culling");
@@ -5755,15 +5234,11 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
5755
5234
  i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
5756
5235
  ];
5757
5236
  const cartesianCenter = import_geospatial5.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core11.Vector3());
5758
- const tiles3DObb = new import_culling3.OrientedBoundingBox().fromCenterHalfSizeQuaternion(
5759
- cartesianCenter,
5760
- i3SObb.halfSize,
5761
- i3SObb.quaternion
5762
- );
5237
+ const tiles3DObb = new import_culling3.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
5763
5238
  return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
5764
5239
  }
5765
5240
 
5766
- // src/3d-tiles-converter/json-templates/tileset.ts
5241
+ // dist/3d-tiles-converter/json-templates/tileset.js
5767
5242
  var import_json_map_transform9 = __toESM(require("json-map-transform"), 1);
5768
5243
  var ASSET = () => ({
5769
5244
  version: {
@@ -5804,17 +5279,17 @@ var TILESET = () => ({
5804
5279
  }
5805
5280
  });
5806
5281
 
5807
- // src/3d-tiles-converter/3d-tiles-converter.ts
5282
+ // dist/3d-tiles-converter/3d-tiles-converter.js
5808
5283
  var import_worker_utils2 = require("@loaders.gl/worker-utils");
5809
5284
 
5810
- // src/3d-tiles-converter/helpers/b3dm-converter.ts
5285
+ // dist/3d-tiles-converter/helpers/b3dm-converter.js
5811
5286
  var import_core12 = require("@loaders.gl/core");
5812
5287
  var import_gltf6 = require("@loaders.gl/gltf");
5813
5288
  var import_d_tiles3 = require("@loaders.gl/3d-tiles");
5814
5289
  var import_core13 = require("@math.gl/core");
5815
5290
  var import_geospatial6 = require("@math.gl/geospatial");
5816
5291
 
5817
- // src/3d-tiles-converter/helpers/texture-atlas.ts
5292
+ // dist/3d-tiles-converter/helpers/texture-atlas.js
5818
5293
  function convertTextureAtlas(texCoords, uvRegions) {
5819
5294
  const convertedTexCoords = new Float32Array(texCoords.length);
5820
5295
  const normalisedRegions = normalizeRegions(uvRegions);
@@ -5845,7 +5320,7 @@ function normalizeRegions(regions) {
5845
5320
  return normalizedRegions;
5846
5321
  }
5847
5322
 
5848
- // src/3d-tiles-converter/helpers/b3dm-converter.ts
5323
+ // dist/3d-tiles-converter/helpers/b3dm-converter.js
5849
5324
  var Z_UP_TO_Y_UP_MATRIX = new import_core13.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
5850
5325
  var scratchVector2 = new import_core13.Vector3();
5851
5326
  var KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
@@ -5859,15 +5334,12 @@ var B3dmConverter = class {
5859
5334
  */
5860
5335
  async convert(i3sAttributesData, featureAttributes = null) {
5861
5336
  const gltf = await this.buildGLTF(i3sAttributesData, featureAttributes);
5862
- const b3dm = (0, import_core12.encodeSync)(
5863
- {
5864
- gltfEncoded: new Uint8Array(gltf),
5865
- type: "b3dm",
5866
- featuresLength: this._getFeaturesLength(featureAttributes),
5867
- batchTable: featureAttributes
5868
- },
5869
- import_d_tiles3.Tile3DWriter
5870
- );
5337
+ const b3dm = (0, import_core12.encodeSync)({
5338
+ gltfEncoded: new Uint8Array(gltf),
5339
+ type: "b3dm",
5340
+ featuresLength: this._getFeaturesLength(featureAttributes),
5341
+ batchTable: featureAttributes
5342
+ }, import_d_tiles3.Tile3DWriter);
5871
5343
  return b3dm;
5872
5344
  }
5873
5345
  /**
@@ -5890,22 +5362,11 @@ var B3dmConverter = class {
5890
5362
  const positions = attributes.positions;
5891
5363
  const positionsValue = positions.value;
5892
5364
  if (attributes.uvRegions && attributes.texCoords) {
5893
- attributes.texCoords.value = convertTextureAtlas(
5894
- attributes.texCoords.value,
5895
- attributes.uvRegions.value
5896
- );
5365
+ attributes.texCoords.value = convertTextureAtlas(attributes.texCoords.value, attributes.uvRegions.value);
5897
5366
  }
5898
5367
  const cartesianOrigin = new import_core13.Vector3(box);
5899
- const cartographicOrigin = import_geospatial6.Ellipsoid.WGS84.cartesianToCartographic(
5900
- cartesianOrigin,
5901
- new import_core13.Vector3()
5902
- );
5903
- attributes.positions.value = this._normalizePositions(
5904
- positionsValue,
5905
- cartesianOrigin,
5906
- cartographicOrigin,
5907
- modelMatrix
5908
- );
5368
+ const cartographicOrigin = import_geospatial6.Ellipsoid.WGS84.cartesianToCartographic(cartesianOrigin, new import_core13.Vector3());
5369
+ attributes.positions.value = this._normalizePositions(positionsValue, cartesianOrigin, cartographicOrigin, modelMatrix);
5909
5370
  this._createBatchIds(tileContent, featureAttributes);
5910
5371
  if (attributes.normals && !this._checkNormals(attributes.normals.value)) {
5911
5372
  delete attributes.normals;
@@ -6112,7 +5573,7 @@ var B3dmConverter = class {
6112
5573
  }
6113
5574
  };
6114
5575
 
6115
- // src/3d-tiles-converter/helpers/load-i3s.ts
5576
+ // dist/3d-tiles-converter/helpers/load-i3s.js
6116
5577
  var import_core14 = require("@loaders.gl/core");
6117
5578
  var import_i3s = require("@loaders.gl/i3s");
6118
5579
  var import_loader_utils5 = require("@loaders.gl/loader-utils");
@@ -6147,12 +5608,7 @@ var loadI3SContent = async (sourceTileset, sourceTile, tilesetLoadOptions, slpkF
6147
5608
  }
6148
5609
  }
6149
5610
  };
6150
- const tileContent = await loadFromArchive2(
6151
- sourceTile.contentUrl,
6152
- import_i3s.I3SLoader,
6153
- loadOptions,
6154
- slpkFilesystem
6155
- );
5611
+ const tileContent = await loadFromArchive2(sourceTile.contentUrl, import_i3s.I3SLoader, loadOptions, slpkFilesystem);
6156
5612
  return tileContent;
6157
5613
  };
6158
5614
  async function openSLPK(url) {
@@ -6206,7 +5662,7 @@ async function getNodeCount(fileSystem) {
6206
5662
  return count;
6207
5663
  }
6208
5664
 
6209
- // src/3d-tiles-converter/3d-tiles-converter.ts
5665
+ // dist/3d-tiles-converter/3d-tiles-converter.js
6210
5666
  var I3S = "I3S";
6211
5667
  var Tiles3DConverter = class {
6212
5668
  constructor() {
@@ -6264,16 +5720,11 @@ var Tiles3DConverter = class {
6264
5720
  }
6265
5721
  }
6266
5722
  this.progress.startMonitoring();
6267
- this.sourceTileset = await loadFromArchive2(
6268
- inputUrl,
6269
- import_i3s2.I3SLoader,
6270
- {
6271
- ...this.loaderOptions,
6272
- // @ts-expect-error `isTileset` can be boolean of 'auto' but TS expects a string
6273
- i3s: { ...this.loaderOptions.i3s, isTileset: true }
6274
- },
6275
- this.slpkFilesystem
6276
- );
5723
+ this.sourceTileset = await loadFromArchive2(inputUrl, import_i3s2.I3SLoader, {
5724
+ ...this.loaderOptions,
5725
+ // @ts-expect-error `isTileset` can be boolean of 'auto' but TS expects a string
5726
+ i3s: { ...this.loaderOptions.i3s, isTileset: true }
5727
+ }, this.slpkFilesystem);
6277
5728
  if (!this.sourceTileset) {
6278
5729
  return;
6279
5730
  }
@@ -6362,12 +5813,7 @@ var Tiles3DConverter = class {
6362
5813
  await this._addChildren(sourceChild, child2, level + 1);
6363
5814
  return;
6364
5815
  }
6365
- const content = await loadI3SContent(
6366
- this.sourceTileset,
6367
- sourceChild,
6368
- this.loaderOptions,
6369
- this.slpkFilesystem
6370
- );
5816
+ const content = await loadI3SContent(this.sourceTileset, sourceChild, this.loaderOptions, this.slpkFilesystem);
6371
5817
  if (!content) {
6372
5818
  await this._addChildren(sourceChild, parentNode, level + 1);
6373
5819
  return;
@@ -6387,11 +5833,7 @@ var Tiles3DConverter = class {
6387
5833
  const b3dm = await b3dmConverter.convert(i3sAttributesData, featureAttributes);
6388
5834
  await this.conversionDump.addNode(`${sourceChild.id}.b3dm`, sourceChild.id);
6389
5835
  await writeFile(this.tilesetPath, new Uint8Array(b3dm), `${sourceChild.id}.b3dm`);
6390
- await this.conversionDump.updateConvertedNodesDumpFile(
6391
- `${sourceChild.id}.b3dm`,
6392
- sourceChild.id,
6393
- true
6394
- );
5836
+ await this.conversionDump.updateConvertedNodesDumpFile(`${sourceChild.id}.b3dm`, sourceChild.id, true);
6395
5837
  parentNode.children.push(child);
6396
5838
  nextParentNode = child;
6397
5839
  }
@@ -6431,9 +5873,7 @@ var Tiles3DConverter = class {
6431
5873
  let header;
6432
5874
  if ((_a2 = this.sourceTileset) == null ? void 0 : _a2.nodePagesTile) {
6433
5875
  console.log(`Node conversion: ${childNodeInfo.id}`);
6434
- header = await this.sourceTileset.nodePagesTile.formTileFromNodePages(
6435
- parseInt(childNodeInfo.id)
6436
- );
5876
+ header = await this.sourceTileset.nodePagesTile.formTileFromNodePages(parseInt(childNodeInfo.id));
6437
5877
  } else {
6438
5878
  const nodeUrl = this._relativeUrlToFullUrl(parentNode.url, childNodeInfo.href);
6439
5879
  const options = {
@@ -6558,3 +5998,4 @@ var Tiles3DConverter = class {
6558
5998
  console.log(`------------------------------------------------`);
6559
5999
  }
6560
6000
  };
6001
+ //# sourceMappingURL=index.cjs.map