@loaders.gl/tile-converter 3.3.0-alpha.2 → 3.3.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 (88) hide show
  1. package/dist/3d-tiles-attributes-worker.js +1 -1
  2. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +8 -0
  3. package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
  4. package/dist/3d-tiles-converter/3d-tiles-converter.js +57 -43
  5. package/dist/converter.min.js +21 -21
  6. package/dist/deps-installer/deps-installer.d.ts +5 -1
  7. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  8. package/dist/deps-installer/deps-installer.js +21 -1
  9. package/dist/dist.min.js +671 -1028
  10. package/dist/es5/3d-tiles-attributes-worker.js +1 -1
  11. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +115 -101
  12. package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  13. package/dist/es5/deps-installer/deps-installer.js +70 -6
  14. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  15. package/dist/es5/i3s-attributes-worker.js +1 -1
  16. package/dist/es5/i3s-attributes-worker.js.map +1 -1
  17. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +4 -0
  18. package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  19. package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  20. package/dist/es5/i3s-converter/helpers/feature-attributes.js +153 -0
  21. package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
  22. package/dist/es5/i3s-converter/helpers/geometry-converter.js +40 -44
  23. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  24. package/dist/es5/i3s-converter/helpers/gltf-attributes.js +55 -36
  25. package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  26. package/dist/es5/i3s-converter/helpers/node-pages.js +10 -2
  27. package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
  28. package/dist/es5/i3s-converter/i3s-converter.js +364 -435
  29. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  30. package/dist/es5/pgm-loader.js +1 -1
  31. package/dist/esm/3d-tiles-attributes-worker.js +1 -1
  32. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +59 -44
  33. package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
  34. package/dist/esm/deps-installer/deps-installer.js +21 -2
  35. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  36. package/dist/esm/i3s-attributes-worker.js +1 -1
  37. package/dist/esm/i3s-attributes-worker.js.map +1 -1
  38. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -0
  39. package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
  40. package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
  41. package/dist/esm/i3s-converter/helpers/feature-attributes.js +138 -0
  42. package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
  43. package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -21
  44. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  45. package/dist/esm/i3s-converter/helpers/gltf-attributes.js +55 -36
  46. package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
  47. package/dist/esm/i3s-converter/helpers/node-pages.js +9 -2
  48. package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
  49. package/dist/esm/i3s-converter/i3s-converter.js +93 -183
  50. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  51. package/dist/esm/pgm-loader.js +1 -1
  52. package/dist/i3s-attributes-worker.d.ts +5 -1
  53. package/dist/i3s-attributes-worker.d.ts.map +1 -1
  54. package/dist/i3s-attributes-worker.js +3 -3
  55. package/dist/i3s-attributes-worker.js.map +2 -2
  56. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +2 -3
  57. package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
  58. package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -0
  59. package/dist/i3s-converter/helpers/coordinate-converter.d.ts +2 -2
  60. package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
  61. package/dist/i3s-converter/helpers/feature-attributes.d.ts +32 -0
  62. package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
  63. package/dist/i3s-converter/helpers/feature-attributes.js +162 -1
  64. package/dist/i3s-converter/helpers/geometry-converter.d.ts +5 -4
  65. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  66. package/dist/i3s-converter/helpers/geometry-converter.js +29 -27
  67. package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
  68. package/dist/i3s-converter/helpers/gltf-attributes.js +50 -30
  69. package/dist/i3s-converter/helpers/node-pages.d.ts +4 -0
  70. package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
  71. package/dist/i3s-converter/helpers/node-pages.js +9 -2
  72. package/dist/i3s-converter/i3s-converter.d.ts +24 -48
  73. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  74. package/dist/i3s-converter/i3s-converter.js +88 -186
  75. package/dist/i3s-converter/types.d.ts +4 -0
  76. package/dist/i3s-converter/types.d.ts.map +1 -1
  77. package/package.json +15 -15
  78. package/src/3d-tiles-converter/3d-tiles-converter.ts +71 -55
  79. package/src/deps-installer/deps-installer.ts +29 -2
  80. package/src/i3s-attributes-worker.ts +5 -1
  81. package/src/i3s-converter/helpers/batch-ids-extensions.ts +13 -6
  82. package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
  83. package/src/i3s-converter/helpers/feature-attributes.ts +182 -0
  84. package/src/i3s-converter/helpers/geometry-converter.ts +45 -36
  85. package/src/i3s-converter/helpers/gltf-attributes.ts +54 -33
  86. package/src/i3s-converter/helpers/node-pages.ts +10 -2
  87. package/src/i3s-converter/i3s-converter.ts +125 -210
  88. package/src/i3s-converter/types.ts +4 -0
