@loaders.gl/tile-converter 3.3.0-alpha.3 → 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.
- package/dist/3d-tiles-attributes-worker.js +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +8 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +57 -43
- package/dist/converter.min.js +21 -21
- package/dist/deps-installer/deps-installer.d.ts +5 -1
- package/dist/deps-installer/deps-installer.d.ts.map +1 -1
- package/dist/deps-installer/deps-installer.js +21 -1
- package/dist/dist.min.js +660 -1016
- package/dist/es5/3d-tiles-attributes-worker.js +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +115 -101
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +70 -6
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -1
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +153 -0
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +40 -44
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +10 -2
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +364 -435
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +59 -44
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +21 -2
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -0
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +138 -0
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +19 -21
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +55 -36
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +93 -183
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/i3s-attributes-worker.d.ts +5 -1
- package/dist/i3s-attributes-worker.d.ts.map +1 -1
- package/dist/i3s-attributes-worker.js +3 -3
- package/dist/i3s-attributes-worker.js.map +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +2 -3
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +3 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +2 -2
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts +32 -0
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.js +162 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +5 -4
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +29 -27
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/gltf-attributes.js +50 -30
- package/dist/i3s-converter/helpers/node-pages.d.ts +4 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +9 -2
- package/dist/i3s-converter/i3s-converter.d.ts +24 -48
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +88 -186
- package/dist/i3s-converter/types.d.ts +4 -0
- package/dist/i3s-converter/types.d.ts.map +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-converter/3d-tiles-converter.ts +71 -55
- package/src/deps-installer/deps-installer.ts +29 -2
- package/src/i3s-attributes-worker.ts +5 -1
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +13 -6
- package/src/i3s-converter/helpers/coordinate-converter.ts +2 -2
- package/src/i3s-converter/helpers/feature-attributes.ts +182 -0
- package/src/i3s-converter/helpers/geometry-converter.ts +45 -36
- package/src/i3s-converter/helpers/gltf-attributes.ts +54 -33
- package/src/i3s-converter/helpers/node-pages.ts +10 -2
- package/src/i3s-converter/i3s-converter.ts +125 -210
- 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,
|
|
70
|
-
var _tileContent$
|
|
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,
|
|
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$
|
|
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
|
|
110
|
+
case 12:
|
|
112
111
|
if (!(i < materials.length)) {
|
|
113
|
-
_context.next =
|
|
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 =
|
|
119
|
+
_context.next = 16;
|
|
121
120
|
break;
|
|
122
121
|
}
|
|
123
122
|
|
|
124
|
-
return _context.abrupt("continue",
|
|
123
|
+
return _context.abrupt("continue", 26);
|
|
125
124
|
|
|
126
|
-
case
|
|
125
|
+
case 16:
|
|
127
126
|
convertedAttributes = convertedAttributesMap.get(sourceMaterial.id);
|
|
128
127
|
|
|
129
128
|
if (convertedAttributes) {
|
|
130
|
-
_context.next =
|
|
129
|
+
_context.next = 19;
|
|
131
130
|
break;
|
|
132
131
|
}
|
|
133
132
|
|
|
134
|
-
return _context.abrupt("continue",
|
|
133
|
+
return _context.abrupt("continue", 26);
|
|
135
134
|
|
|
136
|
-
case
|
|
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:
|
|
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
|
-
|
|
159
|
-
|
|
160
|
-
case 27:
|
|
158
|
+
case 26:
|
|
161
159
|
i++;
|
|
162
|
-
_context.next =
|
|
160
|
+
_context.next = 12;
|
|
163
161
|
break;
|
|
164
162
|
|
|
165
|
-
case
|
|
163
|
+
case 29:
|
|
166
164
|
if (result.length) {
|
|
167
|
-
_context.next =
|
|
165
|
+
_context.next = 31;
|
|
168
166
|
break;
|
|
169
167
|
}
|
|
170
168
|
|
|
171
169
|
return _context.abrupt("return", null);
|
|
172
170
|
|
|
173
|
-
case
|
|
171
|
+
case 31:
|
|
174
172
|
return _context.abrupt("return", result);
|
|
175
173
|
|
|
176
|
-
case
|
|
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$
|
|
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$
|
|
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 >
|
|
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 >
|
|
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(
|
|
1057
|
-
var
|
|
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(
|
|
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(
|
|
1087
|
-
var
|
|
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 =
|
|
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(
|
|
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 =
|
|
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
|