@loaders.gl/tile-converter 3.4.0-alpha.2 → 3.4.0-alpha.3
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 +2 -2
- package/dist/3d-tiles-attributes-worker.js.map +3 -3
- package/dist/converter.min.js +182 -182
- package/dist/dist.min.js +1101 -754
- package/dist/es5/3d-tiles-attributes-worker.js +1 -2
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +264 -287
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +89 -113
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -2
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +67 -81
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +64 -69
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +1 -2
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +0 -8
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +0 -5
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +14 -16
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +1 -11
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +3 -10
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +397 -449
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +0 -2
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +1 -9
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-index-document.js +293 -318
- package/dist/es5/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +279 -319
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +964 -1030
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +28 -30
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +15 -18
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +198 -218
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +118 -128
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +0 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +81 -85
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +84 -92
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +7 -10
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +7 -9
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +10 -12
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +1 -3
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +1 -15
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +0 -12
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +0 -3
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/esm/bundle.js +0 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/converter-cli.js +0 -11
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +1 -4
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +1 -3
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +0 -8
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +0 -5
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +0 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +0 -11
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +0 -7
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +0 -48
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +0 -3
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +1 -9
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-index-document.js +0 -14
- package/dist/esm/i3s-converter/helpers/node-index-document.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +0 -18
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +4 -42
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/geometry-definitions.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-server/controllers/index-controller.js +0 -2
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +0 -1
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +1 -17
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +0 -7
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +0 -2
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js.map +1 -1
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +0 -2
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +1 -3
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.js +2 -2
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/node-pages.js +1 -1
- package/package.json +16 -16
|
@@ -10,7 +10,6 @@ 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
|
-
|
|
14
13
|
const DEFAULT_ROUGHNESS_FACTOR = 1;
|
|
15
14
|
const DEFAULT_METALLIC_FACTOR = 1;
|
|
16
15
|
const VALUES_PER_VERTEX = 3;
|
|
@@ -24,14 +23,12 @@ const BATCHED_ID_POSSIBLE_ATTRIBUTE_NAMES = ['CUSTOM_ATTRIBUTE_2', '_BATCHID', '
|
|
|
24
23
|
const EXT_FEATURE_METADATA = 'EXT_feature_metadata';
|
|
25
24
|
const EXT_MESH_FEATURES = 'EXT_mesh_features';
|
|
26
25
|
let scratchVector = new Vector3();
|
|
27
|
-
|
|
28
26
|
export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNodePage, propertyTable, featuresHashArray, attributeStorageInfo, draco, generateBoundingVolumes, shouldMergeMaterials, geoidHeightModel, workerSource) {
|
|
29
27
|
var _tileContent$gltf;
|
|
30
28
|
const useCartesianPositions = generateBoundingVolumes;
|
|
31
29
|
const materialAndTextureList = await convertMaterials((_tileContent$gltf = tileContent.gltf) === null || _tileContent$gltf === void 0 ? void 0 : _tileContent$gltf.materials, shouldMergeMaterials);
|
|
32
30
|
const dataForAttributesConversion = prepareDataForAttributesConversion(tileContent);
|
|
33
31
|
const convertedAttributesMap = await convertAttributes(dataForAttributesConversion, materialAndTextureList, useCartesianPositions);
|
|
34
|
-
|
|
35
32
|
if (generateBoundingVolumes) {
|
|
36
33
|
_generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel);
|
|
37
34
|
}
|
|
@@ -41,7 +38,6 @@ export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNod
|
|
|
41
38
|
if (!convertedAttributesMap.has(originarMaterialId)) {
|
|
42
39
|
continue;
|
|
43
40
|
}
|
|
44
|
-
|
|
45
41
|
const convertedAttributes = convertedAttributesMap.get(originarMaterialId);
|
|
46
42
|
if (!convertedAttributes) {
|
|
47
43
|
continue;
|
|
@@ -69,7 +65,6 @@ export default async function convertB3dmToI3sGeometry(tileContent, addNodeToNod
|
|
|
69
65
|
}
|
|
70
66
|
return result;
|
|
71
67
|
}
|
|
72
|
-
|
|
73
68
|
function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeightModel) {
|
|
74
69
|
for (const attributes of convertedAttributesMap.values()) {
|
|
75
70
|
const boundingVolumes = createBoundingVolumesFromGeometry(attributes.positions, geoidHeightModel);
|
|
@@ -84,7 +79,6 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
84
79
|
}
|
|
85
80
|
}
|
|
86
81
|
}
|
|
87
|
-
|
|
88
82
|
async function _makeNodeResources(_ref) {
|
|
89
83
|
var _tileContent$gltf2;
|
|
90
84
|
let {
|
|
@@ -145,7 +139,6 @@ async function _makeNodeResources(_ref) {
|
|
|
145
139
|
boundingVolumes
|
|
146
140
|
};
|
|
147
141
|
}
|
|
148
|
-
|
|
149
142
|
export async function convertAttributes(attributesData, materialAndTextureList, useCartesianPositions) {
|
|
150
143
|
const {
|
|
151
144
|
nodes,
|
|
@@ -180,7 +173,6 @@ export async function convertAttributes(attributesData, materialAndTextureList,
|
|
|
180
173
|
attributesMap.delete(attrKey);
|
|
181
174
|
continue;
|
|
182
175
|
}
|
|
183
|
-
|
|
184
176
|
if (attributes.featureIndicesGroups) {
|
|
185
177
|
attributes.featureIndices = attributes.featureIndicesGroups.reduce((acc, value) => acc.concat(value));
|
|
186
178
|
delete attributes.featureIndicesGroups;
|
|
@@ -188,7 +180,6 @@ export async function convertAttributes(attributesData, materialAndTextureList,
|
|
|
188
180
|
}
|
|
189
181
|
return attributesMap;
|
|
190
182
|
}
|
|
191
|
-
|
|
192
183
|
function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
|
|
193
184
|
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
185
|
if (nodes) {
|
|
@@ -197,7 +188,6 @@ function convertNodes(nodes, images, cartographicOrigin, cartesianModelMatrix, a
|
|
|
197
188
|
}
|
|
198
189
|
}
|
|
199
190
|
}
|
|
200
|
-
|
|
201
191
|
function getCompositeTransformationMatrix(node, matrix) {
|
|
202
192
|
let transformationMatrix = matrix;
|
|
203
193
|
const {
|
|
@@ -220,7 +210,6 @@ function getCompositeTransformationMatrix(node, matrix) {
|
|
|
220
210
|
}
|
|
221
211
|
return transformationMatrix;
|
|
222
212
|
}
|
|
223
|
-
|
|
224
213
|
function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions) {
|
|
225
214
|
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
215
|
const transformationMatrix = getCompositeTransformationMatrix(node, matrix);
|
|
@@ -230,7 +219,6 @@ function convertNode(node, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
230
219
|
}
|
|
231
220
|
convertNodes(node.children || [], images, cartographicOrigin, cartesianModelMatrix, attributesMap, useCartesianPositions, transformationMatrix);
|
|
232
221
|
}
|
|
233
|
-
|
|
234
222
|
function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, attributesMap) {
|
|
235
223
|
let useCartesianPositions = arguments.length > 5 && arguments[5] !== undefined ? arguments[5] : false;
|
|
236
224
|
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]);
|
|
@@ -284,7 +272,6 @@ function convertMesh(mesh, images, cartographicOrigin, cartesianModelMatrix, att
|
|
|
284
272
|
outputAttributes.featureIndicesGroups.push(flattenBatchIds(getBatchIds(attributes, primitive, images), (_primitive$indices6 = primitive.indices) === null || _primitive$indices6 === void 0 ? void 0 : _primitive$indices6.value));
|
|
285
273
|
}
|
|
286
274
|
}
|
|
287
|
-
|
|
288
275
|
function transformVertexArray(args) {
|
|
289
276
|
const {
|
|
290
277
|
vertices,
|
|
@@ -306,7 +293,6 @@ function transformVertexArray(args) {
|
|
|
306
293
|
}
|
|
307
294
|
return newVertices;
|
|
308
295
|
}
|
|
309
|
-
|
|
310
296
|
function transformVertexPositions(vertexVector, calleeArgs) {
|
|
311
297
|
const {
|
|
312
298
|
cartesianModelMatrix,
|
|
@@ -325,7 +311,6 @@ function transformVertexPositions(vertexVector, calleeArgs) {
|
|
|
325
311
|
vertexVector = vertexVector.subtract(cartographicOrigin);
|
|
326
312
|
return vertexVector;
|
|
327
313
|
}
|
|
328
|
-
|
|
329
314
|
function transformVertexNormals(vertexVector, calleeArgs) {
|
|
330
315
|
const {
|
|
331
316
|
cartesianModelMatrix,
|
|
@@ -337,7 +322,6 @@ function transformVertexNormals(vertexVector, calleeArgs) {
|
|
|
337
322
|
vertexVector = vertexVector.transformAsVector(cartesianModelMatrix);
|
|
338
323
|
return vertexVector;
|
|
339
324
|
}
|
|
340
|
-
|
|
341
325
|
function flattenTexCoords(texCoords, indices) {
|
|
342
326
|
const newTexCoords = new Float32Array(indices.length * VALUES_PER_TEX_COORD);
|
|
343
327
|
if (!texCoords) {
|
|
@@ -352,7 +336,6 @@ function flattenTexCoords(texCoords, indices) {
|
|
|
352
336
|
}
|
|
353
337
|
return newTexCoords;
|
|
354
338
|
}
|
|
355
|
-
|
|
356
339
|
function flattenColors(colorsAttribute, indices) {
|
|
357
340
|
const components = (colorsAttribute === null || colorsAttribute === void 0 ? void 0 : colorsAttribute.components) || VALUES_PER_COLOR_ELEMENT;
|
|
358
341
|
const newColors = new Uint8Array(indices.length * components);
|
|
@@ -372,7 +355,6 @@ function flattenColors(colorsAttribute, indices) {
|
|
|
372
355
|
}
|
|
373
356
|
return newColors;
|
|
374
357
|
}
|
|
375
|
-
|
|
376
358
|
function createUvRegion(materialUvRegion, indices) {
|
|
377
359
|
const result = new Uint16Array(indices.length * 4);
|
|
378
360
|
for (let i = 0; i < result.length; i += 4) {
|
|
@@ -380,7 +362,6 @@ function createUvRegion(materialUvRegion, indices) {
|
|
|
380
362
|
}
|
|
381
363
|
return result;
|
|
382
364
|
}
|
|
383
|
-
|
|
384
365
|
function flattenBatchIds(batchedIds, indices) {
|
|
385
366
|
if (!batchedIds.length || !indices.length) {
|
|
386
367
|
return [];
|
|
@@ -392,7 +373,6 @@ function flattenBatchIds(batchedIds, indices) {
|
|
|
392
373
|
}
|
|
393
374
|
return newBatchIds;
|
|
394
375
|
}
|
|
395
|
-
|
|
396
376
|
function getBatchIds(attributes, primitive, images) {
|
|
397
377
|
const batchIds = handleBatchIdsExtensions(attributes, primitive, images);
|
|
398
378
|
if (batchIds.length) {
|
|
@@ -406,7 +386,6 @@ function getBatchIds(attributes, primitive, images) {
|
|
|
406
386
|
}
|
|
407
387
|
return [];
|
|
408
388
|
}
|
|
409
|
-
|
|
410
389
|
async function convertMaterials() {
|
|
411
390
|
let sourceMaterials = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
412
391
|
let shouldMergeMaterials = arguments.length > 1 ? arguments[1] : undefined;
|
|
@@ -419,7 +398,6 @@ async function convertMaterials() {
|
|
|
419
398
|
}
|
|
420
399
|
return materials;
|
|
421
400
|
}
|
|
422
|
-
|
|
423
401
|
async function mergeAllMaterials(materials) {
|
|
424
402
|
const result = [];
|
|
425
403
|
while (materials.length > 0) {
|
|
@@ -472,7 +450,6 @@ async function mergeAllMaterials(materials) {
|
|
|
472
450
|
}
|
|
473
451
|
return result;
|
|
474
452
|
}
|
|
475
|
-
|
|
476
453
|
async function mergeMaterials(material1, material2) {
|
|
477
454
|
var _material1$texture, _material2$texture;
|
|
478
455
|
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 +472,6 @@ async function mergeMaterials(material1, material2) {
|
|
|
495
472
|
material1.mergedMaterials = material1.mergedMaterials.concat(material2.mergedMaterials);
|
|
496
473
|
return material1;
|
|
497
474
|
}
|
|
498
|
-
|
|
499
475
|
function convertMaterial(sourceMaterial) {
|
|
500
476
|
var _sourceMaterial$emiss, _sourceMaterial$pbrMe, _sourceMaterial$pbrMe2, _sourceMaterial$pbrMe3;
|
|
501
477
|
const material = {
|
|
@@ -540,7 +516,6 @@ function convertMaterial(sourceMaterial) {
|
|
|
540
516
|
mergedMaterials
|
|
541
517
|
};
|
|
542
518
|
}
|
|
543
|
-
|
|
544
519
|
function convertAlphaMode(gltfAlphaMode) {
|
|
545
520
|
switch (gltfAlphaMode) {
|
|
546
521
|
case 'OPAQUE':
|
|
@@ -553,7 +528,6 @@ function convertAlphaMode(gltfAlphaMode) {
|
|
|
553
528
|
return 'opaque';
|
|
554
529
|
}
|
|
555
530
|
}
|
|
556
|
-
|
|
557
531
|
function getDefaultMaterial() {
|
|
558
532
|
return {
|
|
559
533
|
alphaMode: 'opaque',
|
|
@@ -563,7 +537,6 @@ function getDefaultMaterial() {
|
|
|
563
537
|
}
|
|
564
538
|
};
|
|
565
539
|
}
|
|
566
|
-
|
|
567
540
|
function getSharedResources(gltfMaterials, nodeId) {
|
|
568
541
|
const i3sResources = {};
|
|
569
542
|
if (!gltfMaterials || !gltfMaterials.length) {
|
|
@@ -583,7 +556,6 @@ function getSharedResources(gltfMaterials, nodeId) {
|
|
|
583
556
|
}
|
|
584
557
|
return i3sResources;
|
|
585
558
|
}
|
|
586
|
-
|
|
587
559
|
function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
588
560
|
var _gltfMaterial$pbrMeta;
|
|
589
561
|
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 +577,6 @@ function convertGLTFMaterialToI3sSharedResources(gltfMaterial, nodeId) {
|
|
|
605
577
|
textureDefinitionInfo
|
|
606
578
|
};
|
|
607
579
|
}
|
|
608
|
-
|
|
609
580
|
function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
610
581
|
let metallicFactor = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
|
611
582
|
const matDielectricColorComponent = 0.04 / 255;
|
|
@@ -625,7 +596,6 @@ function extractSharedResourcesMaterialInfo(baseColorFactor) {
|
|
|
625
596
|
}
|
|
626
597
|
};
|
|
627
598
|
}
|
|
628
|
-
|
|
629
599
|
function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
630
600
|
var _texture$source, _texture$source2, _texture$source3;
|
|
631
601
|
return {
|
|
@@ -637,7 +607,6 @@ function extractSharedResourcesTextureInfo(texture, nodeId) {
|
|
|
637
607
|
}]
|
|
638
608
|
};
|
|
639
609
|
}
|
|
640
|
-
|
|
641
610
|
function generateImageId(texture, nodeId) {
|
|
642
611
|
var _texture$source4;
|
|
643
612
|
const {
|
|
@@ -657,13 +626,11 @@ function generateImageId(texture, nodeId) {
|
|
|
657
626
|
const imageId = BigInt("0b".concat(leftHalf.toString(2)).concat(rightHalf));
|
|
658
627
|
return imageId.toString();
|
|
659
628
|
}
|
|
660
|
-
|
|
661
629
|
function makeFeatureIdsUnique(featureIds, featureIndices, featuresHashArray, batchTable) {
|
|
662
630
|
const replaceMap = getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray);
|
|
663
631
|
replaceIndicesByUnique(featureIndices, replaceMap);
|
|
664
632
|
replaceIndicesByUnique(featureIds, replaceMap);
|
|
665
633
|
}
|
|
666
|
-
|
|
667
634
|
function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
|
|
668
635
|
const featureMap = {};
|
|
669
636
|
for (let index = 0; index < featureIds.length; index++) {
|
|
@@ -673,7 +640,6 @@ function getFeaturesReplaceMap(featureIds, batchTable, featuresHashArray) {
|
|
|
673
640
|
}
|
|
674
641
|
return featureMap;
|
|
675
642
|
}
|
|
676
|
-
|
|
677
643
|
function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
678
644
|
let str = '';
|
|
679
645
|
for (const key in batchTable) {
|
|
@@ -681,7 +647,6 @@ function generateStringFromBatchTableByIndex(batchTable, index) {
|
|
|
681
647
|
}
|
|
682
648
|
return str;
|
|
683
649
|
}
|
|
684
|
-
|
|
685
650
|
function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
|
|
686
651
|
const batchTableStr = generateStringFromBatchTableByIndex(batchTable, index);
|
|
687
652
|
const hash = md5(batchTableStr);
|
|
@@ -690,13 +655,11 @@ function getOrCreateUniqueFeatureId(index, batchTable, featuresHashArray) {
|
|
|
690
655
|
}
|
|
691
656
|
return featuresHashArray.push(hash) - 1;
|
|
692
657
|
}
|
|
693
|
-
|
|
694
658
|
function replaceIndicesByUnique(indicesArray, featureMap) {
|
|
695
659
|
for (let index = 0; index < indicesArray.length; index++) {
|
|
696
660
|
indicesArray[index] = featureMap[indicesArray[index]];
|
|
697
661
|
}
|
|
698
662
|
}
|
|
699
|
-
|
|
700
663
|
function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attributeStorageInfo) {
|
|
701
664
|
const attributeBuffers = [];
|
|
702
665
|
const needFlattenPropertyTable = checkPropertiesLength(featureIds, propertyTable);
|
|
@@ -713,7 +676,6 @@ function convertPropertyTableToAttributeBuffers(featureIds, propertyTable, attri
|
|
|
713
676
|
}
|
|
714
677
|
return attributeBuffers;
|
|
715
678
|
}
|
|
716
|
-
|
|
717
679
|
function generateAttributeBuffer(type, value) {
|
|
718
680
|
let attributeBuffer;
|
|
719
681
|
switch (type) {
|
|
@@ -732,25 +694,21 @@ function generateAttributeBuffer(type, value) {
|
|
|
732
694
|
}
|
|
733
695
|
return attributeBuffer;
|
|
734
696
|
}
|
|
735
|
-
|
|
736
697
|
function getAttributeType(key, attributeStorageInfo) {
|
|
737
698
|
const attribute = attributeStorageInfo.find(attr => attr.name === key);
|
|
738
699
|
return attribute.attributeValues.valueType;
|
|
739
700
|
}
|
|
740
|
-
|
|
741
701
|
function generateShortIntegerAttributeBuffer(featureIds) {
|
|
742
702
|
const count = new Uint32Array([featureIds.length]);
|
|
743
703
|
const valuesArray = new Uint32Array(featureIds);
|
|
744
704
|
return concatenateArrayBuffers(count.buffer, valuesArray.buffer);
|
|
745
705
|
}
|
|
746
|
-
|
|
747
706
|
function generateDoubleAttributeBuffer(featureIds) {
|
|
748
707
|
const count = new Uint32Array([featureIds.length]);
|
|
749
708
|
const padding = new Uint8Array(4);
|
|
750
709
|
const valuesArray = new Float64Array(featureIds);
|
|
751
710
|
return concatenateArrayBuffers(count.buffer, padding.buffer, valuesArray.buffer);
|
|
752
711
|
}
|
|
753
|
-
|
|
754
712
|
function generateStringAttributeBuffer(batchAttributes) {
|
|
755
713
|
const stringCountArray = new Uint32Array([batchAttributes.length]);
|
|
756
714
|
let totalNumberOfBytes = 0;
|
|
@@ -767,7 +725,6 @@ function generateStringAttributeBuffer(batchAttributes) {
|
|
|
767
725
|
const totalBytes = new Uint32Array([totalNumberOfBytes]);
|
|
768
726
|
return concatenateArrayBuffers(stringCountArray.buffer, totalBytes.buffer, stringSizesArray.buffer, ...stringBufferArray);
|
|
769
727
|
}
|
|
770
|
-
|
|
771
728
|
function generateBigUint64Array(featureIds) {
|
|
772
729
|
const typedFeatureIds = new BigUint64Array(featureIds.length);
|
|
773
730
|
for (let index = 0; index < featureIds.length; index++) {
|
|
@@ -775,7 +732,6 @@ function generateBigUint64Array(featureIds) {
|
|
|
775
732
|
}
|
|
776
733
|
return typedFeatureIds;
|
|
777
734
|
}
|
|
778
|
-
|
|
779
735
|
async function generateCompressedGeometry(vertexCount, convertedAttributes, attributes, dracoWorkerSoure) {
|
|
780
736
|
const {
|
|
781
737
|
positions,
|
|
@@ -827,7 +783,6 @@ async function generateCompressedGeometry(vertexCount, convertedAttributes, attr
|
|
|
827
783
|
}
|
|
828
784
|
});
|
|
829
785
|
}
|
|
830
|
-
|
|
831
786
|
function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
832
787
|
const orderedFeatureIndices = new Uint32Array(featureIndex.length);
|
|
833
788
|
let fillIndex = 0;
|
|
@@ -840,7 +795,6 @@ function generateFeatureIndexAttribute(featureIndex, faceRange) {
|
|
|
840
795
|
}
|
|
841
796
|
return orderedFeatureIndices;
|
|
842
797
|
}
|
|
843
|
-
|
|
844
798
|
export function getPropertyTable(tileContent) {
|
|
845
799
|
const batchTableJson = tileContent === null || tileContent === void 0 ? void 0 : tileContent.batchTableJson;
|
|
846
800
|
if (batchTableJson) {
|
|
@@ -864,7 +818,6 @@ export function getPropertyTable(tileContent) {
|
|
|
864
818
|
return null;
|
|
865
819
|
}
|
|
866
820
|
}
|
|
867
|
-
|
|
868
821
|
function getPropertyTableExtension(tileContent) {
|
|
869
822
|
var _tileContent$gltf3, _tileContent$gltf5, _tileContent$gltf5$ex;
|
|
870
823
|
const extensionsWithPropertyTables = [EXT_FEATURE_METADATA, EXT_MESH_FEATURES];
|
|
@@ -889,7 +842,6 @@ function getPropertyTableExtension(tileContent) {
|
|
|
889
842
|
extension
|
|
890
843
|
};
|
|
891
844
|
}
|
|
892
|
-
|
|
893
845
|
function getPropertyTableFromExtFeatureMetadata(extension) {
|
|
894
846
|
if (extension !== null && extension !== void 0 && extension.featureTextures) {
|
|
895
847
|
console.warn('The I3S converter does not yet support the EXT_feature_metadata feature textures');
|