@loaders.gl/tile-converter 4.4.5 → 5.0.0-alpha.2
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/LICENSE +14 -3
- package/dist/converter.min.cjs +203 -267
- package/dist/i3s-server/bin/i3s-server.min.cjs +100 -335
- package/package.json +17 -17
- package/src/3d-tiles-converter/3d-tiles-converter.ts +1 -1
- package/src/3d-tiles-converter/helpers/3d-tiles-content-converter.ts +2 -2
- package/src/3d-tiles-converter/json-templates/tileset.ts +4 -4
- package/src/converter-cli.ts +4 -4
- package/src/i3s-converter/helpers/attribute-metadata-info.ts +1 -1
- package/src/i3s-converter/helpers/geometry-attributes.ts +1 -1
- package/src/i3s-converter/helpers/geometry-converter.ts +4 -4
- package/src/i3s-converter/helpers/gltf-attributes.ts +2 -2
- package/src/i3s-converter/helpers/node-debug.ts +5 -6
- package/src/i3s-converter/i3s-converter.ts +10 -12
- package/src/i3s-converter/json-templates/geometry-definitions.ts +4 -4
- package/src/i3s-converter/json-templates/layers.ts +6 -6
- package/src/i3s-converter/json-templates/node.ts +1 -1
- package/src/i3s-converter/json-templates/scene-server.ts +1 -1
- package/src/i3s-converter/json-templates/shared-resources.ts +1 -1
- package/src/i3s-converter/json-templates/store.ts +1 -1
- package/src/i3s-server/controllers/slpk-controller.ts +1 -1
- package/src/i3s-server/routes/slpk-router.ts +1 -1
- package/src/lib/utils/compress-util.ts +8 -7
- package/src/lib/utils/conversion-dump.ts +4 -4
- package/src/lib/utils/file-utils.ts +2 -2
- package/src/lib/utils/lod-conversion-utils.ts +2 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@loaders.gl/tile-converter",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-alpha.2",
|
|
4
4
|
"description": "Converter",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -51,20 +51,20 @@
|
|
|
51
51
|
"copy-certificates": "cp -R src/i3s-server/certs dist/i3s-server"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@loaders.gl/3d-tiles": "
|
|
55
|
-
"@loaders.gl/compression": "
|
|
56
|
-
"@loaders.gl/crypto": "
|
|
57
|
-
"@loaders.gl/draco": "
|
|
58
|
-
"@loaders.gl/gltf": "
|
|
59
|
-
"@loaders.gl/i3s": "
|
|
60
|
-
"@loaders.gl/images": "
|
|
61
|
-
"@loaders.gl/loader-utils": "
|
|
62
|
-
"@loaders.gl/math": "
|
|
63
|
-
"@loaders.gl/polyfills": "
|
|
64
|
-
"@loaders.gl/textures": "
|
|
65
|
-
"@loaders.gl/tiles": "
|
|
66
|
-
"@loaders.gl/worker-utils": "
|
|
67
|
-
"@loaders.gl/zip": "
|
|
54
|
+
"@loaders.gl/3d-tiles": "5.0.0-alpha.2",
|
|
55
|
+
"@loaders.gl/compression": "5.0.0-alpha.2",
|
|
56
|
+
"@loaders.gl/crypto": "5.0.0-alpha.2",
|
|
57
|
+
"@loaders.gl/draco": "5.0.0-alpha.2",
|
|
58
|
+
"@loaders.gl/gltf": "5.0.0-alpha.2",
|
|
59
|
+
"@loaders.gl/i3s": "5.0.0-alpha.2",
|
|
60
|
+
"@loaders.gl/images": "5.0.0-alpha.2",
|
|
61
|
+
"@loaders.gl/loader-utils": "5.0.0-alpha.2",
|
|
62
|
+
"@loaders.gl/math": "5.0.0-alpha.2",
|
|
63
|
+
"@loaders.gl/polyfills": "5.0.0-alpha.2",
|
|
64
|
+
"@loaders.gl/textures": "5.0.0-alpha.2",
|
|
65
|
+
"@loaders.gl/tiles": "5.0.0-alpha.2",
|
|
66
|
+
"@loaders.gl/worker-utils": "5.0.0-alpha.2",
|
|
67
|
+
"@loaders.gl/zip": "5.0.0-alpha.2",
|
|
68
68
|
"@math.gl/core": "^4.1.0",
|
|
69
69
|
"@math.gl/culling": "^4.1.0",
|
|
70
70
|
"@math.gl/geoid": "^4.1.0",
|
|
@@ -91,7 +91,7 @@
|
|
|
91
91
|
"@types/inquirer": "^9.0.7"
|
|
92
92
|
},
|
|
93
93
|
"peerDependencies": {
|
|
94
|
-
"@loaders.gl/core": "~
|
|
94
|
+
"@loaders.gl/core": "~5.0.0-alpha.0"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "27bcc0db684abb66a83003263c9d1cafd9e5b2dd"
|
|
97
97
|
}
|
|
@@ -209,7 +209,7 @@ export class Tiles3DContentConverter {
|
|
|
209
209
|
featureAttributes: I3STileAttributes
|
|
210
210
|
): PropertyAttribute | null {
|
|
211
211
|
const attributeValues = featureAttributes[attributeName];
|
|
212
|
-
const info = attributeStorageInfo.find(
|
|
212
|
+
const info = attributeStorageInfo.find(e => e.name === attributeName);
|
|
213
213
|
if (!info) {
|
|
214
214
|
return null;
|
|
215
215
|
}
|
|
@@ -477,6 +477,6 @@ export class Tiles3DContentConverter {
|
|
|
477
477
|
*/
|
|
478
478
|
_checkNormals(normals) {
|
|
479
479
|
// If all normals === 0, the resulting tileset is all in black colors on Cesium
|
|
480
|
-
return normals.find(
|
|
480
|
+
return normals.find(value => value);
|
|
481
481
|
}
|
|
482
482
|
}
|
|
@@ -22,21 +22,21 @@ const TILE = () => ({
|
|
|
22
22
|
},
|
|
23
23
|
children: {
|
|
24
24
|
path: 'children',
|
|
25
|
-
transform:
|
|
25
|
+
transform: val => val.map(tile => transform(tile, TILE()))
|
|
26
26
|
}
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
export const TILESET = () => ({
|
|
30
30
|
asset: {
|
|
31
31
|
path: 'asset',
|
|
32
|
-
transform:
|
|
32
|
+
transform: val => transform(val, ASSET())
|
|
33
33
|
},
|
|
34
34
|
geometricError: {
|
|
35
35
|
path: 'root',
|
|
36
|
-
transform:
|
|
36
|
+
transform: val => val.geometricError
|
|
37
37
|
},
|
|
38
38
|
root: {
|
|
39
39
|
path: 'root',
|
|
40
|
-
transform:
|
|
40
|
+
transform: val => transform(val, TILE())
|
|
41
41
|
}
|
|
42
42
|
});
|
package/src/converter-cli.ts
CHANGED
|
@@ -152,7 +152,7 @@ async function main() {
|
|
|
152
152
|
await convert(validatedOptions);
|
|
153
153
|
}
|
|
154
154
|
|
|
155
|
-
main().catch(
|
|
155
|
+
main().catch(error => {
|
|
156
156
|
console.log(error);
|
|
157
157
|
process.exit(1); // eslint-disable-line no-process-exit
|
|
158
158
|
});
|
|
@@ -280,13 +280,13 @@ function validateOptions(
|
|
|
280
280
|
inputType: {
|
|
281
281
|
getMessage: () =>
|
|
282
282
|
console.log('Missed/Incorrect: --input-type [tileset input type: I3S or 3DTILES]'),
|
|
283
|
-
condition:
|
|
283
|
+
condition: value =>
|
|
284
284
|
addHash || (Boolean(value) && Object.values(TILESET_TYPE).includes(value.toUpperCase()))
|
|
285
285
|
},
|
|
286
286
|
outputVersion: {
|
|
287
287
|
getMessage: () =>
|
|
288
288
|
console.log('Incorrect: --output-version [1.0 or 1.1] is for --input-type "I3S" only'),
|
|
289
|
-
condition:
|
|
289
|
+
condition: value =>
|
|
290
290
|
addHash ||
|
|
291
291
|
(Boolean(value) &&
|
|
292
292
|
Object.values(['1.0', '1.1']).includes(value) &&
|
|
@@ -307,7 +307,7 @@ function validateOptions(
|
|
|
307
307
|
}
|
|
308
308
|
}
|
|
309
309
|
if (exceptions.length) {
|
|
310
|
-
exceptions.forEach(
|
|
310
|
+
exceptions.forEach(exeption => exeption());
|
|
311
311
|
process.exit(1); // eslint-disable-line no-process-exit
|
|
312
312
|
}
|
|
313
313
|
return <ValidatedTileConversionOptions>options;
|
|
@@ -74,7 +74,7 @@ export class AttributeMetadataInfo {
|
|
|
74
74
|
/*
|
|
75
75
|
We will append a new attribute only in case it has not been added to the attribute storage info yet.
|
|
76
76
|
*/
|
|
77
|
-
const elementFound = this._attributeStorageInfo.find(
|
|
77
|
+
const elementFound = this._attributeStorageInfo.find(element => element.name === key);
|
|
78
78
|
if (!elementFound) {
|
|
79
79
|
const attributeType = attributeTypes[key];
|
|
80
80
|
|
|
@@ -211,7 +211,7 @@ function unifyObjectsByFeatureId(
|
|
|
211
211
|
attributes: GroupedByFeatureIdAttributes[];
|
|
212
212
|
}[] = [];
|
|
213
213
|
for (const data of sortedData) {
|
|
214
|
-
const existingObject = groupedMetadata.find(
|
|
214
|
+
const existingObject = groupedMetadata.find(obj => obj.featureId === data.featureId);
|
|
215
215
|
if (existingObject) {
|
|
216
216
|
existingObject.attributes.push(data);
|
|
217
217
|
} else {
|
|
@@ -304,7 +304,7 @@ async function _makeNodeResources({
|
|
|
304
304
|
faceRange.buffer
|
|
305
305
|
)
|
|
306
306
|
);
|
|
307
|
-
//
|
|
307
|
+
// biome-ignore format: preserve intentional fixture layout
|
|
308
308
|
const compressedGeometry = draco
|
|
309
309
|
? generateCompressedGeometry(
|
|
310
310
|
vertexCount,
|
|
@@ -1059,7 +1059,7 @@ async function mergeMaterials(
|
|
|
1059
1059
|
function convertMaterial(sourceMaterial: GLTFMaterialPostprocessed): I3SMaterialWithTexture {
|
|
1060
1060
|
const material: I3SMaterialDefinition = {
|
|
1061
1061
|
doubleSided: sourceMaterial.doubleSided,
|
|
1062
|
-
emissiveFactor: sourceMaterial.emissiveFactor?.map(
|
|
1062
|
+
emissiveFactor: sourceMaterial.emissiveFactor?.map(c => Math.round(c * 255)) as [
|
|
1063
1063
|
number,
|
|
1064
1064
|
number,
|
|
1065
1065
|
number
|
|
@@ -1096,7 +1096,7 @@ function convertMaterial(sourceMaterial: GLTFMaterialPostprocessed): I3SMaterial
|
|
|
1096
1096
|
// https://github.com/KhronosGroup/glTF/tree/master/specification/2.0#reference-pbrmetallicroughness
|
|
1097
1097
|
const baseColorFactor = sourceMaterial?.pbrMetallicRoughness?.baseColorFactor;
|
|
1098
1098
|
material.pbrMetallicRoughness.baseColorFactor =
|
|
1099
|
-
((baseColorFactor && baseColorFactor.map(
|
|
1099
|
+
((baseColorFactor && baseColorFactor.map(c => Math.round(c * 255))) as [
|
|
1100
1100
|
number,
|
|
1101
1101
|
number,
|
|
1102
1102
|
number,
|
|
@@ -1472,7 +1472,7 @@ function generateAttributeBuffer(type: string, value: any): ArrayBuffer {
|
|
|
1472
1472
|
* @returns attribute type.
|
|
1473
1473
|
*/
|
|
1474
1474
|
function getAttributeType(key: string, attributeStorageInfo: any[]): string {
|
|
1475
|
-
const attribute = attributeStorageInfo.find(
|
|
1475
|
+
const attribute = attributeStorageInfo.find(attr => attr.name === key);
|
|
1476
1476
|
if (!attribute) {
|
|
1477
1477
|
// eslint-disable-next-line no-console
|
|
1478
1478
|
console.error(
|
|
@@ -25,7 +25,7 @@ export function prepareDataForAttributesConversion(
|
|
|
25
25
|
[];
|
|
26
26
|
|
|
27
27
|
const images =
|
|
28
|
-
tileContent.gltf?.images?.map(
|
|
28
|
+
tileContent.gltf?.images?.map(imageObject => {
|
|
29
29
|
// Need data only for uncompressed images because we can't get batchIds from compressed textures.
|
|
30
30
|
if (imageObject?.image?.compressed) {
|
|
31
31
|
return null;
|
|
@@ -141,7 +141,7 @@ function prepareNodes(nodes: GLTFNodePostprocessed[]): void {
|
|
|
141
141
|
...node,
|
|
142
142
|
mesh: {
|
|
143
143
|
...node.mesh,
|
|
144
|
-
primitives: node.mesh?.primitives.map(
|
|
144
|
+
primitives: node.mesh?.primitives.map(primitive => ({
|
|
145
145
|
...primitive,
|
|
146
146
|
indices: {value: primitive?.indices?.value},
|
|
147
147
|
attributes: getB3DMAttributesWithoutBufferView(primitive.attributes),
|
|
@@ -3,7 +3,7 @@ import {OrientedBoundingBox, BoundingSphere} from '@math.gl/culling';
|
|
|
3
3
|
import {Vector3} from '@math.gl/core';
|
|
4
4
|
import {Ellipsoid} from '@math.gl/geospatial';
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// biome-ignore format: preserve intentional fixture layout
|
|
7
7
|
const CUBE_POSITIONS = new Float32Array([
|
|
8
8
|
-1, -1, 1, 1, -1, 1, 1, 1, 1, -1, 1, 1,
|
|
9
9
|
-1, -1, -1, -1, 1, -1, 1, 1, -1, 1, -1, -1,
|
|
@@ -103,11 +103,10 @@ function getTileObbVertices(node: Node3DIndexDocument): number[] {
|
|
|
103
103
|
let vertices = [];
|
|
104
104
|
|
|
105
105
|
for (let i = 0; i < positions.length; i += 3) {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
);
|
|
106
|
+
positions[i] *= halfSize[0];
|
|
107
|
+
positions[i + 1] *= halfSize[1];
|
|
108
|
+
positions[i + 2] *= halfSize[2];
|
|
109
|
+
const positionsVector = new Vector3(positions[i], positions[i + 1], positions[i + 2]);
|
|
111
110
|
const rotatedPositions = positionsVector
|
|
112
111
|
// @ts-expect-error
|
|
113
112
|
.transformByQuaternion(node.obb.quaternion)
|
|
@@ -382,7 +382,7 @@ export default class I3SConverter {
|
|
|
382
382
|
...this.loadOptions,
|
|
383
383
|
'3d-tiles': {...this.loadOptions['3d-tiles'], loadGLTF: false}
|
|
384
384
|
});
|
|
385
|
-
} catch (
|
|
385
|
+
} catch (_error) {
|
|
386
386
|
// eslint-disable-next-line no-console
|
|
387
387
|
console.log(
|
|
388
388
|
`[warning]: Failed to load ${sourceTile.contentUrl}. An I3S tile with empty content will be added to the output tileset`
|
|
@@ -462,7 +462,7 @@ export default class I3SConverter {
|
|
|
462
462
|
: tilesetPath;
|
|
463
463
|
try {
|
|
464
464
|
await removeDir(removePath);
|
|
465
|
-
} catch (
|
|
465
|
+
} catch (_e) {
|
|
466
466
|
// do nothing
|
|
467
467
|
}
|
|
468
468
|
|
|
@@ -532,7 +532,7 @@ export default class I3SConverter {
|
|
|
532
532
|
this.layers0!.materialDefinitions = this.materialDefinitions;
|
|
533
533
|
// @ts-ignore
|
|
534
534
|
this.layers0.geometryDefinitions = transform(
|
|
535
|
-
this.geometryConfigs.map(
|
|
535
|
+
this.geometryConfigs.map(config => ({
|
|
536
536
|
geometryConfig: {...config, draco: this.options.draco}
|
|
537
537
|
})),
|
|
538
538
|
geometryDefinitionTemlate()
|
|
@@ -540,9 +540,7 @@ export default class I3SConverter {
|
|
|
540
540
|
|
|
541
541
|
if (this.layersHasTexture === false) {
|
|
542
542
|
this.layers0!.store.defaultGeometrySchema.ordering =
|
|
543
|
-
this.layers0!.store.defaultGeometrySchema.ordering.filter(
|
|
544
|
-
(attribute) => attribute !== 'uv0'
|
|
545
|
-
);
|
|
543
|
+
this.layers0!.store.defaultGeometrySchema.ordering.filter(attribute => attribute !== 'uv0');
|
|
546
544
|
}
|
|
547
545
|
|
|
548
546
|
await this._writeLayers0();
|
|
@@ -614,14 +612,14 @@ export default class I3SConverter {
|
|
|
614
612
|
const slpkTilesetPath = join(tilesetPath, 'SceneServer', 'layers', '0');
|
|
615
613
|
const slpkFileName = `${tilesetPath}.slpk`;
|
|
616
614
|
|
|
617
|
-
await createZip(slpkTilesetPath, slpkFileName, async
|
|
615
|
+
await createZip(slpkTilesetPath, slpkFileName, async fileList => ({
|
|
618
616
|
path: '@specialIndexFileHASH128@',
|
|
619
617
|
file: await composeHashFile(fileList)
|
|
620
618
|
}));
|
|
621
619
|
|
|
622
620
|
try {
|
|
623
621
|
await removeDir(tilesetPath);
|
|
624
|
-
} catch (
|
|
622
|
+
} catch (_e) {
|
|
625
623
|
// do nothing
|
|
626
624
|
}
|
|
627
625
|
}
|
|
@@ -728,7 +726,7 @@ export default class I3SConverter {
|
|
|
728
726
|
this.layersHasTexture ||
|
|
729
727
|
Boolean(
|
|
730
728
|
('texture' in resources && resources.texture) ||
|
|
731
|
-
|
|
729
|
+
('texelCountHint' in resources && resources.texelCountHint)
|
|
732
730
|
);
|
|
733
731
|
|
|
734
732
|
if (this.generateBoundingVolumes && resources.boundingVolumes) {
|
|
@@ -737,7 +735,7 @@ export default class I3SConverter {
|
|
|
737
735
|
|
|
738
736
|
const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
|
|
739
737
|
const maxScreenThresholdSQ = lodSelection.find(
|
|
740
|
-
|
|
738
|
+
val => val.metricType === 'maxScreenThresholdSQ'
|
|
741
739
|
) || {maxError: 0};
|
|
742
740
|
|
|
743
741
|
if (isDumped) {
|
|
@@ -837,7 +835,7 @@ export default class I3SConverter {
|
|
|
837
835
|
let tileContent: Tiles3DTileContent | null = null;
|
|
838
836
|
try {
|
|
839
837
|
tileContent = await loadTile3DContent(this.sourceTileset, sourceTile, this.loadOptions);
|
|
840
|
-
} catch (
|
|
838
|
+
} catch (_error) {
|
|
841
839
|
// eslint-disable-next-line no-console
|
|
842
840
|
console.log(`[warning]: Failed to load ${sourceTile.contentUrl}`);
|
|
843
841
|
}
|
|
@@ -1017,7 +1015,7 @@ export default class I3SConverter {
|
|
|
1017
1015
|
definition: this.findOrCreateGeometryDefinition(
|
|
1018
1016
|
Boolean(
|
|
1019
1017
|
('texture' in resources && resources.texture) ||
|
|
1020
|
-
|
|
1018
|
+
('texelCountHint' in resources && resources.texelCountHint)
|
|
1021
1019
|
),
|
|
1022
1020
|
hasUvRegions
|
|
1023
1021
|
),
|
|
@@ -18,7 +18,7 @@ const PLAIN_GEOMETRY_DEFINITION = () => ({
|
|
|
18
18
|
},
|
|
19
19
|
uv0: {
|
|
20
20
|
path: 'hasTexture',
|
|
21
|
-
transform:
|
|
21
|
+
transform: val => (val && {type: 'Float32', component: 2}) || false,
|
|
22
22
|
omitValues: [false]
|
|
23
23
|
},
|
|
24
24
|
color: {
|
|
@@ -29,7 +29,7 @@ const PLAIN_GEOMETRY_DEFINITION = () => ({
|
|
|
29
29
|
},
|
|
30
30
|
uvRegion: {
|
|
31
31
|
path: 'hasUvRegions',
|
|
32
|
-
transform:
|
|
32
|
+
transform: val => (val && {type: 'UInt16', component: 4}) || false,
|
|
33
33
|
omitValues: [false]
|
|
34
34
|
},
|
|
35
35
|
featureId: {
|
|
@@ -54,7 +54,7 @@ const COMPRESSED_GEOMETRY_DEFINITION = () => ({
|
|
|
54
54
|
},
|
|
55
55
|
'compressedAttributes.attributes': {
|
|
56
56
|
path: 'geometryConfig',
|
|
57
|
-
transform:
|
|
57
|
+
transform: val => {
|
|
58
58
|
const result = ['position', 'normal'];
|
|
59
59
|
if (val.hasTexture) {
|
|
60
60
|
result.push('uv0');
|
|
@@ -72,7 +72,7 @@ const COMPRESSED_GEOMETRY_DEFINITION = () => ({
|
|
|
72
72
|
export const GEOMETRY_DEFINITION = () => ({
|
|
73
73
|
geometryBuffers: {
|
|
74
74
|
path: 'geometryConfig',
|
|
75
|
-
transform:
|
|
75
|
+
transform: val => {
|
|
76
76
|
const result = [transform(val, PLAIN_GEOMETRY_DEFINITION())];
|
|
77
77
|
if (val.draco) {
|
|
78
78
|
result.push(transform({geometryConfig: val}, COMPRESSED_GEOMETRY_DEFINITION()));
|
|
@@ -69,7 +69,7 @@ const FULL_EXTENT = () => ({
|
|
|
69
69
|
export const LAYERS = () => ({
|
|
70
70
|
version: {
|
|
71
71
|
path: 'version',
|
|
72
|
-
transform:
|
|
72
|
+
transform: val => val.toUpperCase()
|
|
73
73
|
},
|
|
74
74
|
id: {
|
|
75
75
|
path: 'id',
|
|
@@ -88,7 +88,7 @@ export const LAYERS = () => ({
|
|
|
88
88
|
},
|
|
89
89
|
spatialReference: {
|
|
90
90
|
path: 'spatialReference',
|
|
91
|
-
transform:
|
|
91
|
+
transform: val => transform(val, SPATIAL_REFERENCE())
|
|
92
92
|
},
|
|
93
93
|
capabilities: {
|
|
94
94
|
path: 'capabilities',
|
|
@@ -96,19 +96,19 @@ export const LAYERS = () => ({
|
|
|
96
96
|
},
|
|
97
97
|
store: {
|
|
98
98
|
path: 'store',
|
|
99
|
-
transform:
|
|
99
|
+
transform: val => transform(val, STORE)
|
|
100
100
|
},
|
|
101
101
|
fullExtent: {
|
|
102
102
|
path: 'fullExtent',
|
|
103
|
-
transform:
|
|
103
|
+
transform: val => transform(val, FULL_EXTENT())
|
|
104
104
|
},
|
|
105
105
|
heightModelInfo: {
|
|
106
106
|
path: 'heightModelInfo',
|
|
107
|
-
transform:
|
|
107
|
+
transform: val => transform(val, HEIGHT_MODEL_INFO())
|
|
108
108
|
},
|
|
109
109
|
nodePages: {
|
|
110
110
|
path: 'nodePages',
|
|
111
|
-
transform:
|
|
111
|
+
transform: val => transform(val, NODE_PAGES())
|
|
112
112
|
},
|
|
113
113
|
materialDefinitions: {
|
|
114
114
|
path: 'materialDefinitions',
|
|
@@ -94,7 +94,7 @@ const TEXTURE_DEFINITION_INFO = () => ({
|
|
|
94
94
|
images: {
|
|
95
95
|
path: 'images',
|
|
96
96
|
transform: (val, thisObject, originalObject) =>
|
|
97
|
-
val.map(
|
|
97
|
+
val.map(image => transform(image, TEXTURE_DEFINITION_IMAGE()))
|
|
98
98
|
}
|
|
99
99
|
});
|
|
100
100
|
|
|
@@ -11,7 +11,7 @@ let slpkArchive: SLPKArchive;
|
|
|
11
11
|
export async function loadArchive(fullLayerPath: string): Promise<void> {
|
|
12
12
|
slpkArchive = await parseSLPKArchive(
|
|
13
13
|
new NodeFile(fullLayerPath),
|
|
14
|
-
|
|
14
|
+
msg => console.log(msg) // eslint-disable-line no-console
|
|
15
15
|
);
|
|
16
16
|
// eslint-disable-next-line no-console
|
|
17
17
|
console.log('The server is ready to use');
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {createGzip} from 'zlib';
|
|
2
2
|
import {createReadStream, createWriteStream} from 'fs';
|
|
3
|
+
import {pipeline} from 'stream';
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Compress file to gzip file
|
|
@@ -14,15 +15,15 @@ export function compressFileWithGzip(pathFile: string): Promise<string> {
|
|
|
14
15
|
const output = createWriteStream(compressedPathFile);
|
|
15
16
|
|
|
16
17
|
return new Promise((resolve, reject) => {
|
|
17
|
-
input
|
|
18
|
+
pipeline(input, gzip, output, error => {
|
|
19
|
+
if (error) {
|
|
20
|
+
console.log(`${compressedPathFile}: compression error!`); // eslint-disable-line no-undef,no-console
|
|
21
|
+
reject(error);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
18
25
|
console.log(`${compressedPathFile} compressed and saved.`); // eslint-disable-line no-undef,no-console
|
|
19
26
|
resolve(compressedPathFile);
|
|
20
27
|
});
|
|
21
|
-
input.on('error', (error) => {
|
|
22
|
-
console.log(`${compressedPathFile}: compression error!`); // eslint-disable-line no-undef,no-console
|
|
23
|
-
reject(error);
|
|
24
|
-
});
|
|
25
|
-
// @ts-ignore Seems typescript upgrade triggered this
|
|
26
|
-
input.pipe(gzip).pipe(output);
|
|
27
28
|
});
|
|
28
29
|
}
|
|
@@ -141,7 +141,7 @@ export class ConversionDump {
|
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
} catch (error) {
|
|
144
|
-
//
|
|
144
|
+
// biome-ignore format: preserve intentional fixture layout
|
|
145
145
|
console.log('Can\'t open dump file', error); // eslint-disable-line no-console
|
|
146
146
|
}
|
|
147
147
|
}
|
|
@@ -196,7 +196,7 @@ export class ConversionDump {
|
|
|
196
196
|
)
|
|
197
197
|
);
|
|
198
198
|
} catch (error) {
|
|
199
|
-
//
|
|
199
|
+
// biome-ignore format: preserve intentional fixture layout
|
|
200
200
|
console.log('Can\'t update dump file', error); // eslint-disable-line no-console
|
|
201
201
|
}
|
|
202
202
|
}
|
|
@@ -289,7 +289,7 @@ export class ConversionDump {
|
|
|
289
289
|
value: boolean
|
|
290
290
|
) {
|
|
291
291
|
const nodeDump = this.tilesConverted[filename]?.nodes.find(
|
|
292
|
-
|
|
292
|
+
element => element.nodeId === nodeId
|
|
293
293
|
);
|
|
294
294
|
if (nodeDump) {
|
|
295
295
|
if (!nodeDump.progress) {
|
|
@@ -361,7 +361,7 @@ export class ConversionDump {
|
|
|
361
361
|
done: boolean
|
|
362
362
|
): Promise<void> {
|
|
363
363
|
const nodeDump = this.tilesConverted[filename]?.nodes.find(
|
|
364
|
-
|
|
364
|
+
element => element.nodeId === nodeId
|
|
365
365
|
);
|
|
366
366
|
if (nodeDump) {
|
|
367
367
|
nodeDump.done = done;
|
|
@@ -81,7 +81,7 @@ export async function openJson(path: string, fileName: string): Promise<{[key: s
|
|
|
81
81
|
const intervalId = setInterval(() => {
|
|
82
82
|
const pathFile = join(path, fileName);
|
|
83
83
|
load(pathFile, JSONLoader)
|
|
84
|
-
.then(
|
|
84
|
+
.then(result => {
|
|
85
85
|
clearInterval(intervalId);
|
|
86
86
|
resolve(result);
|
|
87
87
|
})
|
|
@@ -147,7 +147,7 @@ export async function renameFile(oldPath: string, newPath: string): Promise<void
|
|
|
147
147
|
try {
|
|
148
148
|
await fs.rename(oldPath, newPath);
|
|
149
149
|
} catch (err) {
|
|
150
|
-
//
|
|
150
|
+
// biome-ignore format: preserve intentional fixture layout
|
|
151
151
|
console.log('Can\'t rename file', err); // eslint-disable-line no-console
|
|
152
152
|
}
|
|
153
153
|
}
|
|
@@ -65,13 +65,11 @@ export function convertGeometricErrorToScreenThreshold(
|
|
|
65
65
|
* @returns lod metric in 3d-tiles format
|
|
66
66
|
*/
|
|
67
67
|
export function convertScreenThresholdToGeometricError(node: I3STileHeader): number {
|
|
68
|
-
const metricData = node.lodSelection?.find(
|
|
69
|
-
(metric) => metric.metricType === 'maxScreenThreshold'
|
|
70
|
-
);
|
|
68
|
+
const metricData = node.lodSelection?.find(metric => metric.metricType === 'maxScreenThreshold');
|
|
71
69
|
let maxError = metricData?.maxError;
|
|
72
70
|
if (!maxError) {
|
|
73
71
|
const sqMetricData = node.lodSelection?.find(
|
|
74
|
-
|
|
72
|
+
metric => metric.metricType === 'maxScreenThresholdSQ'
|
|
75
73
|
);
|
|
76
74
|
if (sqMetricData) {
|
|
77
75
|
maxError = Math.sqrt(sqMetricData.maxError / (Math.PI * 0.25));
|