@loaders.gl/tile-converter 3.4.0-alpha.2 → 3.4.0-alpha.4

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 (156) 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.min.js +90 -2875
  4. package/dist/dist.min.js +1823 -19725
  5. package/dist/es5/3d-tiles-attributes-worker.js +1 -2
  6. package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
  7. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +264 -287
  8. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  9. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +89 -113
  10. package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  11. package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
  12. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -2
  13. package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  14. package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  15. package/dist/es5/constants.js.map +1 -1
  16. package/dist/es5/converter-cli.js +67 -81
  17. package/dist/es5/converter-cli.js.map +1 -1
  18. package/dist/es5/deps-installer/deps-installer.js +64 -69
  19. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  20. package/dist/es5/i3s-attributes-worker.js +1 -2
  21. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  22. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +0 -8
  23. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  24. package/dist/es5/i3s-converter/helpers/coordinate-converter.js +0 -5
  25. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  26. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +14 -16
  27. package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
  28. package/dist/es5/i3s-converter/helpers/feature-attributes.js +1 -11
  29. package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
  30. package/dist/es5/i3s-converter/helpers/geometry-attributes.js +3 -10
  31. package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  32. package/dist/es5/i3s-converter/helpers/geometry-converter.js +427 -457
  33. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  34. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +0 -2
  35. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  36. package/dist/es5/i3s-converter/helpers/node-debug.js +3 -13
  37. package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
  38. package/dist/es5/i3s-converter/helpers/node-index-document.js +293 -318
  39. package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
  40. package/dist/es5/i3s-converter/helpers/node-pages.js +279 -319
  41. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  42. package/dist/es5/i3s-converter/i3s-converter.js +964 -1030
  43. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  44. package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
  45. package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
  46. package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
  47. package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
  48. package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
  49. package/dist/es5/i3s-converter/json-templates/shared-resources.js +1 -1
  50. package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
  51. package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
  52. package/dist/es5/i3s-converter/types.js.map +1 -1
  53. package/dist/es5/i3s-server/app.js.map +1 -1
  54. package/dist/es5/i3s-server/controllers/index-controller.js +28 -30
  55. package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
  56. package/dist/es5/i3s-server/routes/index.js +15 -18
  57. package/dist/es5/i3s-server/routes/index.js.map +1 -1
  58. package/dist/es5/index.js.map +1 -1
  59. package/dist/es5/lib/utils/compress-util.js +198 -218
  60. package/dist/es5/lib/utils/compress-util.js.map +1 -1
  61. package/dist/es5/lib/utils/file-utils.js +118 -128
  62. package/dist/es5/lib/utils/file-utils.js.map +1 -1
  63. package/dist/es5/lib/utils/lod-conversion-utils.js +0 -1
  64. package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
  65. package/dist/es5/lib/utils/queue.js.map +1 -1
  66. package/dist/es5/lib/utils/statistic-utills.js +81 -85
  67. package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
  68. package/dist/es5/lib/utils/write-queue.js +84 -92
  69. package/dist/es5/lib/utils/write-queue.js.map +1 -1
  70. package/dist/es5/pgm-loader.js +7 -10
  71. package/dist/es5/pgm-loader.js.map +1 -1
  72. package/dist/es5/workers/3d-tiles-attributes-worker.js +7 -9
  73. package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
  74. package/dist/es5/workers/i3s-attributes-worker.js +10 -12
  75. package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
  76. package/dist/esm/3d-tiles-attributes-worker.js +1 -3
  77. package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
  78. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +1 -15
  79. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  80. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +0 -12
  81. package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
  82. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -1
  83. package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
  84. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +0 -3
  85. package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
  86. package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
  87. package/dist/esm/bundle.js +0 -1
  88. package/dist/esm/bundle.js.map +1 -1
  89. package/dist/esm/converter-cli.js +0 -11
  90. package/dist/esm/converter-cli.js.map +1 -1
  91. package/dist/esm/deps-installer/deps-installer.js +1 -4
  92. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  93. package/dist/esm/i3s-attributes-worker.js +1 -3
  94. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  95. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +0 -8
  96. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  97. package/dist/esm/i3s-converter/helpers/coordinate-converter.js +0 -5
  98. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  99. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +0 -1
  100. package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
  101. package/dist/esm/i3s-converter/helpers/feature-attributes.js +0 -11
  102. package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
  103. package/dist/esm/i3s-converter/helpers/geometry-attributes.js +0 -7
  104. package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
  105. package/dist/esm/i3s-converter/helpers/geometry-converter.js +30 -56
  106. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  107. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +0 -3
  108. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  109. package/dist/esm/i3s-converter/helpers/node-debug.js +3 -13
  110. package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
  111. package/dist/esm/i3s-converter/helpers/node-index-document.js +0 -14
  112. package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
  113. package/dist/esm/i3s-converter/helpers/node-pages.js +0 -18
  114. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  115. package/dist/esm/i3s-converter/i3s-converter.js +4 -42
  116. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  117. package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
  118. package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
  119. package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
  120. package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
  121. package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
  122. package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
  123. package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
  124. package/dist/esm/i3s-converter/types.js.map +1 -1
  125. package/dist/esm/i3s-server/app.js.map +1 -1
  126. package/dist/esm/i3s-server/controllers/index-controller.js +0 -2
  127. package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
  128. package/dist/esm/i3s-server/routes/index.js +0 -1
  129. package/dist/esm/i3s-server/routes/index.js.map +1 -1
  130. package/dist/esm/lib/utils/compress-util.js +1 -17
  131. package/dist/esm/lib/utils/compress-util.js.map +1 -1
  132. package/dist/esm/lib/utils/file-utils.js +0 -7
  133. package/dist/esm/lib/utils/file-utils.js.map +1 -1
  134. package/dist/esm/lib/utils/lod-conversion-utils.js +0 -2
  135. package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
  136. package/dist/esm/lib/utils/queue.js.map +1 -1
  137. package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
  138. package/dist/esm/lib/utils/write-queue.js +0 -2
  139. package/dist/esm/lib/utils/write-queue.js.map +1 -1
  140. package/dist/esm/pgm-loader.js +1 -3
  141. package/dist/esm/pgm-loader.js.map +1 -1
  142. package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
  143. package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
  144. package/dist/i3s-attributes-worker.js +2 -2
  145. package/dist/i3s-attributes-worker.js.map +3 -3
  146. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  147. package/dist/i3s-converter/helpers/geometry-converter.js +44 -6
  148. package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -1
  149. package/dist/i3s-converter/helpers/node-debug.js +10 -4
  150. package/dist/i3s-converter/helpers/node-pages.js +1 -1
  151. package/dist/i3s-converter/types.d.ts +1 -0
  152. package/dist/i3s-converter/types.d.ts.map +1 -1
  153. package/package.json +15 -16
  154. package/src/i3s-converter/helpers/geometry-converter.ts +59 -14
  155. package/src/i3s-converter/helpers/node-debug.ts +11 -5
  156. package/src/i3s-converter/types.ts +10 -0
