@loaders.gl/tile-converter 4.3.0-alpha.7 → 4.3.0-beta.1
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-converter/3d-tiles-converter.d.ts +3 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.js +15 -11
- package/dist/3d-tiles-converter/helpers/{b3dm-converter.d.ts → 3d-tiles-content-converter.d.ts} +13 -6
- package/dist/3d-tiles-converter/helpers/3d-tiles-content-converter.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/{b3dm-converter.js → 3d-tiles-content-converter.js} +110 -17
- package/dist/3d-tiles-converter/helpers/load-i3s.d.ts.map +1 -1
- package/dist/converter-cli.js +15 -0
- package/dist/converter.min.cjs +95 -95
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts +2 -2
- package/dist/i3s-converter/helpers/batch-ids-extensions.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/batch-ids-extensions.js +1 -1
- package/dist/i3s-converter/helpers/feature-attributes.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/load-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/preprocess-3d-tiles.js +1 -2
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts +3 -3
- package/dist/i3s-converter/helpers/tileset-traversal.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +1 -0
- package/dist/i3s-server/bin/i3s-server.min.cjs +70 -70
- package/dist/i3s-server/bin/www.js +2 -0
- package/dist/i3s-server/utils/server-utils.d.ts +0 -3
- package/dist/i3s-server/utils/server-utils.d.ts.map +1 -1
- package/dist/index.cjs +130 -34
- package/dist/index.cjs.map +4 -4
- package/dist/lib/utils/conversion-dump.d.ts +1 -0
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +3 -2
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +1 -1
- package/package.json +20 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +40 -14
- package/src/3d-tiles-converter/helpers/{b3dm-converter.ts → 3d-tiles-content-converter.ts} +157 -21
- package/src/converter-cli.ts +22 -0
- package/src/i3s-converter/helpers/batch-ids-extensions.ts +6 -6
- package/src/i3s-converter/helpers/geometry-converter.ts +6 -2
- package/src/i3s-converter/helpers/preprocess-3d-tiles.ts +2 -2
- package/src/i3s-converter/i3s-converter.ts +1 -0
- package/src/i3s-server/README.md +2 -0
- package/src/i3s-server/bin/www.ts +2 -0
- package/src/lib/utils/conversion-dump.ts +5 -2
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +0 -1
|
@@ -11,12 +11,14 @@ import { formErrorHandler, formListeningHandler, normalizePort } from "../utils/
|
|
|
11
11
|
// const __filename = fileURLToPath(import.meta.url);
|
|
12
12
|
// const __dirname = path.dirname(__filename);
|
|
13
13
|
/** Get port from environment and store in Express. */
|
|
14
|
+
// eslint-disable-next-line no-process-env
|
|
14
15
|
const httpPort = normalizePort(process.env.PORT || '80');
|
|
15
16
|
if (httpPort === false) {
|
|
16
17
|
// eslint-disable-next-line no-console
|
|
17
18
|
console.error('Incorrect HTTP port');
|
|
18
19
|
process.exit(1); // eslint-disable-line no-process-exit
|
|
19
20
|
}
|
|
21
|
+
// eslint-disable-next-line no-process-env
|
|
20
22
|
const httpsPort = normalizePort(process.env.HTTPS_PORT || '443');
|
|
21
23
|
if (httpsPort === false) {
|
|
22
24
|
// eslint-disable-next-line no-console
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../../../src/i3s-server/utils/server-utils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"server-utils.d.ts","sourceRoot":"","sources":["../../../src/i3s-server/utils/server-utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,MAAM,IAAI,WAAW,EAAC,MAAM,OAAO,CAAC;AACjD,OAAO,KAAK,EAAC,MAAM,IAAI,UAAU,EAAC,MAAM,MAAM,CAAC;AAK/C;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAclE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,GAAG,MAAM,GAE5B,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,KAAK,IAAI,CAuBxC;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,cAAc,EAAE,WAAW,GAAG,UAAU,GAAG,MAAM,IAAI,CAMzF"}
|
package/dist/index.cjs
CHANGED
|
@@ -1109,8 +1109,8 @@ function prepareNodes(nodes) {
|
|
|
1109
1109
|
}
|
|
1110
1110
|
|
|
1111
1111
|
// dist/i3s-converter/helpers/batch-ids-extensions.js
|
|
1112
|
-
var import_math = require("@loaders.gl/math");
|
|
1113
1112
|
var import_gltf = require("@loaders.gl/gltf");
|
|
1113
|
+
var import_math = require("@loaders.gl/math");
|
|
1114
1114
|
function getTextureByMetadataClass(tileContent, metadataClass) {
|
|
1115
1115
|
var _a2, _b;
|
|
1116
1116
|
const extFeatureMetadata = (_b = (_a2 = tileContent.gltf) == null ? void 0 : _a2.extensions) == null ? void 0 : _b[import_gltf.EXT_FEATURE_METADATA];
|
|
@@ -2325,7 +2325,7 @@ function convertScreenThresholdToGeometricError(node) {
|
|
|
2325
2325
|
|
|
2326
2326
|
// dist/pgm-loader.js
|
|
2327
2327
|
var import_geoid = require("@math.gl/geoid");
|
|
2328
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
2328
|
+
var VERSION = true ? "4.3.0-alpha.8" : "latest";
|
|
2329
2329
|
var PGMLoader = {
|
|
2330
2330
|
dataType: null,
|
|
2331
2331
|
batchType: null,
|
|
@@ -3486,7 +3486,6 @@ var traverseDatasetWith = async ({ tile, traversalProps, processTile, postproces
|
|
|
3486
3486
|
// dist/i3s-converter/helpers/preprocess-3d-tiles.js
|
|
3487
3487
|
var import_gltf4 = require("@loaders.gl/gltf");
|
|
3488
3488
|
var import_core8 = require("@loaders.gl/core");
|
|
3489
|
-
var import_gltf5 = require("@loaders.gl/gltf");
|
|
3490
3489
|
var GLTF_PRIMITIVE_MODES = [
|
|
3491
3490
|
GLTFPrimitiveModeString.POINTS,
|
|
3492
3491
|
// 0
|
|
@@ -3541,7 +3540,7 @@ var getMeshTypesFromGLTF = (gltfJson) => {
|
|
|
3541
3540
|
var getMetadataClassesFromGLTF = (gltfJson) => {
|
|
3542
3541
|
var _a2, _b, _c, _d, _e, _f;
|
|
3543
3542
|
const result = /* @__PURE__ */ new Set();
|
|
3544
|
-
const extFeatureMetadataClasses = (_c = (_b = (_a2 = gltfJson.extensions) == null ? void 0 : _a2[
|
|
3543
|
+
const extFeatureMetadataClasses = (_c = (_b = (_a2 = gltfJson.extensions) == null ? void 0 : _a2[import_gltf4.EXT_FEATURE_METADATA]) == null ? void 0 : _b.schema) == null ? void 0 : _c.classes;
|
|
3545
3544
|
if (extFeatureMetadataClasses) {
|
|
3546
3545
|
for (const classKey of Object.keys(extFeatureMetadataClasses)) {
|
|
3547
3546
|
result.add(classKey);
|
|
@@ -4024,7 +4023,7 @@ var ConversionDump = class {
|
|
|
4024
4023
|
* @param currentOptions - converter options
|
|
4025
4024
|
*/
|
|
4026
4025
|
async createDump(currentOptions) {
|
|
4027
|
-
const { tilesetName, slpk, egmFilePath, inputUrl, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, mergeMaterials: mergeMaterials2 = true, metadataClass, analyze = false } = currentOptions;
|
|
4026
|
+
const { tilesetName, slpk, egmFilePath, inputUrl, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, mergeMaterials: mergeMaterials2 = true, metadataClass, analyze = false, outputVersion = "1.1" } = currentOptions;
|
|
4028
4027
|
this.options = {
|
|
4029
4028
|
tilesetName,
|
|
4030
4029
|
slpk,
|
|
@@ -4038,7 +4037,8 @@ var ConversionDump = class {
|
|
|
4038
4037
|
generateBoundingVolumes,
|
|
4039
4038
|
mergeMaterials: mergeMaterials2,
|
|
4040
4039
|
metadataClass,
|
|
4041
|
-
analyze
|
|
4040
|
+
analyze,
|
|
4041
|
+
outputVersion
|
|
4042
4042
|
};
|
|
4043
4043
|
const dumpFilename = (0, import_path6.join)(this.options.outputPath, this.options.tilesetName, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`);
|
|
4044
4044
|
if (await isFileExists(dumpFilename)) {
|
|
@@ -5411,11 +5411,12 @@ var TILESET = () => ({
|
|
|
5411
5411
|
// dist/3d-tiles-converter/3d-tiles-converter.js
|
|
5412
5412
|
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
5413
5413
|
|
|
5414
|
-
// dist/3d-tiles-converter/helpers/
|
|
5414
|
+
// dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js
|
|
5415
5415
|
var import_core12 = require("@loaders.gl/core");
|
|
5416
|
-
var
|
|
5416
|
+
var import_gltf5 = require("@loaders.gl/gltf");
|
|
5417
5417
|
var import_d_tiles3 = require("@loaders.gl/3d-tiles");
|
|
5418
5418
|
var import_core13 = require("@math.gl/core");
|
|
5419
|
+
var import_types5 = require("@math.gl/types");
|
|
5419
5420
|
var import_geospatial6 = require("@math.gl/geospatial");
|
|
5420
5421
|
|
|
5421
5422
|
// dist/3d-tiles-converter/helpers/texture-atlas.js
|
|
@@ -5449,41 +5450,48 @@ function normalizeRegions(regions) {
|
|
|
5449
5450
|
return normalizedRegions;
|
|
5450
5451
|
}
|
|
5451
5452
|
|
|
5452
|
-
// dist/3d-tiles-converter/helpers/
|
|
5453
|
+
// dist/3d-tiles-converter/helpers/3d-tiles-content-converter.js
|
|
5453
5454
|
var Z_UP_TO_Y_UP_MATRIX = new import_core13.Matrix4([1, 0, 0, 0, 0, 0, -1, 0, 0, 1, 0, 0, 0, 0, 0, 1]);
|
|
5454
5455
|
var scratchVector2 = new import_core13.Vector3();
|
|
5455
5456
|
var KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
|
|
5456
5457
|
var METALLIC_FACTOR_DEFAULT = 1;
|
|
5457
5458
|
var ROUGHNESS_FACTOR_DEFAULT = 1;
|
|
5458
|
-
var
|
|
5459
|
+
var Tiles3DContentConverter = class {
|
|
5459
5460
|
// @ts-expect-error
|
|
5460
5461
|
rtcCenter;
|
|
5461
5462
|
i3sTile;
|
|
5463
|
+
tileType;
|
|
5464
|
+
constructor(options = { outputVersion: "1.1" }) {
|
|
5465
|
+
this.tileType = options.outputVersion === "1.0" ? import_d_tiles3.TILE3D_TYPE.BATCHED_3D_MODEL : import_d_tiles3.TILE3D_TYPE.GLTF;
|
|
5466
|
+
}
|
|
5462
5467
|
/**
|
|
5463
5468
|
* The starter of content conversion
|
|
5464
5469
|
* @param i3sTile - Tile3D instance for I3S node
|
|
5465
5470
|
* @returns - encoded content
|
|
5466
5471
|
*/
|
|
5467
|
-
async convert(i3sAttributesData, featureAttributes = null) {
|
|
5468
|
-
const gltf = await this.buildGLTF(i3sAttributesData, featureAttributes);
|
|
5469
|
-
|
|
5470
|
-
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
|
|
5474
|
-
|
|
5475
|
-
|
|
5472
|
+
async convert(i3sAttributesData, featureAttributes = null, attributeStorageInfo) {
|
|
5473
|
+
const gltf = await this.buildGLTF(i3sAttributesData, featureAttributes, attributeStorageInfo);
|
|
5474
|
+
if (this.tileType === import_d_tiles3.TILE3D_TYPE.BATCHED_3D_MODEL) {
|
|
5475
|
+
const b3dm = (0, import_core12.encodeSync)({
|
|
5476
|
+
gltfEncoded: new Uint8Array(gltf),
|
|
5477
|
+
type: "b3dm",
|
|
5478
|
+
featuresLength: this._getFeaturesLength(featureAttributes),
|
|
5479
|
+
batchTable: featureAttributes
|
|
5480
|
+
}, import_d_tiles3.Tile3DWriter);
|
|
5481
|
+
return b3dm;
|
|
5482
|
+
}
|
|
5483
|
+
return gltf;
|
|
5476
5484
|
}
|
|
5477
5485
|
/**
|
|
5478
5486
|
* Build and encode gltf
|
|
5479
5487
|
* @param i3sTile - Tile3D instance for I3S node
|
|
5480
5488
|
* @returns - encoded glb content
|
|
5481
5489
|
*/
|
|
5482
|
-
// eslint-disable-next-line max-statements
|
|
5483
|
-
async buildGLTF(i3sAttributesData, featureAttributes) {
|
|
5490
|
+
// eslint-disable-next-line complexity, max-statements
|
|
5491
|
+
async buildGLTF(i3sAttributesData, featureAttributes, attributeStorageInfo) {
|
|
5484
5492
|
const { tileContent, textureFormat, box } = i3sAttributesData;
|
|
5485
5493
|
const { material, attributes, indices: originalIndices, modelMatrix } = tileContent;
|
|
5486
|
-
const gltfBuilder = new
|
|
5494
|
+
const gltfBuilder = new import_gltf5.GLTFScenegraph();
|
|
5487
5495
|
const textureIndex = await this._addI3sTextureToGLTF(tileContent, textureFormat, gltfBuilder);
|
|
5488
5496
|
const pbrMetallicRoughness = material == null ? void 0 : material.pbrMetallicRoughness;
|
|
5489
5497
|
if (pbrMetallicRoughness && (pbrMetallicRoughness.metallicFactor === void 0 || pbrMetallicRoughness.metallicFactor === METALLIC_FACTOR_DEFAULT) && (pbrMetallicRoughness.roughnessFactor === void 0 || pbrMetallicRoughness.roughnessFactor === ROUGHNESS_FACTOR_DEFAULT)) {
|
|
@@ -5511,13 +5519,97 @@ var B3dmConverter = class {
|
|
|
5511
5519
|
material: materialIndex,
|
|
5512
5520
|
mode: 4
|
|
5513
5521
|
});
|
|
5522
|
+
if (this.tileType === import_d_tiles3.TILE3D_TYPE.GLTF) {
|
|
5523
|
+
this._createMetadataExtensions(gltfBuilder, meshIndex, featureAttributes, attributeStorageInfo, tileContent);
|
|
5524
|
+
}
|
|
5514
5525
|
const transformMatrix = this._generateTransformMatrix(cartesianOrigin);
|
|
5515
5526
|
const nodeIndex = gltfBuilder.addNode({ meshIndex, matrix: transformMatrix });
|
|
5516
5527
|
const sceneIndex = gltfBuilder.addScene({ nodeIndices: [nodeIndex] });
|
|
5517
5528
|
gltfBuilder.setDefaultScene(sceneIndex);
|
|
5518
5529
|
gltfBuilder.createBinaryChunk();
|
|
5519
|
-
|
|
5520
|
-
|
|
5530
|
+
return (0, import_core12.encodeSync)(gltfBuilder.gltf, import_gltf5.GLTFWriter, { gltfBuilder });
|
|
5531
|
+
}
|
|
5532
|
+
_createMetadataExtensions(gltfBuilder, meshIndex, featureAttributes, attributeStorageInfo, tileContent) {
|
|
5533
|
+
var _a2;
|
|
5534
|
+
const propertyAttributes = this._createPropertyAttibutes(featureAttributes, attributeStorageInfo);
|
|
5535
|
+
const tableIndex = (0, import_gltf5.createExtStructuralMetadata)(gltfBuilder, propertyAttributes);
|
|
5536
|
+
const mesh = gltfBuilder.getMesh(meshIndex);
|
|
5537
|
+
for (const primitive of mesh.primitives) {
|
|
5538
|
+
if ((_a2 = tileContent.attributes._BATCHID) == null ? void 0 : _a2.value) {
|
|
5539
|
+
(0, import_gltf5.createExtMeshFeatures)(gltfBuilder, primitive, tileContent.attributes._BATCHID.value, tableIndex);
|
|
5540
|
+
}
|
|
5541
|
+
}
|
|
5542
|
+
}
|
|
5543
|
+
_createPropertyAttibutes(featureAttributes, attributeStorageInfo) {
|
|
5544
|
+
if (!featureAttributes || !attributeStorageInfo) {
|
|
5545
|
+
return [];
|
|
5546
|
+
}
|
|
5547
|
+
const propertyAttributeArray = [];
|
|
5548
|
+
for (const attributeName in featureAttributes) {
|
|
5549
|
+
const propertyAttribute = this._convertAttributeStorageInfoToPropertyAttribute(attributeName, attributeStorageInfo, featureAttributes);
|
|
5550
|
+
if (propertyAttribute) {
|
|
5551
|
+
propertyAttributeArray.push(propertyAttribute);
|
|
5552
|
+
}
|
|
5553
|
+
}
|
|
5554
|
+
return propertyAttributeArray;
|
|
5555
|
+
}
|
|
5556
|
+
// eslint-disable-next-line complexity
|
|
5557
|
+
_convertAttributeStorageInfoToPropertyAttribute(attributeName, attributeStorageInfo, featureAttributes) {
|
|
5558
|
+
const attributeValues = featureAttributes[attributeName];
|
|
5559
|
+
const info = attributeStorageInfo.find((e) => e.name === attributeName);
|
|
5560
|
+
if (!info) {
|
|
5561
|
+
return null;
|
|
5562
|
+
}
|
|
5563
|
+
const attributeMetadata = info.attributeValues;
|
|
5564
|
+
if (!(attributeMetadata == null ? void 0 : attributeMetadata.valueType)) {
|
|
5565
|
+
return null;
|
|
5566
|
+
}
|
|
5567
|
+
let elementType;
|
|
5568
|
+
let componentType;
|
|
5569
|
+
switch (attributeMetadata.valueType.toLowerCase()) {
|
|
5570
|
+
case "oid32":
|
|
5571
|
+
elementType = "SCALAR";
|
|
5572
|
+
componentType = "UINT32";
|
|
5573
|
+
break;
|
|
5574
|
+
case "int32":
|
|
5575
|
+
elementType = "SCALAR";
|
|
5576
|
+
componentType = "INT32";
|
|
5577
|
+
break;
|
|
5578
|
+
case "uint32":
|
|
5579
|
+
elementType = "SCALAR";
|
|
5580
|
+
componentType = "UINT32";
|
|
5581
|
+
break;
|
|
5582
|
+
case "int16":
|
|
5583
|
+
elementType = "SCALAR";
|
|
5584
|
+
componentType = "INT16";
|
|
5585
|
+
break;
|
|
5586
|
+
case "uint16":
|
|
5587
|
+
elementType = "SCALAR";
|
|
5588
|
+
componentType = "UINT16";
|
|
5589
|
+
break;
|
|
5590
|
+
case "float64":
|
|
5591
|
+
elementType = "SCALAR";
|
|
5592
|
+
componentType = "FLOAT64";
|
|
5593
|
+
break;
|
|
5594
|
+
case "string":
|
|
5595
|
+
elementType = "STRING";
|
|
5596
|
+
break;
|
|
5597
|
+
default:
|
|
5598
|
+
elementType = "";
|
|
5599
|
+
break;
|
|
5600
|
+
}
|
|
5601
|
+
const propertyAttribute = {
|
|
5602
|
+
name: attributeName,
|
|
5603
|
+
elementType,
|
|
5604
|
+
componentType,
|
|
5605
|
+
values: []
|
|
5606
|
+
};
|
|
5607
|
+
if ((0, import_types5.isTypedArray)(attributeValues)) {
|
|
5608
|
+
propertyAttribute.values = Array.from(attributeValues);
|
|
5609
|
+
} else if (attributeValues !== null) {
|
|
5610
|
+
propertyAttribute.values = attributeValues;
|
|
5611
|
+
}
|
|
5612
|
+
return propertyAttribute;
|
|
5521
5613
|
}
|
|
5522
5614
|
/**
|
|
5523
5615
|
* Update gltfBuilder with texture from I3S tile
|
|
@@ -5806,6 +5898,7 @@ var Tiles3DConverter = class {
|
|
|
5806
5898
|
};
|
|
5807
5899
|
conversionDump;
|
|
5808
5900
|
progress;
|
|
5901
|
+
fileExt;
|
|
5809
5902
|
constructor() {
|
|
5810
5903
|
this.options = {};
|
|
5811
5904
|
this.tilesetPath = "";
|
|
@@ -5817,12 +5910,14 @@ var Tiles3DConverter = class {
|
|
|
5817
5910
|
this.workerSource = {};
|
|
5818
5911
|
this.conversionDump = new ConversionDump();
|
|
5819
5912
|
this.progress = new Progress();
|
|
5913
|
+
this.fileExt = "";
|
|
5820
5914
|
}
|
|
5821
5915
|
/**
|
|
5822
5916
|
* Convert i3s format data to 3dTiles
|
|
5823
5917
|
* @param options
|
|
5824
5918
|
* @param options.inputUrl the url to read the tileset from
|
|
5825
5919
|
* @param options.outputPath the output filename
|
|
5920
|
+
* @param options.outputVersion the version of 3DTiles
|
|
5826
5921
|
* @param options.tilesetName the output name of the tileset
|
|
5827
5922
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
5828
5923
|
* @param options.maxDepth The max tree depth of conversion
|
|
@@ -5834,9 +5929,10 @@ var Tiles3DConverter = class {
|
|
|
5834
5929
|
console.log(BROWSER_ERROR_MESSAGE);
|
|
5835
5930
|
return BROWSER_ERROR_MESSAGE;
|
|
5836
5931
|
}
|
|
5837
|
-
const { inputUrl, outputPath, tilesetName, maxDepth, egmFilePath, inquirer, analyze } = options;
|
|
5932
|
+
const { inputUrl, outputPath, outputVersion, tilesetName, maxDepth, egmFilePath, inquirer, analyze } = options;
|
|
5838
5933
|
this.conversionStartTime = import_process5.default.hrtime();
|
|
5839
|
-
this.options = { maxDepth, inquirer };
|
|
5934
|
+
this.options = { maxDepth, inquirer, outputVersion };
|
|
5935
|
+
this.fileExt = this.options.outputVersion === "1.0" ? "b3dm" : "glb";
|
|
5840
5936
|
console.log("Loading egm file...");
|
|
5841
5937
|
this.geoidHeightModel = await (0, import_core15.load)(egmFilePath, PGMLoader);
|
|
5842
5938
|
console.log("Loading egm file completed!");
|
|
@@ -5891,7 +5987,7 @@ var Tiles3DConverter = class {
|
|
|
5891
5987
|
refine: "REPLACE"
|
|
5892
5988
|
};
|
|
5893
5989
|
await this._addChildren(rootNode, rootTile, 1);
|
|
5894
|
-
const tileset = (0, import_json_map_transform10.default)({ root: rootTile }, TILESET());
|
|
5990
|
+
const tileset = (0, import_json_map_transform10.default)({ asset: { version: outputVersion }, root: rootTile }, TILESET());
|
|
5895
5991
|
await writeFile(this.tilesetPath, JSON.stringify(tileset), "tileset.json");
|
|
5896
5992
|
await this.conversionDump.deleteDumpFile();
|
|
5897
5993
|
this.progress.stopMonitoring();
|
|
@@ -5938,7 +6034,7 @@ var Tiles3DConverter = class {
|
|
|
5938
6034
|
let nextParentNode = parentNode;
|
|
5939
6035
|
const sourceChild = await this._loadChildNode(parentSourceNode, childNodeInfo);
|
|
5940
6036
|
if (sourceChild.contentUrl) {
|
|
5941
|
-
if (this.conversionDump.restored && this.conversionDump.isFileConversionComplete(`${sourceChild.id}.
|
|
6037
|
+
if (this.conversionDump.restored && this.conversionDump.isFileConversionComplete(`${sourceChild.id}.${this.fileExt}`) && (sourceChild.obb || sourceChild.mbs)) {
|
|
5942
6038
|
const { child: child2 } = this._createChildAndBoundingVolume(sourceChild);
|
|
5943
6039
|
parentNode.children.push(child2);
|
|
5944
6040
|
await this._addChildren(sourceChild, child2, level + 1);
|
|
@@ -5960,11 +6056,11 @@ var Tiles3DConverter = class {
|
|
|
5960
6056
|
box: boundingVolume.box || [],
|
|
5961
6057
|
textureFormat: sourceChild.textureFormat
|
|
5962
6058
|
};
|
|
5963
|
-
const
|
|
5964
|
-
const
|
|
5965
|
-
await this.conversionDump.addNode(`${sourceChild.id}.
|
|
5966
|
-
await writeFile(this.tilesetPath, new Uint8Array(
|
|
5967
|
-
await this.conversionDump.updateConvertedNodesDumpFile(`${sourceChild.id}.
|
|
6059
|
+
const converter = new Tiles3DContentConverter({ outputVersion: this.options.outputVersion });
|
|
6060
|
+
const contentData = await converter.convert(i3sAttributesData, featureAttributes, this.attributeStorageInfo);
|
|
6061
|
+
await this.conversionDump.addNode(`${sourceChild.id}.${this.fileExt}`, sourceChild.id);
|
|
6062
|
+
await writeFile(this.tilesetPath, new Uint8Array(contentData), `${sourceChild.id}.${this.fileExt}`);
|
|
6063
|
+
await this.conversionDump.updateConvertedNodesDumpFile(`${sourceChild.id}.${this.fileExt}`, sourceChild.id, true);
|
|
5968
6064
|
parentNode.children.push(child);
|
|
5969
6065
|
nextParentNode = child;
|
|
5970
6066
|
}
|
|
@@ -6037,7 +6133,7 @@ var Tiles3DConverter = class {
|
|
|
6037
6133
|
geometricError: convertScreenThresholdToGeometricError(sourceChild),
|
|
6038
6134
|
children: [],
|
|
6039
6135
|
content: {
|
|
6040
|
-
uri: `${sourceChild.id}.
|
|
6136
|
+
uri: `${sourceChild.id}.${this.fileExt}`,
|
|
6041
6137
|
boundingVolume
|
|
6042
6138
|
}
|
|
6043
6139
|
};
|