@loaders.gl/tile-converter 3.3.0-alpha.8 → 3.4.0-alpha.1

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 (125) hide show
  1. package/dist/3d-tiles-attributes-worker.js +1 -1
  2. package/dist/converter-cli.js +14 -2
  3. package/dist/converter.min.js +22 -22
  4. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  5. package/dist/deps-installer/deps-installer.js +8 -0
  6. package/dist/dist.min.js +1014 -693
  7. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  8. package/dist/es5/converter-cli.js +14 -2
  9. package/dist/es5/converter-cli.js.map +1 -1
  10. package/dist/es5/deps-installer/deps-installer.js +13 -2
  11. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  12. package/dist/es5/i3s-attributes-worker.js +1 -1
  13. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  14. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +16 -7
  15. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  16. package/dist/es5/i3s-converter/helpers/geometry-converter.js +363 -113
  17. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  18. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +6 -11
  19. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  20. package/dist/es5/i3s-converter/helpers/node-index-document.js +517 -0
  21. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
  22. package/dist/es5/i3s-converter/helpers/node-pages.js +455 -173
  23. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  24. package/dist/es5/i3s-converter/i3s-converter.js +549 -618
  25. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  26. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
  27. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  28. package/dist/es5/i3s-converter/json-templates/layers.js +2 -93
  29. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  30. package/dist/es5/i3s-converter/json-templates/shared-resources.js +3 -3
  31. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  32. package/dist/es5/i3s-converter/types.js.map +1 -1
  33. package/dist/es5/lib/utils/file-utils.js +93 -9
  34. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  35. package/dist/es5/lib/utils/write-queue.js +38 -25
  36. package/dist/es5/lib/utils/write-queue.js.map +1 -1
  37. package/dist/es5/pgm-loader.js +1 -1
  38. package/dist/es5/workers/i3s-attributes-worker.js +1 -1
  39. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
  40. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  41. package/dist/esm/converter-cli.js +14 -2
  42. package/dist/esm/converter-cli.js.map +1 -1
  43. package/dist/esm/deps-installer/deps-installer.js +9 -1
  44. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  45. package/dist/esm/i3s-attributes-worker.js +1 -1
  46. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  47. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +16 -7
  48. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  49. package/dist/esm/i3s-converter/helpers/geometry-converter.js +150 -40
  50. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  51. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +6 -9
  52. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  53. package/dist/esm/i3s-converter/helpers/node-index-document.js +202 -0
  54. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
  55. package/dist/esm/i3s-converter/helpers/node-pages.js +162 -76
  56. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  57. package/dist/esm/i3s-converter/i3s-converter.js +115 -220
  58. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  59. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
  60. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  61. package/dist/esm/i3s-converter/json-templates/layers.js +2 -85
  62. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
  63. package/dist/esm/i3s-converter/json-templates/shared-resources.js +3 -3
  64. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  65. package/dist/esm/i3s-converter/types.js.map +1 -1
  66. package/dist/esm/lib/utils/file-utils.js +44 -3
  67. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  68. package/dist/esm/lib/utils/write-queue.js +19 -10
  69. package/dist/esm/lib/utils/write-queue.js.map +1 -1
  70. package/dist/esm/pgm-loader.js +1 -1
  71. package/dist/esm/workers/i3s-attributes-worker.js +1 -1
  72. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
  73. package/dist/i3s-attributes-worker.js +2 -2
  74. package/dist/i3s-attributes-worker.js.map +2 -2
  75. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +3 -3
  76. package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -3
  77. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  78. package/dist/i3s-converter/helpers/geometry-attributes.js +16 -10
  79. package/dist/i3s-converter/helpers/geometry-converter.d.ts +8 -4
  80. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  81. package/dist/i3s-converter/helpers/geometry-converter.js +200 -44
  82. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  83. package/dist/i3s-converter/helpers/gltf-attributes.js +2 -3
  84. package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
  85. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
  86. package/dist/i3s-converter/helpers/node-index-document.js +250 -0
  87. package/dist/i3s-converter/helpers/node-pages.d.ts +78 -43
  88. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  89. package/dist/i3s-converter/helpers/node-pages.js +194 -93
  90. package/dist/i3s-converter/i3s-converter.d.ts +33 -58
  91. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  92. package/dist/i3s-converter/i3s-converter.js +122 -233
  93. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
  94. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
  95. package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
  96. package/dist/i3s-converter/json-templates/layers.d.ts +1 -30
  97. package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
  98. package/dist/i3s-converter/json-templates/layers.js +2 -86
  99. package/dist/i3s-converter/json-templates/shared-resources.js +3 -3
  100. package/dist/i3s-converter/types.d.ts +28 -2
  101. package/dist/i3s-converter/types.d.ts.map +1 -1
  102. package/dist/lib/utils/file-utils.d.ts +17 -1
  103. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  104. package/dist/lib/utils/file-utils.js +64 -7
  105. package/dist/lib/utils/write-queue.d.ts +18 -2
  106. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  107. package/dist/lib/utils/write-queue.js +18 -12
  108. package/dist/workers/i3s-attributes-worker.js +1 -1
  109. package/package.json +23 -19
  110. package/src/converter-cli.ts +22 -2
  111. package/src/deps-installer/deps-installer.ts +9 -0
  112. package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -3
  113. package/src/i3s-converter/helpers/geometry-attributes.ts +16 -11
  114. package/src/i3s-converter/helpers/geometry-converter.ts +217 -48
  115. package/src/i3s-converter/helpers/gltf-attributes.ts +2 -3
  116. package/src/i3s-converter/helpers/node-index-document.ts +315 -0
  117. package/src/i3s-converter/helpers/node-pages.ts +215 -110
  118. package/src/i3s-converter/i3s-converter.ts +170 -312
  119. package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
  120. package/src/i3s-converter/json-templates/layers.ts +2 -91
  121. package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
  122. package/src/i3s-converter/types.ts +29 -2
  123. package/src/lib/utils/file-utils.ts +62 -7
  124. package/src/lib/utils/write-queue.ts +36 -15
  125. package/src/workers/i3s-attributes-worker.ts +2 -1
package/dist/dist.min.js CHANGED
@@ -638,8 +638,8 @@ var require_globals2 = __commonJS({
638
638
  });
639
639
  var _isBrowser = _interopRequireDefault(require_is_browser());
640
640
  var _globals = require_globals();
641
- var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
642
- exports.VERSION = VERSION17;
641
+ var VERSION18 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "untranspiled source";
642
+ exports.VERSION = VERSION18;
643
643
  var isBrowser3 = (0, _isBrowser.default)();
644
644
  exports.isBrowser = isBrowser3;
645
645
  }