@@ -10,7 +10,7 @@ import { createBoundingVolumesFromGeometry } from './coordinate-converter';
10
10
  import { prepareDataForAttributesConversion } from './gltf-attributes';
11
11
  import { handleBatchIdsExtensions } from './batch-ids-extensions';
12
12
  import { checkPropertiesLength, flattenPropertyTableByFeatureIds } from './feature-attributes';
13
-
13
+ import { GL } from '@loaders.gl/math';
14
14
  const DEFAULT_ROUGHNESS_FACTOR = 1;
15
15
  const DEFAULT_METALLIC_FACTOR = 1;
16
16
  const VALUES_PER_VERTEX = 3;
@@ -24,14 +24,12 @@ const BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ['CUSTOM_ATTRIBUTE_2', '_BATCHID', '
24
24
  const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
25
25
  const EXT_MESH_FEATURES = 'EXT_mesh_features';
26
26
  let scratchVector = new Vector3();
27
-
28
27
  export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
29
28
  var _tileContent$gltf;
30
29
  const useCartesianPositions = generateBoundingVolumes;
31
30
  const materialAndTextureList = await convertMaterials((_tileContent$gltf = tileContent.gltf) === null || _tileContent$gltf === void 0 ? void 0 : _tileContent$gltf.materials, shouldMergeMaterials);
32
31
  const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
33
32
  const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
34
-
35
33
  if (generateBoundingVolumes) {
36
34
  _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
37
35
  }
@@ -41,7 +39,6 @@ export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNod
41
39
  if (!convertedAttributesMap.has(originarMaterialId)) {
42
40
  continue;
43
41
  }
44
-
45
42
  const convertedAttributes = convertedAttributesMap.get(originarMaterialId);
46
43
  if (!convertedAttributes) {
47
44
  continue;
@@ -69,7 +66,6 @@ export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNod
69
66
  }
70
67
  return result;
71
68
  }
