@loaders.gl/tile-converter 3.3.0-alpha.8 → 3.3.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 (132) hide show
  1. package/dist/3d-tiles-attributes-worker.js +2 -2
  2. package/dist/3d-tiles-attributes-worker.js.map +3 -3
  3. package/dist/converter-cli.js +14 -2
  4. package/dist/converter.min.js +22 -22
  5. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  6. package/dist/deps-installer/deps-installer.js +8 -0
  7. package/dist/dist.min.js +1167 -848
  8. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  9. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
  10. package/dist/es5/converter-cli.js +14 -2
  11. package/dist/es5/converter-cli.js.map +1 -1
  12. package/dist/es5/deps-installer/deps-installer.js +13 -2
  13. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  14. package/dist/es5/i3s-attributes-worker.js +1 -1
  15. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  16. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  17. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +16 -7
  18. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  19. package/dist/es5/i3s-converter/helpers/geometry-converter.js +363 -113
  20. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  21. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +6 -11
  22. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  23. package/dist/es5/i3s-converter/helpers/node-index-document.js +517 -0
  24. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -0
  25. package/dist/es5/i3s-converter/helpers/node-pages.js +455 -173
  26. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  27. package/dist/es5/i3s-converter/i3s-converter.js +549 -618
  28. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  29. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js +107 -0
  30. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  31. package/dist/es5/i3s-converter/json-templates/layers.js +2 -93
  32. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  33. package/dist/es5/i3s-converter/json-templates/shared-resources.js +3 -3
  34. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  35. package/dist/es5/i3s-converter/types.js.map +1 -1
  36. package/dist/es5/lib/utils/file-utils.js +93 -9
  37. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  38. package/dist/es5/lib/utils/write-queue.js +38 -25
  39. package/dist/es5/lib/utils/write-queue.js.map +1 -1
  40. package/dist/es5/pgm-loader.js +1 -1
  41. package/dist/es5/pgm-loader.js.map +1 -1
  42. package/dist/es5/workers/i3s-attributes-worker.js +1 -1
  43. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
  44. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  45. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
  46. package/dist/esm/converter-cli.js +14 -2
  47. package/dist/esm/converter-cli.js.map +1 -1
  48. package/dist/esm/deps-installer/deps-installer.js +9 -1
  49. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  50. package/dist/esm/i3s-attributes-worker.js +1 -1
  51. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  52. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  53. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +16 -7
  54. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  55. package/dist/esm/i3s-converter/helpers/geometry-converter.js +150 -40
  56. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  57. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +6 -9
  58. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  59. package/dist/esm/i3s-converter/helpers/node-index-document.js +202 -0
  60. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -0
  61. package/dist/esm/i3s-converter/helpers/node-pages.js +162 -76
  62. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  63. package/dist/esm/i3s-converter/i3s-converter.js +115 -220
  64. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  65. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js +89 -0
  66. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -0
  67. package/dist/esm/i3s-converter/json-templates/layers.js +2 -85
  68. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
  69. package/dist/esm/i3s-converter/json-templates/shared-resources.js +3 -3
  70. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  71. package/dist/esm/i3s-converter/types.js.map +1 -1
  72. package/dist/esm/lib/utils/file-utils.js +44 -3
  73. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  74. package/dist/esm/lib/utils/write-queue.js +19 -10
  75. package/dist/esm/lib/utils/write-queue.js.map +1 -1
  76. package/dist/esm/pgm-loader.js +1 -1
  77. package/dist/esm/pgm-loader.js.map +1 -1
  78. package/dist/esm/workers/i3s-attributes-worker.js +1 -1
  79. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
  80. package/dist/i3s-attributes-worker.js +2 -2
  81. package/dist/i3s-attributes-worker.js.map +2 -2
  82. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +3 -3
  83. package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -3
  84. package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -1
  85. package/dist/i3s-converter/helpers/geometry-attributes.js +16 -10
  86. package/dist/i3s-converter/helpers/geometry-converter.d.ts +8 -4
  87. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  88. package/dist/i3s-converter/helpers/geometry-converter.js +200 -44
  89. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  90. package/dist/i3s-converter/helpers/gltf-attributes.js +2 -3
  91. package/dist/i3s-converter/helpers/node-index-document.d.ts +95 -0
  92. package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -0
  93. package/dist/i3s-converter/helpers/node-index-document.js +250 -0
  94. package/dist/i3s-converter/helpers/node-pages.d.ts +78 -43
  95. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  96. package/dist/i3s-converter/helpers/node-pages.js +194 -93
  97. package/dist/i3s-converter/i3s-converter.d.ts +33 -58
  98. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  99. package/dist/i3s-converter/i3s-converter.js +122 -233
  100. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts +7 -0
  101. package/dist/i3s-converter/json-templates/geometry-definitions.d.ts.map +1 -0
  102. package/dist/i3s-converter/json-templates/geometry-definitions.js +87 -0
  103. package/dist/i3s-converter/json-templates/layers.d.ts +1 -30
  104. package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -1
  105. package/dist/i3s-converter/json-templates/layers.js +2 -86
  106. package/dist/i3s-converter/json-templates/shared-resources.js +3 -3
  107. package/dist/i3s-converter/types.d.ts +28 -2
  108. package/dist/i3s-converter/types.d.ts.map +1 -1
  109. package/dist/lib/utils/file-utils.d.ts +17 -1
  110. package/dist/lib/utils/file-utils.d.ts.map +1 -1
  111. package/dist/lib/utils/file-utils.js +64 -7
  112. package/dist/lib/utils/write-queue.d.ts +18 -2
  113. package/dist/lib/utils/write-queue.d.ts.map +1 -1
  114. package/dist/lib/utils/write-queue.js +18 -12
  115. package/dist/workers/i3s-attributes-worker.js +1 -1
  116. package/package.json +25 -20
  117. package/src/converter-cli.ts +22 -2
  118. package/src/deps-installer/deps-installer.ts +9 -0
  119. package/src/i3s-converter/helpers/batch-ids-extensions.ts +3 -3
  120. package/src/i3s-converter/helpers/geometry-attributes.ts +16 -11
  121. package/src/i3s-converter/helpers/geometry-converter.ts +217 -48
  122. package/src/i3s-converter/helpers/gltf-attributes.ts +2 -3
  123. package/src/i3s-converter/helpers/node-index-document.ts +315 -0
  124. package/src/i3s-converter/helpers/node-pages.ts +215 -110
  125. package/src/i3s-converter/i3s-converter.ts +170 -312
  126. package/src/i3s-converter/json-templates/geometry-definitions.ts +83 -0
  127. package/src/i3s-converter/json-templates/layers.ts +2 -91
  128. package/src/i3s-converter/json-templates/shared-resources.ts +3 -3
  129. package/src/i3s-converter/types.ts +29 -2
  130. package/src/lib/utils/file-utils.ts +62 -7
  131. package/src/lib/utils/write-queue.ts +36 -15
  132. 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;