@@ -66,17 +66,17 @@ function convertB3dmToI3sGeometry(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8, _x9) {
66
66
  }
67
67
 
68
68
  function _convertB3dmToI3sGeometry() {
69
- _convertB3dmToI3sGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tileContent, nodeId, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
70
- var _tileContent$gltf;
69
+ _convertB3dmToI3sGeometry = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, geoidHeightModel, workerSource) {
70
+ var _tileContent$gltf4;
71
71
 
72
- var useCartesianPositions, materialAndTextureList, dataForAttributesConversion, convertedAttributesMap, result, nodesCounter, _ref3, _ref3$materials, materials, i, sourceMaterial, convertedAttributes, _materialAndTextureLi, material, texture;
72
+ var useCartesianPositions, materialAndTextureList, dataForAttributesConversion, convertedAttributesMap, result, _ref3, _ref3$materials, materials, i, sourceMaterial, convertedAttributes, _materialAndTextureLi, material, texture, nodeId;
73
73
 
74
74
  return _regenerator.default.wrap(function _callee$(_context) {
75
75
  while (1) {
76
76
  switch (_context.prev = _context.next) {
77
77
  case 0:
78
78
  useCartesianPositions = generateBoundingVolumes;
79
- materialAndTextureList = convertMaterials((_tileContent$gltf = tileContent.gltf) === null || _tileContent$gltf === void 0 ? void 0 : _tileContent$gltf.materials);
79
+ materialAndTextureList = convertMaterials((_tileContent$gltf4 = tileContent.gltf) === null || _tileContent$gltf4 === void 0 ? void 0 : _tileContent$gltf4.materials);
80
80
  dataForAttributesConversion = (0, _gltfAttributes.prepareDataForAttributesConversion)(tileContent);
81
81
  _context.next = 5;
82
82
  return convertAttributes(dataForAttributesConversion, useCartesianPositions);
@@ -95,7 +95,6 @@ function _convertB3dmToI3sGeometry() {
95
95
  }
96
96
 
97
97
  result = [];
98
- nodesCounter = nodeId;
99
98
  _ref3 = tileContent.gltf || {
100
99
  materials: []
101
100
  }, _ref3$materials = _ref3.materials, materials = _ref3$materials === void 0 ? [] : _ref3$materials;
@@ -108,33 +107,34 @@ function _convertB3dmToI3sGeometry() {
108
107
 
109
108
  i = 0;
110
109
 
111
- case 13:
110
+ case 12:
112
111
  if (!(i < materials.length)) {
113
- _context.next = 30;
112
+ _context.next = 29;
114
113
  break;
115
114
  }
116
115
 
117
116
  sourceMaterial = materials[i];
118
117
 
119
118
  if (convertedAttributesMap.has(sourceMaterial.id)) {
120
- _context.next = 17;
119
+ _context.next = 16;
121
120
  break;
122
121
  }
123
122
 
124
- return _context.abrupt("continue", 27);
123
+ return _context.abrupt("continue", 26);
125
124
 
126
- case 17:
125
+ case 16:
127
126
  convertedAttributes = convertedAttributesMap.get(sourceMaterial.id);
128
127
 
129
128
  if (convertedAttributes) {
130
- _context.next = 20;
129
+ _context.next = 19;
131
130
  break;
132
131
  }
133
132
 
134
- return _context.abrupt("continue", 27);
133
+ return _context.abrupt("continue", 26);
135
134
 
136
- case 20:
135
+ case 19:
137
136
  _materialAndTextureLi = materialAndTextureList[i], material = _materialAndTextureLi.material, texture = _materialAndTextureLi.texture;
137
+ nodeId = addNodeToNodePage();
138
138
  _context.t0 = result;
139
139
  _context.next = 24;
140
140
  return _makeNodeResources({
@@ -142,7 +142,7 @@ function _convertB3dmToI3sGeometry() {
142
142
  material: material,
143
143
  texture: texture,
144
144
  tileContent: tileContent,
145
- nodeId: nodesCounter,
145
+ nodeId: nodeId,
146
146
  featuresHashArray: featuresHashArray,
147
147
  propertyTable: propertyTable,
148
148
  attributeStorageInfo: attributeStorageInfo,
@@ -155,25 +155,23 @@ function _convertB3dmToI3sGeometry() {
155
155
 
156
156
  _context.t0.push.call(_context.t0, _context.t1);
157
157
 
158
- nodesCounter++;
159
-
160
- case 27:
158
+ case 26:
161
159
  i++;
162
- _context.next = 13;
160
+ _context.next = 12;
163
161
  break;
164
162
 
165
- case 30:
163
+ case 29:
166
164
  if (result.length) {
167
- _context.next = 32;
165
+ _context.next = 31;
168
166
  break;
169
167
  }
170
168
 
171
169
  return _context.abrupt("return", null);
172
170
 
173
- case 32:
171
+ case 31:
174
172
  return _context.abrupt("return", result);
175
173
 
176
- case 33:
174
+ case 32:
177
175
  case "end":
178
176
  return _context.stop();
179
177
  }
@@ -217,7 +215,7 @@ function _makeNodeResources(_x10) {
217
215
 
218
216
  function _makeNodeResources2() {
219
217
  _makeNodeResources2 = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee2(_ref) {
220
- var _tileContent$gltf2;
218
+ var _tileContent$gltf5;
221
219
 
222
220
  var convertedAttributes, material, texture, tileContent, nodeId, featuresHashArray, propertyTable, attributeStorageInfo, draco, workerSource, boundingVolumes, vertexCount, _generateAttributes, faceRange, featureIds, positions, normals, colors, texCoords, featureCount, header, typedFeatureIds, fileBuffer, compressedGeometry, attributes;
223
221
 
@@ -253,10 +251,11 @@ function _makeNodeResources2() {
253
251
  }
254
252
 
255
253
  return _context2.abrupt("return", {
254
+ nodeId: nodeId,
256
255
  geometry: fileBuffer,
257
256
  compressedGeometry: compressedGeometry,
258
257
  texture: texture,
259
- sharedResources: getSharedResources(((_tileContent$gltf2 = tileContent.gltf) === null || _tileContent$gltf2 === void 0 ? void 0 : _tileContent$gltf2.materials) || [], nodeId),
258
+ sharedResources: getSharedResources(((_tileContent$gltf5 = tileContent.gltf) === null || _tileContent$gltf5 === void 0 ? void 0 : _tileContent$gltf5.materials) || [], nodeId),
260
259
  meshMaterial: material,
261
260
  vertexCount: vertexCount,
262
261
  attributes: attributes,
@@ -280,13 +279,13 @@ function convertAttributes(_x11, _x12) {
280
279
 
281
280
  function _convertAttributes() {
282
281
  _convertAttributes = (0, _asyncToGenerator2.default)(_regenerator.default.mark(function _callee3(attributesData, useCartesianPositions) {
283
- var gltfMaterials, nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, _iterator7, _step7, material, _iterator8, _step8, attrKey, attributes;
282
+ var gltfMaterials, nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, _iterator7, _step7, material, _iterator8, _step8, attrKey, attributes;
284
283
 
285
284
  return _regenerator.default.wrap(function _callee3$(_context3) {
286
285
  while (1) {
287
286
  switch (_context3.prev = _context3.next) {
288
287
  case 0:
289
- gltfMaterials = attributesData.gltfMaterials, nodes = attributesData.nodes, cartographicOrigin = attributesData.cartographicOrigin, cartesianModelMatrix = attributesData.cartesianModelMatrix;
288
+ gltfMaterials = attributesData.gltfMaterials, nodes = attributesData.nodes, images = attributesData.images, cartographicOrigin = attributesData.cartographicOrigin, cartesianModelMatrix = attributesData.cartesianModelMatrix;
290
289
  attributesMap = new Map();
291
290
  _iterator7 = _createForOfIteratorHelper(gltfMaterials || [{
292
291
  id: 'default'
@@ -311,7 +310,7 @@ function _convertAttributes() {
311
310
  _iterator7.f();
312
311
  }
313
312
 
314
- convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
313
+ convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions);
315
314
  _iterator8 = _createForOfIteratorHelper(attributesMap.keys());
316
315
  _context3.prev = 6;
317
316
 
@@ -384,8 +383,8 @@ function _convertAttributes() {
384
383
  return _convertAttributes.apply(this, arguments);
385
384
  }
386
385
 
387
- function convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
388
- var matrix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
386
+ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
387
+ var matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
389
388
 
390
389
  if (nodes) {
391
390
  var _iterator2 = _createForOfIteratorHelper(nodes),
@@ -394,7 +393,7 @@ function convertNodes(nodes, cartographicOrigin, cartesianModelMatrix, attribute
394
393
  try {
395
394
  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {
396
395
  var node = _step2.value;
397
- convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
396
+ convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, matrix);
398
397
  }
399
398
  } catch (err) {
400
399
  _iterator2.e(err);
@@ -430,17 +429,16 @@ function getCompositeTransformationMatrix(node, matrix) {
430
429
  return transformationMatrix;
431
430
  }
432
431
 
433
- function convertNode(node, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
434
- var matrix = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
432
+ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
433
+ var matrix = arguments.length > 6 && arguments[6] !== undefined ? arguments[6] : new _core.Matrix4([1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1]);
435
434
  var transformationMatrix = getCompositeTransformationMatrix(node, matrix);
436
435
  var mesh = node.mesh;
437
- var images = node.images;
438
436
 
439
437
  if (mesh) {
440
438
  convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
441
439
  }
442
440
 
443
- convertNodes(node.children || [], cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
441
+ convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
444
442
  }
445
443
 
446
444
  function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap) {
@@ -1053,16 +1051,14 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
1053
1051
  return orderedFeatureIndices;
1054
1052
  }
1055
1053
 
1056
- function getPropertyTable(sourceTile) {
1057
- var _sourceTile$content;
1058
-
1059
- var batchTableJson = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content = sourceTile.content) === null || _sourceTile$content === void 0 ? void 0 : _sourceTile$content.batchTableJson;
1054
+ function getPropertyTable(tileContent) {
1055
+ var batchTableJson = tileContent === null || tileContent === void 0 ? void 0 : tileContent.batchTableJson;
1060
1056
 
1061
1057
  if (batchTableJson) {
1062
1058
  return batchTableJson;
1063
1059
  }
1064
1060
 
1065
- var _getPropertyTableExte = getPropertyTableExtension(sourceTile),
1061
+ var _getPropertyTableExte = getPropertyTableExtension(tileContent),
1066
1062
  extensionName = _getPropertyTableExte.extensionName,
1067
1063
  extension = _getPropertyTableExte.extension;
1068
1064
 
@@ -1083,11 +1079,11 @@ function getPropertyTable(sourceTile) {
1083
1079
  }
1084
1080
  }
1085
1081
 
1086
- function getPropertyTableExtension(sourceTile) {
1087
- var _sourceTile$content2, _sourceTile$content2$, _sourceTile$content3, _sourceTile$content3$, _sourceTile$content3$2, _sourceTile$content4, _sourceTile$content4$;
1082
+ function getPropertyTableExtension(tileContent) {
1083
+ var _tileContent$gltf, _tileContent$gltf2, _tileContent$gltf2$ex, _tileContent$gltf3;
1088
1084
 
1089
1085
  var extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
1090
- var extensionsUsed = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content2 = sourceTile.content) === null || _sourceTile$content2 === void 0 ? void 0 : (_sourceTile$content2$ = _sourceTile$content2.gltf) === null || _sourceTile$content2$ === void 0 ? void 0 : _sourceTile$content2$.extensionsUsed;
1086
+ var extensionsUsed = tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf = tileContent.gltf) === null || _tileContent$gltf === void 0 ? void 0 : _tileContent$gltf.extensionsUsed;
1091
1087
 
1092
1088
  if (!extensionsUsed) {
1093
1089
  return {
@@ -1098,7 +1094,7 @@ function getPropertyTableExtension(sourceTile) {
1098
1094
 
1099
1095
  var extensionName = '';
1100
1096
 
1101
- var _iterator6 = _createForOfIteratorHelper(sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content4 = sourceTile.content) === null || _sourceTile$content4 === void 0 ? void 0 : (_sourceTile$content4$ = _sourceTile$content4.gltf) === null || _sourceTile$content4$ === void 0 ? void 0 : _sourceTile$content4$.extensionsUsed),
1097
+ var _iterator6 = _createForOfIteratorHelper((tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf3 = tileContent.gltf) === null || _tileContent$gltf3 === void 0 ? void 0 : _tileContent$gltf3.extensionsUsed) || []),
1102
1098
  _step6;
1103
1099
 
1104
1100
  try {
@@ -1116,7 +1112,7 @@ function getPropertyTableExtension(sourceTile) {
1116
1112
  _iterator6.f();
1117
1113
  }
1118
1114
 
1119
- var extension = sourceTile === null || sourceTile === void 0 ? void 0 : (_sourceTile$content3 = sourceTile.content) === null || _sourceTile$content3 === void 0 ? void 0 : (_sourceTile$content3$ = _sourceTile$content3.gltf) === null || _sourceTile$content3$ === void 0 ? void 0 : (_sourceTile$content3$2 = _sourceTile$content3$.extensions) === null || _sourceTile$content3$2 === void 0 ? void 0 : _sourceTile$content3$2[extensionName];
1115
+ var extension = tileContent === null || tileContent === void 0 ? void 0 : (_tileContent$gltf2 = tileContent.gltf) === null || _tileContent$gltf2 === void 0 ? void 0 : (_tileContent$gltf2$ex = _tileContent$gltf2.extensions) === null || _tileContent$gltf2$ex === void 0 ? void 0 : _tileContent$gltf2$ex[extensionName];
1120
1116
  return {
1121
1117
  extensionName: extensionName,
1122
1118
  extension: extension