72
-
73
69
  function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel) {
74
70
  for (const attributes of convertedAttributesMap.values()) {
75
71
  const boundingVolumes = createBoundingVolumesFromGeometry(attributes.positions, geoidHeightModel);
@@ -84,7 +80,6 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
84
80
  }
85
81
  }
86
82
  }
87
-
88
83
  async function _makeNodeResources(_ref) {
89
84
  var _tileContent$gltf2;
90
85
  let {
@@ -145,7 +140,6 @@ async function _makeNodeResources(_ref) {
145
140
  boundingVolumes
146
141
  };
147
142
  }
148
-
149
143
  export async function convertAttributes(attributesData, materialAndTextureList, useCartesianPositions) {
150
144
  const {
151
145
  nodes,
@@ -180,7 +174,6 @@ export async function convertAttributes(attributesData, materialAndTextureList,
180
174
  attributesMap.delete(attrKey);
181
175
  continue;
182
176
  }
183
-
184
177
  if (attributes.featureIndicesGroups) {
185
178
  attributes.featureIndices = attributes.featureIndicesGroups.reduce((acc, value) => acc.concat(value));
186
179
  delete attributes.featureIndicesGroups;
@@ -188,7 +181,6 @@ export async function convertAttributes(attributesData, materialAndTextureList,
188
181
  }
189
182
  return attributesMap;
190
183
  }
191
-
192
184
  function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
193
185
  let matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
194
186
  if (nodes) {
@@ -197,7 +189,6 @@ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, a
197
189
  }
198
190
  }
199
191
  }
200
-
201
192
  function getCompositeTransformationMatrix(node, matrix) {
202
193
  let transformationMatrix = matrix;
203
194
  const {
@@ -220,7 +211,6 @@ function getCompositeTransformationMatrix(node, matrix) {
220
211
  }
221
212
  return transformationMatrix;
222
213
  }
223
-
224
214
  function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
225
215
  let matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
226
216
  const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
@@ -230,12 +220,10 @@ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, att
230
220
  }
231
221
  convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
232
222
  }
233
-
234
223
  function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap) {
235
224
  let useCartesianPositions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
236
225
  let matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
237
226
  for (const primitive of mesh.primitives) {
238
- var _primitive$indices, _primitive$indices2, _primitive$indices3, _primitive$indices4, _primitive$indices6;
239
227
  let outputAttributes = null;
240
228
  let materialUvRegion;
241
229
  if (primitive.material) {
@@ -256,12 +244,13 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
256
244
  if (!outputAttributes) {
257
245
  continue;
258
246
  }
247
+ const indices = getIndices(primitive);
259
248
  outputAttributes.positions = concatenateTypedArrays(outputAttributes.positions, transformVertexArray({
260
249
  vertices: attributes.POSITION.value,
261
250
  cartographicOrigin,
262
251
  cartesianModelMatrix,
263
252
  nodeMatrix: matrix,
264
- indices: (_primitive$indices = primitive.indices) === null || _primitive$indices === void 0 ? void 0 : _primitive$indices.value,
253
+ indices,
265
254
  attributeSpecificTransformation: transformVertexPositions,
266
255
  useCartesianPositions
267
256
  }));
@@ -270,21 +259,41 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
270
259
  cartographicOrigin,
271
260
  cartesianModelMatrix,
272
261
  nodeMatrix: matrix,
273
- indices: (_primitive$indices2 = primitive.indices) === null || _primitive$indices2 === void 0 ? void 0 : _primitive$indices2.value,
262
+ indices,
274
263
  attributeSpecificTransformation: transformVertexNormals,
275
264
  useCartesianPositions: false
276
265
  }));