@@ -16345,7 +16345,7 @@ var require_graceful_fs = __commonJS({
16345
16345
  var polyfills = require_polyfills();
16346
16346
  var legacy = require_legacy_streams();
16347
16347
  var clone2 = require_clone();
16348
- var util2 = require("util");
16348
+ var util = require("util");
16349
16349
  var gracefulQueue;
16350
16350
  var previousSymbol;
16351
16351
  if (typeof Symbol === "function" && typeof Symbol.for === "function") {
@@ -16365,11 +16365,11 @@ var require_graceful_fs = __commonJS({
16365
16365
  });
16366
16366
  }
16367
16367
  var debug = noop;
16368
- if (util2.debuglog)
16369
- debug = util2.debuglog("gfs4");
16368
+ if (util.debuglog)
16369
+ debug = util.debuglog("gfs4");
16370
16370
  else if (/\bgfs4\b/i.test(process.env.NODE_DEBUG || ""))
16371
16371
  debug = function() {
16372
- var m = util2.format.apply(util2, arguments);
16372
+ var m = util.format.apply(util, arguments);
16373
16373
  m = "GFS4: " + m.split(/\n/).join("\nGFS4: ");
16374
16374
  console.error(m);
16375
16375
  };
@@ -16421,7 +16421,7 @@ var require_graceful_fs = __commonJS({
16421
16421
  polyfills(fs6);
16422
16422
  fs6.gracefulify = patch;
16423
16423
  fs6.createReadStream = createReadStream2;
16424
- fs6.createWriteStream = createWriteStream2;
16424
+ fs6.createWriteStream = createWriteStream3;
16425
16425
  var fs$readFile = fs6.readFile;
16426
16426
  fs6.readFile = readFile2;
16427
16427
  function readFile2(path2, options, cb) {
@@ -16623,7 +16623,7 @@ var require_graceful_fs = __commonJS({
16623
16623
  function createReadStream2(path2, options) {
16624
16624
  return new fs6.ReadStream(path2, options);
16625
16625
  }
16626
- function createWriteStream2(path2, options) {
16626
+ function createWriteStream3(path2, options) {
16627
16627
  return new fs6.WriteStream(path2, options);
16628
16628
  }
16629
16629
  var fs$open = fs6.open;
@@ -16922,14 +16922,14 @@ var require_inherits_browser = __commonJS({
16922
16922
  var require_inherits2 = __commonJS({
16923
16923
  "../../node_modules/inherits/inherits.js"(exports, module2) {
16924
16924
  try {
16925
- util2 = require("util");
16926
- if (typeof util2.inherits !== "function")
16925
+ util = require("util");
16926
+ if (typeof util.inherits !== "function")
16927
16927
  throw "";
16928
- module2.exports = util2.inherits;
16928
+ module2.exports = util.inherits;
16929
16929
  } catch (e) {
16930
16930
  module2.exports = require_inherits_browser();
16931
16931
  }
16932
- var util2;
16932
+ var util;
16933
16933
  }
16934
16934
  });
16935
16935
 
@@ -16943,7 +16943,7 @@ var require_BufferList = __commonJS({
16943
16943
  }
16944
16944
  }
16945
16945
  var Buffer2 = require_safe_buffer().Buffer;
16946
- var util2 = require("util");
16946
+ var util = require("util");
16947
16947
  function copyBuffer(src, target, offset) {
16948
16948
  src.copy(target, offset);
16949
16949
  }
@@ -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;
@@ -17012,9 +17012,9 @@ var require_BufferList = __commonJS({
17012
17012
  };
17013
17013
  return BufferList;
17014
17014
  }();
17015
- if (util2 && util2.inspect && util2.inspect.custom) {
17016
- module2.exports.prototype[util2.inspect.custom] = function() {
17017
- var obj = util2.inspect({ length: this.length });
17015
+ if (util && util.inspect && util.inspect.custom) {
17016
+ module2.exports.prototype[util.inspect.custom] = function() {
17017
+ var obj = util.inspect({ length: this.length });
17018
17018
  return this.constructor.name + " " + obj;
17019
17019
  };
17020
17020
  }
@@ -17105,8 +17105,8 @@ var require_stream_writable = __commonJS({
17105
17105
  var asyncWrite = !process.browser && ["v0.10", "v0.9."].indexOf(process.version.slice(0, 5)) > -1 ? setImmediate : pna.nextTick;
17106
17106
  var Duplex;
17107
17107
  Writable.WritableState = WritableState;
17108
- var util2 = Object.create(require_util());
17109
- util2.inherits = require_inherits2();
17108
+ var util = Object.create(require_util());
17109
+ util.inherits = require_inherits2();
17110
17110
  var internalUtil = {
17111
17111
  deprecate: require_node()
17112
17112
  };
@@ -17121,7 +17121,7 @@ var require_stream_writable = __commonJS({
17121
17121
  return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
17122
17122
  }
17123
17123
  var destroyImpl = require_destroy();
17124
- util2.inherits(Writable, Stream);
17124
+ util.inherits(Writable, Stream);
17125
17125
  function nop() {
17126
17126
  }
17127
17127
  function WritableState(options, stream) {
@@ -17570,11 +17570,11 @@ var require_stream_duplex = __commonJS({
17570
17570
  return keys2;
17571
17571
  };
17572
17572
  module2.exports = Duplex;
17573
- var util2 = Object.create(require_util());
17574
- util2.inherits = require_inherits2();
17573
+ var util = Object.create(require_util());
17574
+ util.inherits = require_inherits2();
17575
17575
  var Readable = require_stream_readable();
17576
17576
  var Writable = require_stream_writable();
17577
- util2.inherits(Duplex, Readable);
17577
+ util.inherits(Duplex, Readable);
17578
17578
  {
17579
17579
  keys = objectKeys(Writable.prototype);
17580
17580
  for (v = 0; v < keys.length; v++) {
@@ -17920,8 +17920,8 @@ var require_stream_readable = __commonJS({
17920
17920
  function _isUint8Array(obj) {
17921
17921
  return Buffer2.isBuffer(obj) || obj instanceof OurUint8Array;
17922
17922
  }
17923
- var util2 = Object.create(require_util());
17924
- util2.inherits = require_inherits2();
17923
+ var util = Object.create(require_util());
17924
+ util.inherits = require_inherits2();
17925
17925
  var debugUtil = require("util");
17926
17926
  var debug = void 0;
17927
17927
  if (debugUtil && debugUtil.debuglog) {
@@ -17933,7 +17933,7 @@ var require_stream_readable = __commonJS({
17933
17933
  var BufferList = require_BufferList();
17934
17934
  var destroyImpl = require_destroy();
17935
17935
  var StringDecoder;
17936
- util2.inherits(Readable, Stream);
17936
+ util.inherits(Readable, Stream);
17937
17937
  var kProxyEvents = ["error", "close", "destroy", "pause", "resume"];
17938
17938
  function prependListener(emitter, event, fn) {
17939
17939
  if (typeof emitter.prependListener === "function")
@@ -18658,9 +18658,9 @@ var require_stream_transform = __commonJS({
18658
18658
  "use strict";
18659
18659
  module2.exports = Transform;
18660
18660
  var Duplex = require_stream_duplex();
18661
- var util2 = Object.create(require_util());
18662
- util2.inherits = require_inherits2();
18663
- util2.inherits(Transform, Duplex);
18661
+ var util = Object.create(require_util());
18662
+ util.inherits = require_inherits2();
18663
+ util.inherits(Transform, Duplex);
18664
18664
  function afterTransform(er, data) {
18665
18665
  var ts = this._transformState;
18666
18666
  ts.transforming = false;
@@ -18765,9 +18765,9 @@ var require_stream_passthrough = __commonJS({
18765
18765
  "use strict";
18766
18766
  module2.exports = PassThrough;
18767
18767
  var Transform = require_stream_transform();
18768
- var util2 = Object.create(require_util());
18769
- util2.inherits = require_inherits2();
18770
- util2.inherits(PassThrough, Transform);
18768
+ var util = Object.create(require_util());
18769
+ util.inherits = require_inherits2();
18770
+ util.inherits(PassThrough, Transform);
18771
18771
  function PassThrough(options) {
18772
18772
  if (!(this instanceof PassThrough))
18773
18773
  return new PassThrough(options);
@@ -18814,14 +18814,14 @@ var require_passthrough = __commonJS({
18814
18814
  // ../../node_modules/lazystream/lib/lazystream.js
18815
18815
  var require_lazystream = __commonJS({
18816
18816
  "../../node_modules/lazystream/lib/lazystream.js"(exports, module2) {
18817
- var util2 = require("util");
18817
+ var util = require("util");
18818
18818
  var PassThrough = require_passthrough();
18819
18819
  module2.exports = {
18820
18820
  Readable,
18821
18821
  Writable
18822
18822
  };
18823
- util2.inherits(Readable, PassThrough);
18824
- util2.inherits(Writable, PassThrough);
18823
+ util.inherits(Readable, PassThrough);
18824
+ util.inherits(Writable, PassThrough);
18825
18825
  function beforeFirstCall(instance, method, callback) {
18826
18826
  instance[method] = function() {
18827
18827
  delete instance[method];
@@ -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;
@@ -21232,7 +21232,7 @@ var require_sync = __commonJS({
21232
21232
  var minimatch = require_minimatch2();
21233
21233
  var Minimatch = minimatch.Minimatch;
21234
21234
  var Glob = require_glob().Glob;
21235
- var util2 = require("util");
21235
+ var util = require("util");
21236
21236
  var path2 = require("path");
21237
21237
  var assert7 = require("assert");
21238
21238
  var isAbsolute2 = require_path_is_absolute();
@@ -21715,7 +21715,7 @@ var require_glob = __commonJS({
21715
21715
  var setopts = common.setopts;
21716
21716
  var ownProp = common.ownProp;
21717
21717
  var inflight = require_inflight();
21718
- var util2 = require("util");
21718
+ var util = require("util");
21719
21719
  var childrenIgnored = common.childrenIgnored;
21720
21720
  var isIgnored = common.isIgnored;
21721
21721
  var once = require_once();
@@ -22527,7 +22527,7 @@ var require_archiver_utils = __commonJS({
22527
22527
  // ../../node_modules/archiver/lib/error.js
22528
22528
  var require_error = __commonJS({
22529
22529
  "../../node_modules/archiver/lib/error.js"(exports, module2) {
22530
- var util2 = require("util");
22530
+ var util = require("util");
22531
22531
  var ERROR_CODES = {
22532
22532
  "ABORTED": "archive was aborted",
22533
22533
  "DIRECTORYDIRPATHREQUIRED": "diretory dirpath argument must be a non-empty string value",
@@ -22552,7 +22552,7 @@ var require_error = __commonJS({
22552
22552
  this.code = code;
22553
22553
  this.data = data;
22554
22554
  }
22555
- util2.inherits(ArchiverError, Error);
22555
+ util.inherits(ArchiverError, Error);
22556
22556
  exports = module2.exports = ArchiverError;
22557
22557
  }
22558
22558
  });
@@ -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;
@@ -25346,7 +25346,7 @@ var require_core = __commonJS({
25346
25346
  var glob = require_readdir_glob();
25347
25347
  var async = require_async();
25348
25348
  var path2 = require("path");
25349
- var util2 = require_archiver_utils();
25349
+ var util = require_archiver_utils();
25350
25350
  var inherits = require("util").inherits;
25351
25351
  var ArchiverError = require_error();
25352
25352
  var Transform = require_readable2().Transform;
@@ -25359,7 +25359,7 @@ var require_core = __commonJS({
25359
25359
  options = format;
25360
25360
  format = "zip";
25361
25361
  }
25362
- options = this.options = util2.defaults(options, {
25362
+ options = this.options = util.defaults(options, {
25363
25363
  highWaterMark: 1024 * 1024,
25364
25364
  statConcurrency: 4
25365
25365
  });
@@ -25496,7 +25496,7 @@ var require_core = __commonJS({
25496
25496
  this._state.modulePiped = false;
25497
25497
  };
25498
25498
  Archiver.prototype._normalizeEntryData = function(data, stats) {
25499
- data = util2.defaults(data, {
25499
+ data = util.defaults(data, {
25500
25500
  type: "file",
25501
25501
  name: null,
25502
25502
  date: null,
@@ -25514,7 +25514,7 @@ var require_core = __commonJS({
25514
25514
  data.name = data.prefix + "/" + data.name;
25515
25515
  data.prefix = null;
25516
25516
  }
25517
- data.name = util2.sanitizePath(data.name);
25517
+ data.name = util.sanitizePath(data.name);
25518
25518
  if (data.type !== "symlink" && data.name.slice(-1) === "/") {
25519
25519
  isDir = true;
25520
25520
  data.type = "directory";
@@ -25543,7 +25543,7 @@ var require_core = __commonJS({
25543
25543
  if (data.stats && data.date === null) {
25544
25544
  data.date = data.stats.mtime;
25545
25545
  } else {
25546
- data.date = util2.dateify(data.date);
25546
+ data.date = util.dateify(data.date);
25547
25547
  }
25548
25548
  return data;
25549
25549
  };
@@ -25612,11 +25612,11 @@ var require_core = __commonJS({
25612
25612
  if (stats.isFile()) {
25613
25613
  task.data.type = "file";
25614
25614
  task.data.sourceType = "stream";
25615
- task.source = util2.lazyReadStream(task.filepath);
25615
+ task.source = util.lazyReadStream(task.filepath);
25616
25616
  } else if (stats.isDirectory() && this._moduleSupports("directory")) {
25617
- task.data.name = util2.trailingSlashIt(task.data.name);
25617
+ task.data.name = util.trailingSlashIt(task.data.name);
25618
25618
  task.data.type = "directory";
25619
- task.data.sourcePath = util2.trailingSlashIt(task.filepath);
25619
+ task.data.sourcePath = util.trailingSlashIt(task.filepath);
25620
25620
  task.data.sourceType = "buffer";
25621
25621
  task.source = Buffer.concat([]);
25622
25622
  } else if (stats.isSymbolicLink() && this._moduleSupports("symlink")) {
@@ -25660,10 +25660,10 @@ var require_core = __commonJS({
25660
25660
  this.emit("error", new ArchiverError("DIRECTORYNOTSUPPORTED", { name: data.name }));
25661
25661
  return this;
25662
25662
  }
25663
- source = util2.normalizeInputSource(source);
25663
+ source = util.normalizeInputSource(source);
25664
25664
  if (Buffer.isBuffer(source)) {
25665
25665
  data.sourceType = "buffer";
25666
- } else if (util2.isStream(source)) {
25666
+ } else if (util.isStream(source)) {
25667
25667
  data.sourceType = "stream";
25668
25668
  } else {
25669
25669
  this.emit("error", new ArchiverError("INPUTSTEAMBUFFERREQUIRED", { name: data.name }));
@@ -25756,7 +25756,7 @@ var require_core = __commonJS({
25756
25756
  };
25757
25757
  Archiver.prototype.glob = function(pattern, options, data) {
25758
25758
  this._pending++;
25759
- options = util2.defaults(options, {
25759
+ options = util.defaults(options, {
25760
25760
  stat: true,
25761
25761
  pattern
25762
25762
  });
@@ -25893,8 +25893,8 @@ var require_archive_entry = __commonJS({
25893
25893
  // ../../node_modules/compress-commons/lib/archivers/zip/util.js
25894
25894
  var require_util2 = __commonJS({
25895
25895
  "../../node_modules/compress-commons/lib/archivers/zip/util.js"(exports, module2) {
25896
- var util2 = module2.exports = {};
25897
- util2.dateToDos = function(d, forceLocalTime) {
25896
+ var util = module2.exports = {};
25897
+ util.dateToDos = function(d, forceLocalTime) {
25898
25898
  forceLocalTime = forceLocalTime || false;
25899
25899
  var year = forceLocalTime ? d.getFullYear() : d.getUTCFullYear();
25900
25900
  if (year < 1980) {
@@ -25912,36 +25912,36 @@ var require_util2 = __commonJS({
25912
25912
  };
25913
25913
  return val.year - 1980 << 25 | val.month + 1 << 21 | val.date << 16 | val.hours << 11 | val.minutes << 5 | val.seconds / 2;
25914
25914
  };
25915
- util2.dosToDate = function(dos) {
25915
+ util.dosToDate = function(dos) {
25916
25916
  return new Date((dos >> 25 & 127) + 1980, (dos >> 21 & 15) - 1, dos >> 16 & 31, dos >> 11 & 31, dos >> 5 & 63, (dos & 31) << 1);
25917
25917
  };
25918
- util2.fromDosTime = function(buf) {
25919
- return util2.dosToDate(buf.readUInt32LE(0));
25918
+ util.fromDosTime = function(buf) {
25919
+ return util.dosToDate(buf.readUInt32LE(0));
25920
25920
  };
25921
- util2.getEightBytes = function(v) {
25921
+ util.getEightBytes = function(v) {
25922
25922
  var buf = Buffer.alloc(8);
25923
25923
  buf.writeUInt32LE(v % 4294967296, 0);
25924
25924
  buf.writeUInt32LE(v / 4294967296 | 0, 4);
25925
25925
  return buf;
25926
25926
  };
25927
- util2.getShortBytes = function(v) {
25927
+ util.getShortBytes = function(v) {
25928
25928
  var buf = Buffer.alloc(2);
25929
25929
  buf.writeUInt16LE((v & 65535) >>> 0, 0);
25930
25930
  return buf;
25931
25931
  };
25932
- util2.getShortBytesValue = function(buf, offset) {
25932
+ util.getShortBytesValue = function(buf, offset) {
25933
25933
  return buf.readUInt16LE(offset);
25934
25934
  };
25935
- util2.getLongBytes = function(v) {
25935
+ util.getLongBytes = function(v) {
25936
25936
  var buf = Buffer.alloc(4);
25937
25937
  buf.writeUInt32LE((v & 4294967295) >>> 0, 0);
25938
25938
  return buf;
25939
25939
  };
25940
- util2.getLongBytesValue = function(buf, offset) {
25940
+ util.getLongBytesValue = function(buf, offset) {
25941
25941
  return buf.readUInt32LE(offset);
25942
25942
  };
25943
- util2.toDosTime = function(d) {
25944
- return util2.getLongBytes(util2.dateToDos(d));
25943
+ util.toDosTime = function(d) {
25944
+ return util.getLongBytes(util.dateToDos(d));
25945
25945
  };
25946
25946
  }
25947
25947
  });
@@ -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;
@@ -28998,16 +28998,16 @@ var require_util3 = __commonJS({
28998
28998
  "../../node_modules/compress-commons/lib/util/index.js"(exports, module2) {
28999
28999
  var Stream = require("stream").Stream;
29000
29000
  var PassThrough = require_readable3().PassThrough;
29001
- var util2 = module2.exports = {};
29002
- util2.isStream = function(source) {
29001
+ var util = module2.exports = {};
29002
+ util.isStream = function(source) {
29003
29003
  return source instanceof Stream;
29004
29004
  };
29005
- util2.normalizeInputSource = function(source) {
29005
+ util.normalizeInputSource = function(source) {
29006
29006
  if (source === null) {
29007
29007
  return Buffer.alloc(0);
29008
29008
  } else if (typeof source === "string") {
29009
29009
  return Buffer.from(source);
29010
- } else if (util2.isStream(source) && !source._readableState) {
29010
+ } else if (util.isStream(source) && !source._readableState) {
29011
29011
  var normalized = new PassThrough();
29012
29012
  source.pipe(normalized);
29013
29013
  return normalized;
@@ -29023,7 +29023,7 @@ var require_archive_output_stream = __commonJS({
29023
29023
  var inherits = require("util").inherits;
29024
29024
  var Transform = require_readable3().Transform;
29025
29025
  var ArchiveEntry = require_archive_entry();
29026
- var util2 = require_util3();
29026
+ var util = require_util3();
29027
29027
  var ArchiveOutputStream = module2.exports = function(options) {
29028
29028
  if (!(this instanceof ArchiveOutputStream)) {
29029
29029
  return new ArchiveOutputStream(options);
@@ -29073,10 +29073,10 @@ var require_archive_output_stream = __commonJS({
29073
29073
  this._archive.processing = true;
29074
29074
  this._normalizeEntry(ae);
29075
29075
  this._entry = ae;
29076
- source = util2.normalizeInputSource(source);
29076
+ source = util.normalizeInputSource(source);
29077
29077
  if (Buffer.isBuffer(source)) {
29078
29078
  this._appendBuffer(ae, source, callback);
29079
- } else if (util2.isStream(source)) {
29079
+ } else if (util.isStream(source)) {
29080
29080
  this._appendStream(ae, source, callback);
29081
29081
  } else {
29082
29082
  this._archive.processing = false;
@@ -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;
@@ -32344,7 +32344,7 @@ var require_zip_archive_output_stream = __commonJS({
32344
32344
  var ZipArchiveEntry = require_zip_archive_entry();
32345
32345
  var GeneralPurposeBit = require_general_purpose_bit();
32346
32346
  var constants = require_constants3();
32347
- var util2 = require_util3();
32347
+ var util = require_util3();
32348
32348
  var zipUtil = require_util2();
32349
32349
  var ZipArchiveOutputStream = module2.exports = function(options) {
32350
32350
  if (!(this instanceof ZipArchiveOutputStream)) {
@@ -32639,7 +32639,7 @@ var require_zip_stream = __commonJS({
32639
32639
  var inherits = require("util").inherits;
32640
32640
  var ZipArchiveOutputStream = require_compress_commons().ZipArchiveOutputStream;
32641
32641
  var ZipArchiveEntry = require_compress_commons().ZipArchiveEntry;
32642
- var util2 = require_archiver_utils();
32642
+ var util = require_archiver_utils();
32643
32643
  var ZipStream = module2.exports = function(options) {
32644
32644
  if (!(this instanceof ZipStream)) {
32645
32645
  return new ZipStream(options);
@@ -32661,7 +32661,7 @@ var require_zip_stream = __commonJS({
32661
32661
  };
32662
32662
  inherits(ZipStream, ZipArchiveOutputStream);
32663
32663
  ZipStream.prototype._normalizeFileData = function(data) {
32664
- data = util2.defaults(data, {
32664
+ data = util.defaults(data, {
32665
32665
  type: "file",
32666
32666
  name: null,
32667
32667
  namePrependSlash: this.options.namePrependSlash,
@@ -32674,7 +32674,7 @@ var require_zip_stream = __commonJS({
32674
32674
  var isDir = data.type === "directory";
32675
32675
  var isSymlink = data.type === "symlink";
32676
32676
  if (data.name) {
32677
- data.name = util2.sanitizePath(data.name);
32677
+ data.name = util.sanitizePath(data.name);
32678
32678
  if (!isSymlink && data.name.slice(-1) === "/") {
32679
32679
  isDir = true;
32680
32680
  data.type = "directory";
@@ -32685,7 +32685,7 @@ var require_zip_stream = __commonJS({
32685
32685
  if (isDir || isSymlink) {
32686
32686
  data.store = true;
32687
32687
  }
32688
- data.date = util2.dateify(data.date);
32688
+ data.date = util.dateify(data.date);
32689
32689
  return data;
32690
32690
  };
32691
32691
  ZipStream.prototype.entry = function(source, data, callback) {
@@ -32740,12 +32740,12 @@ var require_zip_stream = __commonJS({
32740
32740
  var require_zip = __commonJS({
32741
32741
  "../../node_modules/archiver/lib/plugins/zip.js"(exports, module2) {
32742
32742
  var engine = require_zip_stream();
32743
- var util2 = require_archiver_utils();
32743
+ var util = require_archiver_utils();
32744
32744
  var Zip = function(options) {
32745
32745
  if (!(this instanceof Zip)) {
32746
32746
  return new Zip(options);
32747
32747
  }
32748
- options = this.options = util2.defaults(options, {
32748
+ options = this.options = util.defaults(options, {
32749
32749
  comment: "",
32750
32750
  forceUTC: false,
32751
32751
  namePrependSlash: false,
@@ -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;
@@ -38877,7 +38877,7 @@ var require_readable6 = __commonJS({
38877
38877
  // ../../node_modules/tar-stream/extract.js
38878
38878
  var require_extract = __commonJS({
38879
38879
  "../../node_modules/tar-stream/extract.js"(exports, module2) {
38880
- var util2 = require("util");
38880
+ var util = require("util");
38881
38881
  var bl = require_bl();
38882
38882
  var headers = require_headers();
38883
38883
  var Writable = require_readable6().Writable;
@@ -38908,7 +38908,7 @@ var require_extract = __commonJS({
38908
38908
  this.offset = offset;
38909
38909
  PassThrough.call(this, { autoDestroy: false });
38910
38910
  };
38911
- util2.inherits(Source, PassThrough);
38911
+ util.inherits(Source, PassThrough);
38912
38912
  Source.prototype.destroy = function(err) {
38913
38913
  this._parent.destroy(err);
38914
38914
  };
@@ -39045,7 +39045,7 @@ var require_extract = __commonJS({
39045
39045
  this._onheader = onheader;
39046
39046
  this._parse(512, onheader);
39047
39047
  };
39048
- util2.inherits(Extract, Writable);
39048
+ util.inherits(Extract, Writable);
39049
39049
  Extract.prototype.destroy = function(err) {
39050
39050
  if (this._destroyed)
39051
39051
  return;
@@ -39467,12 +39467,12 @@ var require_tar = __commonJS({
39467
39467
  "../../node_modules/archiver/lib/plugins/tar.js"(exports, module2) {
39468
39468
  var zlib = require("zlib");
39469
39469
  var engine = require_tar_stream();
39470
- var util2 = require_archiver_utils();
39470
+ var util = require_archiver_utils();
39471
39471
  var Tar = function(options) {
39472
39472
  if (!(this instanceof Tar)) {
39473
39473
  return new Tar(options);
39474
39474
  }
39475
- options = this.options = util2.defaults(options, {
39475
+ options = this.options = util.defaults(options, {
39476
39476
  gzip: false
39477
39477
  });
39478
39478
  if (typeof options.gzipOptions !== "object") {
@@ -39513,7 +39513,7 @@ var require_tar = __commonJS({
39513
39513
  });
39514
39514
  source.pipe(entry);
39515
39515
  } else if (data.sourceType === "stream") {
39516
- util2.collectStream(source, append);
39516
+ util.collectStream(source, append);
39517
39517
  }
39518
39518
  };
39519
39519
  Tar.prototype.finalize = function() {
@@ -39546,12 +39546,12 @@ var require_json = __commonJS({
39546
39546
  var inherits = require("util").inherits;
39547
39547
  var Transform = require_readable2().Transform;
39548
39548
  var crc32 = require_buffer_crc32();
39549
- var util2 = require_archiver_utils();
39549
+ var util = require_archiver_utils();
39550
39550
  var Json = function(options) {
39551
39551
  if (!(this instanceof Json)) {
39552
39552
  return new Json(options);
39553
39553
  }
39554
- options = this.options = util2.defaults(options, {});
39554
+ options = this.options = util.defaults(options, {});
39555
39555
  Transform.call(this, options);
39556
39556
  this.supports = {
39557
39557
  directory: true,
@@ -39583,7 +39583,7 @@ var require_json = __commonJS({
39583
39583
  if (data.sourceType === "buffer") {
39584
39584
  onend(null, source);
39585
39585
  } else if (data.sourceType === "stream") {
39586
- util2.collectStream(source, onend);
39586
+ util.collectStream(source, onend);
39587
39587
  }
39588
39588
  };
39589
39589
  Json.prototype.finalize = function() {
@@ -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
  }
@@ -64963,7 +64967,7 @@ var WorkerFarm = class {
64963
64967
  };
64964
64968
 
64965
64969
  // ../worker-utils/src/lib/worker-api/get-worker-url.ts
64966
- var NPM_TAG = "beta";
64970
+ var NPM_TAG = "latest";
64967
64971
  var VERSION2 = typeof VERSION !== "undefined" ? VERSION : NPM_TAG;
64968
64972
  function getWorkerName(worker) {
64969
64973
  const warning = worker.version !== VERSION2 ? ` (worker-utils@${VERSION2})` : "";
@@ -65085,7 +65089,7 @@ function requireFromString(code, filename2 = "", options) {
65085
65089
  }
65086
65090
 
65087
65091
  // ../worker-utils/src/lib/library-utils/library-utils.ts
65088
- var LATEST = "beta";
65092
+ var LATEST = "latest";
65089
65093
  var VERSION3 = typeof VERSION !== "undefined" ? VERSION : LATEST;
65090
65094
  var loadLibraryPromises = {};
65091
65095
  async function loadLibrary(libraryUrl, moduleName = null, options = {}) {
@@ -65366,68 +65370,7 @@ function parseJSON(string) {
65366
65370
  }
65367
65371
  }
65368
65372
 
65369
- // ../loader-utils/src/lib/node/buffer.ts
65370
- function toArrayBuffer(buffer) {
65371
- if (Buffer.isBuffer(buffer)) {
65372
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
65373
- return typedArray.slice().buffer;
65374
- }
65375
- return buffer;
65376
- }
65377
- function toBuffer(binaryData) {
65378
- if (ArrayBuffer.isView(binaryData)) {
65379
- binaryData = binaryData.buffer;
65380
- }
65381
- if (typeof Buffer !== "undefined" && binaryData instanceof ArrayBuffer) {
65382
- const buffer = new Buffer(binaryData.byteLength);
65383
- const view = new Uint8Array(binaryData);
65384
- for (let i = 0; i < buffer.length; ++i) {
65385
- buffer[i] = view[i];
65386
- }
65387
- return buffer;
65388
- }
65389
- return assert2(false);
65390
- }
65391
-
65392
- // ../loader-utils/src/lib/binary-utils/buffer-utils.ts
65393
- function isBuffer(value) {
65394
- return value && typeof value === "object" && value.isBuffer;
65395
- }
65396
- function toBuffer2(data) {
65397
- return toBuffer ? toBuffer(data) : data;
65398
- }
65399
- function bufferToArrayBuffer(buffer) {
65400
- if (isBuffer(buffer)) {
65401
- const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
65402
- return typedArray.slice().buffer;
65403
- }
65404
- return buffer;
65405
- }
65406
-
65407
65373
  // ../loader-utils/src/lib/binary-utils/array-buffer-utils.ts
65408
- function toArrayBuffer2(data) {
65409
- if (isBuffer(data)) {
65410
- return bufferToArrayBuffer(data);
65411
- }
65412
- if (data instanceof ArrayBuffer) {
65413
- return data;
65414
- }
65415
- if (ArrayBuffer.isView(data)) {
65416
- if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
65417
- return data.buffer;
65418
- }
65419
- return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
65420
- }
65421
- if (typeof data === "string") {
65422
- const text = data;
65423
- const uint8Array = new TextEncoder().encode(text);
65424
- return uint8Array.buffer;
65425
- }
65426
- if (data && typeof data === "object" && data._toArrayBuffer) {
65427
- return data._toArrayBuffer();
65428
- }
65429
- throw new Error("toArrayBuffer");
65430
- }
65431
65374
  function compareArrayBuffers(arrayBuffer1, arrayBuffer2, byteLength) {
65432
65375
  byteLength = byteLength || arrayBuffer1.byteLength;
65433
65376
  if (arrayBuffer1.byteLength < byteLength || arrayBuffer2.byteLength < byteLength) {
@@ -65617,6 +65560,85 @@ function resolvePath(filename2) {
65617
65560
  return filename2;
65618
65561
  }
65619
65562
 
65563
+ // ../loader-utils/src/json-loader.ts
65564
+ var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
65565
+ var JSONLoader = {
65566
+ name: "JSON",
65567
+ id: "json",
65568
+ module: "json",
65569
+ version: VERSION4,
65570
+ extensions: ["json", "geojson"],
65571
+ mimeTypes: ["application/json"],
65572
+ category: "json",
65573
+ text: true,
65574
+ parseTextSync,
65575
+ parse: async (arrayBuffer) => parseTextSync(new TextDecoder().decode(arrayBuffer)),
65576
+ options: {}
65577
+ };
65578
+ function parseTextSync(text) {
65579
+ return JSON.parse(text);
65580
+ }
65581
+
65582
+ // ../loader-utils/src/lib/node/buffer.ts
65583
+ function toArrayBuffer(buffer) {
65584
+ if (Buffer.isBuffer(buffer)) {
65585
+ const typedArray = new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.length);
65586
+ return typedArray.slice().buffer;
65587
+ }
65588
+ return buffer;
65589
+ }
65590
+ function toBuffer(binaryData) {
65591
+ if (Buffer.isBuffer(binaryData)) {
65592
+ return binaryData;
65593
+ }
65594
+ if (ArrayBuffer.isView(binaryData)) {
65595
+ binaryData = binaryData.buffer;
65596
+ }
65597
+ if (typeof Buffer !== "undefined" && binaryData instanceof ArrayBuffer) {
65598
+ return Buffer.from(binaryData);
65599
+ }
65600
+ throw new Error("toBuffer");
65601
+ }
65602
+
65603
+ // ../loader-utils/src/lib/binary-utils/memory-conversion-utils.ts
65604
+ function isBuffer(value) {
65605
+ return value && typeof value === "object" && value.isBuffer;
65606
+ }
65607
+ function toBuffer2(data) {
65608
+ return toBuffer ? toBuffer(data) : data;
65609
+ }
65610
+ function toArrayBuffer2(data) {
65611
+ if (isBuffer(data)) {
65612
+ return toArrayBuffer(data);
65613
+ }
65614
+ if (data instanceof ArrayBuffer) {
65615
+ return data;
65616
+ }
65617
+ if (ArrayBuffer.isView(data)) {
65618
+ if (data.byteOffset === 0 && data.byteLength === data.buffer.byteLength) {
65619
+ return data.buffer;
65620
+ }
65621
+ return data.buffer.slice(data.byteOffset, data.byteOffset + data.byteLength);
65622
+ }
65623
+ if (typeof data === "string") {
65624
+ const text = data;
65625
+ const uint8Array = new TextEncoder().encode(text);
65626
+ return uint8Array.buffer;
65627
+ }
65628
+ if (data && typeof data === "object" && data._toArrayBuffer) {
65629
+ return data._toArrayBuffer();
65630
+ }
65631
+ throw new Error("toArrayBuffer");
65632
+ }
65633
+
65634
+ // ../loader-utils/src/lib/node/promisify.ts
65635
+ function promisify2(fn) {
65636
+ return (arg1, arg2) => new Promise((resolve, reject) => fn(arg1, arg2, (error, callbackArgs) => error ? reject(error) : resolve(callbackArgs)));
65637
+ }
65638
+ function promisify3(fn) {
65639
+ return (arg1, arg2, arg3) => new Promise((resolve, reject) => fn(arg1, arg2, arg3, (error, callbackArgs) => error ? reject(error) : resolve(callbackArgs)));
65640
+ }
65641
+
65620
65642
  // ../loader-utils/src/lib/path-utils/path.ts
65621
65643
  var path_exports = {};
65622
65644
  __export(path_exports, {
@@ -65646,15 +65668,12 @@ function join(...parts) {
65646
65668
  return parts.join(separator);
65647
65669
  }
65648
65670
 
65649
- // ../loader-utils/src/lib/node/util.ts
65650
- var util = __toModule(require("util"));
65651
- var promisify2 = util.promisify;
65652
-
65653
65671
  // ../loader-utils/src/lib/node/fs.ts
65654
65672
  var fs_exports = {};
65655
65673
  __export(fs_exports, {
65656
65674
  _readToArrayBuffer: () => _readToArrayBuffer,
65657
65675
  close: () => close,
65676
+ createWriteStream: () => createWriteStream,
65658
65677
  fstat: () => fstat,
65659
65678
  isSupported: () => isSupported,
65660
65679
  open: () => open,
@@ -65677,18 +65696,20 @@ var open;
65677
65696
  var close;
65678
65697
  var read;
65679
65698
  var fstat;
65699
+ var createWriteStream;
65680
65700
  var isSupported = Boolean(import_fs.default);
65681
65701
  try {
65682
65702
  readdir = promisify2(import_fs.default.readdir);
65683
65703
  stat = promisify2(import_fs.default.stat);
65684
- readFile = promisify2(import_fs.default.readFile);
65704
+ readFile = import_fs.default.readFile;
65685
65705
  readFileSync = import_fs.default.readFileSync;
65686
- writeFile = promisify2(import_fs.default.writeFile);
65706
+ writeFile = promisify3(import_fs.default.writeFile);
65687
65707
  writeFileSync = import_fs.default.writeFileSync;
65688
- open = promisify2(import_fs.default.open);
65689
- close = promisify2(import_fs.default.close);
65690
- read = promisify2(import_fs.default.read);
65691
- fstat = promisify2(import_fs.default.fstat);
65708
+ open = import_fs.default.open;
65709
+ close = (fd) => new Promise((resolve, reject) => import_fs.default.close(fd, (err) => err ? reject(err) : resolve()));
65710
+ read = import_fs.default.read;
65711
+ fstat = import_fs.default.fstat;
65712
+ createWriteStream = import_fs.default.createWriteStream;
65692
65713
  isSupported = Boolean(import_fs.default);
65693
65714
  } catch {
65694
65715
  }
@@ -66957,10 +66978,10 @@ function defined2(x) {
66957
66978
  var scratchScale = new import_core4.Vector3();
66958
66979
  var scratchNorthWest = new import_core4.Vector3();
66959
66980
  var scratchSouthEast = new import_core4.Vector3();
66960
- function createBoundingVolume(boundingVolumeHeader, transform9, result) {
66981
+ function createBoundingVolume(boundingVolumeHeader, transform11, result) {
66961
66982
  assert2(boundingVolumeHeader, "3D Tile: boundingVolume must be defined");
66962
66983
  if (boundingVolumeHeader.box) {
66963
- return createBox(boundingVolumeHeader.box, transform9, result);
66984
+ return createBox(boundingVolumeHeader.box, transform11, result);
66964
66985
  }
66965
66986
  if (boundingVolumeHeader.region) {
66966
66987
  const [west, south, east, north, minHeight, maxHeight] = boundingVolumeHeader.region;
@@ -66971,13 +66992,13 @@ function createBoundingVolume(boundingVolumeHeader, transform9, result) {
66971
66992
  return createSphere([centerInCartesian[0], centerInCartesian[1], centerInCartesian[2], radius], new import_core4.Matrix4());
66972
66993
  }
66973
66994
  if (boundingVolumeHeader.sphere) {
66974
- return createSphere(boundingVolumeHeader.sphere, transform9, result);
66995
+ return createSphere(boundingVolumeHeader.sphere, transform11, result);
66975
66996
  }
66976
66997
  throw new Error("3D Tile: boundingVolume must contain a sphere, region, or box");
66977
66998
  }
66978
- function createBox(box, transform9, result) {
66999
+ function createBox(box, transform11, result) {
66979
67000
  const center = new import_core4.Vector3(box[0], box[1], box[2]);
66980
- transform9.transform(center, center);
67001
+ transform11.transform(center, center);
66981
67002
  let origin = [];
66982
67003
  if (box.length === 10) {
66983
67004
  const halfSize = box.slice(3, 6);
@@ -66996,9 +67017,9 @@ function createBox(box, transform9, result) {
66996
67017
  } else {
66997
67018
  origin = [...box.slice(3, 6), ...box.slice(6, 9), ...box.slice(9, 12)];
66998
67019
  }
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));
67020
+ const xAxis = transform11.transformAsVector(origin.slice(0, 3));
67021
+ const yAxis = transform11.transformAsVector(origin.slice(3, 6));
67022
+ const zAxis = transform11.transformAsVector(origin.slice(6, 9));
67002
67023
  const halfAxes = new import_core4.Matrix3([
67003
67024
  xAxis[0],
67004
67025
  xAxis[1],
@@ -67017,10 +67038,10 @@ function createBox(box, transform9, result) {
67017
67038
  }
67018
67039
  return new import_culling3.OrientedBoundingBox(center, halfAxes);
67019
67040
  }
67020
- function createSphere(sphere, transform9, result) {
67041
+ function createSphere(sphere, transform11, result) {
67021
67042
  const center = new import_core4.Vector3(sphere[0], sphere[1], sphere[2]);
67022
- transform9.transform(center, center);
67023
- const scale = transform9.getScale(scratchScale);
67043
+ transform11.transform(center, center);
67044
+ const scale = transform11.getScale(scratchScale);
67024
67045
  const uniformScale = Math.max(Math.max(scale[0], scale[1]), scale[2]);
67025
67046
  const radius = sphere[3] * uniformScale;
67026
67047
  if (defined2(result)) {
@@ -67209,7 +67230,7 @@ var ManagedArray = class {
67209
67230
  }
67210
67231
  };
67211
67232
 
67212
- // ../tiles/src/tileset/traversers/tileset-traverser.ts
67233
+ // ../tiles/src/tileset/tileset-traverser.ts
67213
67234
  var DEFAULT_PROPS4 = {
67214
67235
  loadSiblings: false,
67215
67236
  skipLevelOfDetail: false,
@@ -67438,7 +67459,7 @@ var scratchVector3 = new import_core7.Vector3();
67438
67459
  function defined3(x) {
67439
67460
  return x !== void 0 && x !== null;
67440
67461
  }
67441
- var TileHeader = class {
67462
+ var Tile3D = class {
67442
67463
  constructor(tileset, header, parentHeader, extendedId = "") {
67443
67464
  this.header = header;
67444
67465
  this.tileset = tileset;
@@ -67801,7 +67822,7 @@ var TileHeader = class {
67801
67822
  }
67802
67823
  };
67803
67824
 
67804
- // ../tiles/src/tileset/traversers/tileset-3d-traverser.ts
67825
+ // ../tiles/src/tileset/format-3d-tiles/tileset-3d-traverser.ts
67805
67826
  var Tileset3DTraverser = class extends TilesetTraverser {
67806
67827
  compareDistanceToCamera(a, b) {
67807
67828
  return b._distanceToCamera === 0 && a._distanceToCamera === 0 ? b._centerZDepth - a._centerZDepth : b._distanceToCamera - a._distanceToCamera;
@@ -67840,7 +67861,7 @@ var Tileset3DTraverser = class extends TilesetTraverser {
67840
67861
  }
67841
67862
  };
67842
67863
 
67843
- // ../tiles/src/tileset/traversers/i3s-pending-tiles-register.ts
67864
+ // ../tiles/src/tileset/format-i3s/i3s-pending-tiles-register.ts
67844
67865
  var I3SPendingTilesRegister = class {
67845
67866
  constructor() {
67846
67867
  this.frameNumberMap = new Map();
@@ -67865,7 +67886,7 @@ var I3SPendingTilesRegister = class {
67865
67886
  }
67866
67887
  };
67867
67888
 
67868
- // ../tiles/src/tileset/traversers/i3s-tile-manager.ts
67889
+ // ../tiles/src/tileset/format-i3s/i3s-tile-manager.ts
67869
67890
  var STATUS = {
67870
67891
  REQUESTED: "REQUESTED",
67871
67892
  COMPLETED: "COMPLETED",
@@ -67926,15 +67947,15 @@ var I3STileManager = class {
67926
67947
  }
67927
67948
  };
67928
67949
 
67929
- // ../tiles/src/tileset/traversers/i3s-tileset-traverser.ts
67950
+ // ../tiles/src/tileset/format-i3s/i3s-tileset-traverser.ts
67930
67951
  var I3STilesetTraverser = class extends TilesetTraverser {
67931
- traversalFinished(frameState) {
67932
- return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
67933
- }
67934
67952
  constructor(options) {
67935
67953
  super(options);
67936
67954
  this._tileManager = new I3STileManager();
67937
67955
  }
67956
+ traversalFinished(frameState) {
67957
+ return !this._tileManager.hasPendingTiles(frameState.viewport.id, this._frameNumber || 0);
67958
+ }
67938
67959
  shouldRefine(tile, frameState) {
67939
67960
  tile._lodJudge = getLodStatus(tile, frameState);
67940
67961
  return tile._lodJudge === "DIG";
@@ -67976,7 +67997,7 @@ var I3STilesetTraverser = class extends TilesetTraverser {
67976
67997
  return await load(nodeUrl, loader, options);
67977
67998
  }
67978
67999
  _onTileLoad(header, tile, extendedId) {
67979
- const childTile = new TileHeader(tile.tileset, header, tile, extendedId);
68000
+ const childTile = new Tile3D(tile.tileset, header, tile, extendedId);
67980
68001
  tile.children.push(childTile);
67981
68002
  const frameState = this._tileManager.find(childTile.id).frameState;
67982
68003
  this.updateTile(childTile, frameState);
@@ -68325,7 +68346,7 @@ var Tileset3D = class {
68325
68346
  this.stats.get(TILES_GPU_MEMORY, "memory");
68326
68347
  }
68327
68348
  _initializeTileHeaders(tilesetJson, parentTileHeader) {
68328
- const rootTile = new TileHeader(this, tilesetJson.root, parentTileHeader);
68349
+ const rootTile = new Tile3D(this, tilesetJson.root, parentTileHeader);
68329
68350
  if (parentTileHeader) {
68330
68351
  parentTileHeader.children.push(rootTile);
68331
68352
  rootTile.depth = parentTileHeader.depth + 1;
@@ -68338,7 +68359,7 @@ var Tileset3D = class {
68338
68359
  this.stats.get(TILES_TOTAL).incrementCount();
68339
68360
  const children = tile.header.children || [];
68340
68361
  for (const childHeader of children) {
68341
- const childTile = new TileHeader(this, childHeader, tile);
68362
+ const childTile = new Tile3D(this, childHeader, tile);
68342
68363
  tile.children.push(childTile);
68343
68364
  childTile.depth = tile.depth + 1;
68344
68365
  stack2.push(childTile);
@@ -68531,7 +68552,7 @@ function getQueryParamString(queryParams) {
68531
68552
  }
68532
68553
 
68533
68554
  // ../3d-tiles/src/lib/utils/version.ts
68534
- var VERSION4 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68555
+ var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68535
68556
 
68536
68557
  // ../3d-tiles/src/lib/constants.ts
68537
68558
  var TILE3D_TYPE = {
@@ -68559,7 +68580,7 @@ function getMagicString3(arrayBuffer, byteOffset = 0) {
68559
68580
  }
68560
68581
 
68561
68582
  // ../draco/src/lib/utils/version.ts
68562
- var VERSION5 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68583
+ var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
68563
68584
 
68564
68585
  // ../draco/src/draco-loader.ts
68565
68586
  var DEFAULT_DRACO_OPTIONS = {
@@ -68575,7 +68596,7 @@ var DracoLoader = {
68575
68596
  id: isBrowser2 ? "draco" : "draco-nodejs",
68576
68597
  module: "draco",
68577
68598
  shapes: ["mesh"],
68578
- version: VERSION5,
68599
+ version: VERSION6,
68579
68600
  worker: true,
68580
68601
  extensions: ["drc"],
68581
68602
  mimeTypes: ["application/octet-stream"],
@@ -69408,17 +69429,17 @@ var DracoParser = class {
69408
69429
  const attribute_type = dracoAttribute.attribute_type();
69409
69430
  const skip = quantizedAttributes.map((type) => this.decoder[type]).includes(attribute_type);
69410
69431
  if (skip) {
69411
- const transform9 = new this.draco.AttributeQuantizationTransform();
69432
+ const transform11 = new this.draco.AttributeQuantizationTransform();
69412
69433
  try {
69413
- if (transform9.InitFromAttribute(dracoAttribute)) {
69434
+ if (transform11.InitFromAttribute(dracoAttribute)) {
69414
69435
  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))
69436
+ quantization_bits: transform11.quantization_bits(),
69437
+ range: transform11.range(),
69438
+ min_values: new Float32Array([1, 2, 3]).map((i) => transform11.min_value(i))
69418
69439
  };
69419
69440
  }
69420
69441
  } finally {
69421
- this.draco.destroy(transform9);
69442
+ this.draco.destroy(transform11);
69422
69443
  }
69423
69444
  }
69424
69445
  return null;
@@ -69428,15 +69449,15 @@ var DracoParser = class {
69428
69449
  const attribute_type = dracoAttribute.attribute_type();
69429
69450
  const octahedron = octahedronAttributes.map((type) => this.decoder[type]).includes(attribute_type);
69430
69451
  if (octahedron) {
69431
- const transform9 = new this.draco.AttributeQuantizationTransform();
69452
+ const transform11 = new this.draco.AttributeQuantizationTransform();
69432
69453
  try {
69433
- if (transform9.InitFromAttribute(dracoAttribute)) {
69454
+ if (transform11.InitFromAttribute(dracoAttribute)) {
69434
69455
  return {
69435
- quantization_bits: transform9.quantization_bits()
69456
+ quantization_bits: transform11.quantization_bits()
69436
69457
  };
69437
69458
  }
69438
69459
  } finally {
69439
- this.draco.destroy(transform9);
69460
+ this.draco.destroy(transform11);
69440
69461
  }
69441
69462
  }
69442
69463
  return null;
@@ -69480,11 +69501,13 @@ function getUint32Array(dracoArray) {
69480
69501
  }
69481
69502
 
69482
69503
  // ../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`;
69504
+ var DRACO_DECODER_VERSION = "1.5.5";
69505
+ var DRACO_ENCODER_VERSION = "1.4.1";
69506
+ var STATIC_DECODER_URL = `https://www.gstatic.com/draco/versioned/decoders/${DRACO_DECODER_VERSION}`;
69507
+ var DRACO_JS_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.js`;
69508
+ var DRACO_WASM_WRAPPER_URL = `${STATIC_DECODER_URL}/draco_wasm_wrapper.js`;
69509
+ var DRACO_WASM_DECODER_URL = `${STATIC_DECODER_URL}/draco_decoder.wasm`;
69510
+ var DRACO_ENCODER_URL = `https://raw.githubusercontent.com/google/draco/${DRACO_ENCODER_VERSION}/javascript/draco_encoder.js`;
69488
69511
  var loadDecoderPromise;
69489
69512
  async function loadDracoDecoderModule(options) {
69490
69513
  const modules = options.modules || {};
@@ -69532,7 +69555,7 @@ var DracoWriterWorker = {
69532
69555
  id: isBrowser2 ? "draco-writer" : "draco-writer-nodejs",
69533
69556
  name: "Draco compressed geometry writer",
69534
69557
  module: "draco",
69535
- version: VERSION5,
69558
+ version: VERSION6,
69536
69559
  worker: true,
69537
69560
  options: {
69538
69561
  draco: {},
@@ -70667,15 +70690,15 @@ async function loadDraco(tile, dracoData, options, context) {
70667
70690
  }
70668
70691
 
70669
70692
  // ../gltf/src/lib/utils/version.ts
70670
- var VERSION6 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
70693
+ var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
70671
70694
 
70672
70695
  // ../textures/src/lib/utils/version.ts
70673
- var VERSION7 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70696
+ var VERSION8 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70674
70697
 
70675
70698
  // ../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`;
70699
+ var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
70700
+ var BASIS_CDN_ENCODER_WASM = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.wasm`;
70701
+ var BASIS_CDN_ENCODER_JS = `https://unpkg.com/@loaders.gl/textures@${VERSION9}/dist/libs/basis_encoder.js`;
70679
70702
  var loadBasisTranscoderPromise;
70680
70703
  async function loadBasisTrascoderModule(options) {
70681
70704
  const modules = options.modules || {};
@@ -71129,6 +71152,7 @@ function transcodeKTX2Image(ktx2File, levelIndex, options) {
71129
71152
  height,
71130
71153
  data: decodedData,
71131
71154
  compressed,
71155
+ levelSize: decodedSize,
71132
71156
  hasAlpha: alphaFlag,
71133
71157
  format
71134
71158
  };
@@ -71171,7 +71195,7 @@ var BasisWorkerLoader = {
71171
71195
  name: "Basis",
71172
71196
  id: isBrowser2 ? "basis" : "basis-nodejs",
71173
71197
  module: "textures",
71174
- version: VERSION7,
71198
+ version: VERSION8,
71175
71199
  worker: true,
71176
71200
  extensions: ["basis", "ktx2"],
71177
71201
  mimeTypes: ["application/octet-stream", "image/ktx2"],
@@ -71484,7 +71508,7 @@ var CompressedTextureWorkerLoader = {
71484
71508
  name: "Texture Containers",
71485
71509
  id: "compressed-texture",
71486
71510
  module: "textures",
71487
- version: VERSION7,
71511
+ version: VERSION8,
71488
71512
  worker: true,
71489
71513
  extensions: [
71490
71514
  "ktx",
@@ -71522,7 +71546,7 @@ var CompressedTextureLoader = {
71522
71546
  };
71523
71547
 
71524
71548
  // ../images/src/lib/utils/version.ts
71525
- var VERSION9 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
71549
+ var VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
71526
71550
 
71527
71551
  // ../images/src/lib/category-api/image-type.ts
71528
71552
  var { _parseImageNode } = globalThis;
@@ -71864,7 +71888,7 @@ var ImageLoader = {
71864
71888
  id: "image",
71865
71889
  module: "images",
71866
71890
  name: "Images",
71867
- version: VERSION9,
71891
+ version: VERSION10,
71868
71892
  mimeTypes: MIME_TYPES,
71869
71893
  extensions: EXTENSIONS,
71870
71894
  parse: parseImage,
@@ -71927,7 +71951,7 @@ var ImageWriter = {
71927
71951
  name: "Images",
71928
71952
  id: "image",
71929
71953
  module: "images",
71930
- version: VERSION9,
71954
+ version: VERSION10,
71931
71955
  extensions: ["jpeg"],
71932
71956
  options: {
71933
71957
  image: {
@@ -71978,7 +72002,7 @@ var KTX2BasisWriterWorker = {
71978
72002
  name: "Basis Universal Supercompressed GPU Texture",
71979
72003
  id: isBrowser ? "ktx2-basis-writer" : "ktx2-basis-writer-nodejs",
71980
72004
  module: "textures",
71981
- version: VERSION7,
72005
+ version: VERSION8,
71982
72006
  extensions: ["ktx2"],
71983
72007
  worker: true,
71984
72008
  options: {
@@ -74102,7 +74126,7 @@ var GLTFLoader = {
74102
74126
  name: "glTF",
74103
74127
  id: "gltf",
74104
74128
  module: "gltf",
74105
- version: VERSION6,
74129
+ version: VERSION7,
74106
74130
  extensions: ["gltf", "glb"],
74107
74131
  mimeTypes: ["model/gltf+json", "model/gltf-binary"],
74108
74132
  text: true,
@@ -74471,7 +74495,7 @@ var Tile3DSubtreeLoader = {
74471
74495
  id: "3d-tiles-subtree",
74472
74496
  name: "3D Tiles Subtree",
74473
74497
  module: "3d-tiles",
74474
- version: VERSION4,
74498
+ version: VERSION5,
74475
74499
  extensions: ["subtree"],
74476
74500
  mimeTypes: ["application/octet-stream"],
74477
74501
  tests: ["subtree"],
@@ -74796,7 +74820,7 @@ var Tiles3DLoader = {
74796
74820
  id: "3d-tiles",
74797
74821
  name: "3D Tiles",
74798
74822
  module: "3d-tiles",
74799
- version: VERSION4,
74823
+ version: VERSION5,
74800
74824
  extensions: ["cmpt", "pnts", "b3dm", "i3dm"],
74801
74825
  mimeTypes: ["application/octet-stream"],
74802
74826
  tests: ["cmpt", "pnts", "b3dm", "i3dm"],
@@ -74931,7 +74955,7 @@ var CesiumIonLoader = {
74931
74955
  };
74932
74956
 
74933
74957
  // src/i3s-converter/i3s-converter.ts
74934
- var import_path7 = __toModule(require("path"));
74958
+ var import_path8 = __toModule(require("path"));
74935
74959
 
74936
74960
  // node_modules/uuid/wrapper.mjs
74937
74961
  var import_dist = __toModule(require_dist());
@@ -74947,11 +74971,11 @@ var parse5 = import_dist.default.parse;
74947
74971
 
74948
74972
  // src/i3s-converter/i3s-converter.ts
74949
74973
  var import_process2 = __toModule(require("process"));
74950
- var import_json_map_transform6 = __toModule(require_json_map_transform());
74974
+ var import_json_map_transform8 = __toModule(require_json_map_transform());
74951
74975
  var import_md52 = __toModule(require_md52());
74952
74976
 
74953
74977
  // src/i3s-converter/helpers/node-pages.ts
74954
- var import_path2 = __toModule(require("path"));
74978
+ var import_path4 = __toModule(require("path"));
74955
74979
  var import_json_map_transform = __toModule(require_json_map_transform());
74956
74980
 
74957
74981
  // src/i3s-converter/json-templates/metadata.ts
@@ -74977,122 +75001,13 @@ var METADATA = () => ({
74977
75001
  }
74978
75002
  });
74979
75003
 
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
75004
  // src/lib/utils/file-utils.ts
75090
75005
  var import_fs3 = __toModule(require("fs"));
75091
- var import_path4 = __toModule(require("path"));
75006
+ var import_path3 = __toModule(require("path"));
75092
75007
 
75093
75008
  // src/lib/utils/compress-util.ts
75094
75009
  var import_zlib = __toModule(require("zlib"));
75095
- var import_path3 = __toModule(require("path"));
75010
+ var import_path2 = __toModule(require("path"));
75096
75011
  var import_fs2 = __toModule(require("fs"));
75097
75012
  var import_archiver = __toModule(require_archiver());
75098
75013
  var import_jszip = __toModule(require_lib4());
@@ -75134,7 +75049,7 @@ async function compressWithChildProcessUnix(inputFolder, outputFile, level = 0,
75134
75049
  wait: 0
75135
75050
  });
75136
75051
  }
75137
- async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, import_path3.join)(".", "*"), sevenZipExe) {
75052
+ async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, import_path2.join)(".", "*"), sevenZipExe) {
75138
75053
  if (inputFiles[0] === "@") {
75139
75054
  inputFiles = `*${inputFiles.substr(1)}`;
75140
75055
  }
@@ -75162,7 +75077,7 @@ async function writeFile3(path2, data, fileName = "index.json") {
75162
75077
  toWriteData = data;
75163
75078
  }
75164
75079
  await import_fs3.promises.mkdir(path2, { recursive: true });
75165
- const pathFile = (0, import_path4.join)(path2, fileName);
75080
+ const pathFile = (0, import_path3.join)(path2, fileName);
75166
75081
  try {
75167
75082
  await import_fs3.promises.writeFile(pathFile, toWriteData);
75168
75083
  } catch (err) {
@@ -75171,15 +75086,51 @@ async function writeFile3(path2, data, fileName = "index.json") {
75171
75086
  console.log(`${pathFile} saved.`);
75172
75087
  return pathFile;
75173
75088
  }
75174
- async function writeFileForSlpk(path2, data, fileName = "index.json", compress = true) {
75089
+ async function writeFileForSlpk(path2, data, fileName = "index.json", compress = true, compressList) {
75175
75090
  const pathFile = await writeFile3(path2, data, fileName);
75176
75091
  if (compress) {
75177
- const pathGzFile = await compressFileWithGzip(pathFile);
75178
- await removeFile(pathFile);
75179
- return pathGzFile;
75092
+ if (compressList) {
75093
+ if (!compressList.includes(pathFile)) {
75094
+ compressList.push(pathFile);
75095
+ return `${pathFile}.gz`;
75096
+ } else {
75097
+ return null;
75098
+ }
75099
+ } else {
75100
+ const pathGzFile = await compressFileWithGzip(pathFile);
75101
+ await removeFile(pathFile);
75102
+ return pathGzFile;
75103
+ }
75180
75104
  }
75181
75105
  return pathFile;
75182
75106
  }
75107
+ async function openJson(path2, fileName) {
75108
+ return new Promise((resolve, reject) => {
75109
+ let count = 0;
75110
+ console.log(`load ${path2}/${fileName}.`);
75111
+ const intervalId = setInterval(() => {
75112
+ const pathFile = (0, import_path3.join)(path2, fileName);
75113
+ load(pathFile, JSONLoader).then((result) => {
75114
+ clearInterval(intervalId);
75115
+ resolve(result);
75116
+ }).catch(() => {
75117
+ count++;
75118
+ if (count > 100) {
75119
+ clearInterval(intervalId);
75120
+ reject(new Error(`Cannon load ${path2}/${fileName}.`));
75121
+ }
75122
+ });
75123
+ }, 200);
75124
+ });
75125
+ }
75126
+ async function isFileExists(fileName) {
75127
+ try {
75128
+ await import_fs3.promises.stat(fileName);
75129
+ return true;
75130
+ } catch {
75131
+ return false;
75132
+ }
75133
+ }
75183
75134
  function removeDir(path2) {
75184
75135
  return import_fs3.promises.rmdir(path2, { recursive: true });
75185
75136
  }
@@ -75187,9 +75138,188 @@ function removeFile(path2) {
75187
75138
  return import_fs3.promises.unlink(path2);
75188
75139
  }
75189
75140
  function getAbsoluteFilePath(filePath) {
75190
- return (0, import_path4.isAbsolute)(filePath) ? filePath : (0, import_path4.join)(process.cwd(), filePath);
75141
+ return (0, import_path3.isAbsolute)(filePath) ? filePath : (0, import_path3.join)(process.cwd(), filePath);
75191
75142
  }
75192
75143
 
75144
+ // src/i3s-converter/helpers/node-pages.ts
75145
+ var NodePages = class {
75146
+ constructor(writeFileFunc, nodesPerPage, converter) {
75147
+ this.length = 0;
75148
+ this.nodesPerPage = nodesPerPage;
75149
+ this.nodesCounter = 0;
75150
+ this.nodePages = [{}];
75151
+ this.nodePages[0].nodes = [];
75152
+ this.writeFile = writeFileFunc;
75153
+ this.converter = converter;
75154
+ this.length = 0;
75155
+ }
75156
+ useWriteFunction(func) {
75157
+ this.writeFile = func;
75158
+ }
75159
+ getNodePageFileName(nodePageId) {
75160
+ let filePath;
75161
+ let fileName;
75162
+ if (this.converter.options.slpk) {
75163
+ filePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages");
75164
+ fileName = `${nodePageId.toString()}.json`;
75165
+ } else {
75166
+ filePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages", nodePageId.toString());
75167
+ fileName = "index.json";
75168
+ }
75169
+ return { filePath, fileName };
75170
+ }
75171
+ async loadNodePage(nodePageId) {
75172
+ const { filePath, fileName } = this.getNodePageFileName(nodePageId);
75173
+ const fullName = (0, import_path4.join)(filePath, fileName);
75174
+ if (await isFileExists(fullName)) {
75175
+ console.log(`load ${fullName}.`);
75176
+ return await openJson(filePath, fileName);
75177
+ } else {
75178
+ return { nodes: [] };
75179
+ }
75180
+ }
75181
+ getPageIndexByNodeId(id) {
75182
+ return Math.floor(id / this.nodesPerPage);
75183
+ }
75184
+ async getPageByNodeId(id) {
75185
+ const pageIndex = this.getPageIndexByNodeId(id);
75186
+ if (this.converter.options.instantNodeWriting) {
75187
+ return await this.loadNodePage(pageIndex);
75188
+ }
75189
+ return this.nodePages[pageIndex];
75190
+ }
75191
+ async getNodeById(id, nodePage) {
75192
+ const nodeIndex = id % this.nodesPerPage;
75193
+ nodePage = nodePage || await this.getPageByNodeId(id);
75194
+ return nodePage.nodes[nodeIndex];
75195
+ }
75196
+ async addChildRelation(parentId, childId) {
75197
+ if (parentId === null || parentId === void 0) {
75198
+ return;
75199
+ }
75200
+ const parentNode = await this.getNodeById(parentId);
75201
+ parentNode.children?.push(childId);
75202
+ await this.saveNode(parentNode);
75203
+ }
75204
+ async push(node2, parentId) {
75205
+ node2.index = this.nodesCounter++;
75206
+ if (!this.converter.options.instantNodeWriting) {
75207
+ let currentNodePage = this.nodePages[this.nodePages.length - 1];
75208
+ if (currentNodePage.nodes.length === this.nodesPerPage) {
75209
+ currentNodePage = { nodes: [] };
75210
+ this.nodePages.push(currentNodePage);
75211
+ }
75212
+ currentNodePage.nodes.push(node2);
75213
+ }
75214
+ await this.addChildRelation(parentId, node2.index);
75215
+ NodePages.updateResourceInMesh(node2);
75216
+ await this.saveNode(node2);
75217
+ return node2;
75218
+ }
75219
+ async saveNode(node2) {
75220
+ if (!this.converter.options.instantNodeWriting) {
75221
+ return;
75222
+ } else {
75223
+ const nodePageIndex = this.getPageIndexByNodeId(node2.index);
75224
+ const nodePage = await this.getPageByNodeId(node2.index);
75225
+ const { filePath, fileName } = this.getNodePageFileName(nodePageIndex);
75226
+ const nodeToUpdate = await this.getNodeById(node2.index, nodePage);
75227
+ if (nodeToUpdate) {
75228
+ NodePages.updateAll(nodeToUpdate, node2);
75229
+ } else {
75230
+ nodePage.nodes.push(node2);
75231
+ }
75232
+ const nodePageStr = JSON.stringify(nodePage);
75233
+ if (this.converter.options.slpk) {
75234
+ await this.converter.writeQueue.enqueue({
75235
+ archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
75236
+ writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
75237
+ }, true);
75238
+ } else {
75239
+ await this.converter.writeQueue.enqueue({
75240
+ writePromise: () => this.writeFile(filePath, nodePageStr)
75241
+ }, true);
75242
+ }
75243
+ }
75244
+ }
75245
+ async saveMetadata() {
75246
+ const metadata = (0, import_json_map_transform.default)({ nodeCount: this.nodesCounter }, METADATA());
75247
+ const compress = false;
75248
+ await this.converter.writeQueue.enqueue({
75249
+ archiveKey: "metadata.json",
75250
+ writePromise: () => this.writeFile(this.converter.layers0Path, JSON.stringify(metadata), "metadata.json", compress)
75251
+ });
75252
+ }
75253
+ async save() {
75254
+ if (this.converter.options.instantNodeWriting) {
75255
+ await this.saveMetadata();
75256
+ return;
75257
+ }
75258
+ if (this.converter.options.slpk) {
75259
+ for (const [index, nodePage] of this.nodePages.entries()) {
75260
+ const nodePageStr = JSON.stringify(nodePage);
75261
+ const slpkPath = (0, import_path4.join)(this.converter.layers0Path, "nodepages");
75262
+ await this.converter.writeQueue.enqueue({
75263
+ archiveKey: `nodePages/${index.toString()}.json.gz`,
75264
+ writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
75265
+ });
75266
+ }
75267
+ await this.saveMetadata();
75268
+ } else {
75269
+ for (const [index, nodePage] of this.nodePages.entries()) {
75270
+ const nodePageStr = JSON.stringify(nodePage);
75271
+ const nodePagePath = (0, import_path4.join)(this.converter.layers0Path, "nodepages", index.toString());
75272
+ await this.converter.writeQueue.enqueue({
75273
+ writePromise: () => this.writeFile(nodePagePath, nodePageStr)
75274
+ });
75275
+ }
75276
+ }
75277
+ }
75278
+ static updateResourceInMesh(node2) {
75279
+ if (node2.mesh && isFinite(node2.index)) {
75280
+ node2.mesh.geometry.resource = node2.index;
75281
+ }
75282
+ }
75283
+ static updateAll(node2, data) {
75284
+ Object.assign(node2, data, { index: node2.index });
75285
+ NodePages.updateResourceInMesh(node2);
75286
+ return node2;
75287
+ }
75288
+ static updateMaterialByNodeId(node2, materialId) {
75289
+ if (!node2.mesh) {
75290
+ return;
75291
+ }
75292
+ node2.mesh.material = {
75293
+ definition: materialId,
75294
+ resource: node2.index
75295
+ };
75296
+ }
75297
+ static updateVertexCountByNodeId(node2, vertexCount) {
75298
+ if (!node2.mesh) {
75299
+ return;
75300
+ }
75301
+ node2.mesh.geometry.vertexCount = vertexCount;
75302
+ }
75303
+ static updateNodeAttributeByNodeId(node2) {
75304
+ if (!node2.mesh || !node2.index) {
75305
+ return;
75306
+ }
75307
+ node2.mesh.attribute.resource = node2.index;
75308
+ }
75309
+ static updateFeatureCountByNodeId(node2, featureCount) {
75310
+ if (!node2.mesh) {
75311
+ return;
75312
+ }
75313
+ node2.mesh.geometry.featureCount = featureCount;
75314
+ }
75315
+ static updateTexelCountHintByNodeId(node2, texelCountHint) {
75316
+ if (!node2.mesh || !node2.mesh.material) {
75317
+ return;
75318
+ }
75319
+ node2.mesh.material.texelCountHint = texelCountHint;
75320
+ }
75321
+ };
75322
+
75193
75323
  // src/lib/utils/statistic-utills.ts
75194
75324
  var import_path5 = __toModule(require("path"));
75195
75325
  var import_fs4 = __toModule(require("fs"));
@@ -75249,7 +75379,7 @@ async function getTotalFilesSize(dirPath) {
75249
75379
  }
75250
75380
 
75251
75381
  // src/i3s-converter/helpers/geometry-converter.ts
75252
- var import_core21 = __toModule(require_es54());
75382
+ var import_core22 = __toModule(require_es54());
75253
75383
  var import_geospatial9 = __toModule(require_es55());
75254
75384
  var import_md5 = __toModule(require_md52());
75255
75385
 
@@ -75257,7 +75387,7 @@ var import_md5 = __toModule(require_md52());
75257
75387
  var VALUES_PER_VERTEX = 3;
75258
75388
  var POSITIONS_AND_NORMALS_PER_TRIANGLE = 9;
75259
75389
  function generateAttributes(attributes) {
75260
- const { positions, normals, texCoords, colors, featureIndices } = attributes;
75390
+ const { positions, normals, texCoords, colors, uvRegions, featureIndices } = attributes;
75261
75391
  const triangleCount = positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE;
75262
75392
  if (!featureIndices.length) {
75263
75393
  return {
@@ -75267,7 +75397,8 @@ function generateAttributes(attributes) {
75267
75397
  positions,
75268
75398
  normals,
75269
75399
  texCoords,
75270
- colors
75400
+ colors,
75401
+ uvRegions
75271
75402
  };
75272
75403
  }
75273
75404
  const data = calculateFaceRangesAndFeaturesCount(featureIndices);
@@ -75321,6 +75452,7 @@ function makeAttributeObjects(attributes) {
75321
75452
  positions,
75322
75453
  normals,
75323
75454
  colors,
75455
+ uvRegions,
75324
75456
  texCoords,
75325
75457
  faceRange = new Uint32Array(0)
75326
75458
  } = attributes;
@@ -75329,31 +75461,33 @@ function makeAttributeObjects(attributes) {
75329
75461
  let normalsList = new Float32Array(normals);
75330
75462
  let colorsList = new Uint8Array(colors);
75331
75463
  let texCoordsList = new Float32Array(texCoords);
75332
- let faceRangeIndex = 0;
75464
+ let uvRegionsList = new Uint16Array(uvRegions);
75333
75465
  for (let index = 0; index < featureIds.length; index++) {
75334
- const startIndex = faceRange[index + faceRangeIndex];
75335
- const endIndex = faceRange[index + faceRangeIndex + 1];
75466
+ const startIndex = faceRange[index * 2];
75467
+ const endIndex = faceRange[index * 2 + 1];
75336
75468
  const positionsCount = getSliceAttributeCount("positions", startIndex, endIndex);
75337
75469
  const normalsCount = getSliceAttributeCount("normals", startIndex, endIndex);
75338
75470
  const colorsCount = getSliceAttributeCount("colors", startIndex, endIndex);
75471
+ const uvRegionsCount = getSliceAttributeCount("uvRegions", startIndex, endIndex);
75339
75472
  const texCoordsCount = getSliceAttributeCount("texCoords", startIndex, endIndex);
75340
75473
  groupedData.push({
75341
75474
  featureId: featureIds[index],
75342
75475
  positions: positionsList.slice(0, positionsCount),
75343
75476
  normals: normalsList.slice(0, normalsCount),
75344
75477
  colors: colorsList.slice(0, colorsCount),
75478
+ uvRegions: uvRegionsList.slice(0, uvRegionsCount),
75345
75479
  texCoords: texCoordsList.slice(0, texCoordsCount)
75346
75480
  });
75347
75481
  positionsList = positionsList.slice(positionsCount);
75348
75482
  normalsList = normalsList.slice(normalsCount);
75349
75483
  colorsList = colorsList.slice(colorsCount);
75484
+ uvRegionsList = uvRegionsList.slice(uvRegionsCount);
75350
75485
  texCoordsList = texCoordsList.slice(texCoordsCount);
75351
- faceRangeIndex += 1;
75352
75486
  }
75353
75487
  return groupedData.sort((first, second) => first.featureId - second.featureId);
75354
75488
  }
75355
75489
  function getSliceAttributeCount(attributeName, startIndex, endIndex) {
75356
- const colorsPerVertex = 4;
75490
+ const itemsPerVertex4 = 4;
75357
75491
  const texCoordsPerVertex = 2;
75358
75492
  const trianglesCount = endIndex - startIndex + 1;
75359
75493
  const vertexCount = trianglesCount * 3;
@@ -75362,7 +75496,8 @@ function getSliceAttributeCount(attributeName, startIndex, endIndex) {
75362
75496
  case "normals":
75363
75497
  return trianglesCount * POSITIONS_AND_NORMALS_PER_TRIANGLE;
75364
75498
  case "colors":
75365
- return vertexCount * colorsPerVertex;
75499
+ case "uvRegions":
75500
+ return vertexCount * itemsPerVertex4;
75366
75501
  case "texCoords":
75367
75502
  return vertexCount * texCoordsPerVertex;
75368
75503
  default:
@@ -75391,6 +75526,7 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75391
75526
  let positions = new Float32Array(firstAttributeObject.positions);
75392
75527
  let normals = new Float32Array(firstAttributeObject.normals);
75393
75528
  let colors = new Uint8Array(firstAttributeObject.colors);
75529
+ let uvRegions = new Uint16Array(firstAttributeObject.uvRegions);
75394
75530
  let texCoords = new Float32Array(firstAttributeObject.texCoords);
75395
75531
  const range = [0];
75396
75532
  let objIndex = 0;
@@ -75401,6 +75537,7 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75401
75537
  positions = concatenateTypedArrays(positions, currentAttributesObject.positions);
75402
75538
  normals = concatenateTypedArrays(normals, currentAttributesObject.normals);
75403
75539
  colors = concatenateTypedArrays(colors, currentAttributesObject.colors);
75540
+ uvRegions = concatenateTypedArrays(uvRegions, currentAttributesObject.uvRegions);
75404
75541
  texCoords = concatenateTypedArrays(texCoords, currentAttributesObject.texCoords);
75405
75542
  const groupedObject = unifiedObjects[objIndex];
75406
75543
  range.push(groupedObject.positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1 + sum);
@@ -75410,11 +75547,11 @@ function groupAttributesAndRangesByFeatureId(unifiedObjects, featureCount) {
75410
75547
  }
75411
75548
  range.push(positions.length / POSITIONS_AND_NORMALS_PER_TRIANGLE - 1);
75412
75549
  const faceRange = new Uint32Array(range);
75413
- return { faceRange, featureIds, positions, normals, colors, texCoords, featureCount };
75550
+ return { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount };
75414
75551
  }
75415
75552
 
75416
75553
  // src/i3s-converter/helpers/coordinate-converter.ts
75417
- var import_core20 = __toModule(require_es54());
75554
+ var import_core21 = __toModule(require_es54());
75418
75555
  var import_geospatial8 = __toModule(require_es55());
75419
75556
  var import_culling5 = __toModule(require_es56());
75420
75557
  function createBoundingVolumes(tile, geoidHeightModel) {
@@ -75422,16 +75559,16 @@ function createBoundingVolumes(tile, geoidHeightModel) {
75422
75559
  let halfSize;
75423
75560
  let quaternion;
75424
75561
  const boundingVolume = tile.boundingVolume;
75425
- const cartographicCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core20.Vector3());
75562
+ const cartographicCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(boundingVolume.center, new import_core21.Vector3());
75426
75563
  cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
75427
75564
  if (boundingVolume instanceof import_culling5.OrientedBoundingBox) {
75428
75565
  halfSize = boundingVolume.halfSize;
75429
- radius = new import_core20.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
75566
+ radius = new import_core21.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
75430
75567
  quaternion = boundingVolume.quaternion;
75431
75568
  } else {
75432
75569
  radius = tile.boundingVolume.radius;
75433
75570
  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();
75571
+ quaternion = new import_core21.Quaternion().fromMatrix3(new import_core21.Matrix3([halfSize[0], 0, 0, 0, halfSize[1], 0, 0, 0, halfSize[2]])).normalize();
75435
75572
  }
75436
75573
  return {
75437
75574
  mbs: [cartographicCenter[0], cartographicCenter[1], cartographicCenter[2], radius],
@@ -75446,8 +75583,8 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
75446
75583
  const positionVectors = convertPositionsToVectors(cartesianPositions);
75447
75584
  const geometryObb = (0, import_culling5.makeOrientedBoundingBoxFromPoints)(positionVectors);
75448
75585
  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());
75586
+ let mbsCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core21.Vector3());
75587
+ let obbCenter = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core21.Vector3());
75451
75588
  mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
75452
75589
  obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
75453
75590
  return {
@@ -75462,7 +75599,7 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
75462
75599
  function convertPositionsToVectors(positions) {
75463
75600
  const result = [];
75464
75601
  for (let i = 0; i < positions.length; i += 3) {
75465
- const positionVector = new import_core20.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
75602
+ const positionVector = new import_core21.Vector3([positions[i], positions[i + 1], positions[i + 2]]);
75466
75603
  result.push(positionVector);
75467
75604
  }
75468
75605
  return result;
@@ -75476,8 +75613,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
75476
75613
  }
75477
75614
  const center = sphere.center;
75478
75615
  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());
75616
+ const vertexMax = import_geospatial8.Ellipsoid.WGS84.cartesianToCartographic(new import_core21.Vector3(center[0] + radius, center[1] + radius, center[2] + radius), new import_core21.Vector3());
75617
+ 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
75618
  return {
75482
75619
  xmin: Math.min(vertexMin[0], vertexMax[0]),
75483
75620
  xmax: Math.max(vertexMin[0], vertexMax[0]),
@@ -75489,8 +75626,8 @@ function convertBoundingVolumeToI3SFullExtent(boundingVolume) {
75489
75626
  }
75490
75627
  function createObbFromMbs(mbs) {
75491
75628
  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]);
75629
+ const center = new import_core21.Vector3(mbs[0], mbs[1], mbs[2]);
75630
+ const halfAxex = new import_core21.Matrix3([radius, 0, 0, 0, radius, 0, 0, 0, radius]);
75494
75631
  return new import_culling5.OrientedBoundingBox(center, halfAxex);
75495
75632
  }
75496
75633
 
@@ -75505,7 +75642,6 @@ function getB3DMAttributesWithoutBufferView(attributes) {
75505
75642
  return attributesWithoutBufferView;
75506
75643
  }
75507
75644
  function prepareDataForAttributesConversion(tileContent) {
75508
- const gltfMaterials = tileContent.gltf?.materials?.map((material) => ({ id: material.id }));
75509
75645
  let nodes = tileContent.gltf?.scene?.nodes || tileContent.gltf?.scenes?.[0]?.nodes || tileContent.gltf?.nodes || [];
75510
75646
  const images = tileContent.gltf?.images?.map((imageObject) => {
75511
75647
  if (imageObject?.image?.compressed) {
@@ -75531,7 +75667,6 @@ function prepareDataForAttributesConversion(tileContent) {
75531
75667
  const cartographicOrigin = tileContent.cartographicOrigin;
75532
75668
  const cartesianModelMatrix = tileContent.cartesianModelMatrix;
75533
75669
  return {
75534
- gltfMaterials,
75535
75670
  nodes,
75536
75671
  images,
75537
75672
  cartographicOrigin,
@@ -75551,7 +75686,8 @@ function prepareNodes(nodes) {
75551
75686
  indices: { value: primitive?.indices?.value },
75552
75687
  attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
75553
75688
  material: {
75554
- id: primitive?.material?.id
75689
+ id: primitive?.material?.id,
75690
+ uniqueId: primitive?.material?.uniqueId
75555
75691
  }
75556
75692
  }))
75557
75693
  }
@@ -75815,36 +75951,27 @@ var OBJECT_ID_TYPE2 = "Oid32";
75815
75951
  var BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ["CUSTOM_ATTRIBUTE_2", "_BATCHID", "BATCHID"];
75816
75952
  var EXT_FEATURE_METADATA3 = "EXT_feature_metadata";
75817
75953
  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) {
75954
+ var scratchVector5 = new import_core22.Vector3();
75955
+ async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
75820
75956
  const useCartesianPositions = generateBoundingVolumes;
75821
- const materialAndTextureList = convertMaterials(tileContent.gltf?.materials);
75957
+ const materialAndTextureList = await convertMaterials(tileContent.gltf?.materials, shouldMergeMaterials);
75822
75958
  const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
75823
- const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, useCartesianPositions);
75959
+ const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
75824
75960
  if (generateBoundingVolumes) {
75825
75961
  _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
75826
75962
  }
75827
- if (convertedAttributesMap.has("default")) {
75828
- materialAndTextureList.push({
75829
- material: getDefaultMaterial()
75830
- });
75831
- }
75832
75963
  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)) {
75964
+ for (const materialAndTexture of materialAndTextureList) {
75965
+ const originarMaterialId = materialAndTexture.mergedMaterials[0].originalMaterialId;
75966
+ if (!convertedAttributesMap.has(originarMaterialId)) {
75840
75967
  continue;
75841
75968
  }
75842
- const convertedAttributes = convertedAttributesMap.get(sourceMaterial.id);
75969
+ const convertedAttributes = convertedAttributesMap.get(originarMaterialId);
75843
75970
  if (!convertedAttributes) {
75844
75971
  continue;
75845
75972
  }
75846
- const { material, texture } = materialAndTextureList[i];
75847
- const nodeId = addNodeToNodePage();
75973
+ const { material, texture } = materialAndTexture;
75974
+ const nodeId = await addNodeToNodePage();
75848
75975
  result.push(await _makeNodeResources({
75849
75976
  convertedAttributes,
75850
75977
  material,
@@ -75891,19 +76018,20 @@ async function _makeNodeResources({
75891
76018
  }) {
75892
76019
  const boundingVolumes = convertedAttributes.boundingVolumes;
75893
76020
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX2;
75894
- const { faceRange, featureIds, positions, normals, colors, texCoords, featureCount } = generateAttributes(convertedAttributes);
76021
+ const { faceRange, featureIds, positions, normals, colors, uvRegions, texCoords, featureCount } = generateAttributes(convertedAttributes);
75895
76022
  if (tileContent.batchTableJson) {
75896
76023
  makeFeatureIdsUnique(featureIds, convertedAttributes.featureIndices, featuresHashArray, tileContent.batchTableJson);
75897
76024
  }
75898
76025
  const header = new Uint32Array(2);
75899
76026
  const typedFeatureIds = generateBigUint64Array(featureIds);
75900
76027
  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));
76028
+ 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
76029
  const compressedGeometry = draco ? generateCompressedGeometry(vertexCount, convertedAttributes, {
75903
76030
  positions,
75904
76031
  normals,
75905
76032
  texCoords: texture ? texCoords : new Float32Array(0),
75906
76033
  colors,
76034
+ uvRegions,
75907
76035
  featureIds,
75908
76036
  faceRange
75909
76037
  }, workerSource.draco) : null;
@@ -75916,6 +76044,7 @@ async function _makeNodeResources({
75916
76044
  geometry: fileBuffer,
75917
76045
  compressedGeometry,
75918
76046
  texture,
76047
+ hasUvRegions: Boolean(uvRegions.length),
75919
76048
  sharedResources: getSharedResources(tileContent.gltf?.materials || [], nodeId),
75920
76049
  meshMaterial: material,
75921
76050
  vertexCount,
@@ -75924,19 +76053,24 @@ async function _makeNodeResources({
75924
76053
  boundingVolumes
75925
76054
  };
75926
76055
  }
75927
- async function convertAttributes(attributesData, useCartesianPositions) {
75928
- const { gltfMaterials, nodes, images, cartographicOrigin, cartesianModelMatrix } = attributesData;
76056
+ async function convertAttributes(attributesData, materialAndTextureList, useCartesianPositions) {
76057
+ const { nodes, images, cartographicOrigin, cartesianModelMatrix } = attributesData;
75929
76058
  const attributesMap = new Map();
75930
- for (const material of gltfMaterials || [{ id: "default" }]) {
75931
- attributesMap.set(material.id, {
76059
+ for (const materialAndTexture of materialAndTextureList) {
76060
+ const attributes = {
75932
76061
  positions: new Float32Array(0),
75933
76062
  normals: new Float32Array(0),
75934
76063
  texCoords: new Float32Array(0),
75935
76064
  colors: new Uint8Array(0),
76065
+ uvRegions: new Uint16Array(0),
75936
76066
  featureIndicesGroups: [],
75937
76067
  featureIndices: [],
75938
- boundingVolumes: null
75939
- });
76068
+ boundingVolumes: null,
76069
+ mergedMaterials: materialAndTexture.mergedMaterials
76070
+ };
76071
+ for (const mergedMaterial of materialAndTexture.mergedMaterials) {
76072
+ attributesMap.set(mergedMaterial.originalMaterialId, attributes);
76073
+ }
75940
76074
  }
75941
76075
  convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
75942
76076
  for (const attrKey of attributesMap.keys()) {
@@ -75955,7 +76089,7 @@ async function convertAttributes(attributesData, useCartesianPositions) {
75955
76089
  }
75956
76090
  return attributesMap;
75957
76091
  }
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])) {
76092
+ 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
76093
  if (nodes) {
75960
76094
  for (const node2 of nodes) {
75961
76095
  convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
@@ -75979,7 +76113,7 @@ function getCompositeTransformationMatrix(node2, matrix) {
75979
76113
  }
75980
76114
  return transformationMatrix;
75981
76115
  }
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])) {
76116
+ 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
76117
  const transformationMatrix = getCompositeTransformationMatrix(node2, matrix);
75984
76118
  const mesh = node2.mesh;
75985
76119
  if (mesh) {
@@ -75987,11 +76121,13 @@ function convertNode(node2, images, cartographicOrigin, cartesianModelMatrix, at
75987
76121
  }
75988
76122
  convertNodes(node2.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
75989
76123
  }
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])) {
76124
+ 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
76125
  for (const primitive of mesh.primitives) {
75992
76126
  let outputAttributes = null;
76127
+ let materialUvRegion;
75993
76128
  if (primitive.material) {
75994
- outputAttributes = attributesMap.get(primitive.material.id);
76129
+ outputAttributes = attributesMap.get(primitive.material.uniqueId);
76130
+ materialUvRegion = outputAttributes?.mergedMaterials.find(({ originalMaterialId }) => originalMaterialId === primitive.material?.uniqueId)?.uvRegion;
75995
76131
  } else if (attributesMap.has("default")) {
75996
76132
  outputAttributes = attributesMap.get("default");
75997
76133
  }
@@ -76020,6 +76156,9 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
76020
76156
  }));
76021
76157
  outputAttributes.texCoords = concatenateTypedArrays(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, primitive.indices?.value));
76022
76158
  outputAttributes.colors = concatenateTypedArrays(outputAttributes.colors, flattenColors(attributes.COLOR_0, primitive.indices?.value));
76159
+ if (materialUvRegion) {
76160
+ outputAttributes.uvRegions = concatenateTypedArrays(outputAttributes.uvRegions, createUvRegion(materialUvRegion, primitive.indices?.value));
76161
+ }
76023
76162
  outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
76024
76163
  outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), primitive.indices?.value));
76025
76164
  }
@@ -76033,7 +76172,7 @@ function transformVertexArray(args) {
76033
76172
  for (let i = 0; i < indices.length; i++) {
76034
76173
  const coordIndex = indices[i] * VALUES_PER_VERTEX2;
76035
76174
  const vertex = vertices.subarray(coordIndex, coordIndex + VALUES_PER_VERTEX2);
76036
- let vertexVector = new import_core21.Vector3(Array.from(vertex));
76175
+ let vertexVector = new import_core22.Vector3(Array.from(vertex));
76037
76176
  vertexVector = attributeSpecificTransformation(vertexVector, args);
76038
76177
  newVertices[i * VALUES_PER_VERTEX2] = vertexVector.x;
76039
76178
  newVertices[i * VALUES_PER_VERTEX2 + 1] = vertexVector.y;
@@ -76095,6 +76234,13 @@ function flattenColors(colorsAttribute, indices) {
76095
76234
  }
76096
76235
  return newColors;
76097
76236
  }
76237
+ function createUvRegion(materialUvRegion, indices) {
76238
+ const result = new Uint16Array(indices.length * 4);
76239
+ for (let i = 0; i < result.length; i += 4) {
76240
+ result.set(materialUvRegion, i);
76241
+ }
76242
+ return result;
76243
+ }
76098
76244
  function flattenBatchIds(batchedIds, indices) {
76099
76245
  if (!batchedIds.length || !indices.length) {
76100
76246
  return [];
@@ -76119,13 +76265,77 @@ function getBatchIds(attributes, primitive, images) {
76119
76265
  }
76120
76266
  return [];
76121
76267
  }
76122
- function convertMaterials(sourceMaterials = []) {
76123
- const result = [];
76268
+ async function convertMaterials(sourceMaterials = [], shouldMergeMaterials) {
76269
+ let materials = [];
76124
76270
  for (const sourceMaterial of sourceMaterials) {
76125
- result.push(convertMaterial(sourceMaterial));
76271
+ materials.push(convertMaterial(sourceMaterial));
76272
+ }
76273
+ if (shouldMergeMaterials) {
76274
+ materials = await mergeAllMaterials(materials);
76275
+ }
76276
+ return materials;
76277
+ }
76278
+ async function mergeAllMaterials(materials) {
76279
+ const result = [];
76280
+ while (materials.length > 0) {
76281
+ let newMaterial = materials.splice(0, 1)[0];
76282
+ const mergedIndices = [];
76283
+ for (let i = 0; i < materials.length; i++) {
76284
+ const material = materials[i];
76285
+ if (newMaterial.texture && material.texture || !newMaterial.texture && !material.texture) {
76286
+ newMaterial = await mergeMaterials(newMaterial, material);
76287
+ mergedIndices.push(i);
76288
+ }
76289
+ }
76290
+ if (newMaterial.texture && mergedIndices.length) {
76291
+ const newWidth = newMaterial.mergedMaterials?.reduce((accum, { textureSize }) => accum + (textureSize?.width || 0), 0);
76292
+ const newHeight = newMaterial.mergedMaterials?.reduce((accum, { textureSize }) => Math.max(accum, textureSize?.height || 0), 0);
76293
+ let currentX = -1;
76294
+ for (const aTextureMetadata of newMaterial.mergedMaterials) {
76295
+ if (aTextureMetadata.textureSize) {
76296
+ const newX = currentX + 1 + aTextureMetadata.textureSize.width / newWidth * 2 ** (Uint16Array.BYTES_PER_ELEMENT * 8) - 1;
76297
+ aTextureMetadata.uvRegion = new Uint16Array([
76298
+ currentX + 1,
76299
+ 0,
76300
+ newX,
76301
+ aTextureMetadata.textureSize.height / newHeight * 2 ** (Uint16Array.BYTES_PER_ELEMENT * 8) - 1
76302
+ ]);
76303
+ currentX = newX;
76304
+ }
76305
+ }
76306
+ newMaterial.texture.image.width = newWidth;
76307
+ newMaterial.texture.image.height = newHeight;
76308
+ }
76309
+ for (const index of mergedIndices.reverse()) {
76310
+ materials.splice(index, 1);
76311
+ }
76312
+ result.push(newMaterial);
76313
+ }
76314
+ if (!result.length) {
76315
+ result.push({
76316
+ material: getDefaultMaterial(),
76317
+ mergedMaterials: [{ originalMaterialId: "default" }]
76318
+ });
76126
76319
  }
76127
76320
  return result;
76128
76321
  }
76322
+ async function mergeMaterials(material1, material2) {
76323
+ if (material1.texture?.bufferView && material2.texture?.bufferView && material1.mergedMaterials && material2.mergedMaterials) {
76324
+ const buffer1 = Buffer.from(material1.texture.bufferView.data);
76325
+ const buffer2 = Buffer.from(material2.texture.bufferView.data);
76326
+ try {
76327
+ const { joinImages } = await import("join-images");
76328
+ const sharpData = await joinImages([buffer1, buffer2], { direction: "horizontal" });
76329
+ material1.texture.bufferView.data = await sharpData.toFormat(material1.texture.mimeType === "image/png" ? "png" : "jpeg").toBuffer();
76330
+ } catch (error) {
76331
+ 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)");
76332
+ throw error;
76333
+ }
76334
+ material1.material.pbrMetallicRoughness.baseColorTexture.textureSetDefinitionId = 1;
76335
+ }
76336
+ material1.mergedMaterials = material1.mergedMaterials.concat(material2.mergedMaterials);
76337
+ return material1;
76338
+ }
76129
76339
  function convertMaterial(sourceMaterial) {
76130
76340
  const material = {
76131
76341
  doubleSided: sourceMaterial.doubleSided,
@@ -76148,11 +76358,16 @@ function convertMaterial(sourceMaterial) {
76148
76358
  textureSetDefinitionId: 0
76149
76359
  };
76150
76360
  }
76361
+ const uniqueId = v4();
76362
+ sourceMaterial.uniqueId = uniqueId;
76363
+ let mergedMaterials = [{ originalMaterialId: uniqueId }];
76151
76364
  if (!texture) {
76152
76365
  const baseColorFactor = sourceMaterial?.pbrMetallicRoughness?.baseColorFactor;
76153
76366
  material.pbrMetallicRoughness.baseColorFactor = baseColorFactor && baseColorFactor.map((c) => Math.round(c * 255)) || void 0;
76367
+ } else {
76368
+ mergedMaterials[0].textureSize = { width: texture.image.width, height: texture.image.height };
76154
76369
  }
76155
- return { material, texture };
76370
+ return { material, texture, mergedMaterials };
76156
76371
  }
76157
76372
  function convertAlphaMode(gltfAlphaMode) {
76158
76373
  switch (gltfAlphaMode) {
@@ -76210,10 +76425,10 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
76210
76425
  }
76211
76426
  function extractSharedResourcesMaterialInfo(baseColorFactor, metallicFactor = 1) {
76212
76427
  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);
76428
+ const black = new import_core22.Vector4(0, 0, 0, 1);
76429
+ const unitVector = new import_core22.Vector4(1, 1, 1, 1);
76430
+ const dielectricSpecular = new import_core22.Vector4(matDielectricColorComponent, matDielectricColorComponent, matDielectricColorComponent, 0);
76431
+ const baseColorVector = new import_core22.Vector4(baseColorFactor);
76217
76432
  const firstOperand = unitVector.subtract(dielectricSpecular).multiply(baseColorVector);
76218
76433
  const diffuse = firstOperand.lerp(firstOperand, black, metallicFactor);
76219
76434
  dielectricSpecular[3] = 1;
@@ -76360,7 +76575,7 @@ function generateBigUint64Array(featureIds) {
76360
76575
  return typedFeatureIds;
76361
76576
  }
76362
76577
  async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
76363
- const { positions, normals, texCoords, colors, featureIds, faceRange } = attributes;
76578
+ const { positions, normals, texCoords, colors, uvRegions, featureIds, faceRange } = attributes;
76364
76579
  const indices = new Uint32Array(vertexCount);
76365
76580
  for (let index = 0; index < indices.length; index++) {
76366
76581
  indices.set([index], index);
@@ -76382,6 +76597,12 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
76382
76597
  "i3s-feature-ids": new Int32Array(featureIds)
76383
76598
  }
76384
76599
  };
76600
+ if (uvRegions.length) {
76601
+ compressedAttributes["uv-region"] = uvRegions;
76602
+ attributesMetadata["uv-region"] = {
76603
+ "i3s-attribute-type": "uv-region"
76604
+ };
76605
+ }
76385
76606
  return encode({ attributes: compressedAttributes, indices }, DracoWriterWorker, {
76386
76607
  ...DracoWriterWorker.options,
76387
76608
  source: dracoWorkerSoure,
@@ -76544,12 +76765,12 @@ function convertScreenThresholdToGeometricError(node2) {
76544
76765
 
76545
76766
  // src/pgm-loader.ts
76546
76767
  var import_geoid = __toModule(require_es57());
76547
- var VERSION10 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
76768
+ var VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
76548
76769
  var PGMLoader = {
76549
76770
  name: "PGM - Netpbm grayscale image format",
76550
76771
  id: "pgm",
76551
76772
  module: "tile-converter",
76552
- version: VERSION10,
76773
+ version: VERSION11,
76553
76774
  mimeTypes: ["image/x-portable-graymap"],
76554
76775
  parse: async (arrayBuffer, options) => (0, import_geoid.parsePGM)(new Uint8Array(arrayBuffer), options),
76555
76776
  extensions: ["pgm"],
@@ -76664,72 +76885,6 @@ var STORE = {
76664
76885
  };
76665
76886
 
76666
76887
  // 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
76888
  var SPATIAL_REFERENCE = () => ({
76734
76889
  wkid: {
76735
76890
  path: "wkid",
@@ -76844,22 +76999,8 @@ var LAYERS = () => ({
76844
76999
  default: []
76845
77000
  },
76846
77001
  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
- ]
77002
+ path: "geometryDefinitions",
77003
+ default: []
76863
77004
  },
76864
77005
  attributeStorageInfo: {
76865
77006
  path: "attributeStorageInfo",
@@ -76875,87 +77016,85 @@ var LAYERS = () => ({
76875
77016
  }
76876
77017
  });
76877
77018
 
76878
- // src/i3s-converter/json-templates/node.ts
77019
+ // src/i3s-converter/json-templates/geometry-definitions.ts
76879
77020
  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
- ]
77021
+ var PLAIN_GEOMETRY_DEFINITION = () => ({
77022
+ offset: {
77023
+ default: 8
76926
77024
  },
76927
- children: {
76928
- path: "children",
76929
- default: null
77025
+ position: {
77026
+ default: {
77027
+ type: "Float32",
77028
+ component: 3
77029
+ }
76930
77030
  },
76931
- neighbors: {
76932
- path: "neighbors",
76933
- default: null
77031
+ normal: {
77032
+ default: {
77033
+ type: "Float32",
77034
+ component: 3
77035
+ }
76934
77036
  },
76935
- parentNode: {
76936
- path: "parentNode",
76937
- transform: (val) => (0, import_json_map_transform4.default)(val, PARENT_NODE()),
76938
- default: null
77037
+ uv0: {
77038
+ path: "hasTexture",
77039
+ transform: (val) => val && { type: "Float32", component: 2 } || false,
77040
+ omitValues: [false]
76939
77041
  },
76940
- sharedResource: {
76941
- path: "sharedResource",
76942
- default: null
77042
+ color: {
77043
+ default: {
77044
+ type: "UInt8",
77045
+ component: 4
77046
+ }
76943
77047
  },
76944
- featureData: {
76945
- path: "featureData",
76946
- default: null
77048
+ uvRegion: {
77049
+ path: "hasUvRegions",
77050
+ transform: (val) => val && { type: "UInt16", component: 4 } || false,
77051
+ omitValues: [false]
76947
77052
  },
76948
- geometryData: {
76949
- path: "geometryData",
76950
- default: null
77053
+ featureId: {
77054
+ default: {
77055
+ binding: "per-feature",
77056
+ type: "UInt64",
77057
+ component: 1
77058
+ }
76951
77059
  },
76952
- textureData: {
76953
- path: "textureData",
76954
- default: null
77060
+ faceRange: {
77061
+ default: {
77062
+ binding: "per-feature",
77063
+ type: "UInt32",
77064
+ component: 2
77065
+ }
77066
+ }
77067
+ });
77068
+ var COMPRESSED_GEOMETRY_DEFINITION = () => ({
77069
+ "compressedAttributes.encoding": {
77070
+ default: "draco"
76955
77071
  },
76956
- attributeData: {
76957
- path: "attributeData",
76958
- default: null
77072
+ "compressedAttributes.attributes": {
77073
+ path: "geometryConfig",
77074
+ transform: (val) => {
77075
+ const result = ["position", "normal"];
77076
+ if (val.hasTexture) {
77077
+ result.push("uv0");
77078
+ }
77079
+ result.push("color");
77080
+ if (val.hasUvRegions) {
77081
+ result.push("uv-region");
77082
+ }
77083
+ result.push("feature-index");
77084
+ return result;
77085
+ }
77086
+ }
77087
+ });
77088
+ var GEOMETRY_DEFINITION = () => ({
77089
+ geometryBuffers: {
77090
+ path: "geometryConfig",
77091
+ transform: (val) => {
77092
+ const result = [(0, import_json_map_transform4.default)(val, PLAIN_GEOMETRY_DEFINITION())];
77093
+ if (val.draco) {
77094
+ result.push((0, import_json_map_transform4.default)({ geometryConfig: val }, COMPRESSED_GEOMETRY_DEFINITION()));
77095
+ }
77096
+ return result;
77097
+ }
76959
77098
  }
76960
77099
  });
76961
77100
 
@@ -76976,15 +77115,15 @@ var MATERIAL_DEFINITION_INFO_PARAMS = () => ({
76976
77115
  },
76977
77116
  ambient: {
76978
77117
  path: "ambient",
76979
- default: [1, 1, 1, 1]
77118
+ default: [1, 1, 1]
76980
77119
  },
76981
77120
  diffuse: {
76982
77121
  path: "diffuse",
76983
- default: [1, 1, 1, 1]
77122
+ default: [1, 1, 1]
76984
77123
  },
76985
77124
  specular: {
76986
77125
  path: "specular",
76987
- default: [0, 0, 0, 0]
77126
+ default: [0, 0, 0]
76988
77127
  },
76989
77128
  useVertexColorAlpha: {
76990
77129
  path: "useVertexColorAlpha",
@@ -77086,7 +77225,7 @@ function transfromTextureDefinitions(textureDefinitionInfos, thisObject, origina
77086
77225
  // src/i3s-converter/helpers/node-debug.ts
77087
77226
  var import_culling6 = __toModule(require_es56());
77088
77227
  var import_engine = __toModule(require_es511());
77089
- var import_core23 = __toModule(require_es54());
77228
+ var import_core24 = __toModule(require_es54());
77090
77229
  var import_geospatial10 = __toModule(require_es55());
77091
77230
  function validateNodeBoundingVolumes(node2) {
77092
77231
  if (!node2?.parentNode?.obb || !node2?.parentNode?.mbs) {
@@ -77131,7 +77270,7 @@ function getTileObbVertices(node2) {
77131
77270
  const obbCenterCartesian = import_geospatial10.Ellipsoid.WGS84.cartographicToCartesian(node2.obb.center);
77132
77271
  let vertices = [];
77133
77272
  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]);
77273
+ const positionsVector = new import_core24.Vector3(positions[i] *= halfSize[0], positions[i + 1] *= halfSize[1], positions[i + 2] *= halfSize[2]);
77135
77274
  const rotatedPositions = positionsVector.transformByQuaternion(node2.obb.quaternion).add(obbCenterCartesian);
77136
77275
  vertices = vertices.concat(rotatedPositions);
77137
77276
  }
@@ -77178,10 +77317,18 @@ var WriteQueue = class extends Queue {
77178
77317
  this.listeningInterval = listeningInterval;
77179
77318
  this.writeConcurrency = writeConcurrency;
77180
77319
  }
77181
- async enqueue(val) {
77182
- super.enqueue(val);
77183
- if (import_process.default.memoryUsage().rss > MEMORY_LIMIT) {
77184
- await this.startWrite();
77320
+ async enqueue(val, writeImmediately = false) {
77321
+ if (writeImmediately) {
77322
+ const { archiveKey, writePromise } = val;
77323
+ const result = await writePromise();
77324
+ if (archiveKey && result) {
77325
+ this.fileMap[archiveKey] = result;
77326
+ }
77327
+ } else {
77328
+ super.enqueue(val);
77329
+ if (import_process.default.memoryUsage().rss > MEMORY_LIMIT) {
77330
+ await this.startWrite();
77331
+ }
77185
77332
  }
77186
77333
  }
77187
77334
  startListening() {
@@ -77193,12 +77340,9 @@ var WriteQueue = class extends Queue {
77193
77340
  }
77194
77341
  }
77195
77342
  async startWrite() {
77196
- if (this.writePromise) {
77197
- await this.writePromise;
77198
- this.writePromise = null;
77199
- return;
77343
+ if (!this.writePromise) {
77344
+ this.writePromise = this.doWrite();
77200
77345
  }
77201
- this.writePromise = this.doWrite();
77202
77346
  await this.writePromise;
77203
77347
  this.writePromise = null;
77204
77348
  }
@@ -77217,12 +77361,12 @@ var WriteQueue = class extends Queue {
77217
77361
  }
77218
77362
  const { archiveKey, writePromise } = item;
77219
77363
  archiveKeys.push(archiveKey);
77220
- promises.push(writePromise);
77364
+ const promise = writePromise();
77365
+ promises.push(promise);
77221
77366
  }
77222
77367
  const writeResults = await Promise.allSettled(promises);
77223
77368
  this.updateFileMap(archiveKeys, writeResults);
77224
77369
  }
77225
- this.writePromise = null;
77226
77370
  }
77227
77371
  updateFileMap(archiveKeys, writeResults) {
77228
77372
  for (let i = 0; i < archiveKeys.length; i++) {
@@ -77235,12 +77379,12 @@ var WriteQueue = class extends Queue {
77235
77379
  };
77236
77380
 
77237
77381
  // src/i3s-attributes-worker.ts
77238
- var VERSION11 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
77382
+ var VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
77239
77383
  var I3SAttributesWorker = {
77240
77384
  id: "i3s-attributes",
77241
77385
  name: "I3S Attributes Worker",
77242
77386
  module: "tile-converter",
77243
- version: VERSION11,
77387
+ version: VERSION12,
77244
77388
  options: {
77245
77389
  useCartesianPositions: false
77246
77390
  }
@@ -77249,6 +77393,257 @@ var I3SAttributesWorker = {
77249
77393
  // src/constants.ts
77250
77394
  var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in node js environment";
77251
77395
 
77396
+ // src/i3s-converter/helpers/node-index-document.ts
77397
+ var import_path7 = __toModule(require("path"));
77398
+ var import_json_map_transform7 = __toModule(require_json_map_transform());
77399
+
77400
+ // src/i3s-converter/json-templates/node.ts
77401
+ var import_json_map_transform6 = __toModule(require_json_map_transform());
77402
+ var COORDINATES = () => ({
77403
+ mbs: {
77404
+ path: "mbs"
77405
+ },
77406
+ obb: {
77407
+ path: "obb"
77408
+ }
77409
+ });
77410
+ var HREF = () => ({
77411
+ href: {
77412
+ path: "href"
77413
+ }
77414
+ });
77415
+ var PARENT_NODE = () => ({
77416
+ id: {
77417
+ path: "id"
77418
+ },
77419
+ ...HREF(),
77420
+ ...COORDINATES()
77421
+ });
77422
+ var NODE = () => ({
77423
+ version: {
77424
+ path: "version"
77425
+ },
77426
+ id: {
77427
+ path: "id"
77428
+ },
77429
+ path: {
77430
+ path: "path"
77431
+ },
77432
+ level: {
77433
+ path: "level"
77434
+ },
77435
+ ...COORDINATES(),
77436
+ lodSelection: {
77437
+ path: "lodSelection",
77438
+ default: [
77439
+ {
77440
+ metricType: "maxScreenThresholdSQ",
77441
+ maxError: 196349.54374999998
77442
+ },
77443
+ {
77444
+ metricType: "maxScreenThreshold",
77445
+ maxError: 999.9999999999999
77446
+ }
77447
+ ]
77448
+ },
77449
+ children: {
77450
+ path: "children",
77451
+ default: null
77452
+ },
77453
+ neighbors: {
77454
+ path: "neighbors",
77455
+ default: null
77456
+ },
77457
+ parentNode: {
77458
+ path: "parentNode",
77459
+ transform: (val) => (0, import_json_map_transform6.default)(val, PARENT_NODE()),
77460
+ default: null
77461
+ },
77462
+ sharedResource: {
77463
+ path: "sharedResource",
77464
+ default: null
77465
+ },
77466
+ featureData: {
77467
+ path: "featureData",
77468
+ default: null
77469
+ },
77470
+ geometryData: {
77471
+ path: "geometryData",
77472
+ default: null
77473
+ },
77474
+ textureData: {
77475
+ path: "textureData",
77476
+ default: null
77477
+ },
77478
+ attributeData: {
77479
+ path: "attributeData",
77480
+ default: null
77481
+ }
77482
+ });
77483
+
77484
+ // src/i3s-converter/helpers/node-index-document.ts
77485
+ var NodeIndexDocument = class {
77486
+ constructor(id, converter) {
77487
+ this.data = null;
77488
+ this.children = [];
77489
+ this.inPageId = id;
77490
+ this.id = id === 0 ? "root" : id.toString();
77491
+ this.converter = converter;
77492
+ }
77493
+ async addData(data) {
77494
+ if (this.converter.options.instantNodeWriting) {
77495
+ await this.write(data);
77496
+ } else {
77497
+ this.data = data;
77498
+ }
77499
+ return this;
77500
+ }
77501
+ async addChildren(childNodes) {
77502
+ const newChildren = [];
77503
+ for (const node2 of childNodes) {
77504
+ const nodeData = await node2.load();
77505
+ newChildren.push({
77506
+ id: node2.id,
77507
+ href: `../${node2.id}`,
77508
+ obb: nodeData.obb,
77509
+ mbs: nodeData.mbs
77510
+ });
77511
+ }
77512
+ this.children = this.children.concat(childNodes);
77513
+ let data = this.data;
77514
+ if (this.converter.options.instantNodeWriting) {
77515
+ data = await this.load();
77516
+ }
77517
+ if (data) {
77518
+ data.children = data.children ?? [];
77519
+ data.children = data.children.concat(newChildren);
77520
+ }
77521
+ if (this.converter.options.instantNodeWriting && data) {
77522
+ await this.write(data);
77523
+ }
77524
+ }
77525
+ async addNeighbors() {
77526
+ const nodeData = await this.load();
77527
+ for (const childNode of this.children) {
77528
+ const childNodeData = await childNode.load();
77529
+ childNodeData.neighbors = childNodeData.neighbors ?? [];
77530
+ if (Number(nodeData?.children?.length) < 1e3) {
77531
+ for (const neighbor of nodeData.children || []) {
77532
+ if (childNode.id === neighbor.id) {
77533
+ continue;
77534
+ }
77535
+ childNodeData.neighbors.push({ ...neighbor });
77536
+ }
77537
+ } else {
77538
+ console.warn(`Node ${childNode.id}: neighbors attribute is omited because of large number of neigbors`);
77539
+ delete childNodeData.neighbors;
77540
+ }
77541
+ if (this.converter.options.instantNodeWriting && childNodeData) {
77542
+ await childNode.write(childNodeData);
77543
+ }
77544
+ await childNode.save();
77545
+ childNode.flush();
77546
+ }
77547
+ }
77548
+ async save() {
77549
+ if (this.data) {
77550
+ await this.write(this.data);
77551
+ }
77552
+ }
77553
+ async write(node2) {
77554
+ const path2 = (0, import_path7.join)(this.converter.layers0Path, "nodes", this.id);
77555
+ if (this.converter.options.slpk) {
77556
+ await this.converter.writeQueue.enqueue({
77557
+ archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
77558
+ writePromise: () => writeFileForSlpk(path2, JSON.stringify(node2), "3dNodeIndexDocument.json", true, this.converter.compressList)
77559
+ }, true);
77560
+ } else {
77561
+ await this.converter.writeQueue.enqueue({ writePromise: () => writeFile3(path2, JSON.stringify(node2)) }, true);
77562
+ }
77563
+ }
77564
+ async load() {
77565
+ if (this.data) {
77566
+ return this.data;
77567
+ }
77568
+ const path2 = this.id;
77569
+ const parentNodePath = (0, import_path7.join)(this.converter.layers0Path, "nodes", path2);
77570
+ let parentNodeFileName = "index.json";
77571
+ if (this.converter.options.slpk) {
77572
+ parentNodeFileName = "3dNodeIndexDocument.json";
77573
+ }
77574
+ return await openJson(parentNodePath, parentNodeFileName);
77575
+ }
77576
+ flush() {
77577
+ this.data = null;
77578
+ }
77579
+ static async createRootNode(boundingVolumes, converter) {
77580
+ const rootData = NodeIndexDocument.createRootNodeIndexDocument(boundingVolumes);
77581
+ const rootNode = await new NodeIndexDocument(0, converter).addData(rootData);
77582
+ return rootNode;
77583
+ }
77584
+ static async createNode(parentNode, boundingVolumes, lodSelection, nodeInPage, resources, converter) {
77585
+ const data = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
77586
+ const node2 = await new NodeIndexDocument(nodeInPage.index, converter).addData(data);
77587
+ return node2;
77588
+ }
77589
+ static createRootNodeIndexDocument(boundingVolumes) {
77590
+ const root0data = {
77591
+ version: `{${v4().toUpperCase()}}`,
77592
+ id: "root",
77593
+ level: 0,
77594
+ lodSelection: [
77595
+ {
77596
+ metricType: "maxScreenThresholdSQ",
77597
+ maxError: 0
77598
+ },
77599
+ {
77600
+ metricType: "maxScreenThreshold",
77601
+ maxError: 0
77602
+ }
77603
+ ],
77604
+ ...boundingVolumes,
77605
+ children: []
77606
+ };
77607
+ return (0, import_json_map_transform7.default)(root0data, NODE());
77608
+ }
77609
+ static async createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources) {
77610
+ const { texture, attributes } = resources;
77611
+ const nodeId = nodeInPage.index;
77612
+ const parentNodeData = await parentNode.load();
77613
+ const nodeData = {
77614
+ version: parentNodeData.version,
77615
+ id: nodeId.toString(),
77616
+ level: parentNodeData.level + 1,
77617
+ ...boundingVolumes,
77618
+ lodSelection,
77619
+ parentNode: {
77620
+ id: parentNode.id,
77621
+ href: `../${parentNode.id}`,
77622
+ mbs: parentNodeData.mbs,
77623
+ obb: parentNodeData.obb
77624
+ },
77625
+ children: [],
77626
+ neighbors: []
77627
+ };
77628
+ const node2 = (0, import_json_map_transform7.default)(nodeData, NODE());
77629
+ if (nodeInPage.mesh) {
77630
+ node2.geometryData = [{ href: "./geometries/0" }];
77631
+ node2.sharedResource = { href: "./shared" };
77632
+ if (texture) {
77633
+ node2.textureData = [{ href: "./textures/0" }, { href: "./textures/1" }];
77634
+ }
77635
+ if (attributes && attributes.length && parentNode.converter.layers0?.attributeStorageInfo?.length) {
77636
+ node2.attributeData = [];
77637
+ for (let index = 0; index < attributes.length; index++) {
77638
+ const folderName = parentNode.converter.layers0.attributeStorageInfo[index].key;
77639
+ node2.attributeData.push({ href: `./attributes/${folderName}/0` });
77640
+ }
77641
+ }
77642
+ }
77643
+ return node2;
77644
+ }
77645
+ };
77646
+
77252
77647
  // src/i3s-converter/i3s-converter.ts
77253
77648
  var ION_DEFAULT_TOKEN = import_process2.default.env?.IonToken || "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ";
77254
77649
  var HARDCODED_NODES_PER_PAGE = 64;
@@ -77266,11 +77661,14 @@ var I3SConverter = class {
77266
77661
  this.Loader = Tiles3DLoader;
77267
77662
  this.workerSource = {};
77268
77663
  this.writeQueue = new WriteQueue();
77269
- this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE);
77664
+ this.compressList = null;
77665
+ this.nodePages = new NodePages(writeFile3, HARDCODED_NODES_PER_PAGE, this);
77270
77666
  this.options = {};
77271
77667
  this.layers0Path = "";
77272
77668
  this.materialMap = new Map();
77273
77669
  this.materialDefinitions = [];
77670
+ this.geometryMap = new Map();
77671
+ this.geometryConfigs = [];
77274
77672
  this.vertexCounter = 0;
77275
77673
  this.layers0 = null;
77276
77674
  this.featuresHashArray = [];
@@ -77282,6 +77680,7 @@ var I3SConverter = class {
77282
77680
  this.generateTextures = false;
77283
77681
  this.generateBoundingVolumes = false;
77284
77682
  this.layersHasTexture = false;
77683
+ this.compressList = null;
77285
77684
  }
77286
77685
  async convert(options) {
77287
77686
  if (isBrowser) {
@@ -77296,14 +77695,27 @@ var I3SConverter = class {
77296
77695
  inputUrl,
77297
77696
  validate: validate2,
77298
77697
  outputPath,
77299
- draco,
77698
+ draco = true,
77300
77699
  sevenZipExe,
77301
77700
  maxDepth,
77302
77701
  token,
77303
77702
  generateTextures,
77304
- generateBoundingVolumes
77703
+ generateBoundingVolumes,
77704
+ instantNodeWriting = false,
77705
+ mergeMaterials: mergeMaterials2 = true
77305
77706
  } = options;
77306
- this.options = { maxDepth, slpk, sevenZipExe, egmFilePath, draco, token, inputUrl };
77707
+ this.options = {
77708
+ maxDepth,
77709
+ slpk,
77710
+ sevenZipExe,
77711
+ egmFilePath,
77712
+ draco,
77713
+ token,
77714
+ inputUrl,
77715
+ instantNodeWriting,
77716
+ mergeMaterials: mergeMaterials2
77717
+ };
77718
+ this.compressList = this.options.instantNodeWriting && [] || null;
77307
77719
  this.validate = Boolean(validate2);
77308
77720
  this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;
77309
77721
  this.generateTextures = Boolean(generateTextures);
@@ -77348,34 +77760,39 @@ var I3SConverter = class {
77348
77760
  }
77349
77761
  }
77350
77762
  async _createAndSaveTileset(outputPath, tilesetName, boundingVolumeRegion) {
77351
- const tilesetPath = (0, import_path7.join)(`${outputPath}`, `${tilesetName}`);
77763
+ const tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
77352
77764
  try {
77353
77765
  await removeDir(tilesetPath);
77354
77766
  } catch (e) {
77355
77767
  }
77356
- this.layers0Path = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
77768
+ this.layers0Path = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
77357
77769
  this._formLayers0(tilesetName, boundingVolumeRegion);
77358
77770
  this.materialDefinitions = [];
77359
77771
  this.materialMap = new Map();
77360
77772
  const sourceRootTile = this.sourceTileset.root;
77361
77773
  const boundingVolumes = createBoundingVolumes(sourceRootTile, this.geoidHeightModel);
77362
- const parentId = this.nodePages.push({
77774
+ await this.nodePages.push({
77363
77775
  index: 0,
77364
77776
  lodThreshold: 0,
77365
77777
  obb: boundingVolumes.obb,
77366
77778
  children: []
77367
77779
  });
77368
- const isCreateSlpk = this.options.slpk;
77369
- const root0 = this._formRootNodeIndexDocument(boundingVolumes);
77370
- await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
77780
+ const rootNode = await NodeIndexDocument.createRootNode(boundingVolumes, this);
77781
+ await this._convertNodesTree(rootNode, sourceRootTile);
77371
77782
  this.layers0.materialDefinitions = this.materialDefinitions;
77783
+ this.layers0.geometryDefinitions = (0, import_json_map_transform8.default)(this.geometryConfigs.map((config) => ({
77784
+ geometryConfig: { ...config, draco: this.options.draco }
77785
+ })), GEOMETRY_DEFINITION());
77372
77786
  if (this.layersHasTexture === false) {
77373
77787
  this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter((attribute) => attribute !== "uv0");
77374
77788
  }
77375
77789
  await this._writeLayers0();
77376
77790
  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);
77791
+ for (const filePath of this.compressList || []) {
77792
+ await compressFileWithGzip(filePath);
77793
+ await removeFile(filePath);
77794
+ }
77795
+ await this.nodePages.save();
77379
77796
  await this.writeQueue.finalize();
77380
77797
  await this._createSlpk(tilesetPath);
77381
77798
  }
@@ -77401,82 +77818,41 @@ var I3SConverter = class {
77401
77818
  compressGeometry: this.options.draco,
77402
77819
  fullExtent
77403
77820
  };
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());
77821
+ this.layers0 = (0, import_json_map_transform8.default)(layers0data, LAYERS());
77425
77822
  }
77426
- async _convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes) {
77823
+ async _convertNodesTree(rootNode, sourceRootTile) {
77427
77824
  await this.sourceTileset._loadTile(sourceRootTile);
77428
77825
  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)) });
77826
+ const childNodes = await this._createNode(rootNode, sourceRootTile, 0);
77827
+ for (const childNode of childNodes) {
77828
+ await childNode.save();
77444
77829
  }
77830
+ await rootNode.addChildren(childNodes);
77445
77831
  } else {
77446
77832
  await this._addChildrenWithNeighborsAndWriteFile({
77447
- parentNode: root0,
77833
+ parentNode: rootNode,
77448
77834
  sourceTiles: sourceRootTile.children,
77449
- parentId,
77450
77835
  level: 1
77451
77836
  });
77452
77837
  }
77453
77838
  await sourceRootTile.unloadContent();
77839
+ await rootNode.save();
77454
77840
  }
77455
77841
  async _writeLayers0() {
77456
77842
  if (this.options.slpk) {
77457
77843
  await this.writeQueue.enqueue({
77458
77844
  archiveKey: "3dSceneLayer.json.gz",
77459
- writePromise: writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
77845
+ writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
77460
77846
  });
77461
77847
  } else {
77462
77848
  await this.writeQueue.enqueue({
77463
- writePromise: writeFile3(this.layers0Path, JSON.stringify(this.layers0))
77464
- });
77465
- }
77466
- }
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")
77849
+ writePromise: () => writeFile3(this.layers0Path, JSON.stringify(this.layers0))
77472
77850
  });
77473
- } else {
77474
- await this.writeQueue.enqueue({ writePromise: writeFile3(rootPath, JSON.stringify(root0)) });
77475
77851
  }
77476
77852
  }
77477
77853
  async _createSlpk(tilesetPath) {
77478
77854
  if (this.options.slpk) {
77479
- const slpkTilesetPath = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
77855
+ const slpkTilesetPath = (0, import_path8.join)(tilesetPath, "SceneServer", "layers", "0");
77480
77856
  const slpkFileName = `${tilesetPath}.slpk`;
77481
77857
  await compressWithChildProcess(slpkTilesetPath, slpkFileName, 0, ".", this.options.sevenZipExe);
77482
77858
  try {
@@ -77486,87 +77862,47 @@ var I3SConverter = class {
77486
77862
  }
77487
77863
  }
77488
77864
  async _addChildrenWithNeighborsAndWriteFile(data) {
77489
- const childNodes = [];
77490
- await this._addChildren({ ...data, childNodes });
77491
- await this._addNeighborsAndWriteFile(data.parentNode, childNodes);
77865
+ await this._addChildren(data);
77866
+ await data.parentNode.addNeighbors();
77492
77867
  }
77493
77868
  async convertNestedTileset({
77494
- sourceTile,
77495
77869
  parentNode,
77496
- childNodes,
77497
- parentId,
77870
+ sourceTile,
77498
77871
  level
77499
77872
  }) {
77500
77873
  await this.sourceTileset._loadTile(sourceTile);
77501
77874
  await this._addChildren({
77502
77875
  parentNode,
77503
77876
  sourceTiles: sourceTile.children,
77504
- childNodes,
77505
- parentId,
77506
77877
  level: level + 1
77507
77878
  });
77508
77879
  await sourceTile.unloadContent();
77509
77880
  }
77510
77881
  async convertNode({
77511
- sourceTile,
77512
77882
  parentNode,
77513
- childNodes,
77514
- parentId,
77883
+ sourceTile,
77515
77884
  level
77516
77885
  }) {
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
- }
77886
+ const childNodes = await this._createNode(parentNode, sourceTile, level);
77887
+ await parentNode.addChildren(childNodes);
77528
77888
  }
77529
77889
  async _addChildren(data) {
77530
- const { childNodes, sourceTiles, parentNode, parentId, level } = data;
77890
+ const { sourceTiles, parentNode, level } = data;
77531
77891
  if (this.options.maxDepth && level > this.options.maxDepth) {
77532
77892
  return;
77533
77893
  }
77534
- const promises = [];
77535
77894
  for (const sourceTile of sourceTiles) {
77536
77895
  if (sourceTile.type === "json") {
77537
- promises.push(this.convertNestedTileset({ sourceTile, parentNode, childNodes, parentId, level }));
77896
+ await this.convertNestedTileset({ parentNode, sourceTile, level });
77538
77897
  } else {
77539
- promises.push(this.convertNode({ sourceTile, parentNode, childNodes, parentId, level }));
77898
+ await this.convertNode({ parentNode, sourceTile, level });
77540
77899
  }
77541
- await Promise.all(promises);
77542
77900
  if (sourceTile.id) {
77543
77901
  console.log(sourceTile.id);
77544
77902
  }
77545
77903
  }
77546
77904
  }
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) {
77905
+ async _createNode(parentNode, sourceTile, level) {
77570
77906
  this._checkAddRefinementTypeForTile(sourceTile);
77571
77907
  await this._updateTilesetOptions();
77572
77908
  await this.sourceTileset._loadTile(sourceTile);
@@ -77575,13 +77911,15 @@ var I3SConverter = class {
77575
77911
  if (propertyTable && !this.layers0?.attributeStorageInfo?.length) {
77576
77912
  this._convertPropertyTableToNodeAttributes(propertyTable);
77577
77913
  }
77578
- const resourcesData = await this._convertResources(sourceTile, parentId, propertyTable);
77914
+ const resourcesData = await this._convertResources(sourceTile, parentNode.inPageId, propertyTable);
77579
77915
  const nodes = [];
77916
+ const nodeIds = [];
77580
77917
  const nodesInPage = [];
77581
77918
  const emptyResources = {
77582
77919
  geometry: null,
77583
77920
  compressedGeometry: null,
77584
77921
  texture: null,
77922
+ hasUvRegions: false,
77585
77923
  sharedResources: null,
77586
77924
  meshMaterial: null,
77587
77925
  vertexCount: null,
@@ -77596,25 +77934,26 @@ var I3SConverter = class {
77596
77934
  }
77597
77935
  const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
77598
77936
  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);
77937
+ const nodeInPage = await this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentNode.inPageId, resources);
77938
+ const nodeData = await NodeIndexDocument.createNodeIndexDocument(parentNode, boundingVolumes, lodSelection, nodeInPage, resources);
77939
+ const node2 = await new NodeIndexDocument(nodeInPage.index, this).addData(nodeData);
77940
+ nodes.push(node2);
77601
77941
  if (nodeInPage.mesh) {
77602
- await this._writeResources(resources, node2.path);
77942
+ await this._writeResources(resources, node2.id);
77603
77943
  }
77604
77944
  if (this.validate) {
77605
- this.boundingVolumeWarnings = validateNodeBoundingVolumes(node2);
77945
+ this.boundingVolumeWarnings = validateNodeBoundingVolumes(nodeData);
77606
77946
  if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
77607
77947
  console.warn("Bounding Volume Warnings: ", ...this.boundingVolumeWarnings);
77608
77948
  }
77609
77949
  }
77610
- nodes.push(node2);
77950
+ nodeIds.push(nodeInPage.index);
77611
77951
  nodesInPage.push(nodeInPage);
77612
77952
  }
77613
77953
  sourceTile.unloadContent();
77614
77954
  await this._addChildrenWithNeighborsAndWriteFile({
77615
77955
  parentNode: nodes[0],
77616
77956
  sourceTiles: sourceTile.children,
77617
- parentId: nodesInPage[0].index,
77618
77957
  level: level + 1
77619
77958
  });
77620
77959
  return nodes;
@@ -77628,11 +77967,11 @@ var I3SConverter = class {
77628
77967
  halfSize: [],
77629
77968
  quaternion: []
77630
77969
  };
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);
77970
+ 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
77971
  return resourcesData;
77633
77972
  }
77634
- _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
77635
- const { meshMaterial, texture, vertexCount, featureCount, geometry } = resources;
77973
+ async _updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources) {
77974
+ const { meshMaterial, texture, vertexCount, featureCount, geometry, hasUvRegions } = resources;
77636
77975
  const nodeInPage = {
77637
77976
  index: 0,
77638
77977
  lodThreshold: maxScreenThresholdSQ.maxError,
@@ -77642,7 +77981,7 @@ var I3SConverter = class {
77642
77981
  if (geometry && this.isContentSupported(sourceTile)) {
77643
77982
  nodeInPage.mesh = {
77644
77983
  geometry: {
77645
- definition: texture ? 0 : 1,
77984
+ definition: this.findOrCreateGeometryDefinition(Boolean(texture), hasUvRegions),
77646
77985
  resource: 0
77647
77986
  },
77648
77987
  attribute: {
@@ -77654,64 +77993,29 @@ var I3SConverter = class {
77654
77993
  };
77655
77994
  }
77656
77995
  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);
77996
+ let node2;
77997
+ if (!nodeId) {
77998
+ node2 = await this.nodePages.push(nodeInPage, parentId);
77661
77999
  } else {
77662
- nodeId = this.nodePages.push(nodeInPage, parentId);
78000
+ node2 = await this.nodePages.getNodeById(nodeId);
77663
78001
  }
78002
+ NodePages.updateAll(node2, nodeInPage);
77664
78003
  if (meshMaterial) {
77665
- this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
78004
+ NodePages.updateMaterialByNodeId(node2, this._findOrCreateMaterial(meshMaterial));
77666
78005
  }
77667
78006
  if (texture) {
77668
78007
  const texelCountHint = texture.image.height * texture.image.width;
77669
- this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);
78008
+ NodePages.updateTexelCountHintByNodeId(node2, texelCountHint);
77670
78009
  }
77671
78010
  if (vertexCount) {
77672
78011
  this.vertexCounter += vertexCount;
77673
- this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);
78012
+ NodePages.updateVertexCountByNodeId(node2, vertexCount);
77674
78013
  }
77675
- this.nodePages.updateNodeAttributeByNodeId(nodeId);
78014
+ NodePages.updateNodeAttributeByNodeId(node2);
77676
78015
  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
- }
78016
+ NodePages.updateFeatureCountByNodeId(node2, featureCount);
77714
78017
  }
78018
+ this.nodePages.saveNode(node2);
77715
78019
  return node2;
77716
78020
  }
77717
78021
  async _writeResources(resources, nodePath) {
@@ -77722,8 +78026,8 @@ var I3SConverter = class {
77722
78026
  sharedResources,
77723
78027
  attributes
77724
78028
  } = resources;
77725
- const childPath = (0, import_path7.join)(this.layers0Path, "nodes", nodePath);
77726
- const slpkChildPath = (0, import_path7.join)("nodes", nodePath);
78029
+ const childPath = (0, import_path8.join)(this.layers0Path, "nodes", nodePath);
78030
+ const slpkChildPath = (0, import_path8.join)("nodes", nodePath);
77727
78031
  await this._writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath);
77728
78032
  await this._writeShared(sharedResources, childPath, slpkChildPath, nodePath);
77729
78033
  await this._writeTexture(texture, childPath, slpkChildPath);
@@ -77731,28 +78035,28 @@ var I3SConverter = class {
77731
78035
  }
77732
78036
  async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath) {
77733
78037
  if (this.options.slpk) {
77734
- const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
78038
+ const slpkGeometryPath = (0, import_path8.join)(childPath, "geometries");
77735
78039
  await this.writeQueue.enqueue({
77736
78040
  archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
77737
- writePromise: writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
78041
+ writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
77738
78042
  });
77739
78043
  } else {
77740
- const geometryPath = (0, import_path7.join)(childPath, "geometries/0/");
78044
+ const geometryPath = (0, import_path8.join)(childPath, "geometries/0/");
77741
78045
  await this.writeQueue.enqueue({
77742
- writePromise: writeFile3(geometryPath, geometryBuffer, "index.bin")
78046
+ writePromise: () => writeFile3(geometryPath, geometryBuffer, "index.bin")
77743
78047
  });
77744
78048
  }
77745
78049
  if (this.options.draco) {
77746
78050
  if (this.options.slpk) {
77747
- const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
78051
+ const slpkCompressedGeometryPath = (0, import_path8.join)(childPath, "geometries");
77748
78052
  await this.writeQueue.enqueue({
77749
78053
  archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
77750
- writePromise: writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
78054
+ writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
77751
78055
  });
77752
78056
  } else {
77753
- const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
78057
+ const compressedGeometryPath = (0, import_path8.join)(childPath, "geometries/1/");
77754
78058
  await this.writeQueue.enqueue({
77755
- writePromise: writeFile3(compressedGeometryPath, compressedGeometry, "index.bin")
78059
+ writePromise: () => writeFile3(compressedGeometryPath, compressedGeometry, "index.bin")
77756
78060
  });
77757
78061
  }
77758
78062
  }
@@ -77762,17 +78066,17 @@ var I3SConverter = class {
77762
78066
  return;
77763
78067
  }
77764
78068
  sharedResources.nodePath = nodePath;
77765
- const sharedData = (0, import_json_map_transform6.default)(sharedResources, SHARED_RESOURCES());
78069
+ const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
77766
78070
  const sharedDataStr = JSON.stringify(sharedData);
77767
78071
  if (this.options.slpk) {
77768
- const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
78072
+ const slpkSharedPath = (0, import_path8.join)(childPath, "shared");
77769
78073
  await this.writeQueue.enqueue({
77770
78074
  archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
77771
- writePromise: writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
78075
+ writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
77772
78076
  });
77773
78077
  } else {
77774
- const sharedPath = (0, import_path7.join)(childPath, "shared/");
77775
- await this.writeQueue.enqueue({ writePromise: writeFile3(sharedPath, sharedDataStr) });
78078
+ const sharedPath = (0, import_path8.join)(childPath, "shared/");
78079
+ await this.writeQueue.enqueue({ writePromise: () => writeFile3(sharedPath, sharedDataStr) });
77776
78080
  }
77777
78081
  }
77778
78082
  async _writeTexture(texture, childPath, slpkChildPath) {
@@ -77811,21 +78115,22 @@ var I3SConverter = class {
77811
78115
  }
77812
78116
  if (!this.layers0.textureSetDefinitions.length) {
77813
78117
  this.layers0.textureSetDefinitions.push({ formats: formats2 });
78118
+ this.layers0.textureSetDefinitions.push({ formats: formats2, atlas: true });
77814
78119
  }
77815
78120
  }
77816
78121
  }
77817
78122
  async writeTextureFile(textureData, name10, format, childPath, slpkChildPath) {
77818
78123
  if (this.options.slpk) {
77819
- const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
78124
+ const slpkTexturePath = (0, import_path8.join)(childPath, "textures");
77820
78125
  const compress = false;
77821
78126
  await this.writeQueue.enqueue({
77822
78127
  archiveKey: `${slpkChildPath}/textures/${name10}.${format}`,
77823
- writePromise: writeFileForSlpk(slpkTexturePath, textureData, `${name10}.${format}`, compress)
78128
+ writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name10}.${format}`, compress)
77824
78129
  });
77825
78130
  } else {
77826
- const texturePath = (0, import_path7.join)(childPath, `textures/${name10}/`);
78131
+ const texturePath = (0, import_path8.join)(childPath, `textures/${name10}/`);
77827
78132
  await this.writeQueue.enqueue({
77828
- writePromise: writeFile3(texturePath, textureData, `index.${format}`)
78133
+ writePromise: () => writeFile3(texturePath, textureData, `index.${format}`)
77829
78134
  });
77830
78135
  }
77831
78136
  }
@@ -77835,15 +78140,15 @@ var I3SConverter = class {
77835
78140
  const folderName = this.layers0.attributeStorageInfo[index].key;
77836
78141
  const fileBuffer = new Uint8Array(attributes[index]);
77837
78142
  if (this.options.slpk) {
77838
- const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
78143
+ const slpkAttributesPath = (0, import_path8.join)(childPath, "attributes", folderName);
77839
78144
  await this.writeQueue.enqueue({
77840
78145
  archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
77841
- writePromise: writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
78146
+ writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
77842
78147
  });
77843
78148
  } else {
77844
- const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
78149
+ const attributesPath = (0, import_path8.join)(childPath, `attributes/${folderName}/0`);
77845
78150
  await this.writeQueue.enqueue({
77846
- writePromise: writeFile3(attributesPath, fileBuffer, "index.bin")
78151
+ writePromise: () => writeFile3(attributesPath, fileBuffer, "index.bin")
77847
78152
  });
77848
78153
  }
77849
78154
  }
@@ -77864,12 +78169,22 @@ var I3SConverter = class {
77864
78169
  _findOrCreateMaterial(material) {
77865
78170
  const hash = (0, import_md52.default)(JSON.stringify(material));
77866
78171
  if (this.materialMap.has(hash)) {
77867
- return this.materialMap.get(hash);
78172
+ return this.materialMap.get(hash) || 0;
77868
78173
  }
77869
78174
  const newMaterialId = this.materialDefinitions.push(material) - 1;
77870
78175
  this.materialMap.set(hash, newMaterialId);
77871
78176
  return newMaterialId;
77872
78177
  }
78178
+ findOrCreateGeometryDefinition(hasTexture, hasUvRegions) {
78179
+ const geometryConfig = { hasTexture, hasUvRegions };
78180
+ const hash = (0, import_md52.default)(JSON.stringify(geometryConfig));
78181
+ if (this.geometryMap.has(hash)) {
78182
+ return this.geometryMap.get(hash) || 0;
78183
+ }
78184
+ const newGeometryId = this.geometryConfigs.push(geometryConfig) - 1;
78185
+ this.geometryMap.set(hash, newGeometryId);
78186
+ return newGeometryId;
78187
+ }
77873
78188
  _convertPropertyTableToNodeAttributes(propertyTable) {
77874
78189
  let attributeIndex = 0;
77875
78190
  const propertyTableWithObjectId = {
@@ -77965,12 +78280,12 @@ var I3SConverter = class {
77965
78280
  };
77966
78281
 
77967
78282
  // src/3d-tiles-converter/3d-tiles-converter.ts
77968
- var import_path8 = __toModule(require("path"));
78283
+ var import_path9 = __toModule(require("path"));
77969
78284
  var import_process3 = __toModule(require("process"));
77970
- var import_json_map_transform8 = __toModule(require_json_map_transform());
78285
+ var import_json_map_transform10 = __toModule(require_json_map_transform());
77971
78286
 
77972
78287
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
77973
- var import_core27 = __toModule(require_es54());
78288
+ var import_core28 = __toModule(require_es54());
77974
78289
  var import_geospatial11 = __toModule(require_es55());
77975
78290
 
77976
78291
  // ../i3s/src/types.ts
@@ -78035,7 +78350,7 @@ function getConstructorForDataFormat(dataType) {
78035
78350
  }
78036
78351
  var GL_TYPE_MAP = {
78037
78352
  UInt8: import_constants10.default.UNSIGNED_BYTE,
78038
- UInt16: import_constants10.default.UNSIGNED_INT,
78353
+ UInt16: import_constants10.default.UNSIGNED_SHORT,
78039
78354
  Float32: import_constants10.default.FLOAT,
78040
78355
  UInt32: import_constants10.default.UNSIGNED_INT,
78041
78356
  UInt64: import_constants10.default.DOUBLE
@@ -78130,12 +78445,12 @@ function parseStringsAttribute(arrayBuffer) {
78130
78445
  }
78131
78446
 
78132
78447
  // ../i3s/src/i3s-attribute-loader.ts
78133
- var VERSION12 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78448
+ var VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78134
78449
  var I3SAttributeLoader = {
78135
78450
  name: "I3S Attribute",
78136
78451
  id: "i3s-attribute",
78137
78452
  module: "i3s",
78138
- version: VERSION12,
78453
+ version: VERSION13,
78139
78454
  mimeTypes: ["application/binary"],
78140
78455
  parse: parse6,
78141
78456
  extensions: ["bin"],
@@ -78216,7 +78531,7 @@ async function loadFeatureAttributeData(attributeName, { attributeUrls }, { attr
78216
78531
  }
78217
78532
 
78218
78533
  // ../i3s/src/lib/parsers/parse-i3s-tile-content.ts
78219
- var scratchVector6 = new import_core27.Vector3([0, 0, 0]);
78534
+ var scratchVector6 = new import_core28.Vector3([0, 0, 0]);
78220
78535
  function getLoaderForTextureFormat(textureFormat) {
78221
78536
  switch (textureFormat) {
78222
78537
  case "ktx-etc2":
@@ -78237,7 +78552,7 @@ async function parseI3STileContent(arrayBuffer, tileOptions, tilesetOptions, opt
78237
78552
  indices: null,
78238
78553
  featureIds: [],
78239
78554
  vertexCount: 0,
78240
- modelMatrix: new import_core27.Matrix4(),
78555
+ modelMatrix: new import_core28.Matrix4(),
78241
78556
  coordinateSystem: 0,
78242
78557
  byteLength: 0,
78243
78558
  texture: null
@@ -78344,7 +78659,7 @@ async function parseI3SNodeGeometry(arrayBuffer, content, tileOptions, tilesetOp
78344
78659
  normals: attributes.normal,
78345
78660
  colors: normalizeAttribute(attributes.color),
78346
78661
  texCoords: attributes.uv0,
78347
- uvRegions: normalizeAttribute(attributes.uvRegion)
78662
+ uvRegions: normalizeAttribute(attributes.uvRegion || attributes.region)
78348
78663
  };
78349
78664
  content.indices = indices || null;
78350
78665
  if (attributes.id && attributes.id.value) {
@@ -78462,9 +78777,9 @@ function parsePositions2(attribute, options) {
78462
78777
  const mbs = options.mbs;
78463
78778
  const value = attribute.value;
78464
78779
  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();
78780
+ const enuMatrix = new import_core28.Matrix4();
78781
+ const cartographicOrigin = new import_core28.Vector3(mbs[0], mbs[1], mbs[2]);
78782
+ const cartesianOrigin = new import_core28.Vector3();
78468
78783
  import_geospatial11.Ellipsoid.WGS84.cartographicToCartesian(cartographicOrigin, cartesianOrigin);
78469
78784
  import_geospatial11.Ellipsoid.WGS84.eastNorthUpToFixedFrame(cartesianOrigin, enuMatrix);
78470
78785
  attribute.value = offsetsToCartesians(value, metadata, cartographicOrigin);
@@ -78491,7 +78806,7 @@ function getModelMatrix(positions) {
78491
78806
  const metadata = positions.metadata;
78492
78807
  const scaleX = metadata?.["i3s-scale_x"]?.double || 1;
78493
78808
  const scaleY = metadata?.["i3s-scale_y"]?.double || 1;
78494
- const modelMatrix = new import_core27.Matrix4();
78809
+ const modelMatrix = new import_core28.Matrix4();
78495
78810
  modelMatrix[0] = scaleX;
78496
78811
  modelMatrix[5] = scaleY;
78497
78812
  return modelMatrix;
@@ -78591,13 +78906,13 @@ function getFeatureIdsFromFeatureIndexMetadata(featureIndex) {
78591
78906
  }
78592
78907
 
78593
78908
  // ../i3s/src/i3s-content-loader.ts
78594
- var VERSION13 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
78909
+ var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "beta";
78595
78910
  var I3SContentLoader = {
78596
78911
  name: "I3S Content (Indexed Scene Layers)",
78597
78912
  id: isBrowser2 ? "i3s-content" : "i3s-content-nodejs",
78598
78913
  module: "i3s",
78599
78914
  worker: true,
78600
- version: VERSION13,
78915
+ version: VERSION14,
78601
78916
  mimeTypes: ["application/octet-stream"],
78602
78917
  parse: parse7,
78603
78918
  extensions: ["bin"],
@@ -78620,7 +78935,7 @@ var import_culling7 = __toModule(require_es56());
78620
78935
  var import_geospatial12 = __toModule(require_es55());
78621
78936
 
78622
78937
  // ../i3s/src/i3s-node-page-loader.ts
78623
- var VERSION14 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78938
+ var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78624
78939
  async function parseNodePage(data) {
78625
78940
  return JSON.parse(new TextDecoder().decode(data));
78626
78941
  }
@@ -78628,7 +78943,7 @@ var I3SNodePageLoader = {
78628
78943
  name: "I3S Node Page",
78629
78944
  id: "i3s-node-page",
78630
78945
  module: "i3s",
78631
- version: VERSION14,
78946
+ version: VERSION15,
78632
78947
  mimeTypes: ["application/json"],
78633
78948
  parse: parse8,
78634
78949
  extensions: ["json"],
@@ -78884,15 +79199,16 @@ async function normalizeTilesetData(tileset, options, context) {
78884
79199
  }
78885
79200
 
78886
79201
  // ../i3s/src/i3s-loader.ts
78887
- var VERSION15 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79202
+ var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
78888
79203
  var TILESET_REGEX = /layers\/[0-9]+$/;
78889
79204
  var TILE_HEADER_REGEX = /nodes\/([0-9-]+|root)$/;
78890
79205
  var SLPK_HEX = "504b0304";
79206
+ var POINT_CLOUD = "PointCloud";
78891
79207
  var I3SLoader = {
78892
79208
  name: "I3S (Indexed Scene Layers)",
78893
79209
  id: "i3s",
78894
79210
  module: "i3s",
78895
- version: VERSION15,
79211
+ version: VERSION16,
78896
79212
  mimeTypes: ["application/octet-stream"],
78897
79213
  parse: parseI3S,
78898
79214
  extensions: ["bin"],
@@ -78946,6 +79262,9 @@ async function parseTileContent(arrayBuffer, options) {
78946
79262
  }
78947
79263
  async function parseTileset2(data, options, context) {
78948
79264
  const tilesetJson = JSON.parse(new TextDecoder().decode(data));
79265
+ if (tilesetJson?.layerType === POINT_CLOUD) {
79266
+ throw new Error("Point Cloud layers currently are not supported by I3SLoader");
79267
+ }
78949
79268
  tilesetJson.loader = I3SLoader;
78950
79269
  await normalizeTilesetData(tilesetJson, options, context);
78951
79270
  return tilesetJson;
@@ -78962,7 +79281,7 @@ function getMagicNumber(data) {
78962
79281
  }
78963
79282
 
78964
79283
  // src/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.ts
78965
- var import_core31 = __toModule(require_es54());
79284
+ var import_core32 = __toModule(require_es54());
78966
79285
  var import_geospatial13 = __toModule(require_es55());
78967
79286
  var import_culling8 = __toModule(require_es56());
78968
79287
  function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
@@ -78971,13 +79290,13 @@ function i3sObbTo3dTilesObb(i3SObb, geoidHeightModel) {
78971
79290
  i3SObb.center[1],
78972
79291
  i3SObb.center[2] + geoidHeightModel.getHeight(i3SObb.center[1], i3SObb.center[0])
78973
79292
  ];
78974
- const cartesianCenter = import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core31.Vector3());
79293
+ const cartesianCenter = import_geospatial13.Ellipsoid.WGS84.cartographicToCartesian(tiles3DCenter, new import_core32.Vector3());
78975
79294
  const tiles3DObb = new import_culling8.OrientedBoundingBox().fromCenterHalfSizeQuaternion(cartesianCenter, i3SObb.halfSize, i3SObb.quaternion);
78976
79295
  return [...tiles3DObb.center, ...tiles3DObb.halfAxes.toArray()];
78977
79296
  }
78978
79297
 
78979
79298
  // src/3d-tiles-converter/json-templates/tileset.ts
78980
- var import_json_map_transform7 = __toModule(require_json_map_transform());
79299
+ var import_json_map_transform9 = __toModule(require_json_map_transform());
78981
79300
  var ASSET = () => ({
78982
79301
  version: {
78983
79302
  path: "version",
@@ -78996,13 +79315,13 @@ var TILE = () => ({
78996
79315
  },
78997
79316
  children: {
78998
79317
  path: "children",
78999
- transform: (val) => val.map((tile) => (0, import_json_map_transform7.default)(tile, TILE()))
79318
+ transform: (val) => val.map((tile) => (0, import_json_map_transform9.default)(tile, TILE()))
79000
79319
  }
79001
79320
  });
79002
79321
  var TILESET = () => ({
79003
79322
  asset: {
79004
79323
  path: "asset",
79005
- transform: (val) => (0, import_json_map_transform7.default)(val, ASSET())
79324
+ transform: (val) => (0, import_json_map_transform9.default)(val, ASSET())
79006
79325
  },
79007
79326
  geometricError: {
79008
79327
  path: "root",
@@ -79010,17 +79329,17 @@ var TILESET = () => ({
79010
79329
  },
79011
79330
  root: {
79012
79331
  path: "root",
79013
- transform: (val) => (0, import_json_map_transform7.default)(val, TILE())
79332
+ transform: (val) => (0, import_json_map_transform9.default)(val, TILE())
79014
79333
  }
79015
79334
  });
79016
79335
 
79017
79336
  // src/3d-tiles-attributes-worker.ts
79018
- var VERSION16 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79337
+ var VERSION17 = typeof __VERSION__ !== "undefined" ? __VERSION__ : "latest";
79019
79338
  var Tile3dAttributesWorker = {
79020
79339
  id: "3d-tiles-attributes",
79021
79340
  name: "3DTiles Attributes Worker",
79022
79341
  module: "tile-converter",
79023
- version: VERSION16,
79342
+ version: VERSION17,
79024
79343
  options: {
79025
79344
  featureAttributes: null
79026
79345
  }
@@ -79071,7 +79390,7 @@ var Tiles3DConverter = class {
79071
79390
  if (!rootNode.header.obb) {
79072
79391
  rootNode.header.obb = createObbFromMbs(rootNode.header.mbs);
79073
79392
  }
79074
- this.tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
79393
+ this.tilesetPath = (0, import_path9.join)(`${outputPath}`, `${tilesetName}`);
79075
79394
  this.attributeStorageInfo = sourceTilesetJson.attributeStorageInfo;
79076
79395
  try {
79077
79396
  await removeDir(this.tilesetPath);
@@ -79085,7 +79404,7 @@ var Tiles3DConverter = class {
79085
79404
  children: []
79086
79405
  };
79087
79406
  await this._addChildren(rootNode, rootTile, 1);
79088
- const tileset = (0, import_json_map_transform8.default)({ root: rootTile }, TILESET());
79407
+ const tileset = (0, import_json_map_transform10.default)({ root: rootTile }, TILESET());
79089
79408
  await writeFile3(this.tilesetPath, JSON.stringify(tileset), "tileset.json");
79090
79409
  this._finishConversion({ slpk: false, outputPath, tilesetName });
79091
79410
  const workerFarm = WorkerFarm.getWorkerFarm({});
@@ -79160,7 +79479,7 @@ var Tiles3DConverter = class {
79160
79479
  console.log(`Node conversion: ${nodeUrl}`);
79161
79480
  header = await load(nodeUrl, loader, options);
79162
79481
  }
79163
- return new TileHeader(this.sourceTileset, header, parentNode);
79482
+ return new Tile3D(this.sourceTileset, header, parentNode);
79164
79483
  }
79165
79484
  _relativeUrlToFullUrl(baseUrl, relativeUrl) {
79166
79485
  let resultArray = baseUrl.split("/");