@@ -3632,7 +3632,7 @@ var require_vector2 = __commonJS({
3632
3632
  }
3633
3633
  }, {
3634
3634
  key: "transform",
3635
- value: function transform9(matrix4) {
3635
+ value: function transform11(matrix4) {
3636
3636
  return this.transformAsPoint(matrix4);
3637
3637
  }
3638
3638
  }, {
@@ -4310,7 +4310,7 @@ var require_vector3 = __commonJS({
4310
4310
  }
4311
4311
  }, {
4312
4312
  key: "transform",
4313
- value: function transform9(matrix4) {
4313
+ value: function transform11(matrix4) {
4314
4314
  return this.transformAsPoint(matrix4);
4315
4315
  }
4316
4316
  }, {
@@ -4538,7 +4538,7 @@ var require_vector4 = __commonJS({
4538
4538
  }
4539
4539
  }, {
4540
4540
  key: "transform",
4541
- value: function transform9(matrix4) {
4541
+ value: function transform11(matrix4) {
4542
4542
  vec4.transformMat4(this, this, matrix4);
4543
4543
  return this.check();
4544
4544
  }
@@ -5431,7 +5431,7 @@ var require_matrix3 = __commonJS({
5431
5431
  }
5432
5432
  }, {
5433
5433
  key: "transform",
5434
- value: function transform9(vector, result) {
5434
+ value: function transform11(vector, result) {
5435
5435
  var out;
5436
5436
  switch (vector.length) {
5437
5437
  case 2:
@@ -7635,7 +7635,7 @@ var require_matrix4 = __commonJS({
7635
7635
  }
7636
7636
  }, {
7637
7637
  key: "transform",
7638
- value: function transform9(vector, result) {
7638
+ value: function transform11(vector, result) {
7639
7639
  if (vector.length === 4) {
7640
7640
  result = vec4.transformMat4(result || [-0, -0, -0, -0], vector, this);
7641
7641
  (0, _validators.checkVector)(result, 4);
@@ -10385,7 +10385,7 @@ var require_axis_aligned_bounding_box = __commonJS({
10385
10385
  }
10386
10386
  }, {
10387
10387
  key: "transform",
10388
- value: function transform9(_transform) {
10388
+ value: function transform11(_transform) {
10389
10389
  this.center.transformAsPoint(_transform);
10390
10390
  this.halfDiagonal.transform(_transform);
10391
10391
  this.minimum.transform(_transform);
@@ -10565,7 +10565,7 @@ var require_bounding_sphere = __commonJS({
10565
10565
  }
10566
10566
  }, {
10567
10567
  key: "transform",
10568
- value: function transform9(_transform) {
10568
+ value: function transform11(_transform) {
10569
10569
  this.center.transform(_transform);
10570
10570
  var scale = mat4.getScaling(scratchVector7, _transform);
10571
10571
  this.radius = Math.max(scale[0], Math.max(scale[1], scale[2])) * this.radius;
@@ -10820,7 +10820,7 @@ var require_oriented_bounding_box = __commonJS({
10820
10820
  }
10821
10821
  }, {
10822
10822
  key: "transform",
10823
- value: function transform9(transformation) {
10823
+ value: function transform11(transformation) {
10824
10824
  this.center.transformAsPoint(transformation);
10825
10825
  var xAxis = this.halfAxes.getColumn(0, scratchVectorU);
10826
10826
  xAxis.transformAsPoint(transformation);
@@ -10911,7 +10911,7 @@ var require_plane = __commonJS({
10911
10911
  }
10912
10912
  }, {
10913
10913
  key: "transform",
10914
- value: function transform9(matrix4) {
10914
+ value: function transform11(matrix4) {
10915
10915
  var normal = scratchNormal2.copy(this.normal).transformAsVector(matrix4).normalize();
10916
10916
  var point = this.normal.scale(-this.distance).transform(matrix4);
10917
10917
  return this.fromPointNormal(point, normal);
@@ -12741,9 +12741,9 @@ var require_jsonMapTransform = __commonJS({
12741
12741
  var isUndefined = require_objectHandler().isUndefined;
12742
12742
  var setObjectValue = (template, key, value, transformedObject, originalObject) => {
12743
12743
  const defaultValue2 = template[key].default;
12744
- const transform10 = template[key].transform;
12744
+ const transform12 = template[key].transform;
12745
12745
  const omitValues = template[key].omitValues || [];
12746
- let transformedValue = transform10 ? transform10(value, transformedObject, originalObject) : value;
12746
+ let transformedValue = transform12 ? transform12(value, transformedObject, originalObject) : value;
12747
12747
  if (isUndefined(transformedValue) && !isUndefined(defaultValue2)) {
12748
12748
  transformedValue = defaultValue2;
12749
12749
  }
@@ -12761,19 +12761,19 @@ var require_jsonMapTransform = __commonJS({
12761
12761
  return afterTransform ? afterTransform(transformedObject, originalObject) : transformedObject;
12762
12762
  };
12763
12763
  var mapTransform = (jsonArray, template, afterTransform) => jsonArray.map((originalObject) => {
12764
- const transformedObject = transform9(originalObject, template);
12764
+ const transformedObject = transform11(originalObject, template);
12765
12765
  return afterTransform ? afterTransform(transformedObject, originalObject) : transformedObject;
12766
12766
  });
12767
- var transform9 = (json, template, afterTransform) => Array.isArray(json) ? mapTransform(json, template, afterTransform) : transformJson(json, template, afterTransform);
12768
- module2.exports = transform9;
12767
+ var transform11 = (json, template, afterTransform) => Array.isArray(json) ? mapTransform(json, template, afterTransform) : transformJson(json, template, afterTransform);
12768
+ module2.exports = transform11;
12769
12769
  }
12770
12770
  });
12771
12771
 
12772
12772
  // ../../node_modules/json-map-transform/index.js
12773
12773
  var require_json_map_transform = __commonJS({
12774
12774
  "../../node_modules/json-map-transform/index.js"(exports, module2) {
12775
- var transform9 = require_jsonMapTransform();
12776
- module2.exports = transform9;
12775
+ var transform11 = require_jsonMapTransform();
12776
+ module2.exports = transform11;
12777
12777
  }
12778
12778
  });
12779
12779
 
@@ -15604,7 +15604,7 @@ var require_async = __commonJS({
15604
15604
  function timesSeries(n, iteratee, callback) {
15605
15605
  return timesLimit(n, 1, iteratee, callback);
15606
15606
  }
15607
- function transform9(coll, accumulator, iteratee, callback) {
15607
+ function transform11(coll, accumulator, iteratee, callback) {
15608
15608
  if (arguments.length <= 3 && typeof accumulator === "function") {
15609
15609
  callback = iteratee;
15610
15610
  iteratee = accumulator;
@@ -15762,7 +15762,7 @@ var require_async = __commonJS({
15762
15762
  times,
15763
15763
  timesLimit,
15764
15764
  timesSeries,
15765
- transform: transform9,
15765
+ transform: transform11,
15766
15766
  tryEach: tryEach$1,
15767
15767
  unmemoize,
15768
15768
  until,
@@ -15867,7 +15867,7 @@ var require_async = __commonJS({
15867
15867
  exports2.times = times;
15868
15868
  exports2.timesLimit = timesLimit;
15869
15869
  exports2.timesSeries = timesSeries;
15870
- exports2.transform = transform9;
15870
+ exports2.transform = transform11;
15871
15871
  exports2.tryEach = tryEach$1;
15872
15872
  exports2.unmemoize = unmemoize;
15873
15873
  exports2.until = until;
@@ -16985,7 +16985,7 @@ var require_BufferList = __commonJS({
16985
16985
  this.head = this.tail = null;
16986
16986
  this.length = 0;
16987
16987
  };
16988
- BufferList.prototype.join = function join9(s) {
16988
+ BufferList.prototype.join = function join10(s) {
16989
16989
  if (this.length === 0)
16990
16990
  return "";
16991
16991
  var p = this.head;
@@ -19956,9 +19956,9 @@ var require_lodash5 = __commonJS({
19956
19956
  }
19957
19957
  return result;
19958
19958
  }
19959
- function overArg(func, transform9) {
19959
+ function overArg(func, transform11) {
19960
19960
  return function(arg) {
19961
- return func(transform9(arg));
19961
+ return func(transform11(arg));
19962
19962
  };
19963
19963
  }
19964
19964
  var funcProto = Function.prototype;
@@ -22689,7 +22689,7 @@ var require_buffer_list = __commonJS({
22689
22689
  }
22690
22690
  }, {
22691
22691
  key: "join",
22692
- value: function join9(s) {
22692
+ value: function join10(s) {
22693
22693
  if (this.length === 0)
22694
22694
  return "";
22695
22695
  var p = this.head;
@@ -26401,7 +26401,7 @@ var require_buffer_list2 = __commonJS({
26401
26401
  }
26402
26402
  }, {
26403
26403
  key: "join",
26404
- value: function join9(s) {
26404
+ value: function join10(s) {
26405
26405
  if (this.length === 0)
26406
26406
  return "";
26407
26407
  var p = this.head;
@@ -29543,7 +29543,7 @@ var require_buffer_list3 = __commonJS({
29543
29543
  }
29544
29544
  }, {
29545
29545
  key: "join",
29546
- value: function join9(s) {
29546
+ value: function join10(s) {
29547
29547
  if (this.length === 0)
29548
29548
  return "";
29549
29549
  var p = this.head;
@@ -32908,7 +32908,7 @@ var require_buffer_list4 = __commonJS({
32908
32908
  }
32909
32909
  }, {
32910
32910
  key: "join",
32911
- value: function join9(s) {
32911
+ value: function join10(s) {
32912
32912
  if (this.length === 0)
32913
32913
  return "";
32914
32914
  var p = this.head;
@@ -36282,7 +36282,7 @@ var require_buffer_list5 = __commonJS({
36282
36282
  }
36283
36283
  }, {
36284
36284
  key: "join",
36285
- value: function join9(s) {
36285
+ value: function join10(s) {
36286
36286
  if (this.length === 0)
36287
36287
  return "";
36288
36288
  var p = this.head;
@@ -40406,14 +40406,14 @@ var require_utils = __commonJS({
40406
40406
  }
40407
40407
  return arrayTo;
40408
40408
  }
40409
- var transform9 = {};
40410
- transform9["string"] = {
40409
+ var transform11 = {};
40410
+ transform11["string"] = {
40411
40411
  "string": identity,
40412
40412
  "array": function(input) {
40413
40413
  return stringToArrayLike(input, new Array(input.length));
40414
40414
  },
40415
40415
  "arraybuffer": function(input) {
40416
- return transform9["string"]["uint8array"](input).buffer;
40416
+ return transform11["string"]["uint8array"](input).buffer;
40417
40417
  },
40418
40418
  "uint8array": function(input) {
40419
40419
  return stringToArrayLike(input, new Uint8Array(input.length));
@@ -40422,7 +40422,7 @@ var require_utils = __commonJS({
40422
40422
  return stringToArrayLike(input, nodejsUtils.allocBuffer(input.length));
40423
40423
  }
40424
40424
  };
40425
- transform9["array"] = {
40425
+ transform11["array"] = {
40426
40426
  "string": arrayLikeToString,
40427
40427
  "array": identity,
40428
40428
  "arraybuffer": function(input) {
@@ -40435,7 +40435,7 @@ var require_utils = __commonJS({
40435
40435
  return nodejsUtils.newBufferFrom(input);
40436
40436
  }
40437
40437
  };
40438
- transform9["arraybuffer"] = {
40438
+ transform11["arraybuffer"] = {
40439
40439
  "string": function(input) {
40440
40440
  return arrayLikeToString(new Uint8Array(input));
40441
40441
  },
@@ -40450,7 +40450,7 @@ var require_utils = __commonJS({
40450
40450
  return nodejsUtils.newBufferFrom(new Uint8Array(input));
40451
40451
  }
40452
40452
  };
40453
- transform9["uint8array"] = {
40453
+ transform11["uint8array"] = {
40454
40454
  "string": arrayLikeToString,
40455
40455
  "array": function(input) {
40456
40456
  return arrayLikeToArrayLike(input, new Array(input.length));
@@ -40463,13 +40463,13 @@ var require_utils = __commonJS({
40463
40463
  return nodejsUtils.newBufferFrom(input);
40464
40464
  }
40465
40465
  };
40466
- transform9["nodebuffer"] = {
40466
+ transform11["nodebuffer"] = {
40467
40467
  "string": arrayLikeToString,
40468
40468
  "array": function(input) {
40469
40469
  return arrayLikeToArrayLike(input, new Array(input.length));
40470
40470
  },
40471
40471
  "arraybuffer": function(input) {
40472
- return transform9["nodebuffer"]["uint8array"](input).buffer;
40472
+ return transform11["nodebuffer"]["uint8array"](input).buffer;
40473
40473
  },
40474
40474
  "uint8array": function(input) {
40475
40475
  return arrayLikeToArrayLike(input, new Uint8Array(input.length));
@@ -40485,7 +40485,7 @@ var require_utils = __commonJS({
40485
40485
  }
40486
40486
  exports.checkSupport(outputType);
40487
40487
  var inputType = exports.getTypeOf(input);
40488
- var result = transform9[inputType][outputType](input);
40488
+ var result = transform11[inputType][outputType](input);
40489
40489
  return result;
40490
40490
  };
40491
40491
  exports.resolve = function(path2) {
@@ -49084,7 +49084,7 @@ var require_init2 = __commonJS({
49084
49084
  var _gltools = require_es58();
49085
49085
  var _stats = require_es5();
49086
49086
  var _env = require_es52();
49087
- var VERSION17 = true ? "8.5.17" : "untranspiled source";
49087
+ var VERSION18 = true ? "8.5.17" : "untranspiled source";
49088
49088
  var STARTUP_MESSAGE = "set luma.log.level=1 (or higher) to trace rendering";
49089
49089
  var StatsManager = function() {
49090
49090
  function StatsManager2() {
@@ -49107,16 +49107,16 @@ var require_init2 = __commonJS({
49107
49107
  exports.StatsManager = StatsManager;
49108
49108
  var lumaStats = new StatsManager();
49109
49109
  exports.lumaStats = lumaStats;
49110
- if (globalThis.luma && globalThis.luma.VERSION !== VERSION17) {
49111
- throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION, " vs ").concat(VERSION17));
49110
+ if (globalThis.luma && globalThis.luma.VERSION !== VERSION18) {
49111
+ throw new Error("luma.gl - multiple VERSIONs detected: ".concat(globalThis.luma.VERSION, " vs ").concat(VERSION18));
49112
49112
  }
49113
49113
  if (!globalThis.luma) {
49114
49114
  if ((0, _env.isBrowser)()) {
49115
- _gltools.log.log(1, "luma.gl ".concat(VERSION17, " - ").concat(STARTUP_MESSAGE))();
49115
+ _gltools.log.log(1, "luma.gl ".concat(VERSION18, " - ").concat(STARTUP_MESSAGE))();
49116
49116
  }
49117
49117
  globalThis.luma = globalThis.luma || {
49118
- VERSION: VERSION17,
49119
- version: VERSION17,
49118
+ VERSION: VERSION18,
49119
+ version: VERSION18,
49120
49120
  log: _gltools.log,
49121
49121
  stats: lumaStats,
49122
49122
  globals: {
@@ -60010,12 +60010,12 @@ var require_transform = __commonJS({
60010
60010
  });
60011
60011
  exports.transform = void 0;
60012
60012
  var vs = "attribute float transform_elementID;\nvec2 transform_getPixelSizeHalf(vec2 size) {\n return vec2(1.) / (2. * size);\n}\n\nvec2 transform_getPixelIndices(vec2 texSize, vec2 pixelSizeHalf) {\n float yIndex = floor((transform_elementID / texSize[0]) + pixelSizeHalf[1]);\n float xIndex = transform_elementID - (yIndex * texSize[0]);\n return vec2(xIndex, yIndex);\n}\nvec2 transform_getTexCoord(vec2 size) {\n vec2 pixelSizeHalf = transform_getPixelSizeHalf(size);\n vec2 indices = transform_getPixelIndices(size, pixelSizeHalf);\n vec2 coord = indices / size + pixelSizeHalf;\n return coord;\n}\nvec2 transform_getPos(vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec2 pos = (texCoord * (2.0, 2.0)) - (1., 1.);\n return pos;\n}\nvec4 transform_getInput(sampler2D texSampler, vec2 size) {\n vec2 texCoord = transform_getTexCoord(size);\n vec4 textureColor = texture2D(texSampler, texCoord);\n return textureColor;\n}\n";
60013
- var transform9 = {
60013
+ var transform11 = {
60014
60014
  name: "transform",
60015
60015
  vs,
60016
60016
  fs: null
60017
60017
  };
60018
- exports.transform = transform9;
60018
+ exports.transform = transform11;
60019
60019
  }
60020
60020
  });
60021
60021
 
@@ -60953,7 +60953,7 @@ var require_model = __commonJS({
60953
60953
  }
60954
60954
  }, {
60955
60955
  key: "transform",
60956
- value: function transform9() {
60956
+ value: function transform11() {
60957
60957
  var opts = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
60958
60958
  var _opts$discard = opts.discard, discard = _opts$discard === void 0 ? true : _opts$discard, feedbackBuffers = opts.feedbackBuffers, _opts$unbindModels = opts.unbindModels, unbindModels = _opts$unbindModels === void 0 ? [] : _opts$unbindModels;
60959
60959
  var parameters = opts.parameters;
@@ -64620,10 +64620,14 @@ var WorkerJob = class {
64620
64620
  }
64621
64621
  };
64622
64622
 
64623
- // ../worker-utils/src/lib/node/worker_threads.js
64623
+ // ../worker-utils/src/lib/node/worker_threads.ts
64624
64624
  var worker_threads_exports = {};
64625
- __markAsModule(worker_threads_exports);
64625
+ __export(worker_threads_exports, {
64626
+ NodeWorker: () => NodeWorker
64627
+ });
64628
+ var WorkerThreads = __toModule(require("worker_threads"));
64626
64629
  __reExport(worker_threads_exports, __toModule(require("worker_threads")));
64630
+ var NodeWorker = WorkerThreads.Worker;
64627
64631
 
64628
64632
  // ../worker-utils/src/lib/worker-utils/get-loadable-worker-url.ts
64629
64633
  var workerURLCache = new Map();
@@ -64731,7 +64735,7 @@ var WorkerThread = class {
64731
64735
  this.worker = isBrowser2 ? this._createBrowserWorker() : this._createNodeWorker();
64732
64736
  }
64733
64737
  static isSupported() {
64734
- return typeof Worker !== "undefined" && isBrowser2 || typeof worker_threads_exports.Worker !== "undefined" && !isBrowser2;
64738
+ return typeof Worker !== "undefined" && isBrowser2 || typeof NodeWorker !== "undefined" && !isBrowser2;
64735
64739
  }
64736
64740
  destroy() {
64737
64741
  this.onMessage = NOOP;
@@ -64779,9 +64783,9 @@ var WorkerThread = class {
64779
64783
  if (this.url) {
64780
64784
  const absolute = this.url.includes(":/") || this.url.startsWith("/");
64781
64785
  const url = absolute ? this.url : `./${this.url}`;
64782
- worker = new worker_threads_exports.Worker(url, { eval: false });
64786
+ worker = new NodeWorker(url, { eval: false });
64783
64787
  } else if (this.source) {
64784
- worker = new worker_threads_exports.Worker(this.source, { eval: true });
64788
+ worker = new NodeWorker(this.source, { eval: true });
64785
64789
  } else {
64786
64790
  throw new Error("no worker");
64787
64791
  }
@@ -65617,6 +65621,25 @@ function resolvePath(filename2) {
65617
65621
  return filename2;
65618
65622
  }
65619
65623
 
65624
+ // ../loader-utils/src/json-loader.ts
65625
+ var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
65626
+ var JSONLoader = {
65627
+ name: "JSON",
65628
+ id: "json",
65629
+ module: "json",
65630
+ version: VERSION4,
65631
+ extensions: ["json", "geojson"],
65632
+ mimeTypes: ["application/json"],
65633
+ category: "json",
65634
+ text: true,
65635
+ parseTextSync,
65636
+ parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),
65637
+ options: {}
65638
+ };
65639
+ function parseTextSync(text) {
65640
+ return JSON.parse(text);
65641
+ }
65642
+
65620
65643
  // ../loader-utils/src/lib/path-utils/path.ts
65621
65644
  var path_exports = {};
65622
65645
  __export(path_exports, {
@@ -66957,10 +66980,10 @@ function defined2(x) {
66957
66980
  var scratchScale = new import_core4.Vector3();
66958
66981
  var scratchNorthWest = new import_core4.Vector3();
66959
66982
  var scratchSouthEast = new import_core4.Vector3();
66960
- function createBoundingVolume(boundingVolumeHeader, transform9, result) {
66983
+ function createBoundingVolume(boundingVolumeHeader, transform11, result) {
66961
66984
  assert2(boundingVolumeHeader, "3D Tile: boundingVolume must be defined");
66962
66985
  if (boundingVolumeHeader.box) {
66963
- return createBox(boundingVolumeHeader.box, transform9, result);
66986
+ return createBox(boundingVolumeHeader.box, transform11, result);
66964
66987
  }
66965
66988
  if (boundingVolumeHeader.region) {
66966
66989
  const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
@@ -66971,13 +66994,13 @@ function createBoundingVolume(boundingVolumeHeader, transform9, result) {
66971
66994
  return createSphere([centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius], new import_core4.Matrix4());
66972
66995
  }
66973
66996
  if (boundingVolumeHeader.sphere) {
66974
- return createSphere(boundingVolumeHeader.sphere, transform9, result);
66997
+ return createSphere(boundingVolumeHeader.sphere, transform11, result);
66975
66998
  }
66976
66999
  throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box");
66977
67000
  }
66978
- function createBox(box, transform9, result) {
67001
+ function createBox(box, transform11, result) {
66979
67002
  const center = new import_core4.Vector3(box[0], box[1], box[2]);
66980
- transform9.transform(center, center);
67003
+ transform11.transform(center, center);
66981
67004
  let origin = [];
66982
67005
  if (box.length === 10) {
66983
67006
  const halfSize = box.slice(3, 6);
@@ -66996,9 +67019,9 @@ function createBox(box, transform9, result) {
66996
67019
  } else {
66997
67020
  origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];
66998
67021
  }
66999
- const xAxis = transform9.transformAsVector(origin.slice(0, 3));
67000
- const yAxis = transform9.transformAsVector(origin.slice(3, 6));
67001
- const zAxis = transform9.transformAsVector(origin.slice(6, 9));
67022
+ const xAxis = transform11.transformAsVector(origin.slice(0, 3));
67023
+ const yAxis = transform11.transformAsVector(origin.slice(3, 6));
67024
+ const zAxis = transform11.transformAsVector(origin.slice(6, 9));
67002
67025
  const halfAxes = new import_core4.Matrix3([
67003
67026
  xAxis[0],
67004
67027
  xAxis[1],
@@ -67017,10 +67040,10 @@ function createBox(box, transform9, result) {
67017
67040
  }
67018
67041
  return new import_culling3.OrientedBoundingBox(center, halfAxes);
67019
67042
  }
67020
- function createSphere(sphere, transform9, result) {
67043
+ function createSphere(sphere, transform11, result) {
67021
67044
  const center = new import_core4.Vector3(sphere[0], sphere[1], sphere[2]);
67022
- transform9.transform(center, center);
67023
- const scale = transform9.getScale(scratchScale);
67045
+ transform11.transform(center, center);
67046
+ const scale = transform11.getScale(scratchScale);
67024
67047
  const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);
67025
67048
  const radius = sphere[3] * uniformScale;
67026
67049
  if (defined2(result)) {
@@ -67209,7 +67232,7 @@ var ManagedArray = class {
67209
67232
  }
67210
67233
  };
67211
67234
 
67212
- // ../tiles/src/tileset/traversers/tileset-traverser.ts
67235
+ // ../tiles/src/tileset/tileset-traverser.ts
67213
67236
  var DEFAULT_PROPS4 = {
67214
67237
  loadSiblings: false,
67215
67238
  skipLevelOfDetail: false,
@@ -67438,7 +67461,7 @@ var scratchVector3 = new import_core7.Vector3();
67438
67461
  function defined3(x) {
67439
67462
  return x !== void 0 && x !== null;
67440
67463
  }
67441
- var TileHeader = class {
67464
+ var Tile3D = class {
67442
67465
  constructor(tileset, header, parentHeader, extendedId = "") {
67443
67466
  this.header = header;
67444
67467
  this.tileset = tileset;
@@ -67801,7 +67824,7 @@ var TileHeader = class {
67801
67824
  }
67802
67825
  };
67803
67826
 
67804
- // ../tiles/src/tileset/traversers/tileset-3d-traverser.ts
67827
+ // ../tiles/src/tileset/format-3d-tiles/tileset-3d-traverser.ts
67805
67828
  var Tileset3DTraverser = class extends TilesetTraverser {
67806
67829
  compareDistanceToCamera(a, b) {
67807
67830
  return b._distanceToCamera === 0 && a._distanceToCamera === 0 ? b._centerZDepth - a._centerZDepth : b._distanceToCamera - a._distanceToCamera;
@@ -67840,7 +67863,7 @@ var Tileset3DTraverser = class extends TilesetTraverser {
67840
67863
  }
67841
67864
  };
67842
67865
 
67843
- // ../tiles/src/tileset/traversers/i3s-pending-tiles-register.ts
67866
+ // ../tiles/src/tileset/format-i3s/i3s-pending-tiles-register.ts
67844
67867
  var I3SPendingTilesRegister = class {
67845
67868
  constructor() {
67846
67869
  this.frameNumberMap = new Map();
@@ -67865,7 +67888,7 @@ var I3SPendingTilesRegister = class {
67865
67888
  }
67866
67889
  };
67867
67890
 
67868
- // ../tiles/src/tileset/traversers/i3s-tile-manager.ts
67891
+ // ../tiles/src/tileset/format-i3s/i3s-tile-manager.ts
67869
67892
  var STATUS = {
67870
67893
  REQUESTED: "REQUESTED",
67871
67894
  COMPLETED: "COMPLETED",
@@ -67926,15 +67949,15 @@ var I3STileManager = class {
67926
67949
  }
67927
67950
  };
67928
67951
 
67929
- // ../tiles/src/tileset/traversers/i3s-tileset-traverser.ts
67952
+ // ../tiles/src/tileset/format-i3s/i3s-tileset-traverser.ts
67930
67953
  var I3STilesetTraverser = class extends TilesetTraverser {
67931
- traversalFinished(frameState) {
67932
- return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
67933
- }
67934
67954
  constructor(options) {
67935
67955
  super(options);
67936
67956
  this._tileManager = new I3STileManager();
67937
67957
  }
67958
+ traversalFinished(frameState) {
67959
+ return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
67960
+ }
67938
67961
  shouldRefine(tile, frameState) {
67939
67962
  tile._lodJudge = getLodStatus(tile, frameState);
67940
67963
  return tile._lodJudge === "DIG";
@@ -67976,7 +67999,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
67976
67999
  return await load(nodeUrl, loader, options);
67977
68000
  }
67978
68001
  _onTileLoad(header, tile, extendedId) {
67979
- const childTile = new TileHeader(tile.tileset, header, tile, extendedId);
68002
+ const childTile = new Tile3D(tile.tileset, header, tile, extendedId);
67980
68003
  tile.children.push(childTile);
67981
68004
  const frameState = this._tileManager.find(childTile.id).frameState;
67982
68005
  this.updateTile(childTile, frameState);
@@ -68325,7 +68348,7 @@ var Tileset3D = class {
68325
68348
  this.stats.get(TILES_GPU_MEMORY, "memory");
68326
68349
  }
68327
68350
  _initializeTileHeaders(tilesetJson, parentTileHeader) {
68328
- const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader);
68351
+ const rootTile = new Tile3D(this, tilesetJson.root, parentTileHeader);
68329
68352
  if (parentTileHeader) {
68330
68353
  parentTileHeader.children.push(rootTile);
68331
68354
  rootTile.depth = parentTileHeader.depth + 1;
@@ -68338,7 +68361,7 @@ var Tileset3D = class {
68338
68361
  this.stats.get(TILES_TOTAL).incrementCount();
68339
68362
  const children = tile.header.children || [];
68340
68363
  for (const childHeader of children) {
68341
- const childTile = new TileHeader(this, childHeader, tile);
68364
+ const childTile = new Tile3D(this, childHeader, tile);
68342
68365
  tile.children.push(childTile);
68343
68366
  childTile.depth = tile.depth + 1;
68344
68367
  stack2.push(childTile);
@@ -68531,7 +68554,7 @@ function getQueryParamString(queryParams) {
68531
68554
  }
68532
68555
 
68533
68556
  // ../3d-tiles/src/lib/utils/version.ts
68534
- var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68557
+ var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68535
68558
 
68536
68559
  // ../3d-tiles/src/lib/constants.ts
68537
68560
  var TILE3D_TYPE = {
@@ -68559,7 +68582,7 @@ function getMagicString3(arrayBuffer, byteOffset = 0) {
68559
68582
  }
68560
68583
 
68561
68584
  // ../draco/src/lib/utils/version.ts
68562
- var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68585
+ var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68563
68586
 
68564
68587
  // ../draco/src/draco-loader.ts
68565
68588
  var DEFAULT_DRACO_OPTIONS = {
@@ -68575,7 +68598,7 @@ var DracoLoader = {
68575
68598
  id: isBrowser2 ? "draco" : "draco-nodejs",
68576
68599
  module: "draco",
68577
68600
  shapes: ["mesh"],
68578
- version: VERSION5,
68601
+ version: VERSION6,
68579
68602
  worker: true,
68580
68603
  extensions: ["drc"],
68581
68604
  mimeTypes: ["application/octet-stream"],
@@ -69408,17 +69431,17 @@ var DracoParser = class {
69408
69431
  const attribute_type = dracoAttribute.attribute_type();
69409
69432
  const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);
69410
69433
  if (skip) {
69411
- const transform9 = new this.draco.AttributeQuantizationTransform();
69434
+ const transform11 = new this.draco.AttributeQuantizationTransform();
69412
69435
  try {
69413
- if (transform9.InitFromAttribute(dracoAttribute)) {
69436
+ if (transform11.InitFromAttribute(dracoAttribute)) {
69414
69437
  return {
69415
- quantization_bits: transform9.quantization_bits(),
69416
- range: transform9.range(),
69417
- min_values: new Float32Array([1, 2, 3]).map((i) => transform9.min_value(i))
69438
+ quantization_bits: transform11.quantization_bits(),
69439
+ range: transform11.range(),
69440
+ min_values: new Float32Array([1, 2, 3]).map((i) => transform11.min_value(i))
69418
69441
  };
69419
69442
  }
69420
69443
  } finally {
69421
- this.draco.destroy(transform9);
69444
+ this.draco.destroy(transform11);
69422
69445
  }
69423
69446
  }
69424
69447
  return null;
@@ -69428,15 +69451,15 @@ var DracoParser = class {
69428
69451
  const attribute_type = dracoAttribute.attribute_type();
69429
69452
  const octahedron = octahedronAttributes.map((type) => this.decoder[type]).includes(attribute_type);
69430
69453
  if (octahedron) {
69431
- const transform9 = new this.draco.AttributeQuantizationTransform();
69454
+ const transform11 = new this.draco.AttributeQuantizationTransform();
69432
69455
  try {
69433
- if (transform9.InitFromAttribute(dracoAttribute)) {
69456
+ if (transform11.InitFromAttribute(dracoAttribute)) {
69434
69457
  return {
69435
- quantization_bits: transform9.quantization_bits()
69458
+ quantization_bits: transform11.quantization_bits()
69436
69459
  };
69437
69460
  }
69438
69461
  } finally {
69439
- this.draco.destroy(transform9);
69462
+ this.draco.destroy(transform11);
69440
69463
  }
69441
69464
  }
69442
69465
  return null;
@@ -69480,11 +69503,13 @@ function getUint32Array(dracoArray) {
69480
69503
  }
69481
69504
 
69482
69505
  // ../draco/src/lib/draco-module-loader.ts
69483
- var DRACO_VERSION = "1.4.1";
69484
- var DRACO_JS_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.js`;
69485
- var DRACO_WASM_WRAPPER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_wasm_wrapper.js`;
69486
- var DRACO_WASM_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_VERSION}/draco_decoder.wasm`;
69487
- var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_VERSION}/javascript/draco_encoder.js`;
69506
+ var DRACO_DECODER_VERSION = "1.5.5";
69507
+ var DRACO_ENCODER_VERSION = "1.4.1";
69508
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
69509
+ var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
69510
+ var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
69511
+ var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
69512
+ var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
69488
69513
  var loadDecoderPromise;
69489
69514
  async function loadDracoDecoderModule(options) {
69490
69515
  const modules = options.modules || {};
@@ -69532,7 +69557,7 @@ var DracoWriterWorker = {
69532
69557
  id: isBrowser2 ? "draco-writer" : "draco-writer-nodejs",
69533
69558
  name: "Draco compressed geometry writer",
69534
69559
  module: "draco",
69535
- version: VERSION5,
69560
+ version: VERSION6,
69536
69561
  worker: true,
69537
69562
  options: {
69538
69563
  draco: {},
@@ -70667,15 +70692,15 @@ async function loadDraco(tile, dracoData, options, context) {
70667
70692
  }
70668
70693
 
70669
70694
  // ../gltf/src/lib/utils/version.ts
70670
- var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
70695
+ var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
70671
70696
 
70672
70697
  // ../textures/src/lib/utils/version.ts
70673
- var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70698
+ var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70674
70699
 
70675
70700
  // ../textures/src/lib/parsers/basis-module-loader.ts
70676
- var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70677
- var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.wasm`;
70678
- var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION8}/dist/libs/basis_encoder.js`;
70701
+ var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70702
+ var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.wasm`;
70703
+ var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.js`;
70679
70704
  var loadBasisTranscoderPromise;
70680
70705
  async function loadBasisTrascoderModule(options) {
70681
70706
  const modules = options.modules || {};
@@ -71129,6 +71154,7 @@ function transcodeKTX2Image(ktx2File, levelIndex, options) {
71129
71154
  height,
71130
71155
  data: decodedData,
71131
71156
  compressed,
71157
+ levelSize: decodedSize,
71132
71158
  hasAlpha: alphaFlag,
71133
71159
  format
71134
71160
  };
@@ -71171,7 +71197,7 @@ var BasisWorkerLoader = {
71171
71197
  name: "Basis",
71172
71198
  id: isBrowser2 ? "basis" : "basis-nodejs",
71173
71199
  module: "textures",
71174
- version: VERSION7,
71200
+ version: VERSION8,
71175
71201
  worker: true,
71176
71202
  extensions: ["basis", "ktx2"],
71177
71203
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -71484,7 +71510,7 @@ var CompressedTextureWorkerLoader = {
71484
71510
  name: "Texture Containers",
71485
71511
  id: "compressed-texture",
71486
71512
  module: "textures",
71487
- version: VERSION7,
71513
+ version: VERSION8,
71488
71514
  worker: true,
71489
71515
  extensions: [
71490
71516
  "ktx",
@@ -71522,7 +71548,7 @@ var CompressedTextureLoader = {
71522
71548
  };
71523
71549
 
71524
71550
  // ../images/src/lib/utils/version.ts
71525
- var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
71551
+ var VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
71526
71552
 
71527
71553
  // ../images/src/lib/category-api/image-type.ts
71528
71554
  var { _parseImageNode } = globalThis;
@@ -71864,7 +71890,7 @@ var ImageLoader = {
71864
71890
  id: "image",
71865
71891
  module: "images",
71866
71892
  name: "Images",
71867
- version: VERSION9,
71893
+ version: VERSION10,
71868
71894
  mimeTypes: MIME_TYPES,
71869
71895
  extensions: EXTENSIONS,
71870
71896
  parse: parseImage,
@@ -71927,7 +71953,7 @@ var ImageWriter = {
71927
71953
  name: "Images",
71928
71954
  id: "image",
71929
71955
  module: "images",
71930
- version: VERSION9,
71956
+ version: VERSION10,
71931
71957
  extensions: ["jpeg"],
71932
71958
  options: {
71933
71959
  image: {
@@ -71978,7 +72004,7 @@ var KTX2BasisWriterWorker = {
71978
72004
  name: "Basis Universal Supercompressed GPU Texture",
71979
72005
  id: isBrowser ? "ktx2-basis-writer" : "ktx2-basis-writer-nodejs",
71980
72006
  module: "textures",
71981
- version: VERSION7,
72007
+ version: VERSION8,
71982
72008
  extensions: ["ktx2"],
71983
72009
  worker: true,
71984
72010
  options: {
@@ -74102,7 +74128,7 @@ var GLTFLoader = {
74102
74128
  name: "glTF",
74103
74129
  id: "gltf",
74104
74130
  module: "gltf",
74105
- version: VERSION6,
74131
+ version: VERSION7,
74106
74132
  extensions: ["gltf", "glb"],
74107
74133
  mimeTypes: ["model/gltf+json", "model/gltf-binary"],
74108
74134
  text: true,
@@ -74471,7 +74497,7 @@ var Tile3DSubtreeLoader = {
74471
74497
  id: "3d-tiles-subtree",
74472
74498
  name: "3D Tiles Subtree",
74473
74499
  module: "3d-tiles",
74474
- version: VERSION4,
74500
+ version: VERSION5,
74475
74501
  extensions: ["subtree"],
74476
74502
  mimeTypes: ["application/octet-stream"],
74477
74503
  tests: ["subtree"],
@@ -74796,7 +74822,7 @@ var Tiles3DLoader = {
74796
74822
  id: "3d-tiles",
74797
74823
  name: "3D Tiles",
74798
74824
  module: "3d-tiles",
74799
- version: VERSION4,
74825
+ version: VERSION5,
74800
74826
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
74801
74827
  mimeTypes: ["application/octet-stream"],
74802
74828
  tests: ["cmpt", "pnts", "b3dm", "i3dm"],
@@ -74931,7 +74957,7 @@ var CesiumIonLoader = {
74931
74957
  };
74932
74958
 
74933
74959
  // src/i3s-converter/i3s-converter.ts
74934
- var import_path7 = __toModule(require("path"));
74960
+ var import_path8 = __toModule(require("path"));
74935
74961
 
74936
74962
  // node_modules/uuid/wrapper.mjs
74937
74963
  var import_dist = __toModule(require_dist());
@@ -74947,11 +74973,11 @@ var parse5 = import_dist.default.parse;
74947
74973
 
74948
74974
  // src/i3s-converter/i3s-converter.ts
74949
74975
  var import_process2 = __toModule(require("process"));
74950
- var import_json_map_transform6 = __toModule(require_json_map_transform());
74976
+ var import_json_map_transform8 = __toModule(require_json_map_transform());
74951
74977
  var import_md52 = __toModule(require_md52());
74952
74978
 
74953
74979
  // src/i3s-converter/helpers/node-pages.ts
74954
- var import_path2 = __toModule(require("path"));
74980
+ var import_path4 = __toModule(require("path"));
74955
74981
  var import_json_map_transform = __toModule(require_json_map_transform());
74956
74982
 
74957
74983
  // src/i3s-converter/json-templates/metadata.ts
@@ -74977,122 +75003,13 @@ var METADATA = () => ({
74977
75003
  }
74978
75004
  });
74979
75005
 
74980
- // src/i3s-converter/helpers/node-pages.ts
74981
- var NodePages = class {
74982
- constructor(writeFileFunc, nodesPerPage) {
74983
- this.nodesPerPage = nodesPerPage;
74984
- this.nodesCounter = 0;
74985
- this.nodePages = [{}];
74986
- this.nodePages[0].nodes = [];
74987
- this.writeFile = writeFileFunc;
74988
- }
74989
- useWriteFunction(func) {
74990
- this.writeFile = func;
74991
- }
74992
- getNodeById(id) {
74993
- const pageIndex = Math.floor(id / this.nodesPerPage);
74994
- const nodeIndex = id % this.nodesPerPage;
74995
- return this.nodePages[pageIndex].nodes[nodeIndex];
74996
- }
74997
- updateAll(id, data) {
74998
- const node2 = this.getNodeById(id);
74999
- Object.assign(node2, data, { index: node2.index });
75000
- }
75001
- updateMaterialByNodeId(id, materialId) {
75002
- const node2 = this.getNodeById(id);
75003
- if (!node2.mesh) {
75004
- return;
75005
- }
75006
- node2.mesh.material = {
75007
- definition: materialId,
75008
- resource: node2.index
75009
- };
75010
- }
75011
- updateVertexCountByNodeId(id, vertexCount) {
75012
- const node2 = this.getNodeById(id);
75013
- if (!node2.mesh) {
75014
- return;
75015
- }
75016
- node2.mesh.geometry.vertexCount = vertexCount;
75017
- }
75018
- updateNodeAttributeByNodeId(id) {
75019
- const node2 = this.getNodeById(id);
75020
- if (!node2.mesh || !node2.index) {
75021
- return;
75022
- }
75023
- node2.mesh.attribute.resource = node2.index;
75024
- }
75025
- updateFeatureCountByNodeId(id, featureCount) {
75026
- const node2 = this.getNodeById(id);
75027
- if (!node2.mesh) {
75028
- return;
75029
- }
75030
- node2.mesh.geometry.featureCount = featureCount;
75031
- }
75032
- updateTexelCountHintByNodeId(id, texelCountHint) {
75033
- const node2 = this.getNodeById(id);
75034
- if (!node2.mesh || !node2.mesh.material) {
75035
- return;
75036
- }
75037
- node2.mesh.material.texelCountHint = texelCountHint;
75038
- }
75039
- addChildRelation(parentId, childId) {
75040
- if (parentId === null || parentId === void 0) {
75041
- return;
75042
- }
75043
- const parentNode = this.getNodeById(parentId);
75044
- parentNode.children?.push(childId);
75045
- }
75046
- updateResourceInMesh(node2) {
75047
- if (node2.mesh && isFinite(node2.index)) {
75048
- node2.mesh.geometry.resource = node2.index;
75049
- }
75050
- }
75051
- push(node2, parentId) {
75052
- let currentNodePage = this.nodePages[this.nodePages.length - 1];
75053
- if (currentNodePage.nodes.length === this.nodesPerPage) {
75054
- currentNodePage = { nodes: [] };
75055
- this.nodePages.push(currentNodePage);
75056
- }
75057
- node2.index = this.nodesCounter++;
75058
- currentNodePage.nodes.push(node2);
75059
- this.addChildRelation(parentId, node2.index);
75060
- this.updateResourceInMesh(node2);
75061
- return node2.index;
75062
- }
75063
- async save(layers0Path, writeQueue, slpk = false) {
75064
- if (slpk) {
75065
- for (const [index, nodePage] of this.nodePages.entries()) {
75066
- const nodePageStr = JSON.stringify(nodePage);
75067
- const slpkPath = (0, import_path2.join)(layers0Path, "nodepages");
75068
- await writeQueue.enqueue({
75069
- archiveKey: `nodePages/${index.toString()}.json.gz`,
75070
- writePromise: this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
75071
- });
75072
- }
75073
- const metadata = (0, import_json_map_transform.default)({ nodeCount: this.nodesCounter }, METADATA());
75074
- const compress = false;
75075
- await writeQueue.enqueue({
75076
- archiveKey: "metadata.json",
75077
- writePromise: this.writeFile(layers0Path, JSON.stringify(metadata), "metadata.json", compress)
75078
- });
75079
- } else {
75080
- for (const [index, nodePage] of this.nodePages.entries()) {
75081
- const nodePageStr = JSON.stringify(nodePage);
75082
- const nodePagePath = (0, import_path2.join)(layers0Path, "nodepages", index.toString());
75083
- await writeQueue.enqueue({ writePromise: this.writeFile(nodePagePath, nodePageStr) });
75084
- }
75085
- }
75086
- }
75087
- };
75088
-
75089
75006
  // src/lib/utils/file-utils.ts
75090
75007
  var import_fs3 = __toModule(require("fs"));
75091
- var import_path4 = __toModule(require("path"));
75008
+ var import_path3 = __toModule(require("path"));
75092
75009
 
75093
75010
  // src/lib/utils/compress-util.ts
75094
75011
  var import_zlib = __toModule(require("zlib"));
75095
- var import_path3 = __toModule(require("path"));
75012
+ var import_path2 = __toModule(require("path"));
75096
75013
  var import_fs2 = __toModule(require("fs"));
75097
75014
  var import_archiver = __toModule(require_archiver());
75098
75015
  var import_jszip = __toModule(require_lib4());
@@ -75134,7 +75051,7 @@ async function compressWithChildProcessUnix(inputFolder, outputFile, level = 0,
75134
75051
  wait: 0
75135
75052
  });
75136
75053
  }
75137
- async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, import_path3.join)(".", "*"), sevenZipExe) {
75054
+ async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, import_path2.join)(".", "*"), sevenZipExe) {
75138
75055
  if (inputFiles[0] === "@") {
75139
75056
  inputFiles = `*${inputFiles.substr(1)}`;
75140
75057
  }
@@ -75162,7 +75079,7 @@ async function writeFile3(path2, data, fileName = "index.json") {
75162
75079
  toWriteData = data;
75163
75080
  }
75164
75081
  await import_fs3.promises.mkdir(path2, { recursive: true });
75165
- const pathFile = (0, import_path4.join)(path2, fileName);
75082
+ const pathFile = (0, import_path3.join)(path2, fileName);
75166
75083
  try {
75167
75084
  await import_fs3.promises.writeFile(pathFile, toWriteData);
75168
75085
  } catch (err) {
@@ -75171,15 +75088,51 @@ async function writeFile3(path2, data, fileName = "index.json") {
75171
75088
  console.log(`${pathFile} saved.`);
75172
75089
  return pathFile;
75173
75090
  }
75174
- async function writeFileForSlpk(path2, data, fileName = "index.json", compress = true) {
75091
+ async function writeFileForSlpk(path2, data, fileName = "index.json", compress = true, compressList) {
75175
75092
  const pathFile = await writeFile3(path2, data, fileName);
75176
75093
  if (compress) {
75177
- const pathGzFile = await compressFileWithGzip(pathFile);
75178
- await removeFile(pathFile);
75179
- return pathGzFile;
75094
+ if (compressList) {
75095
+ if (!compressList.includes(pathFile)) {
75096
+ compressList.push(pathFile);
75097
+ return `${pathFile}.gz`;
75098
+ } else {
75099
+ return null;
75100
+ }
75101
+ } else {
75102
+ const pathGzFile = await compressFileWithGzip(pathFile);
75103
+ await removeFile(pathFile);
75104
+ return pathGzFile;
75105
+ }
75180
75106
  }
75181
75107
  return pathFile;
75182
75108
  }
75109
+ async function openJson(path2, fileName) {
75110
+ return new Promise((resolve, reject) => {
75111
+ let count = 0;
75112
+ console.log(`load ${path2}/${fileName}.`);
75113
+ const intervalId = setInterval(() => {
75114
+ const pathFile = (0, import_path3.join)(path2, fileName);
75115
+ load(pathFile, JSONLoader).then((result) => {
75116
+ clearInterval(intervalId);
75117
+ resolve(result);
75118
+ }).catch(() => {
75119
+ count++;
75120
+ if (count > 100) {
75121
+ clearInterval(intervalId);
75122
+ reject(new Error(`Cannon load ${path2}/${fileName}.`));
75123
+ }
75124
+ });
75125
+ }, 200);
75126
+ });
75127
+ }
75128
+ async function isFileExists(fileName) {
75129
+ try {
75130
+ await import_fs3.promises.stat(fileName);
75131
+ return true;
75132
+ } catch {
75133
+ return false;
75134
+ }
75135
+ }
75183
75136
  function removeDir(path2) {
75184
75137
  return import_fs3.promises.rmdir(path2, { recursive: true });
75185
75138
  }
@@ -75187,9 +75140,188 @@ function removeFile(path2) {
75187
75140
  return import_fs3.promises.unlink(path2);
75188
75141
  }
75189
75142
  function getAbsoluteFilePath(filePath) {
75190
- return (0, import_path4.isAbsolute)(filePath) ? filePath : (0, import_path4.join)(process.cwd(), filePath);
75143
+ return (0, import_path3.isAbsolute)(filePath) ? filePath : (0, import_path3.join)(process.cwd(), filePath);
75191
75144
  }
75192
75145
 
75146
+ // src/i3s-converter/helpers/node-pages.ts
75147
+ var NodePages = class {
75148
+ constructor(writeFileFunc, nodesPerPage, converter) {
75149
+ this.length = 0;
75150
+ this.nodesPerPage = nodesPerPage;
75151
+ this.nodesCounter = 0;
75152
+ this.nodePages = [{}];
75153
+ this.nodePages[0].nodes = [];
75154
+ this.writeFile = writeFileFunc;
75155
+ this.converter = converter;
75156
+ this.length = 0;
75157
+ }
75158
+ useWriteFunction(func) {
75159
+ this.writeFile = func;
75160
+ }
75161
+ getNodePageFileName(nodePageId) {
75162
+ let filePath;
75163
+ let fileName;
75164
+ if (this.converter.options.slpk) {
75165
+ filePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages");
75166
+ fileName = `${nodePageId.toString()}.json`;
75167
+ } else {
75168
+ filePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages", nodePageId.toString());
75169
+ fileName = "index.json";
75170
+ }
75171
+ return { filePath, fileName };
75172
+ }
75173
+ async loadNodePage(nodePageId) {
75174
+ const { filePath, fileName } = this.getNodePageFileName(nodePageId);
75175
+ const fullName = (0, import_path4.join)(filePath, fileName);
75176
+ if (await isFileExists(fullName)) {
75177
+ console.log(`load ${fullName}.`);
75178
+ return await openJson(filePath, fileName);
75179
+ } else {
75180
+ return { nodes: [] };
75181
+ }
75182
+ }
75183
+ getPageIndexByNodeId(id) {
75184
+ return Math.floor(id / this.nodesPerPage);
75185
+ }
75186
+ async getPageByNodeId(id) {
75187
+ const pageIndex = this.getPageIndexByNodeId(id);
75188
+ if (this.converter.options.instantNodeWriting) {
75189
+ return await this.loadNodePage(pageIndex);
75190
+ }
75191
+ return this.nodePages[pageIndex];
75192
+ }
75193
+ async getNodeById(id, nodePage) {
75194
+ const nodeIndex = id % this.nodesPerPage;
75195
+ nodePage = nodePage || await this.getPageByNodeId(id);
75196
+ return nodePage.nodes[nodeIndex];
75197
+ }
75198
+ async addChildRelation(parentId, childId) {
75199
+ if (parentId === null || parentId === void 0) {
75200
+ return;
75201
+ }
75202
+ const parentNode = await this.getNodeById(parentId);
75203
+ parentNode.children?.push(childId);
75204
+ await this.saveNode(parentNode);
75205
+ }
75206
+ async push(node2, parentId) {
75207
+ node2.index = this.nodesCounter++;
75208
+ if (!this.converter.options.instantNodeWriting) {
75209
+ let currentNodePage = this.nodePages[this.nodePages.length - 1];
75210
+ if (currentNodePage.nodes.length === this.nodesPerPage) {
75211
+ currentNodePage = { nodes: [] };
75212
+ this.nodePages.push(currentNodePage);
75213
+ }
75214
+ currentNodePage.nodes.push(node2);
75215
+ }
75216
+ await this.addChildRelation(parentId, node2.index);
75217
+ NodePages.updateResourceInMesh(node2);
75218
+ await this.saveNode(node2);
75219
+ return node2;
75220
+ }
75221
+ async saveNode(node2) {
75222
+ if (!this.converter.options.instantNodeWriting) {
75223
+ return;
75224
+ } else {
75225
+ const nodePageIndex = this.getPageIndexByNodeId(node2.index);
75226
+ const nodePage = await this.getPageByNodeId(node2.index);
75227
+ const { filePath, fileName } = this.getNodePageFileName(nodePageIndex);
75228
+ const nodeToUpdate = await this.getNodeById(node2.index, nodePage);
75229
+ if (nodeToUpdate) {
75230
+ NodePages.updateAll(nodeToUpdate, node2);
75231
+ } else {
75232
+ nodePage.nodes.push(node2);
75233
+ }
75234
+ const nodePageStr = JSON.stringify(nodePage);
75235
+ if (this.converter.options.slpk) {
75236
+ await this.converter.writeQueue.enqueue({
75237
+ archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
75238
+ writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
75239
+ }, true);
75240
+ } else {
75241
+ await this.converter.writeQueue.enqueue({
75242
+ writePromise: () => this.writeFile(filePath, nodePageStr)
75243
+ }, true);
75244
+ }
75245
+ }
75246
+ }
75247
+ async saveMetadata() {
75248
+ const metadata = (0, import_json_map_transform.default)({ nodeCount: this.nodesCounter }, METADATA());
75249
+ const compress = false;
75250
+ await this.converter.writeQueue.enqueue({
75251
+ archiveKey: "metadata.json",
75252
+ writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), "metadata.json", compress)
75253
+ });
75254
+ }
75255
+ async save() {
75256
+ if (this.converter.options.instantNodeWriting) {
75257
+ await this.saveMetadata();
75258
+ return;
75259
+ }
75260
+ if (this.converter.options.slpk) {
75261
+ for (const [index, nodePage] of this.nodePages.entries()) {
75262
+ const nodePageStr = JSON.stringify(nodePage);
75263
+ const slpkPath = (0, import_path4.join)(this.converter.layers0Path, "nodepages");
75264
+ await this.converter.writeQueue.enqueue({
75265
+ archiveKey: `nodePages/${index.toString()}.json.gz`,
75266
+ writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
75267
+ });
75268
+ }
75269
+ await this.saveMetadata();
75270
+ } else {
75271
+ for (const [index, nodePage] of this.nodePages.entries()) {
75272
+ const nodePageStr = JSON.stringify(nodePage);
75273
+ const nodePagePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages", index.toString());
75274
+ await this.converter.writeQueue.enqueue({
75275
+ writePromise: () => this.writeFile(nodePagePath, nodePageStr)
75276
+ });
75277
+ }
75278
+ }
75279
+ }
75280
+ static updateResourceInMesh(node2) {
75281
+ if (node2.mesh && isFinite(node2.index)) {
75282
+ node2.mesh.geometry.resource = node2.index;
75283
+ }
75284
+ }
75285
+ static updateAll(node2, data) {
75286
+ Object.assign(node2, data, { index: node2.index });
75287
+ NodePages.updateResourceInMesh(node2);
75288
+ return node2;
75289
+ }
75290
+ static updateMaterialByNodeId(node2, materialId) {
75291
+ if (!node2.mesh) {
75292
+ return;
75293
+ }
75294
+ node2.mesh.material = {
75295
+ definition: materialId,
75296
+ resource: node2.index
75297
+ };
75298
+ }
75299
+ static updateVertexCountByNodeId(node2, vertexCount) {
75300
+ if (!node2.mesh) {
75301
+ return;
75302
+ }
75303
+ node2.mesh.geometry.vertexCount = vertexCount;
75304
+ }
75305
+ static updateNodeAttributeByNodeId(node2) {
75306
+ if (!node2.mesh || !node2.index) {
75307
+ return;
75308
+ }
75309
+ node2.mesh.attribute.resource = node2.index;
75310
+ }
75311
+ static updateFeatureCountByNodeId(node2, featureCount) {
75312
+ if (!node2.mesh) {
75313
+ return;
75314
+ }
75315
+ node2.mesh.geometry.featureCount = featureCount;
75316
+ }
75317
+ static updateTexelCountHintByNodeId(node2, texelCountHint) {
75318
+ if (!node2.mesh || !node2.mesh.material) {
75319
+ return;
75320
+ }
75321
+ node2.mesh.material.texelCountHint = texelCountHint;
75322
+ }
75323
+ };
75324
+
75193
75325
  // src/lib/utils/statistic-utills.ts
75194
75326
  var import_path5 = __toModule(require("path"));
75195
75327
  var import_fs4 = __toModule(require("fs"));
@@ -75249,7 +75381,7 @@ async function getTotalFilesSize(dirPath) {
75249
75381
  }
75250
75382
 
75251
75383
  // src/i3s-converter/helpers/geometry-converter.ts
75252
- var import_core21 = __toModule(require_es54());
75384
+ var import_core22 = __toModule(require_es54());
75253
75385
  var import_geospatial9 = __toModule(require_es55());
75254
75386
  var import_md5 = __toModule(require_md52());
75255
75387
 
@@ -75257,7 +75389,7 @@ var import_md5 = __toModule(require_md52());
75257
75389
  var VALUES_PER_VERTEX = 3;
75258
75390
  var POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
75259
75391
  function generateAttributes(attributes) {
75260
- const { positions, normals, texCoords, colors, featureIndices } = attributes;
75392
+ const { positions, normals, texCoords, colors, uvRegions, featureIndices } = attributes;
75261
75393
  const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
75262
75394
  if (!featureIndices.length) {
75263
75395
  return {
@@ -75267,7 +75399,8 @@ function generateAttributes(attributes) {
75267
75399
  positions,
75268
75400
  normals,
75269
75401
  texCoords,
75270
- colors
75402
+ colors,
75403
+ uvRegions
75271
75404
  };
75272
75405
  }
75273
75406
  const data = calculateFaceRangesAndFeaturesCount(featureIndices);
@@ -75321,6 +75454,7 @@ function makeAttributeObjects(attributes) {
75321
75454
  positions,
75322
75455
  normals,
75323
75456
  colors,
75457
+ uvRegions,
75324
75458
  texCoords,
75325
75459
  faceRange = new Uint32Array(0)
75326
75460
  } = attributes;
@@ -75329,31 +75463,33 @@ function makeAttributeObjects(attributes) {
75329
75463
  let normalsList = new Float32Array(normals);
75330
75464
  let colorsList = new Uint8Array(colors);
75331
75465
  let texCoordsList = new Float32Array(texCoords);
75332
- let faceRangeIndex = 0;
75466
+ let uvRegionsList = new Uint16Array(uvRegions);
75333
75467
  for (let index = 0; index < featureIds.length; index++) {
75334
- const startIndex = faceRange[index + faceRangeIndex];
75335
- const endIndex = faceRange[index + faceRangeIndex + 1];
75468
+ const startIndex = faceRange[index * 2];
75469
+ const endIndex = faceRange[index * 2 + 1];
75336
75470
  const positionsCount = getSliceAttributeCount("positions", startIndex, endIndex);
75337
75471
  const normalsCount = getSliceAttributeCount("normals", startIndex, endIndex);
75338
75472
  const colorsCount = getSliceAttributeCount("colors", startIndex, endIndex);
75473
+ const uvRegionsCount = getSliceAttributeCount("uvRegions", startIndex, endIndex);
75339
75474
  const texCoordsCount = getSliceAttributeCount("texCoords", startIndex, endIndex);
75340
75475
  groupedData.push({
75341
75476
  featureId: featureIds[index],
75342
75477
  positions: positionsList.slice(0, positionsCount),
75343
75478
  normals: normalsList.slice(0, normalsCount),
75344
75479
  colors: colorsList.slice(0, colorsCount),
75480
+ uvRegions: uvRegionsList.slice(0, uvRegionsCount),
75345
75481
  texCoords: texCoordsList.slice(0, texCoordsCount)
75346
75482
  });
75347
75483
  positionsList = positionsList.slice(positionsCount);
75348
75484
  normalsList = normalsList.slice(normalsCount);
75349
75485
  colorsList = colorsList.slice(colorsCount);
75486
+ uvRegionsList = uvRegionsList.slice(uvRegionsCount);
75350
75487
  texCoordsList = texCoordsList.slice(texCoordsCount);
75351
- faceRangeIndex += 1;
75352
75488
  }
75353
75489
  return groupedData.sort((first, second) => first.featureId - second.featureId);
75354
75490
  }
75355
75491
  function getSliceAttributeCount(attributeName, startIndex, endIndex) {
75356
- const colorsPerVertex = 4;
75492
+ const itemsPerVertex4 = 4;
75357
75493
  const texCoordsPerVertex = 2;
75358
75494
  const trianglesCount = endIndex - startIndex + 1;
75359
75495
  const vertexCount = trianglesCount * 3;
@@ -75362,7 +75498,8 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
75362
75498
  case "normals":
75363
75499
  return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
75364
75500
  case "colors":
75365
- return vertexCount * colorsPerVertex;
75501
+ case "uvRegions":
75502
+ return vertexCount * itemsPerVertex4;
75366
75503
  case "texCoords":
75367
75504
  return vertexCount * texCoordsPerVertex;
75368
75505
  default:
@@ -75391,6 +75528,7 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75391
75528
  let positions = new Float32Array(firstAttributeObject.positions);
75392
75529
  let normals = new Float32Array(firstAttributeObject.normals);
75393
75530
  let colors = new Uint8Array(firstAttributeObject.colors);
75531
+ let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
75394
75532
  let texCoords = new Float32Array(firstAttributeObject.texCoords);
75395
75533
  const range = [0];
75396
75534
  let objIndex = 0;
@@ -75401,6 +75539,7 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75401
75539
  positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
75402
75540
  normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
75403
75541
  colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
75542
+ uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
75404
75543
  texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
75405
75544
  const groupedObject = unifiedObjects[objIndex];
75406
75545
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
@@ -75410,11 +75549,11 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75410
75549
  }
75411
75550
  range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
75412
75551
  const faceRange = new Uint32Array(range);
75413
- return { faceRange, featureIds, positions, normals, colors, texCoords, featureCount };
75552
+ return { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount };
75414
75553
  }
75415
75554
 
75416
75555
  // src/i3s-converter/helpers/coordinate-converter.ts
75417
- var import_core20 = __toModule(require_es54());
75556
+ var import_core21 = __toModule(require_es54());
75418
75557
  var import_geospatial8 = __toModule(require_es55());
75419
75558
  var import_culling5 = __toModule(require_es56());
75420
75559
  function createBoundingVolumes(tile, geoidHeightModel) {
@@ -75422,16 +75561,16 @@ function createBoundingVolumes(tile, geoidHeightModel) {
75422
75561
  let halfSize;
75423
75562
  let quaternion;
75424
75563
  const boundingVolume = tile.boundingVolume;
75425
- const cartographicCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core20.Vector3());
75564
+ const cartographicCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core21.Vector3());
75426
75565
  cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
75427
75566
  if (boundingVolume instanceof import_culling5.OrientedBoundingBox) {
75428
75567
  halfSize = boundingVolume.halfSize;
75429
- radius = new import_core20.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
75568
+ radius = new import_core21.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
75430
75569
  quaternion = boundingVolume.quaternion;
75431
75570
  } else {
75432
75571
  radius = tile.boundingVolume.radius;
75433
75572
  halfSize = [radius, radius, radius];
75434
- quaternion = new import_core20.Quaternion().fromMatrix3(new import_core20.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
75573
+ quaternion = new import_core21.Quaternion().fromMatrix3(new import_core21.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
75435
75574
  }
75436
75575
  return {
75437
75576
  mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
@@ -75446,8 +75585,8 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
75446
75585
  const positionVectors = convertPositionsToVectors(cartesianPositions);
75447
75586
  const geometryObb = (0, import_culling5.makeOrientedBoundingBoxFromPoints)(positionVectors);
75448
75587
  const geometryMbs = (0, import_culling5.makeBoundingSphereFromPoints)(positionVectors);
75449
- let mbsCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core20.Vector3());
75450
- let obbCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core20.Vector3());
75588
+ let mbsCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core21.Vector3());
75589
+ let obbCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core21.Vector3());
75451
75590
  mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
75452
75591
  obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
75453
75592
  return {
@@ -75462,7 +75601,7 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
75462
75601
  function convertPositionsToVectors(positions) {
75463
75602
  const result = [];
75464
75603
  for (let i = 0; i < positions.length; i += 3) {
75465
- const positionVector = new import_core20.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
75604
+ const positionVector = new import_core21.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
75466
75605
  result.push(positionVector);
75467
75606
  }
75468
75607
  return result;
@@ -75476,8 +75615,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
75476
75615
  }
75477
75616
  const center = sphere.center;
75478
75617
  const radius = sphere.radius;
75479
- const vertexMax = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core20.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new import_core20.Vector3());
75480
- const vertexMin = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core20.Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new import_core20.Vector3());
75618
+ const vertexMax = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core21.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new import_core21.Vector3());
75619
+ const vertexMin = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core21.Vector3(center[0] - radius, center[1] - radius, center[2] - radius), new import_core21.Vector3());
75481
75620
  return {
75482
75621
  xmin: Math.min(vertexMin[0], vertexMax[0]),
75483
75622
  xmax: Math.max(vertexMin[0], vertexMax[0]),
@@ -75489,8 +75628,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
75489
75628
  }
75490
75629
  function createObbFromMbs(mbs) {
75491
75630
  const radius = mbs[3];
75492
- const center = new import_core20.Vector3(mbs[0], mbs[1], mbs[2]);
75493
- const halfAxex = new import_core20.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
75631
+ const center = new import_core21.Vector3(mbs[0], mbs[1], mbs[2]);
75632
+ const halfAxex = new import_core21.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
75494
75633
  return new import_culling5.OrientedBoundingBox(center, halfAxex);
75495
75634
  }
75496
75635
 
@@ -75505,7 +75644,6 @@ function getB3DMAttributesWithoutBufferView(attributes) {
75505
75644
  return attributesWithoutBufferView;
75506
75645
  }
75507
75646
  function prepareDataForAttributesConversion(tileContent) {
75508
- const gltfMaterials = tileContent.gltf?.materials?.map((material) => ({ id: material.id }));
75509
75647
  let nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
75510
75648
  const images = tileContent.gltf?.images?.map((imageObject) => {
75511
75649
  if (imageObject?.image?.compressed) {
@@ -75531,7 +75669,6 @@ function prepareDataForAttributesConversion(tileContent) {
75531
75669
  const cartographicOrigin = tileContent.cartographicOrigin;
75532
75670
  const cartesianModelMatrix = tileContent.cartesianModelMatrix;
75533
75671
  return {
75534
- gltfMaterials,
75535
75672
  nodes,
75536
75673
  images,
75537
75674
  cartographicOrigin,
@@ -75551,7 +75688,8 @@ function prepareNodes(nodes) {
75551
75688
  indices: { value: primitive?.indices?.value },
75552
75689
  attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
75553
75690
  material: {
75554
- id: primitive?.material?.id
75691
+ id: primitive?.material?.id,
75692
+ uniqueId: primitive?.material?.uniqueId
75555
75693
  }
75556
75694
  }))
75557
75695
  }
@@ -75815,36 +75953,27 @@ var OBJECT_ID_TYPE2 = "Oid32";
75815
75953
  var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
75816
75954
  var EXT_FEATURE_METADATA3 = "EXT_feature_metadata";
75817
75955
  var EXT_MESH_FEATURES2 = "EXT_mesh_features";
75818
- var scratchVector5 = new import_core21.Vector3();
75819
- async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
75956
+ var scratchVector5 = new import_core22.Vector3();
75957
+ async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
75820
75958
  const useCartesianPositions = generateBoundingVolumes;
75821
- const materialAndTextureList = convertMaterials(tileContent.gltf?.materials);
75959
+ const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
75822
75960
  const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
75823
- const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, useCartesianPositions);
75961
+ const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
75824
75962
  if (generateBoundingVolumes) {
75825
75963
  _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
75826
75964
  }
75827
- if (convertedAttributesMap.has("default")) {
75828
- materialAndTextureList.push({
75829
- material: getDefaultMaterial()
75830
- });
75831
- }
75832
75965
  const result = [];
75833
- let { materials = [] } = tileContent.gltf || { materials: [] };
75834
- if (!materials?.length) {
75835
- materials.push({ id: "default" });
75836
- }
75837
- for (let i = 0; i < materials.length; i++) {
75838
- const sourceMaterial = materials[i];
75839
- if (!convertedAttributesMap.has(sourceMaterial.id)) {
75966
+ for (const materialAndTexture of materialAndTextureList) {
75967
+ const originarMaterialId = materialAndTexture.mergedMaterials[0].originalMaterialId;
75968
+ if (!convertedAttributesMap.has(originarMaterialId)) {
75840
75969
  continue;
75841
75970
  }
75842
- const convertedAttributes = convertedAttributesMap.get(sourceMaterial.id);
75971
+ const convertedAttributes = convertedAttributesMap.get(originarMaterialId);
75843
75972
  if (!convertedAttributes) {
75844
75973
  continue;
75845
75974
  }
75846
- const { material, texture } = materialAndTextureList[i];
75847
- const nodeId = addNodeToNodePage();
75975
+ const { material, texture } = materialAndTexture;
75976
+ const nodeId = await addNodeToNodePage();
75848
75977
  result.push(await _makeNodeResources({
75849
75978
  convertedAttributes,
75850
75979
  material,
@@ -75891,19 +76020,20 @@ async function _makeNodeResources({
75891
76020
  }) {
75892
76021
  const boundingVolumes = convertedAttributes.boundingVolumes;
75893
76022
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX2;
75894
- const { faceRange, featureIds, positions, normals, colors, texCoords, featureCount } = generateAttributes(convertedAttributes);
76023
+ const { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount } = generateAttributes(convertedAttributes);
75895
76024
  if (tileContent.batchTableJson) {
75896
76025
  makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
75897
76026
  }
75898
76027
  const header = new Uint32Array(2);
75899
76028
  const typedFeatureIds = generateBigUint64Array(featureIds);
75900
76029
  header.set([vertexCount, featureCount], 0);
75901
- const fileBuffer = new Uint8Array(concatenateArrayBuffers(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, typedFeatureIds.buffer, faceRange.buffer));
76030
+ const fileBuffer = new Uint8Array(concatenateArrayBuffers(header.buffer, positions.buffer, normals.buffer, texture ? texCoords.buffer : new ArrayBuffer(0), colors.buffer, uvRegions, typedFeatureIds.buffer, faceRange.buffer));
75902
76031
  const compressedGeometry = draco ? generateCompressedGeometry(vertexCount, convertedAttributes, {
75903
76032
  positions,
75904
76033
  normals,
75905
76034
  texCoords: texture ? texCoords : new Float32Array(0),
75906
76035
  colors,
76036
+ uvRegions,
75907
76037
  featureIds,
75908
76038
  faceRange
75909
76039
  }, workerSource.draco) : null;
@@ -75916,6 +76046,7 @@ async function _makeNodeResources({
75916
76046
  geometry: fileBuffer,
75917
76047
  compressedGeometry,
75918
76048
  texture,
76049
+ hasUvRegions: Boolean(uvRegions.length),
75919
76050
  sharedResources: getSharedResources(tileContent.gltf?.materials || [], nodeId),
75920
76051
  meshMaterial: material,
75921
76052
  vertexCount,
@@ -75924,19 +76055,24 @@ async function _makeNodeResources({
75924
76055
  boundingVolumes
75925
76056
  };
75926
76057
  }
75927
- async function convertAttributes(attributesData, useCartesianPositions) {
75928
- const { gltfMaterials, nodes, images, cartographicOrigin, cartesianModelMatrix } = attributesData;
76058
+ async function convertAttributes(attributesData, materialAndTextureList, useCartesianPositions) {
76059
+ const { nodes, images, cartographicOrigin, cartesianModelMatrix } = attributesData;
75929
76060
  const attributesMap = new Map();
75930
- for (const material of gltfMaterials || [{ id: "default" }]) {
75931
- attributesMap.set(material.id, {
76061
+ for (const materialAndTexture of materialAndTextureList) {
76062
+ const attributes = {
75932
76063
  positions: new Float32Array(0),
75933
76064
  normals: new Float32Array(0),
75934
76065
  texCoords: new Float32Array(0),
75935
76066
  colors: new Uint8Array(0),
76067
+ uvRegions: new Uint16Array(0),
75936
76068
  featureIndicesGroups: [],
75937
76069
  featureIndices: [],
75938
- boundingVolumes: null
75939
- });
76070
+ boundingVolumes: null,
76071
+ mergedMaterials: materialAndTexture.mergedMaterials
76072
+ };
76073
+ for (const mergedMaterial of materialAndTexture.mergedMaterials) {
76074
+ attributesMap.set(mergedMaterial.originalMaterialId, attributes);
76075
+ }
75940
76076
  }
75941
76077
  convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
75942
76078
  for (const attrKey of attributesMap.keys()) {
@@ -75955,7 +76091,7 @@ async function convertAttributes(attributesData, useCartesianPositions) {
75955
76091
  }
75956
76092
  return attributesMap;
75957
76093
  }
75958
- function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
76094
+ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core22.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
75959
76095
  if (nodes) {
75960
76096
  for (const node2 of nodes) {
75961
76097
  convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
@@ -75979,7 +76115,7 @@ function getCompositeTransformationMatrix(node2, matrix) {
75979
76115
  }
75980
76116
  return transformationMatrix;
75981
76117
  }
75982
- function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
76118
+ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix = new import_core22.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
75983
76119
  const transformationMatrix = getCompositeTransformationMatrix(node2, matrix);
75984
76120
  const mesh = node2.mesh;
75985
76121
  if (mesh) {
@@ -75987,11 +76123,13 @@ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, at
75987
76123
  }
75988
76124
  convertNodes(node2.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
75989
76125
  }
75990
- function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core21.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
76126
+ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions = false, matrix = new import_core22.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1])) {
75991
76127
  for (const primitive of mesh.primitives) {
75992
76128
  let outputAttributes = null;
76129
+ let materialUvRegion;
75993
76130
  if (primitive.material) {
75994
- outputAttributes = attributesMap.get(primitive.material.id);
76131
+ outputAttributes = attributesMap.get(primitive.material.uniqueId);
76132
+ materialUvRegion = outputAttributes?.mergedMaterials.find(({ originalMaterialId }) => originalMaterialId === primitive.material?.uniqueId)?.uvRegion;
75995
76133
  } else if (attributesMap.has("default")) {
75996
76134
  outputAttributes = attributesMap.get("default");
75997
76135
  }
@@ -76020,6 +76158,9 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
76020
76158
  }));
76021
76159
  outputAttributes.texCoords = concatenateTypedArrays(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, primitive.indices?.value));
76022
76160
  outputAttributes.colors = concatenateTypedArrays(outputAttributes.colors, flattenColors(attributes.COLOR_0, primitive.indices?.value));
76161
+ if (materialUvRegion) {
76162
+ outputAttributes.uvRegions = concatenateTypedArrays(outputAttributes.uvRegions, createUvRegion(materialUvRegion, primitive.indices?.value));
76163
+ }
76023
76164
  outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
76024
76165
  outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), primitive.indices?.value));
76025
76166
  }
@@ -76033,7 +76174,7 @@ function transformVertexArray(args) {
76033
76174
  for (let i = 0; i < indices.length; i++) {
76034
76175
  const coordIndex = indices[i] * VALUES_PER_VERTEX2;
76035
76176
  const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
76036
- let vertexVector = new import_core21.Vector3(Array.from(vertex));
76177
+ let vertexVector = new import_core22.Vector3(Array.from(vertex));
76037
76178
  vertexVector = attributeSpecificTransformation(vertexVector, args);
76038
76179
  newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
76039
76180
  newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
@@ -76095,6 +76236,13 @@ function flattenColors(colorsAttribute, indices) {
76095
76236
  }
76096
76237
  return newColors;
76097
76238
  }
76239
+ function createUvRegion(materialUvRegion, indices) {
76240
+ const result = new Uint16Array(indices.length * 4);
76241
+ for (let i = 0; i < result.length; i += 4) {
76242
+ result.set(materialUvRegion, i);
76243
+ }
76244
+ return result;
76245
+ }
76098
76246
  function flattenBatchIds(batchedIds, indices) {
76099
76247
  if (!batchedIds.length || !indices.length) {
76100
76248
  return [];
@@ -76119,13 +76267,77 @@ function getBatchIds(attributes, primitive, images) {
76119
76267
  }
76120
76268
  return [];
76121
76269
  }
76122
- function convertMaterials(sourceMaterials = []) {
76123
- const result = [];
76270
+ async function convertMaterials(sourceMaterials = [], shouldMergeMaterials) {
76271
+ let materials = [];
76124
76272
  for (const sourceMaterial of sourceMaterials) {
76125
- result.push(convertMaterial(sourceMaterial));
76273
+ materials.push(convertMaterial(sourceMaterial));
76274
+ }
76275
+ if (shouldMergeMaterials) {
76276
+ materials = await mergeAllMaterials(materials);
76277
+ }
76278
+ return materials;
76279
+ }
76280
+ async function mergeAllMaterials(materials) {
76281
+ const result = [];
76282
+ while (materials.length > 0) {
76283
+ let newMaterial = materials.splice(0, 1)[0];
76284
+ const mergedIndices = [];
76285
+ for (let i = 0; i < materials.length; i++) {
76286
+ const material = materials[i];
76287
+ if (newMaterial.texture && material.texture || !newMaterial.texture && !material.texture) {
76288
+ newMaterial = await mergeMaterials(newMaterial, material);
76289
+ mergedIndices.push(i);
76290
+ }
76291
+ }
76292
+ if (newMaterial.texture && mergedIndices.length) {
76293
+ const newWidth = newMaterial.mergedMaterials?.reduce((accum, { textureSize }) => accum + (textureSize?.width || 0), 0);
76294
+ const newHeight = newMaterial.mergedMaterials?.reduce((accum, { textureSize }) => Math.max(accum, textureSize?.height || 0), 0);
76295
+ let currentX = -1;
76296
+ for (const aTextureMetadata of newMaterial.mergedMaterials) {
76297
+ if (aTextureMetadata.textureSize) {
76298
+ const newX = currentX + 1 + aTextureMetadata.textureSize.width / newWidth * 2 ** (Uint16Array.BYTES_PER_ELEMENT * 8) - 1;
76299
+ aTextureMetadata.uvRegion = new Uint16Array([
76300
+ currentX + 1,
76301
+ 0,
76302
+ newX,
76303
+ aTextureMetadata.textureSize.height / newHeight * 2 ** (Uint16Array.BYTES_PER_ELEMENT * 8) - 1
76304
+ ]);
76305
+ currentX = newX;
76306
+ }
76307
+ }
76308
+ newMaterial.texture.image.width = newWidth;
76309
+ newMaterial.texture.image.height = newHeight;
76310
+ }
76311
+ for (const index of mergedIndices.reverse()) {
76312
+ materials.splice(index, 1);
76313
+ }
76314
+ result.push(newMaterial);
76315
+ }
76316
+ if (!result.length) {
76317
+ result.push({
76318
+ material: getDefaultMaterial(),
76319
+ mergedMaterials: [{ originalMaterialId: "default" }]
76320
+ });
76126
76321
  }
76127
76322
  return result;
76128
76323
  }
76324
+ async function mergeMaterials(material1, material2) {
76325
+ if (material1.texture?.bufferView && material2.texture?.bufferView && material1.mergedMaterials && material2.mergedMaterials) {
76326
+ const buffer1 = Buffer.from(material1.texture.bufferView.data);
76327
+ const buffer2 = Buffer.from(material2.texture.bufferView.data);
76328
+ try {
76329
+ const { joinImages } = await import("join-images");
76330
+ const sharpData = await joinImages([buffer1, buffer2], { direction: "horizontal" });
76331
+ material1.texture.bufferView.data = await sharpData.toFormat(material1.texture.mimeType === "image/png" ? "png" : "jpeg").toBuffer();
76332
+ } catch (error) {
76333
+ 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)");
76334
+ throw error;
76335
+ }
76336
+ material1.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId = 1;
76337
+ }
76338
+ material1.mergedMaterials = material1.mergedMaterials.concat(material2.mergedMaterials);
76339
+ return material1;
76340
+ }
76129
76341
  function convertMaterial(sourceMaterial) {
76130
76342
  const material = {
76131
76343
  doubleSided: sourceMaterial.doubleSided,
@@ -76148,11 +76360,16 @@ function convertMaterial(sourceMaterial) {
76148
76360
  textureSetDefinitionId: 0
76149
76361
  };
76150
76362
  }
76363
+ const uniqueId = v4();
76364
+ sourceMaterial.uniqueId = uniqueId;
76365
+ let mergedMaterials = [{ originalMaterialId: uniqueId }];
76151
76366
  if (!texture) {
76152
76367
  const baseColorFactor = sourceMaterial?.pbrMetallicRoughness?.baseColorFactor;
76153
76368
  material.pbrMetallicRoughness.baseColorFactor = baseColorFactor && baseColorFactor.map((c) => Math.round(c * 255)) || void 0;
76369
+ } else {
76370
+ mergedMaterials[0].textureSize = { width: texture.image.width, height: texture.image.height };
76154
76371
  }
76155
- return { material, texture };
76372
+ return { material, texture, mergedMaterials };
76156
76373
  }
76157
76374
  function convertAlphaMode(gltfAlphaMode) {
76158
76375
  switch (gltfAlphaMode) {
@@ -76210,10 +76427,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
76210
76427
  }
76211
76428
  function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1) {
76212
76429
  const matDielectricColorComponent = 0.04 / 255;
76213
- const black = new import_core21.Vector4(0, 0, 0, 1);
76214
- const unitVector = new import_core21.Vector4(1, 1, 1, 1);
76215
- const dielectricSpecular = new import_core21.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
76216
- const baseColorVector = new import_core21.Vector4(baseColorFactor);
76430
+ const black = new import_core22.Vector4(0, 0, 0, 1);
76431
+ const unitVector = new import_core22.Vector4(1, 1, 1, 1);
76432
+ const dielectricSpecular = new import_core22.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
76433
+ const baseColorVector = new import_core22.Vector4(baseColorFactor);
76217
76434
  const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
76218
76435
  const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
76219
76436
  dielectricSpecular[3] = 1;
@@ -76360,7 +76577,7 @@ function generateBigUint64Array(featureIds) {
76360
76577
  return typedFeatureIds;
76361
76578
  }
76362
76579
  async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
76363
- const { positions, normals, texCoords, colors, featureIds, faceRange } = attributes;
76580
+ const { positions, normals, texCoords, colors, uvRegions, featureIds, faceRange } = attributes;
76364
76581
  const indices = new Uint32Array(vertexCount);
76365
76582
  for (let index = 0; index < indices.length; index++) {
76366
76583
  indices.set([index], index);
@@ -76382,6 +76599,12 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
76382
76599
  "i3s-feature-ids": new Int32Array(featureIds)
76383
76600
  }
76384
76601
  };
76602
+ if (uvRegions.length) {
76603
+ compressedAttributes["uv-region"] = uvRegions;
76604
+ attributesMetadata["uv-region"] = {
76605
+ "i3s-attribute-type": "uv-region"
76606
+ };
76607
+ }
76385
76608
  return encode({ attributes: compressedAttributes, indices }, DracoWriterWorker, {
76386
76609
  ...DracoWriterWorker.options,
76387
76610
  source: dracoWorkerSoure,
@@ -76544,12 +76767,12 @@ function convertScreenThresholdToGeometricError(node2) {
76544
76767
 
76545
76768
  // src/pgm-loader.ts
76546
76769
  var import_geoid = __toModule(require_es57());
76547
- var VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
76770
+ var VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
76548
76771
  var PGMLoader = {
76549
76772
  name: "PGM - Netpbm grayscale image format",
76550
76773
  id: "pgm",
76551
76774
  module: "tile-converter",
76552
- version: VERSION10,
76775
+ version: VERSION11,
76553
76776
  mimeTypes: ["image/x-portable-graymap"],
76554
76777
  parse: async (arrayBuffer, options) => (0, import_geoid.parsePGM)(new Uint8Array(arrayBuffer), options),
76555
76778
  extensions: ["pgm"],
@@ -76664,72 +76887,6 @@ var STORE = {
76664
76887
  };
76665
76888
 
76666
76889
  // src/i3s-converter/json-templates/layers.ts
76667
- var PLAIN_GEOMETRY_DEFINITION = () => ({
76668
- offset: 8,
76669
- position: {
76670
- type: "Float32",
76671
- component: 3
76672
- },
76673
- normal: {
76674
- type: "Float32",
76675
- component: 3
76676
- },
76677
- uv0: {
76678
- type: "Float32",
76679
- component: 2
76680
- },
76681
- color: {
76682
- type: "UInt8",
76683
- component: 4
76684
- },
76685
- featureId: {
76686
- binding: "per-feature",
76687
- type: "UInt64",
76688
- component: 1
76689
- },
76690
- faceRange: {
76691
- binding: "per-feature",
76692
- type: "UInt32",
76693
- component: 2
76694
- }
76695
- });
76696
- var PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0 = () => ({
76697
- offset: 8,
76698
- position: {
76699
- type: "Float32",
76700
- component: 3
76701
- },
76702
- normal: {
76703
- type: "Float32",
76704
- component: 3
76705
- },
76706
- color: {
76707
- type: "UInt8",
76708
- component: 4
76709
- },
76710
- featureId: {
76711
- binding: "per-feature",
76712
- type: "UInt64",
76713
- component: 1
76714
- },
76715
- faceRange: {
76716
- binding: "per-feature",
76717
- type: "UInt32",
76718
- component: 2
76719
- }
76720
- });
76721
- var COMPRESSED_GEOMETRY_DEFINITION = () => ({
76722
- compressedAttributes: {
76723
- encoding: "draco",
76724
- attributes: ["position", "normal", "uv0", "color", "feature-index"]
76725
- }
76726
- });
76727
- var COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0 = () => ({
76728
- compressedAttributes: {
76729
- encoding: "draco",
76730
- attributes: ["position", "normal", "color", "feature-index"]
76731
- }
76732
- });
76733
76890
  var SPATIAL_REFERENCE = () => ({
76734
76891
  wkid: {
76735
76892
  path: "wkid",
@@ -76844,22 +77001,8 @@ var LAYERS = () => ({
76844
77001
  default: []
76845
77002
  },
76846
77003
  geometryDefinitions: {
76847
- path: "compressGeometry",
76848
- transform: (val) => {
76849
- const result = [{ geometryBuffers: [] }, { geometryBuffers: [] }];
76850
- result[0].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION());
76851
- result[1].geometryBuffers.push(PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0());
76852
- if (val) {
76853
- result[0].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION());
76854
- result[1].geometryBuffers.push(COMPRESSED_GEOMETRY_DEFINITION_WITHOUT_UV0());
76855
- }
76856
- return result;
76857
- },
76858
- default: [
76859
- {
76860
- geometryBuffers: [PLAIN_GEOMETRY_DEFINITION(), PLAIN_GEOMETRY_DEFINITION_WITHOUT_UV0()]
76861
- }
76862
- ]
77004
+ path: "geometryDefinitions",
77005
+ default: []
76863
77006
  },
76864
77007
  attributeStorageInfo: {
76865
77008
  path: "attributeStorageInfo",
@@ -76875,87 +77018,85 @@ var LAYERS = () => ({
76875
77018
  }
76876
77019
  });
76877
77020
 
76878
- // src/i3s-converter/json-templates/node.ts
77021
+ // src/i3s-converter/json-templates/geometry-definitions.ts
76879
77022
  var import_json_map_transform4 = __toModule(require_json_map_transform());
76880
- var COORDINATES = () => ({
76881
- mbs: {
76882
- path: "mbs"
76883
- },
76884
- obb: {
76885
- path: "obb"
76886
- }
76887
- });
76888
- var HREF = () => ({
76889
- href: {
76890
- path: "href"
76891
- }
76892
- });
76893
- var PARENT_NODE = () => ({
76894
- id: {
76895
- path: "id"
76896
- },
76897
- ...HREF(),
76898
- ...COORDINATES()
76899
- });
76900
- var NODE = () => ({
76901
- version: {
76902
- path: "version"
76903
- },
76904
- id: {
76905
- path: "id"
76906
- },
76907
- path: {
76908
- path: "path"
76909
- },
76910
- level: {
76911
- path: "level"
76912
- },
76913
- ...COORDINATES(),
76914
- lodSelection: {
76915
- path: "lodSelection",
76916
- default: [
76917
- {
76918
- metricType: "maxScreenThresholdSQ",
76919
- maxError: 196349.54374999998
76920
- },
76921
- {
76922
- metricType: "maxScreenThreshold",
76923
- maxError: 999.9999999999999
76924
- }
76925
- ]
77023
+ var PLAIN_GEOMETRY_DEFINITION = () => ({
77024
+ offset: {
77025
+ default: 8
76926
77026
  },
76927
- children: {
76928
- path: "children",
76929
- default: null
77027
+ position: {
77028
+ default: {
77029
+ type: "Float32",
77030
+ component: 3
77031
+ }
76930
77032
  },
76931
- neighbors: {
76932
- path: "neighbors",
76933
- default: null
77033
+ normal: {
77034
+ default: {
77035
+ type: "Float32",
77036
+ component: 3
77037
+ }
76934
77038
  },
76935
- parentNode: {
76936
- path: "parentNode",
76937
- transform: (val) => (0, import_json_map_transform4.default)(val, PARENT_NODE()),
76938
- default: null
77039
+ uv0: {
77040
+ path: "hasTexture",
77041
+ transform: (val) => val && { type: "Float32", component: 2 } || false,
77042
+ omitValues: [false]
76939
77043
  },
76940
- sharedResource: {
76941
- path: "sharedResource",
76942
- default: null
77044
+ color: {
77045
+ default: {
77046
+ type: "UInt8",
77047
+ component: 4
77048
+ }
76943
77049
  },
76944
- featureData: {
76945
- path: "featureData",
76946
- default: null
77050
+ uvRegion: {
77051
+ path: "hasUvRegions",
77052
+ transform: (val) => val && { type: "UInt16", component: 4 } || false,
77053
+ omitValues: [false]
76947
77054
  },
76948
- geometryData: {
76949
- path: "geometryData",
76950
- default: null
77055
+ featureId: {
77056
+ default: {
77057
+ binding: "per-feature",
77058
+ type: "UInt64",
77059
+ component: 1
77060
+ }
76951
77061
  },
76952
- textureData: {
76953
- path: "textureData",
76954
- default: null
77062
+ faceRange: {
77063
+ default: {
77064
+ binding: "per-feature",
77065
+ type: "UInt32",
77066
+ component: 2
77067
+ }
77068
+ }
77069
+ });
77070
+ var COMPRESSED_GEOMETRY_DEFINITION = () => ({
77071
+ "compressedAttributes.encoding": {
77072
+ default: "draco"
76955
77073
  },
76956
- attributeData: {
76957
- path: "attributeData",
76958
- default: null
77074
+ "compressedAttributes.attributes": {
77075
+ path: "geometryConfig",
77076
+ transform: (val) => {
77077
+ const result = ["position", "normal"];
77078
+ if (val.hasTexture) {
77079
+ result.push("uv0");
77080
+ }
77081
+ result.push("color");
77082
+ if (val.hasUvRegions) {
77083
+ result.push("uv-region");
77084
+ }
77085
+ result.push("feature-index");
77086
+ return result;
77087
+ }
77088
+ }
77089
+ });
77090
+ var GEOMETRY_DEFINITION = () => ({
77091
+ geometryBuffers: {
77092
+ path: "geometryConfig",
77093
+ transform: (val) => {
77094
+ const result = [(0, import_json_map_transform4.default)(val, PLAIN_GEOMETRY_DEFINITION())];
77095
+ if (val.draco) {
77096
+ result.push((0, import_json_map_transform4.default)({ geometryConfig: val }, COMPRESSED_GEOMETRY_DEFINITION()));
77097
+ }
77098
+ return result;
77099
+ }
76959
77100
  }
76960
77101
  });
76961
77102
 
@@ -76976,15 +77117,15 @@ var MATERIAL_DEFINITION_INFO_PARAMS = () => ({
76976
77117
  },
76977
77118
  ambient: {
76978
77119
  path: "ambient",
76979
- default: [1, 1, 1, 1]
77120
+ default: [1, 1, 1]
76980
77121
  },
76981
77122
  diffuse: {
76982
77123
  path: "diffuse",
76983
- default: [1, 1, 1, 1]
77124
+ default: [1, 1, 1]
76984
77125
  },
76985
77126
  specular: {
76986
77127
  path: "specular",
76987
- default: [0, 0, 0, 0]
77128
+ default: [0, 0, 0]
76988
77129
  },
76989
77130
  useVertexColorAlpha: {
76990
77131
  path: "useVertexColorAlpha",
@@ -77086,7 +77227,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
77086
77227
  // src/i3s-converter/helpers/node-debug.ts
77087
77228
  var import_culling6 = __toModule(require_es56());
77088
77229
  var import_engine = __toModule(require_es511());
77089
- var import_core23 = __toModule(require_es54());
77230
+ var import_core24 = __toModule(require_es54());
77090
77231
  var import_geospatial10 = __toModule(require_es55());
77091
77232
  function validateNodeBoundingVolumes(node2) {
77092
77233
  if (!node2?.parentNode?.obb || !node2?.parentNode?.mbs) {
@@ -77131,7 +77272,7 @@ function getTileObbVertices(node2) {
77131
77272
  const obbCenterCartesian = import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
77132
77273
  let vertices = [];
77133
77274
  for (let i = 0; i < positions.length; i += 3) {
77134
- const positionsVector = new import_core23.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
77275
+ const positionsVector = new import_core24.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
77135
77276
  const rotatedPositions = positionsVector.transformByQuaternion(node2.obb.quaternion).add(obbCenterCartesian);
77136
77277
  vertices = vertices.concat(rotatedPositions);
77137
77278
  }
@@ -77178,10 +77319,18 @@ var WriteQueue = class extends Queue {
77178
77319
  this.listeningInterval = listeningInterval;
77179
77320
  this.writeConcurrency = writeConcurrency;
77180
77321
  }
77181
- async enqueue(val) {
77182
- super.enqueue(val);
77183
- if (import_process.default.memoryUsage().rss > MEMORY_LIMIT) {
77184
- await this.startWrite();
77322
+ async enqueue(val, writeImmediately = false) {
77323
+ if (writeImmediately) {
77324
+ const { archiveKey, writePromise } = val;
77325
+ const result = await writePromise();
77326
+ if (archiveKey && result) {
77327
+ this.fileMap[archiveKey] = result;
77328
+ }
77329
+ } else {
77330
+ super.enqueue(val);
77331
+ if (import_process.default.memoryUsage().rss > MEMORY_LIMIT) {
77332
+ await this.startWrite();
77333
+ }
77185
77334
  }
77186
77335
  }
77187
77336
  startListening() {
@@ -77193,12 +77342,9 @@ var WriteQueue = class extends Queue {
77193
77342
  }
77194
77343
  }
77195
77344
  async startWrite() {
77196
- if (this.writePromise) {
77197
- await this.writePromise;
77198
- this.writePromise = null;
77199
- return;
77345
+ if (!this.writePromise) {
77346
+ this.writePromise = this.doWrite();
77200
77347
  }
77201
- this.writePromise = this.doWrite();
77202
77348
  await this.writePromise;
77203
77349
  this.writePromise = null;
77204
77350
  }
@@ -77217,12 +77363,12 @@ var WriteQueue = class extends Queue {
77217
77363
  }
77218
77364
  const { archiveKey, writePromise } = item;
77219
77365
  archiveKeys.push(archiveKey);
77220
- promises.push(writePromise);
77366
+ const promise = writePromise();
77367
+ promises.push(promise);
77221
77368
  }
77222
77369
  const writeResults = await Promise.allSettled(promises);
77223
77370
  this.updateFileMap(archiveKeys, writeResults);
77224
77371
  }
77225
- this.writePromise = null;
77226
77372
  }
77227
77373
  updateFileMap(archiveKeys, writeResults) {
77228
77374
  for (let i = 0; i < archiveKeys.length; i++) {
@@ -77235,12 +77381,12 @@ var WriteQueue = class extends Queue {
77235
77381
  };
77236
77382
 
77237
77383
  // src/i3s-attributes-worker.ts
77238
- var VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
77384
+ var VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
77239
77385
  var I3SAttributesWorker = {
77240
77386
  id: "i3s-attributes",
77241
77387
  name: "I3S Attributes Worker",
77242
77388
  module: "tile-converter",
77243
- version: VERSION11,
77389
+ version: VERSION12,
77244
77390
  options: {
77245
77391
  useCartesianPositions: false
77246
77392
  }
@@ -77249,6 +77395,257 @@ var I3SAttributesWorker = {
77249
77395
  // src/constants.ts
77250
77396
  var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in node js environment";
77251
77397
 
77398
+ // src/i3s-converter/helpers/node-index-document.ts
77399
+ var import_path7 = __toModule(require("path"));
77400
+ var import_json_map_transform7 = __toModule(require_json_map_transform());
77401
+
77402
+ // src/i3s-converter/json-templates/node.ts
77403
+ var import_json_map_transform6 = __toModule(require_json_map_transform());
77404
+ var COORDINATES = () => ({
77405
+ mbs: {
77406
+ path: "mbs"
77407
+ },
77408
+ obb: {
77409
+ path: "obb"
77410
+ }
77411
+ });
77412
+ var HREF = () => ({
77413
+ href: {
77414
+ path: "href"
77415
+ }
77416
+ });
77417
+ var PARENT_NODE = () => ({
77418
+ id: {
77419
+ path: "id"
77420
+ },
77421
+ ...HREF(),
77422
+ ...COORDINATES()
77423
+ });
77424
+ var NODE = () => ({
77425
+ version: {
77426
+ path: "version"
77427
+ },
77428
+ id: {
77429
+ path: "id"
77430
+ },
77431
+ path: {
77432
+ path: "path"
77433
+ },
77434
+ level: {
77435
+ path: "level"
77436
+ },
77437
+ ...COORDINATES(),
77438
+ lodSelection: {
77439
+ path: "lodSelection",
77440
+ default: [
77441
+ {
77442
+ metricType: "maxScreenThresholdSQ",
77443
+ maxError: 196349.54374999998
77444
+ },
77445
+ {
77446
+ metricType: "maxScreenThreshold",
77447
+ maxError: 999.9999999999999
77448
+ }
77449
+ ]
77450
+ },
77451
+ children: {
77452
+ path: "children",
77453
+ default: null
77454
+ },
77455
+ neighbors: {
77456
+ path: "neighbors",
77457
+ default: null
77458
+ },
77459
+ parentNode: {
77460
+ path: "parentNode",
77461
+ transform: (val) => (0, import_json_map_transform6.default)(val, PARENT_NODE()),
77462
+ default: null
77463
+ },
77464
+ sharedResource: {
77465
+ path: "sharedResource",
77466
+ default: null
77467
+ },
77468
+ featureData: {
77469
+ path: "featureData",
77470
+ default: null
77471
+ },
77472
+ geometryData: {
77473
+ path: "geometryData",
77474
+ default: null
77475
+ },
77476
+ textureData: {
77477
+ path: "textureData",
77478
+ default: null
77479
+ },
77480
+ attributeData: {
77481
+ path: "attributeData",
77482
+ default: null
77483
+ }
77484
+ });
77485
+
77486
+ // src/i3s-converter/helpers/node-index-document.ts
77487
+ var NodeIndexDocument = class {
77488
+ constructor(id, converter) {
77489
+ this.data = null;
77490
+ this.children = [];
77491
+ this.inPageId = id;
77492
+ this.id = id === 0 ? "root" : id.toString();
77493
+ this.converter = converter;
77494
+ }
77495
+ async addData(data) {
77496
+ if (this.converter.options.instantNodeWriting) {
77497
+ await this.write(data);
77498
+ } else {
77499
+ this.data = data;
77500
+ }
77501
+ return this;
77502
+ }
77503
+ async addChildren(childNodes) {
77504
+ const newChildren = [];
77505
+ for (const node2 of childNodes) {
77506
+ const nodeData = await node2.load();
77507
+ newChildren.push({
77508
+ id: node2.id,
77509
+ href: `../${node2.id}`,
77510
+ obb: nodeData.obb,
77511
+ mbs: nodeData.mbs
77512
+ });
77513
+ }
77514
+ this.children = this.children.concat(childNodes);
77515
+ let data = this.data;
77516
+ if (this.converter.options.instantNodeWriting) {
77517
+ data = await this.load();
77518
+ }
77519
+ if (data) {
77520
+ data.children = data.children ?? [];
77521
+ data.children = data.children.concat(newChildren);
77522
+ }
77523
+ if (this.converter.options.instantNodeWriting && data) {
77524
+ await this.write(data);
77525
+ }
77526
+ }
77527
+ async addNeighbors() {
77528
+ const nodeData = await this.load();
77529
+ for (const childNode of this.children) {
77530
+ const childNodeData = await childNode.load();
77531
+ childNodeData.neighbors = childNodeData.neighbors ?? [];
77532
+ if (Number(nodeData?.children?.length) < 1e3) {
77533
+ for (const neighbor of nodeData.children || []) {
77534
+ if (childNode.id === neighbor.id) {
77535
+ continue;
77536
+ }
77537
+ childNodeData.neighbors.push({ ...neighbor });
77538
+ }
77539
+ } else {
77540
+ console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
77541
+ delete childNodeData.neighbors;
77542
+ }
77543
+ if (this.converter.options.instantNodeWriting && childNodeData) {
77544
+ await childNode.write(childNodeData);
77545
+ }
77546
+ await childNode.save();
77547
+ childNode.flush();
77548
+ }
77549
+ }
77550
+ async save() {
77551
+ if (this.data) {
77552
+ await this.write(this.data);
77553
+ }
77554
+ }
77555
+ async write(node2) {
77556
+ const path2 = (0, import_path7.join)(this.converter.layers0Path, "nodes", this.id);
77557
+ if (this.converter.options.slpk) {
77558
+ await this.converter.writeQueue.enqueue({
77559
+ archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
77560
+ writePromise: () => writeFileForSlpk(path2, JSON.stringify(node2), "3dNodeIndexDocument.json", true, this.converter.compressList)
77561
+ }, true);
77562
+ } else {
77563
+ await this.converter.writeQueue.enqueue({ writePromise: () => writeFile3(path2, JSON.stringify(node2)) }, true);
77564
+ }
77565
+ }
77566
+ async load() {
77567
+ if (this.data) {
77568
+ return this.data;
77569
+ }
77570
+ const path2 = this.id;
77571
+ const parentNodePath = (0, import_path7.join)(this.converter.layers0Path, "nodes", path2);
77572
+ let parentNodeFileName = "index.json";
77573
+ if (this.converter.options.slpk) {
77574
+ parentNodeFileName = "3dNodeIndexDocument.json";
77575
+ }
77576
+ return await openJson(parentNodePath, parentNodeFileName);
77577
+ }
77578
+ flush() {
77579
+ this.data = null;
77580
+ }
77581
+ static async createRootNode(boundingVolumes, converter) {
77582
+ const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);
77583
+ const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);
77584
+ return rootNode;
77585
+ }
77586
+ static async createNode(parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter) {
77587
+ const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
77588
+ const node2 = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
77589
+ return node2;
77590
+ }
77591
+ static createRootNodeIndexDocument(boundingVolumes) {
77592
+ const root0data = {
77593
+ version: `{${v4().toUpperCase()}}`,
77594
+ id: "root",
77595
+ level: 0,
77596
+ lodSelection: [
77597
+ {
77598
+ metricType: "maxScreenThresholdSQ",
77599
+ maxError: 0
77600
+ },
77601
+ {
77602
+ metricType: "maxScreenThreshold",
77603
+ maxError: 0
77604
+ }
77605
+ ],
77606
+ ...boundingVolumes,
77607
+ children: []
77608
+ };
77609
+ return (0, import_json_map_transform7.default)(root0data, NODE());
77610
+ }
77611
+ static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
77612
+ const { texture, attributes } = resources;
77613
+ const nodeId = nodeInPage.index;
77614
+ const parentNodeData = await parentNode.load();
77615
+ const nodeData = {
77616
+ version: parentNodeData.version,
77617
+ id: nodeId.toString(),
77618
+ level: parentNodeData.level + 1,
77619
+ ...boundingVolumes,
77620
+ lodSelection,
77621
+ parentNode: {
77622
+ id: parentNode.id,
77623
+ href: `../${parentNode.id}`,
77624
+ mbs: parentNodeData.mbs,
77625
+ obb: parentNodeData.obb
77626
+ },
77627
+ children: [],
77628
+ neighbors: []
77629
+ };
77630
+ const node2 = (0, import_json_map_transform7.default)(nodeData, NODE());
77631
+ if (nodeInPage.mesh) {
77632
+ node2.geometryData = [{ href: "./geometries/0" }];
77633
+ node2.sharedResource = { href: "./shared" };
77634
+ if (texture) {
77635
+ node2.textureData = [{ href: "./textures/0" }, { href: "./textures/1" }];
77636
+ }
77637
+ if (attributes && attributes.length && parentNode.converter.layers0?.attributeStorageInfo?.length) {
77638
+ node2.attributeData = [];
77639
+ for (let index = 0; index < attributes.length; index++) {
77640
+ const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
77641
+ node2.attributeData.push({ href: `./attributes/${folderName}/0` });
77642
+ }
77643
+ }
77644
+ }
77645
+ return node2;
77646
+ }
77647
+ };
77648
+
77252
77649
  // src/i3s-converter/i3s-converter.ts
77253
77650
  var ION_DEFAULT_TOKEN = import_process2.default.env?.IonToken || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";
77254
77651
  var HARDCODED_NODES_PER_PAGE = 64;
@@ -77266,11 +77663,14 @@ var I3SConverter = class {
77266
77663
  this.Loader = Tiles3DLoader;
77267
77664
  this.workerSource = {};
77268
77665
  this.writeQueue = new WriteQueue();
77269
- this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE);
77666
+ this.compressList = null;
77667
+ this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE, this);
77270
77668
  this.options = {};
77271
77669
  this.layers0Path = "";
77272
77670
  this.materialMap = new Map();
77273
77671
  this.materialDefinitions = [];
77672
+ this.geometryMap = new Map();
77673
+ this.geometryConfigs = [];
77274
77674
  this.vertexCounter = 0;
77275
77675
  this.layers0 = null;
77276
77676
  this.featuresHashArray = [];
@@ -77282,6 +77682,7 @@ var I3SConverter = class {
77282
77682
  this.generateTextures = false;
77283
77683
  this.generateBoundingVolumes = false;
77284
77684
  this.layersHasTexture = false;
77685
+ this.compressList = null;
77285
77686
  }
77286
77687
  async convert(options) {
77287
77688
  if (isBrowser) {
@@ -77296,14 +77697,27 @@ var I3SConverter = class {
77296
77697
  inputUrl,
77297
77698
  validate: validate2,
77298
77699
  outputPath,
77299
- draco,
77700
+ draco = true,
77300
77701
  sevenZipExe,
77301
77702
  maxDepth,
77302
77703
  token,
77303
77704
  generateTextures,
77304
- generateBoundingVolumes
77705
+ generateBoundingVolumes,
77706
+ instantNodeWriting = false,
77707
+ mergeMaterials: mergeMaterials2 = true
77305
77708
  } = options;
77306
- this.options = { maxDepth, slpk, sevenZipExe, egmFilePath, draco, token, inputUrl };
77709
+ this.options = {
77710
+ maxDepth,
77711
+ slpk,
77712
+ sevenZipExe,
77713
+ egmFilePath,
77714
+ draco,
77715
+ token,
77716
+ inputUrl,
77717
+ instantNodeWriting,
77718
+ mergeMaterials: mergeMaterials2
77719
+ };
77720
+ this.compressList = this.options.instantNodeWriting && [] || null;
77307
77721
  this.validate = Boolean(validate2);
77308
77722
  this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;
77309
77723
  this.generateTextures = Boolean(generateTextures);
@@ -77348,34 +77762,39 @@ var I3SConverter = class {
77348
77762
  }
77349
77763
  }
77350
77764
  async _createAndSaveTileset(outputPath, tilesetName, boundingVolumeRegion) {
77351
- const tilesetPath = (0, import_path7.join)(`${outputPath}`, `${tilesetName}`);
77765
+ const tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
77352
77766
  try {
77353
77767
  await removeDir(tilesetPath);
77354
77768
  } catch (e) {
77355
77769
  }
77356
- this.layers0Path = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
77770
+ this.layers0Path = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
77357
77771
  this._formLayers0(tilesetName, boundingVolumeRegion);
77358
77772
  this.materialDefinitions = [];
77359
77773
  this.materialMap = new Map();
77360
77774
  const sourceRootTile = this.sourceTileset.root;
77361
77775
  const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);
77362
- const parentId = this.nodePages.push({
77776
+ await this.nodePages.push({
77363
77777
  index: 0,
77364
77778
  lodThreshold: 0,
77365
77779
  obb: boundingVolumes.obb,
77366
77780
  children: []
77367
77781
  });
77368
- const isCreateSlpk = this.options.slpk;
77369
- const root0 = this._formRootNodeIndexDocument(boundingVolumes);
77370
- await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
77782
+ const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
77783
+ await this._convertNodesTree(rootNode, sourceRootTile);
77371
77784
  this.layers0.materialDefinitions = this.materialDefinitions;
77785
+ this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(this.geometryConfigs.map((config) => ({
77786
+ geometryConfig: { ...config, draco: this.options.draco }
77787
+ })), GEOMETRY_DEFINITION());
77372
77788
  if (this.layersHasTexture === false) {
77373
77789
  this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter((attribute) => attribute !== "uv0");
77374
77790
  }
77375
77791
  await this._writeLayers0();
77376
77792
  createSceneServerPath(tilesetName, this.layers0, tilesetPath);
77377
- await this._writeNodeIndexDocument(root0, "root", (0, import_path7.join)(this.layers0Path, "nodes", "root"));
77378
- await this.nodePages.save(this.layers0Path, this.writeQueue, isCreateSlpk);
77793
+ for (const filePath of this.compressList || []) {
77794
+ await compressFileWithGzip(filePath);
77795
+ await removeFile(filePath);
77796
+ }
77797
+ await this.nodePages.save();
77379
77798
  await this.writeQueue.finalize();
77380
77799
  await this._createSlpk(tilesetPath);
77381
77800
  }
@@ -77401,82 +77820,41 @@ var I3SConverter = class {
77401
77820
  compressGeometry: this.options.draco,
77402
77821
  fullExtent
77403
77822
  };
77404
- this.layers0 = (0, import_json_map_transform6.default)(layers0data, LAYERS());
77405
- }
77406
- _formRootNodeIndexDocument(boundingVolumes) {
77407
- const root0data = {
77408
- version: `{${v4().toUpperCase()}}`,
77409
- id: "root",
77410
- level: 0,
77411
- lodSelection: [
77412
- {
77413
- metricType: "maxScreenThresholdSQ",
77414
- maxError: 0
77415
- },
77416
- {
77417
- metricType: "maxScreenThreshold",
77418
- maxError: 0
77419
- }
77420
- ],
77421
- ...boundingVolumes,
77422
- children: []
77423
- };
77424
- return (0, import_json_map_transform6.default)(root0data, NODE());
77823
+ this.layers0 = (0, import_json_map_transform8.default)(layers0data, LAYERS());
77425
77824
  }
77426
- async _convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes) {
77825
+ async _convertNodesTree(rootNode, sourceRootTile) {
77427
77826
  await this.sourceTileset._loadTile(sourceRootTile);
77428
77827
  if (this.isContentSupported(sourceRootTile)) {
77429
- root0.children = root0.children || [];
77430
- root0.children.push({
77431
- id: "1",
77432
- href: "./1",
77433
- ...boundingVolumes
77434
- });
77435
- const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);
77436
- const childPath = (0, import_path7.join)(this.layers0Path, "nodes", child.path);
77437
- if (this.options.slpk) {
77438
- await this.writeQueue.enqueue({
77439
- archiveKey: "nodes/1/3dNodeIndexDocument.json.gz",
77440
- writePromise: writeFileForSlpk(childPath, JSON.stringify(child), "3dNodeIndexDocument.json")
77441
- });
77442
- } else {
77443
- await this.writeQueue.enqueue({ writePromise: writeFile3(childPath, JSON.stringify(child)) });
77828
+ const childNodes = await this._createNode(rootNode, sourceRootTile, 0);
77829
+ for (const childNode of childNodes) {
77830
+ await childNode.save();
77444
77831
  }
77832
+ await rootNode.addChildren(childNodes);
77445
77833
  } else {
77446
77834
  await this._addChildrenWithNeighborsAndWriteFile({
77447
- parentNode: root0,
77835
+ parentNode: rootNode,
77448
77836
  sourceTiles: sourceRootTile.children,
77449
- parentId,
77450
77837
  level: 1
77451
77838
  });
77452
77839
  }
77453
77840
  await sourceRootTile.unloadContent();
77841
+ await rootNode.save();
77454
77842
  }
77455
77843
  async _writeLayers0() {
77456
77844
  if (this.options.slpk) {
77457
77845
  await this.writeQueue.enqueue({
77458
77846
  archiveKey: "3dSceneLayer.json.gz",
77459
- writePromise: writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
77847
+ writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
77460
77848
  });
77461
77849
  } else {
77462
77850
  await this.writeQueue.enqueue({
77463
- writePromise: writeFile3(this.layers0Path, JSON.stringify(this.layers0))
77851
+ writePromise: () => writeFile3(this.layers0Path, JSON.stringify(this.layers0))
77464
77852
  });
77465
77853
  }
77466
77854
  }
77467
- async _writeNodeIndexDocument(root0, nodePath, rootPath) {
77468
- if (this.options.slpk) {
77469
- await this.writeQueue.enqueue({
77470
- archiveKey: `nodes/${nodePath}/3dNodeIndexDocument.json.gz`,
77471
- writePromise: writeFileForSlpk(rootPath, JSON.stringify(root0), "3dNodeIndexDocument.json")
77472
- });
77473
- } else {
77474
- await this.writeQueue.enqueue({ writePromise: writeFile3(rootPath, JSON.stringify(root0)) });
77475
- }
77476
- }
77477
77855
  async _createSlpk(tilesetPath) {
77478
77856
  if (this.options.slpk) {
77479
- const slpkTilesetPath = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
77857
+ const slpkTilesetPath = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
77480
77858
  const slpkFileName = `${tilesetPath}.slpk`;
77481
77859
  await compressWithChildProcess(slpkTilesetPath, slpkFileName, 0, ".", this.options.sevenZipExe);
77482
77860
  try {
@@ -77486,87 +77864,47 @@ var I3SConverter = class {
77486
77864
  }
77487
77865
  }
77488
77866
  async _addChildrenWithNeighborsAndWriteFile(data) {
77489
- const childNodes = [];
77490
- await this._addChildren({ ...data, childNodes });
77491
- await this._addNeighborsAndWriteFile(data.parentNode, childNodes);
77867
+ await this._addChildren(data);
77868
+ await data.parentNode.addNeighbors();
77492
77869
  }
77493
77870
  async convertNestedTileset({
77494
- sourceTile,
77495
77871
  parentNode,
77496
- childNodes,
77497
- parentId,
77872
+ sourceTile,
77498
77873
  level
77499
77874
  }) {
77500
77875
  await this.sourceTileset._loadTile(sourceTile);
77501
77876
  await this._addChildren({
77502
77877
  parentNode,
77503
77878
  sourceTiles: sourceTile.children,
77504
- childNodes,
77505
- parentId,
77506
77879
  level: level + 1
77507
77880
  });
77508
77881
  await sourceTile.unloadContent();
77509
77882
  }
77510
77883
  async convertNode({
77511
- sourceTile,
77512
77884
  parentNode,
77513
- childNodes,
77514
- parentId,
77885
+ sourceTile,
77515
77886
  level
77516
77887
  }) {
77517
- const children = await this._createNode(parentNode, sourceTile, parentId, level);
77518
- parentNode.children = parentNode.children || [];
77519
- for (const child of children) {
77520
- parentNode.children.push({
77521
- id: child.id,
77522
- href: `../${child.path}`,
77523
- obb: child.obb,
77524
- mbs: child.mbs
77525
- });
77526
- childNodes.push(child);
77527
- }
77888
+ const childNodes = await this._createNode(parentNode, sourceTile, level);
77889
+ await parentNode.addChildren(childNodes);
77528
77890
  }
77529
77891
  async _addChildren(data) {
77530
- const { childNodes, sourceTiles, parentNode, parentId, level } = data;
77892
+ const { sourceTiles, parentNode, level } = data;
77531
77893
  if (this.options.maxDepth && level > this.options.maxDepth) {
77532
77894
  return;
77533
77895
  }
77534
- const promises = [];
77535
77896
  for (const sourceTile of sourceTiles) {
77536
77897
  if (sourceTile.type === "json") {
77537
- promises.push(this.convertNestedTileset({ sourceTile, parentNode, childNodes, parentId, level }));
77898
+ await this.convertNestedTileset({ parentNode, sourceTile, level });
77538
77899
  } else {
77539
- promises.push(this.convertNode({ sourceTile, parentNode, childNodes, parentId, level }));
77900
+ await this.convertNode({ parentNode, sourceTile, level });
77540
77901
  }
77541
- await Promise.all(promises);
77542
77902
  if (sourceTile.id) {
77543
77903
  console.log(sourceTile.id);
77544
77904
  }
77545
77905
  }
77546
77906
  }
77547
- async _addNeighborsAndWriteFile(parentNode, childNodes) {
77548
- for (const node2 of childNodes) {
77549
- const childPath = (0, import_path7.join)(this.layers0Path, "nodes", node2.path);
77550
- const nodePath = node2.path;
77551
- delete node2.path;
77552
- if (Number(parentNode?.children?.length) < 1e3) {
77553
- for (const neighbor of parentNode.children || []) {
77554
- if (node2.id === neighbor.id) {
77555
- continue;
77556
- }
77557
- if (node2.neighbors) {
77558
- node2.neighbors.push({ ...neighbor });
77559
- }
77560
- }
77561
- } else {
77562
- console.warn(`Node ${node2.id}: neighbors attribute is omited because of large number of neigbors`);
77563
- delete node2.neighbors;
77564
- }
77565
- await this._writeNodeIndexDocument(node2, nodePath, childPath);
77566
- node2.neighbors = [];
77567
- }
77568
- }
77569
- async _createNode(parentTile, sourceTile, parentId, level) {
77907
+ async _createNode(parentNode, sourceTile, level) {
77570
77908
  this._checkAddRefinementTypeForTile(sourceTile);
77571
77909
  await this._updateTilesetOptions();
77572
77910
  await this.sourceTileset._loadTile(sourceTile);
@@ -77575,13 +77913,15 @@ var I3SConverter = class {
77575
77913
  if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {
77576
77914
  this._convertPropertyTableToNodeAttributes(propertyTable);
77577
77915
  }
77578
- const resourcesData = await this._convertResources(sourceTile, parentId, propertyTable);
77916
+ const resourcesData = await this._convertResources(sourceTile, parentNode.inPageId, propertyTable);
77579
77917
  const nodes = [];
77918
+ const nodeIds = [];
77580
77919
  const nodesInPage = [];
77581
77920
  const emptyResources = {
77582
77921
  geometry: null,
77583
77922
  compressedGeometry: null,
77584
77923
  texture: null,
77924
+ hasUvRegions: false,
77585
77925
  sharedResources: null,
77586
77926
  meshMaterial: null,
77587
77927
  vertexCount: null,
@@ -77596,25 +77936,26 @@ var I3SConverter = class {
77596
77936
  }
77597
77937
  const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
77598
77938
  const maxScreenThresholdSQ = lodSelection.find((val) => val.metricType === "maxScreenThresholdSQ") || { maxError: 0 };
77599
- const nodeInPage = this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
77600
- const node2 = this._createNodeIndexDocument(parentTile, boundingVolumes, lodSelection, nodeInPage, resources);
77939
+ const nodeInPage = await this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentNode.inPageId, resources);
77940
+ const nodeData = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
77941
+ const node2 = await new NodeIndexDocument(nodeInPage.index, this).addData(nodeData);
77942
+ nodes.push(node2);
77601
77943
  if (nodeInPage.mesh) {
77602
- await this._writeResources(resources, node2.path);
77944
+ await this._writeResources(resources, node2.id);
77603
77945
  }
77604
77946
  if (this.validate) {
77605
- this.boundingVolumeWarnings = validateNodeBoundingVolumes(node2);
77947
+ this.boundingVolumeWarnings = validateNodeBoundingVolumes(nodeData);
77606
77948
  if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
77607
77949
  console.warn("Bounding Volume Warnings: ", ...this.boundingVolumeWarnings);
77608
77950
  }
77609
77951
  }
77610
- nodes.push(node2);
77952
+ nodeIds.push(nodeInPage.index);
77611
77953
  nodesInPage.push(nodeInPage);
77612
77954
  }
77613
77955
  sourceTile.unloadContent();
77614
77956
  await this._addChildrenWithNeighborsAndWriteFile({
77615
77957
  parentNode: nodes[0],
77616
77958
  sourceTiles: sourceTile.children,
77617
- parentId: nodesInPage[0].index,
77618
77959
  level: level + 1
77619
77960
  });
77620
77961
  return nodes;
@@ -77628,11 +77969,11 @@ var I3SConverter = class {
77628
77969
  halfSize: [],
77629
77970
  quaternion: []
77630
77971
  };
77631
- const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, () => this.nodePages.push({ index: 0, obb: draftObb }, parentId), propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
77972
+ const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
77632
77973
  return resourcesData;
77633
77974
  }
77634
- _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
77635
- const { meshMaterial, texture, vertexCount, featureCount, geometry } = resources;
77975
+ async _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
77976
+ const { meshMaterial, texture, vertexCount, featureCount, geometry, hasUvRegions } = resources;
77636
77977
  const nodeInPage = {
77637
77978
  index: 0,
77638
77979
  lodThreshold: maxScreenThresholdSQ.maxError,
@@ -77642,7 +77983,7 @@ var I3SConverter = class {
77642
77983
  if (geometry && this.isContentSupported(sourceTile)) {
77643
77984
  nodeInPage.mesh = {
77644
77985
  geometry: {
77645
- definition: texture ? 0 : 1,
77986
+ definition: this.findOrCreateGeometryDefinition(Boolean(texture), hasUvRegions),
77646
77987
  resource: 0
77647
77988
  },
77648
77989
  attribute: {
@@ -77654,64 +77995,29 @@ var I3SConverter = class {
77654
77995
  };
77655
77996
  }
77656
77997
  let nodeId = resources.nodeId;
77657
- if (nodeId) {
77658
- this.nodePages.updateAll(nodeId, nodeInPage);
77659
- const node2 = this.nodePages.getNodeById(nodeId);
77660
- this.nodePages.updateResourceInMesh(node2);
77998
+ let node2;
77999
+ if (!nodeId) {
78000
+ node2 = await this.nodePages.push(nodeInPage, parentId);
77661
78001
  } else {
77662
- nodeId = this.nodePages.push(nodeInPage, parentId);
78002
+ node2 = await this.nodePages.getNodeById(nodeId);
77663
78003
  }
78004
+ NodePages.updateAll(node2, nodeInPage);
77664
78005
  if (meshMaterial) {
77665
- this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
78006
+ NodePages.updateMaterialByNodeId(node2, this._findOrCreateMaterial(meshMaterial));
77666
78007
  }
77667
78008
  if (texture) {
77668
78009
  const texelCountHint = texture.image.height * texture.image.width;
77669
- this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);
78010
+ NodePages.updateTexelCountHintByNodeId(node2, texelCountHint);
77670
78011
  }
77671
78012
  if (vertexCount) {
77672
78013
  this.vertexCounter += vertexCount;
77673
- this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);
78014
+ NodePages.updateVertexCountByNodeId(node2, vertexCount);
77674
78015
  }
77675
- this.nodePages.updateNodeAttributeByNodeId(nodeId);
78016
+ NodePages.updateNodeAttributeByNodeId(node2);
77676
78017
  if (featureCount) {
77677
- this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);
77678
- }
77679
- return this.nodePages.getNodeById(nodeId);
77680
- }
77681
- _createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
77682
- const { texture, attributes } = resources;
77683
- const nodeId = nodeInPage.index;
77684
- const nodeData = {
77685
- version: parentNode.version,
77686
- id: nodeId.toString(),
77687
- path: nodeId.toString(),
77688
- level: parentNode.level + 1,
77689
- ...boundingVolumes,
77690
- lodSelection,
77691
- parentNode: {
77692
- id: parentNode.id,
77693
- href: `../${parentNode.id}`,
77694
- mbs: parentNode.mbs,
77695
- obb: parentNode.obb
77696
- },
77697
- children: [],
77698
- neighbors: []
77699
- };
77700
- const node2 = (0, import_json_map_transform6.default)(nodeData, NODE());
77701
- if (nodeInPage.mesh) {
77702
- node2.geometryData = [{ href: "./geometries/0" }];
77703
- node2.sharedResource = { href: "./shared" };
77704
- if (texture) {
77705
- node2.textureData = [{ href: "./textures/0" }, { href: "./textures/1" }];
77706
- }
77707
- if (attributes && attributes.length && this.layers0?.attributeStorageInfo?.length) {
77708
- node2.attributeData = [];
77709
- for (let index = 0; index < attributes.length; index++) {
77710
- const folderName = this.layers0.attributeStorageInfo[index].key;
77711
- node2.attributeData.push({ href: `./attributes/${folderName}/0` });
77712
- }
77713
- }
78018
+ NodePages.updateFeatureCountByNodeId(node2, featureCount);
77714
78019
  }
78020
+ this.nodePages.saveNode(node2);
77715
78021
  return node2;
77716
78022
  }
77717
78023
  async _writeResources(resources, nodePath) {
@@ -77722,8 +78028,8 @@ var I3SConverter = class {
77722
78028
  sharedResources,
77723
78029
  attributes
77724
78030
  } = resources;
77725
- const childPath = (0, import_path7.join)(this.layers0Path, "nodes", nodePath);
77726
- const slpkChildPath = (0, import_path7.join)("nodes", nodePath);
78031
+ const childPath = (0, import_path8.join)(this.layers0Path, "nodes", nodePath);
78032
+ const slpkChildPath = (0, import_path8.join)("nodes", nodePath);
77727
78033
  await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);
77728
78034
  await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);
77729
78035
  await this._writeTexture(texture, childPath, slpkChildPath);
@@ -77731,28 +78037,28 @@ var I3SConverter = class {
77731
78037
  }
77732
78038
  async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath) {
77733
78039
  if (this.options.slpk) {
77734
- const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
78040
+ const slpkGeometryPath = (0, import_path8.join)(childPath, "geometries");
77735
78041
  await this.writeQueue.enqueue({
77736
78042
  archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
77737
- writePromise: writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
78043
+ writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
77738
78044
  });
77739
78045
  } else {
77740
- const geometryPath = (0, import_path7.join)(childPath, "geometries/0/");
78046
+ const geometryPath = (0, import_path8.join)(childPath, "geometries/0/");
77741
78047
  await this.writeQueue.enqueue({
77742
- writePromise: writeFile3(geometryPath, geometryBuffer, "index.bin")
78048
+ writePromise: () => writeFile3(geometryPath, geometryBuffer, "index.bin")
77743
78049
  });
77744
78050
  }
77745
78051
  if (this.options.draco) {
77746
78052
  if (this.options.slpk) {
77747
- const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
78053
+ const slpkCompressedGeometryPath = (0, import_path8.join)(childPath, "geometries");
77748
78054
  await this.writeQueue.enqueue({
77749
78055
  archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
77750
- writePromise: writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
78056
+ writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
77751
78057
  });
77752
78058
  } else {
77753
- const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
78059
+ const compressedGeometryPath = (0, import_path8.join)(childPath, "geometries/1/");
77754
78060
  await this.writeQueue.enqueue({
77755
- writePromise: writeFile3(compressedGeometryPath, compressedGeometry, "index.bin")
78061
+ writePromise: () => writeFile3(compressedGeometryPath, compressedGeometry, "index.bin")
77756
78062
  });
77757
78063
  }
77758
78064
  }
@@ -77762,17 +78068,17 @@ var I3SConverter = class {
77762
78068
  return;
77763
78069
  }
77764
78070
  sharedResources.nodePath = nodePath;
77765
- const sharedData = (0, import_json_map_transform6.default)(sharedResources, SHARED_RESOURCES());
78071
+ const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
77766
78072
  const sharedDataStr = JSON.stringify(sharedData);
77767
78073
  if (this.options.slpk) {
77768
- const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
78074
+ const slpkSharedPath = (0, import_path8.join)(childPath, "shared");
77769
78075
  await this.writeQueue.enqueue({
77770
78076
  archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
77771
- writePromise: writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
78077
+ writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
77772
78078
  });
77773
78079
  } else {
77774
- const sharedPath = (0, import_path7.join)(childPath, "shared/");
77775
- await this.writeQueue.enqueue({ writePromise: writeFile3(sharedPath, sharedDataStr) });
78080
+ const sharedPath = (0, import_path8.join)(childPath, "shared/");
78081
+ await this.writeQueue.enqueue({ writePromise: () => writeFile3(sharedPath, sharedDataStr) });
77776
78082
  }
77777
78083
  }
77778
78084
  async _writeTexture(texture, childPath, slpkChildPath) {
@@ -77811,21 +78117,22 @@ var I3SConverter = class {
77811
78117
  }
77812
78118
  if (!this.layers0.textureSetDefinitions.length) {
77813
78119
  this.layers0.textureSetDefinitions.push({ formats: formats2 });
78120
+ this.layers0.textureSetDefinitions.push({ formats: formats2, atlas: true });
77814
78121
  }
77815
78122
  }
77816
78123
  }
77817
78124
  async writeTextureFile(textureData, name10, format, childPath, slpkChildPath) {
77818
78125
  if (this.options.slpk) {
77819
- const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
78126
+ const slpkTexturePath = (0, import_path8.join)(childPath, "textures");
77820
78127
  const compress = false;
77821
78128
  await this.writeQueue.enqueue({
77822
78129
  archiveKey: `${slpkChildPath}/textures/${name10}.${format}`,
77823
- writePromise: writeFileForSlpk(slpkTexturePath, textureData, `${name10}.${format}`, compress)
78130
+ writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name10}.${format}`, compress)
77824
78131
  });
77825
78132
  } else {
77826
- const texturePath = (0, import_path7.join)(childPath, `textures/${name10}/`);
78133
+ const texturePath = (0, import_path8.join)(childPath, `textures/${name10}/`);
77827
78134
  await this.writeQueue.enqueue({
77828
- writePromise: writeFile3(texturePath, textureData, `index.${format}`)
78135
+ writePromise: () => writeFile3(texturePath, textureData, `index.${format}`)
77829
78136
  });
77830
78137
  }
77831
78138
  }
@@ -77835,15 +78142,15 @@ var I3SConverter = class {
77835
78142
  const folderName = this.layers0.attributeStorageInfo[index].key;
77836
78143
  const fileBuffer = new Uint8Array(attributes[index]);
77837
78144
  if (this.options.slpk) {
77838
- const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
78145
+ const slpkAttributesPath = (0, import_path8.join)(childPath, "attributes", folderName);
77839
78146
  await this.writeQueue.enqueue({
77840
78147
  archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
77841
- writePromise: writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
78148
+ writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
77842
78149
  });
77843
78150
  } else {
77844
- const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
78151
+ const attributesPath = (0, import_path8.join)(childPath, `attributes/${folderName}/0`);
77845
78152
  await this.writeQueue.enqueue({
77846
- writePromise: writeFile3(attributesPath, fileBuffer, "index.bin")
78153
+ writePromise: () => writeFile3(attributesPath, fileBuffer, "index.bin")
77847
78154
  });
77848
78155
  }
77849
78156
  }
@@ -77864,12 +78171,22 @@ var I3SConverter = class {
77864
78171
  _findOrCreateMaterial(material) {
77865
78172
  const hash = (0, import_md52.default)(JSON.stringify(material));
77866
78173
  if (this.materialMap.has(hash)) {
77867
- return this.materialMap.get(hash);
78174
+ return this.materialMap.get(hash) || 0;
77868
78175
  }
77869
78176
  const newMaterialId = this.materialDefinitions.push(material) - 1;
77870
78177
  this.materialMap.set(hash, newMaterialId);
77871
78178
  return newMaterialId;
77872
78179
  }
78180
+ findOrCreateGeometryDefinition(hasTexture, hasUvRegions) {
78181
+ const geometryConfig = { hasTexture, hasUvRegions };
78182
+ const hash = (0, import_md52.default)(JSON.stringify(geometryConfig));
78183
+ if (this.geometryMap.has(hash)) {
78184
+ return this.geometryMap.get(hash) || 0;
78185
+ }
78186
+ const newGeometryId = this.geometryConfigs.push(geometryConfig) - 1;
78187
+ this.geometryMap.set(hash, newGeometryId);
78188
+ return newGeometryId;
78189
+ }
77873
78190
  _convertPropertyTableToNodeAttributes(propertyTable) {
77874
78191
  let attributeIndex = 0;
77875
78192
  const propertyTableWithObjectId = {
@@ -77965,12 +78282,12 @@ var I3SConverter = class {
77965
78282
  };
77966
78283
 
77967
78284
  // src/3d-tiles-converter/3d-tiles-converter.ts
77968
- var import_path8 = __toModule(require("path"));
78285
+ var import_path9 = __toModule(require("path"));
77969
78286
  var import_process3 = __toModule(require("process"));
77970
- var import_json_map_transform8 = __toModule(require_json_map_transform());
78287
+ var import_json_map_transform10 = __toModule(require_json_map_transform());
77971
78288
 
77972
78289
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
77973
- var import_core27 = __toModule(require_es54());
78290
+ var import_core28 = __toModule(require_es54());
77974
78291
  var import_geospatial11 = __toModule(require_es55());
77975
78292
 
77976
78293
  // ../i3s/src/types.ts
@@ -78035,7 +78352,7 @@ function getConstructorForDataFormat(dataType) {
78035
78352
  }
78036
78353
  var GL_TYPE_MAP = {
78037
78354
  UInt8: import_constants10.default.UNSIGNED_BYTE,
78038
- UInt16: import_constants10.default.UNSIGNED_INT,
78355
+ UInt16: import_constants10.default.UNSIGNED_SHORT,
78039
78356
  Float32: import_constants10.default.FLOAT,
78040
78357
  UInt32: import_constants10.default.UNSIGNED_INT,
78041
78358
  UInt64: import_constants10.default.DOUBLE
@@ -78130,12 +78447,12 @@ function parseStringsAttribute(arrayBuffer) {
78130
78447
  }
78131
78448
 
78132
78449
  // ../i3s/src/i3s-attribute-loader.ts
78133
- var VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78450
+ var VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78134
78451
  var I3SAttributeLoader = {
78135
78452
  name: "I3S Attribute",
78136
78453
  id: "i3s-attribute",
78137
78454
  module: "i3s",
78138
- version: VERSION12,
78455
+ version: VERSION13,
78139
78456
  mimeTypes: ["application/binary"],
78140
78457
  parse: parse6,
78141
78458
  extensions: ["bin"],
@@ -78216,7 +78533,7 @@ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attr
78216
78533
  }
78217
78534
 
78218
78535
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
78219
- var scratchVector6 = new import_core27.Vector3([0, 0, 0]);
78536
+ var scratchVector6 = new import_core28.Vector3([0, 0, 0]);
78220
78537
  function getLoaderForTextureFormat(textureFormat) {
78221
78538
  switch (textureFormat) {
78222
78539
  case "ktx-etc2":
@@ -78237,7 +78554,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
78237
78554
  indices: null,
78238
78555
  featureIds: [],
78239
78556
  vertexCount: 0,
78240
- modelMatrix: new import_core27.Matrix4(),
78557
+ modelMatrix: new import_core28.Matrix4(),
78241
78558
  coordinateSystem: 0,
78242
78559
  byteLength: 0,
78243
78560
  texture: null
@@ -78344,7 +78661,7 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
78344
78661
  normals: attributes.normal,
78345
78662
  colors: normalizeAttribute(attributes.color),
78346
78663
  texCoords: attributes.uv0,
78347
- uvRegions: normalizeAttribute(attributes.uvRegion)
78664
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
78348
78665
  };
78349
78666
  content.indices = indices || null;
78350
78667
  if (attributes.id && attributes.id.value) {
@@ -78462,9 +78779,9 @@ function parsePositions2(attribute, options) {
78462
78779
  const mbs = options.mbs;
78463
78780
  const value = attribute.value;
78464
78781
  const metadata = attribute.metadata;
78465
- const enuMatrix = new import_core27.Matrix4();
78466
- const cartographicOrigin = new import_core27.Vector3(mbs[0], mbs[1], mbs[2]);
78467
- const cartesianOrigin = new import_core27.Vector3();
78782
+ const enuMatrix = new import_core28.Matrix4();
78783
+ const cartographicOrigin = new import_core28.Vector3(mbs[0], mbs[1], mbs[2]);
78784
+ const cartesianOrigin = new import_core28.Vector3();
78468
78785
  import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
78469
78786
  import_geospatial11.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
78470
78787
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
@@ -78491,7 +78808,7 @@ function getModelMatrix(positions) {
78491
78808
  const metadata = positions.metadata;
78492
78809
  const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
78493
78810
  const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
78494
- const modelMatrix = new import_core27.Matrix4();
78811
+ const modelMatrix = new import_core28.Matrix4();
78495
78812
  modelMatrix[0] = scaleX;
78496
78813
  modelMatrix[5] = scaleY;
78497
78814
  return modelMatrix;
@@ -78591,13 +78908,13 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
78591
78908
  }
78592
78909
 
78593
78910
  // ../i3s/src/i3s-content-loader.ts
78594
- var VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
78911
+ var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
78595
78912
  var I3SContentLoader = {
78596
78913
  name: "I3S Content (Indexed Scene Layers)",
78597
78914
  id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
78598
78915
  module: "i3s",
78599
78916
  worker: true,
78600
- version: VERSION13,
78917
+ version: VERSION14,
78601
78918
  mimeTypes: ["application/octet-stream"],
78602
78919
  parse: parse7,
78603
78920
  extensions: ["bin"],
@@ -78620,7 +78937,7 @@ var import_culling7 = __toModule(require_es56());
78620
78937
  var import_geospatial12 = __toModule(require_es55());
78621
78938
 
78622
78939
  // ../i3s/src/i3s-node-page-loader.ts
78623
- var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78940
+ var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78624
78941
  async function parseNodePage(data) {
78625
78942
  return JSON.parse(new TextDecoder().decode(data));
78626
78943
  }
@@ -78628,7 +78945,7 @@ var I3SNodePageLoader = {
78628
78945
  name: "I3S Node Page",
78629
78946
  id: "i3s-node-page",
78630
78947
  module: "i3s",
78631
- version: VERSION14,
78948
+ version: VERSION15,
78632
78949
  mimeTypes: ["application/json"],
78633
78950
  parse: parse8,
78634
78951
  extensions: ["json"],
@@ -78884,15 +79201,16 @@ async function normalizeTilesetData(tileset, options, context) {
78884
79201
  }
78885
79202
 
78886
79203
  // ../i3s/src/i3s-loader.ts
78887
- var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79204
+ var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78888
79205
  var TILESET_REGEX = /layers\/[0-9]+$/;
78889
79206
  var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
78890
79207
  var SLPK_HEX = "504b0304";
79208
+ var POINT_CLOUD = "PointCloud";
78891
79209
  var I3SLoader = {
78892
79210
  name: "I3S (Indexed Scene Layers)",
78893
79211
  id: "i3s",
78894
79212
  module: "i3s",
78895
- version: VERSION15,
79213
+ version: VERSION16,
78896
79214
  mimeTypes: ["application/octet-stream"],
78897
79215
  parse: parseI3S,
78898
79216
  extensions: ["bin"],
@@ -78946,6 +79264,9 @@ async function parseTileContent(arrayBuffer, options) {
78946
79264
  }
78947
79265
  async function parseTileset2(data, options, context) {
78948
79266
  const tilesetJson = JSON.parse(new TextDecoder().decode(data));
79267
+ if (tilesetJson?.layerType === POINT_CLOUD) {
79268
+ throw new Error("Point Cloud layers currently are not supported by I3SLoader");
79269
+ }
78949
79270
  tilesetJson.loader = I3SLoader;
78950
79271
  await normalizeTilesetData(tilesetJson, options, context);
78951
79272
  return tilesetJson;
@@ -78962,7 +79283,7 @@ function getMagicNumber(data) {
78962
79283
  }
78963
79284
 
78964
79285
  // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
78965
- var import_core31 = __toModule(require_es54());
79286
+ var import_core32 = __toModule(require_es54());
78966
79287
  var import_geospatial13 = __toModule(require_es55());
78967
79288
  var import_culling8 = __toModule(require_es56());
78968
79289
  function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
@@ -78971,13 +79292,13 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
78971
79292
  i3SObb.center[1],
78972
79293
  i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
78973
79294
  ];
78974
- const cartesianCenter = import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core31.Vector3());
79295
+ const cartesianCenter = import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core32.Vector3());
78975
79296
  const tiles3DObb = new import_culling8.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
78976
79297
  return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
78977
79298
  }
78978
79299
 
78979
79300
  // src/3d-tiles-converter/json-templates/tileset.ts
78980
- var import_json_map_transform7 = __toModule(require_json_map_transform());
79301
+ var import_json_map_transform9 = __toModule(require_json_map_transform());
78981
79302
  var ASSET = () => ({
78982
79303
  version: {
78983
79304
  path: "version",
@@ -78996,13 +79317,13 @@ var TILE = () => ({
78996
79317
  },
78997
79318
  children: {
78998
79319
  path: "children",
78999
- transform: (val) => val.map((tile) => (0, import_json_map_transform7.default)(tile, TILE()))
79320
+ transform: (val) => val.map((tile) => (0, import_json_map_transform9.default)(tile, TILE()))
79000
79321
  }
79001
79322
  });
79002
79323
  var TILESET = () => ({
79003
79324
  asset: {
79004
79325
  path: "asset",
79005
- transform: (val) => (0, import_json_map_transform7.default)(val, ASSET())
79326
+ transform: (val) => (0, import_json_map_transform9.default)(val, ASSET())
79006
79327
  },
79007
79328
  geometricError: {
79008
79329
  path: "root",
@@ -79010,17 +79331,17 @@ var TILESET = () => ({
79010
79331
  },
79011
79332
  root: {
79012
79333
  path: "root",
79013
- transform: (val) => (0, import_json_map_transform7.default)(val, TILE())
79334
+ transform: (val) => (0, import_json_map_transform9.default)(val, TILE())
79014
79335
  }
79015
79336
  });
79016
79337
 
79017
79338
  // src/3d-tiles-attributes-worker.ts
79018
- var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79339
+ var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79019
79340
  var Tile3dAttributesWorker = {
79020
79341
  id: "3d-tiles-attributes",
79021
79342
  name: "3DTiles Attributes Worker",
79022
79343
  module: "tile-converter",
79023
- version: VERSION16,
79344
+ version: VERSION17,
79024
79345
  options: {
79025
79346
  featureAttributes: null
79026
79347
  }
@@ -79071,7 +79392,7 @@ var Tiles3DConverter = class {
79071
79392
  if (!rootNode.header.obb) {
79072
79393
  rootNode.header.obb = createObbFromMbs(rootNode.header.mbs);
79073
79394
  }
79074
- this.tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
79395
+ this.tilesetPath = (0, import_path9.join)(`${outputPath}`, `${tilesetName}`);
79075
79396
  this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
79076
79397
  try {
79077
79398
  await removeDir(this.tilesetPath);
@@ -79085,7 +79406,7 @@ var Tiles3DConverter = class {
79085
79406
  children: []
79086
79407
  };
79087
79408
  await this._addChildren(rootNode, rootTile, 1);
79088
- const tileset = (0, import_json_map_transform8.default)({ root: rootTile }, TILESET());
79409
+ const tileset = (0, import_json_map_transform10.default)({ root: rootTile }, TILESET());
79089
79410
  await writeFile3(this.tilesetPath, JSON.stringify(tileset), "tileset.json");
79090
79411
  this._finishConversion({ slpk: false, outputPath, tilesetName });
79091
79412
  const workerFarm = WorkerFarm.getWorkerFarm({});
@@ -79160,7 +79481,7 @@ var Tiles3DConverter = class {
79160
79481
  console.log(`Node conversion: ${nodeUrl}`);
79161
79482
  header = await load(nodeUrl, loader, options);
79162
79483
  }
79163
- return new TileHeader(this.sourceTileset, header, parentNode);
79484
+ return new Tile3D(this.sourceTileset, header, parentNode);
79164
79485
  }
79165
79486
  _relativeUrlToFullUrl(baseUrl, relativeUrl) {
79166
79487
  let resultArray = baseUrl.split("/");