277
- outputAttributes.texCoords = concatenateTypedArrays(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, (_primitive$indices3 = primitive.indices) === null || _primitive$indices3 === void 0 ? void 0 : _primitive$indices3.value));
278
- outputAttributes.colors = concatenateTypedArrays(outputAttributes.colors, flattenColors(attributes.COLOR_0, (_primitive$indices4 = primitive.indices) === null || _primitive$indices4 === void 0 ? void 0 : _primitive$indices4.value));
266
+ outputAttributes.texCoords = concatenateTypedArrays(outputAttributes.texCoords, flattenTexCoords(attributes.TEXCOORD_0 && attributes.TEXCOORD_0.value, indices));
267
+ outputAttributes.colors = concatenateTypedArrays(outputAttributes.colors, flattenColors(attributes.COLOR_0, indices));
279
268
  if (materialUvRegion) {
280
- var _primitive$indices5;
281
- outputAttributes.uvRegions = concatenateTypedArrays(outputAttributes.uvRegions, createUvRegion(materialUvRegion, (_primitive$indices5 = primitive.indices) === null || _primitive$indices5 === void 0 ? void 0 : _primitive$indices5.value));
269
+ outputAttributes.uvRegions = concatenateTypedArrays(outputAttributes.uvRegions, createUvRegion(materialUvRegion, indices));
282
270
  }
283
271
  outputAttributes.featureIndicesGroups = outputAttributes.featureIndicesGroups || [];
284
- outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), (_primitive$indices6 = primitive.indices) === null || _primitive$indices6 === void 0 ? void 0 : _primitive$indices6.value));
272
+ outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), indices));
273
+ }
274
+ }
275
+ function getIndices(primitive) {
276
+ var _primitive$indices;
277
+ let indices = (_primitive$indices = primitive.indices) === null || _primitive$indices === void 0 ? void 0 : _primitive$indices.value;
278
+ if (indices && primitive.mode === GL.TRIANGLE_STRIP) {
279
+ const TypedArrayConstructor = indices.constructor;
280
+ const newIndices = new TypedArrayConstructor((indices.length - 2) * 3);
281
+ let triangleIndex = 0;
282
+ let currentTriangle = indices.slice(0, 3);
283
+ newIndices.set(currentTriangle, 0);
284
+ for (let i = 1; i + 2 < indices.length; i++) {
285
+ triangleIndex += 3;
286
+ currentTriangle = indices.slice(i, i + 3);
287
+ if (i % 2 === 0) {
288
+ newIndices.set(currentTriangle, triangleIndex);
289
+ } else {
290
+ newIndices.set(currentTriangle.reverse(), triangleIndex);
291
+ }
292
+ }
293
+ indices = newIndices;
285
294
  }
295
+ return indices;
286
296
  }
287
-
288
297
  function transformVertexArray(args) {
289
298
  const {
290
299
  vertices,
@@ -306,7 +315,6 @@ function transformVertexArray(args) {
306
315
  }
307
316
  return newVertices;
308
317
  }
309
-
310
318
  function transformVertexPositions(vertexVector, calleeArgs) {
311
319
  const {
312
320
  cartesianModelMatrix,
@@ -325,7 +333,6 @@ function transformVertexPositions(vertexVector, calleeArgs) {
325
333
  vertexVector = vertexVector.subtract(cartographicOrigin);
326
334
  return vertexVector;
327
335
  }
328
-
329
336
  function transformVertexNormals(vertexVector, calleeArgs) {
330
337
  const {
331
338
  cartesianModelMatrix,
@@ -337,7 +344,6 @@ function transformVertexNormals(vertexVector, calleeArgs) {
337
344
  vertexVector = vertexVector.transformAsVector(cartesianModelMatrix);
338
345
  return vertexVector;
339
346
  }
340
-
341
347
  function flattenTexCoords(texCoords, indices) {
342
348
  const newTexCoords = new Float32Array(indices.length * VALUES_PER_TEX_COORD);
343
349
  if (!texCoords) {
@@ -352,7 +358,6 @@ function flattenTexCoords(texCoords, indices) {
352
358
  }
353
359
  return newTexCoords;
354
360
  }
355
-
356
361
  function flattenColors(colorsAttribute, indices) {
357
362
  const components = (colorsAttribute === null || colorsAttribute === void 0 ? void 0 : colorsAttribute.components) || VALUES_PER_COLOR_ELEMENT;
358
363
  const newColors = new Uint8Array(indices.length * components);
@@ -372,7 +377,6 @@ function flattenColors(colorsAttribute, indices) {
372
377
  }
373
378
  return newColors;
374
379
  }
375
-
376
380
  function createUvRegion(materialUvRegion, indices) {
377
381
  const result = new Uint16Array(indices.length * 4);
378
382
  for (let i = 0; i < result.length; i += 4) {
@@ -380,7 +384,6 @@ function createUvRegion(materialUvRegion, indices) {
380
384
  }
381
385
  return result;
382
386
  }
383
-
384
387
  function flattenBatchIds(batchedIds, indices) {
385
388
  if (!batchedIds.length || !indices.length) {
386
389
  return [];
@@ -392,7 +395,6 @@ function flattenBatchIds(batchedIds, indices) {
392
395
  }
393
396
  return newBatchIds;
394
397
  }
395
-
396
398
  function getBatchIds(attributes, primitive, images) {
397
399
  const batchIds = handleBatchIdsExtensions(attributes, primitive, images);
398
400
  if (batchIds.length) {
@@ -406,7 +408,6 @@ function getBatchIds(attributes, primitive, images) {
406
408
  }
407
409
  return [];
408
410
  }
409
-
410
411
  async function convertMaterials() {
411
412
  let sourceMaterials = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
412
413
  let shouldMergeMaterials = arguments.length > 1 ? arguments[1] : undefined;
@@ -419,7 +420,6 @@ async function convertMaterials() {
419
420
  }
420
421
  return materials;
421
422
  }
422
-
423
423
  async function mergeAllMaterials(materials) {
424
424
  const result = [];
425
425
  while (materials.length > 0) {
@@ -472,7 +472,6 @@ async function mergeAllMaterials(materials) {
472
472
  }
473
473
  return result;
474
474
  }
475
-
476
475
  async function mergeMaterials(material1, material2) {
477
476
  var _material1$texture, _material2$texture;
478
477
  if ((_material1$texture = material1.texture) !== null && _material1$texture !== void 0 && _material1$texture.bufferView && (_material2$texture = material2.texture) !== null && _material2$texture !== void 0 && _material2$texture.bufferView && material1.mergedMaterials && material2.mergedMaterials) {
@@ -495,7 +494,6 @@ async function mergeMaterials(material1, material2) {
495
494
  material1.mergedMaterials = material1.mergedMaterials.concat(material2.mergedMaterials);
496
495
  return material1;
497
496
  }
498
-
499
497
  function convertMaterial(sourceMaterial) {
500
498
  var _sourceMaterial$emiss, _sourceMaterial$pbrMe, _sourceMaterial$pbrMe2, _sourceMaterial$pbrMe3;
501
499
  const material = {
@@ -540,7 +538,6 @@ function convertMaterial(sourceMaterial) {
540
538
  mergedMaterials
541
539
  };
542
540
  }
543
-
544
541
  function convertAlphaMode(gltfAlphaMode) {
545
542
  switch (gltfAlphaMode) {
546
543
  case 'OPAQUE':
@@ -553,7 +550,6 @@ function convertAlphaMode(gltfAlphaMode) {
553
550
  return 'opaque';
554
551
  }
555
552
  }
556
-
557
553
  function getDefaultMaterial() {
558
554
  return {
559
555
  alphaMode: 'opaque',
@@ -563,7 +559,6 @@ function getDefaultMaterial() {
563
559
  }
564
560
  };
565
561
  }
566
-
567
562
  function getSharedResources(gltfMaterials, nodeId) {
568
563
  const i3sResources = {};
569
564
  if (!gltfMaterials || !gltfMaterials.length) {
@@ -583,7 +578,6 @@ function getSharedResources(gltfMaterials, nodeId) {
583
578
  }
584
579
  return i3sResources;
585
580
  }
586
-
587
581
  function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
588
582
  var _gltfMaterial$pbrMeta;
589
583
  const texture = (gltfMaterial === null || gltfMaterial === void 0 ? void 0 : (_gltfMaterial$pbrMeta = gltfMaterial.pbrMetallicRoughness) === null || _gltfMaterial$pbrMeta === void 0 ? void 0 : _gltfMaterial$pbrMeta.baseColorTexture) || gltfMaterial.emissiveTexture;
@@ -605,7 +599,6 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
605
599
  textureDefinitionInfo
606
600
  };
607
601
  }
608
-
609
602
  function extractSharedResourcesMaterialInfo(baseColorFactor) {
610
603
  let metallicFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
611
604
  const matDielectricColorComponent = 0.04 / 255;
@@ -625,7 +618,6 @@ function extractSharedResourcesMaterialInfo(baseColorFactor) {
625
618
  }
626
619
  };
627
620
  }
628
-
629
621
  function extractSharedResourcesTextureInfo(texture, nodeId) {
630
622
  var _texture$source, _texture$source2, _texture$source3;
631
623
  return {
@@ -637,7 +629,6 @@ function extractSharedResourcesTextureInfo(texture, nodeId) {
637
629
  }]
638
630
  };
639
631
  }
640
-
641
632
  function generateImageId(texture, nodeId) {
642
633
  var _texture$source4;
643
634
  const {
@@ -657,13 +648,11 @@ function generateImageId(texture, nodeId) {
657
648
  const imageId = BigInt("0b".concat(leftHalf.toString(2)).concat(rightHalf));
658
649
  return imageId.toString();
659
650
  }
660
-
661
651
  function makeFeatureIdsUnique(featureIds, featureIndices, featuresHashArray, batchTable) {
662
652
  const replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
663
653
  replaceIndicesByUnique(featureIndices, replaceMap);
664
654
  replaceIndicesByUnique(featureIds, replaceMap);
665
655
  }
666
-
667
656
  function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
668
657
  const featureMap = {};
669
658
  for (let index = 0; index < featureIds.length; index++) {
@@ -673,7 +662,6 @@ function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
673
662
  }
674
663
  return featureMap;
675
664
  }
676
-
677
665
  function generateStringFromBatchTableByIndex(batchTable, index) {
678
666
  let str = '';
679
667
  for (const key in batchTable) {
@@ -681,7 +669,6 @@ function generateStringFromBatchTableByIndex(batchTable, index) {
681
669
  }
682
670
  return str;
683
671
  }
684
-
685
672
  function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
686
673
  const batchTableStr = generateStringFromBatchTableByIndex(batchTable, index);
687
674
  const hash = md5(batchTableStr);
@@ -690,13 +677,11 @@ function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
690
677
  }
691
678
  return featuresHashArray.push(hash) - 1;
692
679
  }
693
-
694
680
  function replaceIndicesByUnique(indicesArray, featureMap) {
695
681
  for (let index = 0; index < indicesArray.length; index++) {
696
682
  indicesArray[index] = featureMap[indicesArray[index]];
697
683
  }
698
684
  }
699
-
700
685
  function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo) {
701
686
  const attributeBuffers = [];
702
687
  const needFlattenPropertyTable = checkPropertiesLength(featureIds, propertyTable);
@@ -713,7 +698,6 @@ function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attri
713
698
  }
714
699
  return attributeBuffers;
715
700
  }
716
-
717
701
  function generateAttributeBuffer(type, value) {
718
702
  let attributeBuffer;
719
703
  switch (type) {
@@ -732,25 +716,21 @@ function generateAttributeBuffer(type, value) {
732
716
  }
733
717
  return attributeBuffer;
734
718
  }
735
-
736
719
  function getAttributeType(key, attributeStorageInfo) {
737
720
  const attribute = attributeStorageInfo.find(attr => attr.name === key);
738
721
  return attribute.attributeValues.valueType;
739
722
  }
740
-
741
723
  function generateShortIntegerAttributeBuffer(featureIds) {
742
724
  const count = new Uint32Array([featureIds.length]);
743
725
  const valuesArray = new Uint32Array(featureIds);
744
726
  return concatenateArrayBuffers(count.buffer, valuesArray.buffer);
745
727
  }
746
-
747
728
  function generateDoubleAttributeBuffer(featureIds) {
748
729
  const count = new Uint32Array([featureIds.length]);
749
730
  const padding = new Uint8Array(4);
750
731
  const valuesArray = new Float64Array(featureIds);
751
732
  return concatenateArrayBuffers(count.buffer, padding.buffer, valuesArray.buffer);
752
733
  }
753
-
754
734
  function generateStringAttributeBuffer(batchAttributes) {
755
735
  const stringCountArray = new Uint32Array([batchAttributes.length]);
756
736
  let totalNumberOfBytes = 0;
@@ -767,7 +747,6 @@ function generateStringAttributeBuffer(batchAttributes) {
767
747
  const totalBytes = new Uint32Array([totalNumberOfBytes]);
768
748
  return concatenateArrayBuffers(stringCountArray.buffer, totalBytes.buffer, stringSizesArray.buffer, ...stringBufferArray);
769
749
  }
770
-
771
750
  function generateBigUint64Array(featureIds) {
772
751
  const typedFeatureIds = new BigUint64Array(featureIds.length);
773
752
  for (let index = 0; index < featureIds.length; index++) {
@@ -775,7 +754,6 @@ function generateBigUint64Array(featureIds) {
775
754
  }
776
755
  return typedFeatureIds;
777
756
  }
778
-
779
757
  async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
780
758
  const {
781
759
  positions,
@@ -827,7 +805,6 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
827
805
  }
828
806
  });
829
807
  }
830
-
831
808
  function generateFeatureIndexAttribute(featureIndex, faceRange) {
832
809
  const orderedFeatureIndices = new Uint32Array(featureIndex.length);
833
810
  let fillIndex = 0;
@@ -840,7 +817,6 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
840
817
  }
841
818
  return orderedFeatureIndices;
842
819
  }
843
-
844
820
  export function getPropertyTable(tileContent) {
845
821
  const batchTableJson = tileContent === null || tileContent === void 0 ? void 0 : tileContent.batchTableJson;
846
822
  if (batchTableJson) {
@@ -864,7 +840,6 @@ export function getPropertyTable(tileContent) {
864
840
  return null;
865
841
  }
866
842
  }
867
-
868
843
  function getPropertyTableExtension(tileContent) {
869
844
  var _tileContent$gltf3, _tileContent$gltf5, _tileContent$gltf5$ex;
870
845
  const extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
@@ -889,7 +864,6 @@ function getPropertyTableExtension(tileContent) {
889
864
  extension
890
865
  };
891
866
  }
892
-
893
867
  function getPropertyTableFromExtFeatureMetadata(extension) {
894
868
  if (extension !== null && extension !== void 0 && extension.featureTextures) {
895
869
  console.warn('The I3S converter does not yet support the EXT_feature_metadata feature textures');