@loaders.gl/tile-converter 4.3.0-alpha.3 → 4.3.0-alpha.5
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 +4 -1
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -1
- package/dist/converter-cli.js +6 -14
- package/dist/converter.min.cjs +94 -95
- package/dist/deps-installer/deps-installer.js +1 -1
- 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/coordinate-converter.js +9 -5
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +4 -2
- package/dist/i3s-converter/helpers/node-index-document.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-index-document.js +6 -14
- package/dist/i3s-converter/helpers/node-pages.d.ts +1 -1
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/node-pages.js +14 -40
- package/dist/i3s-converter/i3s-converter.d.ts +24 -22
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +67 -132
- package/dist/i3s-server/app.d.ts +2 -1
- package/dist/i3s-server/app.d.ts.map +1 -1
- package/dist/i3s-server/app.js +7 -10
- package/dist/i3s-server/bin/i3s-server.min.cjs +71 -71
- package/dist/i3s-server/bin/www.js +5 -0
- package/dist/i3s-server/routes/slpk-router.js +7 -1
- package/dist/index.cjs +98 -200
- package/dist/index.cjs.map +2 -2
- package/dist/lib/utils/statistic-utills.d.ts +4 -1
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -1
- package/dist/lib/utils/statistic-utills.js +4 -23
- package/dist/pgm-loader.js +1 -1
- package/package.json +19 -20
- package/src/3d-tiles-converter/3d-tiles-converter.ts +2 -1
- package/src/converter-cli.ts +8 -20
- package/src/i3s-converter/helpers/coordinate-converter.ts +13 -7
- package/src/i3s-converter/helpers/geometry-converter.ts +6 -4
- package/src/i3s-converter/helpers/node-index-document.ts +16 -26
- package/src/i3s-converter/helpers/node-pages.ts +20 -46
- package/src/i3s-converter/i3s-converter.ts +101 -161
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- package/src/i3s-server/routes/slpk-router.ts +6 -1
- package/src/lib/utils/statistic-utills.ts +5 -27
- package/bin/slpk-extractor.js +0 -2
- package/dist/i3s-server/controllers/index-controller.d.ts +0 -8
- package/dist/i3s-server/controllers/index-controller.d.ts.map +0 -1
- package/dist/i3s-server/controllers/index-controller.js +0 -31
- package/dist/i3s-server/routes/index.d.ts +0 -2
- package/dist/i3s-server/routes/index.d.ts.map +0 -1
- package/dist/i3s-server/routes/index.js +0 -17
- package/dist/slpk-extractor/slpk-extractor.d.ts +0 -23
- package/dist/slpk-extractor/slpk-extractor.d.ts.map +0 -1
- package/dist/slpk-extractor/slpk-extractor.js +0 -73
- package/dist/slpk-extractor-cli.d.ts +0 -17
- package/dist/slpk-extractor-cli.d.ts.map +0 -1
- package/dist/slpk-extractor-cli.js +0 -105
- package/dist/slpk-extractor.min.cjs +0 -344
- package/src/i3s-server/controllers/index-controller.ts +0 -32
- package/src/i3s-server/routes/index.ts +0 -18
- package/src/slpk-extractor/slpk-extractor.ts +0 -102
- package/src/slpk-extractor-cli.ts +0 -136
|
@@ -28,6 +28,11 @@ const options = {
|
|
|
28
28
|
key: fs.readFileSync(path.join(__dirname, '../certs/key.pem')),
|
|
29
29
|
cert: fs.readFileSync(path.join(__dirname, '../certs/cert.pem'))
|
|
30
30
|
};
|
|
31
|
+
if (!app) {
|
|
32
|
+
// eslint-disable-next-line no-console
|
|
33
|
+
console.error('This server supports *.slpk files only');
|
|
34
|
+
process.exit(1); // eslint-disable-line no-process-exit
|
|
35
|
+
}
|
|
31
36
|
const httpServer = http.createServer(app);
|
|
32
37
|
const httpsServer = https.createServer(options, app);
|
|
33
38
|
/** Listen on provided port, on all network interfaces. */
|
|
@@ -23,7 +23,13 @@ router.get('*', (req, res, next) => {
|
|
|
23
23
|
async function routerCallback(req, res, next) {
|
|
24
24
|
const file = await getFileByUrl(req.path.replace(/\/+$/, ''));
|
|
25
25
|
if (file) {
|
|
26
|
-
|
|
26
|
+
try {
|
|
27
|
+
const json = JSON.parse(textDecoder.decode(file));
|
|
28
|
+
res.send(json);
|
|
29
|
+
}
|
|
30
|
+
catch (e) {
|
|
31
|
+
res.send(Buffer.from(file));
|
|
32
|
+
}
|
|
27
33
|
}
|
|
28
34
|
else {
|
|
29
35
|
res.status(404);
|
package/dist/index.cjs
CHANGED
|
@@ -456,15 +456,8 @@ var NodePages = class {
|
|
|
456
456
|
* @returns file path and file name
|
|
457
457
|
*/
|
|
458
458
|
getNodePageFileName(nodePageId) {
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
if (this.converter.options.slpk) {
|
|
462
|
-
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
463
|
-
fileName = `${nodePageId.toString()}.json`;
|
|
464
|
-
} else {
|
|
465
|
-
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", nodePageId.toString());
|
|
466
|
-
fileName = "index.json";
|
|
467
|
-
}
|
|
459
|
+
const filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
460
|
+
const fileName = `${nodePageId.toString()}.json`;
|
|
468
461
|
return { filePath, fileName };
|
|
469
462
|
}
|
|
470
463
|
/**
|
|
@@ -564,16 +557,10 @@ var NodePages = class {
|
|
|
564
557
|
nodePage.nodes.push(node);
|
|
565
558
|
}
|
|
566
559
|
const nodePageStr = JSON.stringify(nodePage);
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
}, true);
|
|
572
|
-
} else {
|
|
573
|
-
await this.converter.writeQueue.enqueue({
|
|
574
|
-
writePromise: () => this.writeFile(filePath, nodePageStr)
|
|
575
|
-
}, true);
|
|
576
|
-
}
|
|
560
|
+
await this.converter.writeQueue.enqueue({
|
|
561
|
+
archiveKey: `nodePages/${nodePageIndex.toString()}.json.gz`,
|
|
562
|
+
writePromise: () => this.writeFile(filePath, nodePageStr, fileName, true, this.converter.compressList)
|
|
563
|
+
}, true);
|
|
577
564
|
}
|
|
578
565
|
/**
|
|
579
566
|
* Save metadata file (for slpk only)
|
|
@@ -595,25 +582,15 @@ var NodePages = class {
|
|
|
595
582
|
await this.saveMetadata();
|
|
596
583
|
return;
|
|
597
584
|
}
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
await this.saveMetadata();
|
|
608
|
-
} else {
|
|
609
|
-
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
610
|
-
const nodePageStr = JSON.stringify(nodePage);
|
|
611
|
-
const nodePagePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", index.toString());
|
|
612
|
-
await this.converter.writeQueue.enqueue({
|
|
613
|
-
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
614
|
-
});
|
|
615
|
-
}
|
|
585
|
+
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
586
|
+
const nodePageStr = JSON.stringify(nodePage);
|
|
587
|
+
const slpkPath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
588
|
+
await this.converter.writeQueue.enqueue({
|
|
589
|
+
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
590
|
+
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
591
|
+
});
|
|
616
592
|
}
|
|
593
|
+
await this.saveMetadata();
|
|
617
594
|
}
|
|
618
595
|
/**
|
|
619
596
|
* Update resource index in node.mesh object
|
|
@@ -730,35 +707,17 @@ function timeConverterFromSecondsAndMilliseconds(timeInSeconds, milliseconds) {
|
|
|
730
707
|
return result;
|
|
731
708
|
}
|
|
732
709
|
async function calculateFilesSize(params) {
|
|
733
|
-
const {
|
|
710
|
+
const { outputPath, tilesetName } = params;
|
|
734
711
|
const fullOutputPath = getAbsoluteFilePath(outputPath);
|
|
735
712
|
try {
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
return stat.size;
|
|
740
|
-
}
|
|
741
|
-
const directoryPath = (0, import_path3.join)(fullOutputPath, tilesetName);
|
|
742
|
-
const totalSize = await getTotalFilesSize(directoryPath);
|
|
743
|
-
return totalSize;
|
|
713
|
+
const slpkPath = (0, import_path3.join)(fullOutputPath, `${tilesetName}.slpk`);
|
|
714
|
+
const stat = await import_fs3.promises.stat(slpkPath);
|
|
715
|
+
return stat.size;
|
|
744
716
|
} catch (error) {
|
|
745
717
|
console.log("Calculate file sizes error: ", error);
|
|
746
718
|
return null;
|
|
747
719
|
}
|
|
748
720
|
}
|
|
749
|
-
async function getTotalFilesSize(dirPath) {
|
|
750
|
-
let totalFileSize = 0;
|
|
751
|
-
const files = await import_fs3.promises.readdir(dirPath);
|
|
752
|
-
for (const file of files) {
|
|
753
|
-
const fileStat = await import_fs3.promises.stat((0, import_path3.join)(dirPath, file));
|
|
754
|
-
if (fileStat.isDirectory()) {
|
|
755
|
-
totalFileSize += await getTotalFilesSize((0, import_path3.join)(dirPath, file));
|
|
756
|
-
} else {
|
|
757
|
-
totalFileSize += fileStat.size;
|
|
758
|
-
}
|
|
759
|
-
}
|
|
760
|
-
return totalFileSize;
|
|
761
|
-
}
|
|
762
721
|
|
|
763
722
|
// dist/i3s-converter/helpers/geometry-converter.js
|
|
764
723
|
var import_core4 = require("@math.gl/core");
|
|
@@ -960,7 +919,9 @@ function createBoundingVolumes(sourceBoundingVolume, geoidHeightModel) {
|
|
|
960
919
|
let halfSize;
|
|
961
920
|
let quaternion;
|
|
962
921
|
const cartographicCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(sourceBoundingVolume.center, new import_core2.Vector3());
|
|
963
|
-
|
|
922
|
+
if (geoidHeightModel) {
|
|
923
|
+
cartographicCenter[2] = cartographicCenter[2] - geoidHeightModel.getHeight(cartographicCenter[1], cartographicCenter[0]);
|
|
924
|
+
}
|
|
964
925
|
if (sourceBoundingVolume instanceof import_culling.OrientedBoundingBox) {
|
|
965
926
|
halfSize = sourceBoundingVolume.halfSize;
|
|
966
927
|
radius = new import_core2.Vector3(halfSize[0], halfSize[1], halfSize[2]).len();
|
|
@@ -985,8 +946,10 @@ function createBoundingVolumesFromGeometry(cartesianPositions, geoidHeightModel)
|
|
|
985
946
|
const geometryMbs = (0, import_culling.makeBoundingSphereFromPoints)(positionVectors);
|
|
986
947
|
const mbsCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryMbs.center, new import_core2.Vector3());
|
|
987
948
|
const obbCenter = import_geospatial.Ellipsoid.WGS84.cartesianToCartographic(geometryObb.center, new import_core2.Vector3());
|
|
988
|
-
|
|
989
|
-
|
|
949
|
+
if (geoidHeightModel) {
|
|
950
|
+
mbsCenter[2] = mbsCenter[2] - geoidHeightModel.getHeight(mbsCenter[1], mbsCenter[0]);
|
|
951
|
+
obbCenter[2] = obbCenter[2] - geoidHeightModel.getHeight(obbCenter[1], obbCenter[0]);
|
|
952
|
+
}
|
|
990
953
|
return {
|
|
991
954
|
mbs: [mbsCenter[0], mbsCenter[1], mbsCenter[2], geometryMbs.radius],
|
|
992
955
|
obb: {
|
|
@@ -1447,7 +1410,9 @@ function _generateBoundingVolumesFromGeometry(convertedAttributesMap, geoidHeigh
|
|
|
1447
1410
|
for (let index = 0; index < attributes.positions.length; index += VALUES_PER_VERTEX2) {
|
|
1448
1411
|
const vertex = attributes.positions.subarray(index, index + VALUES_PER_VERTEX2);
|
|
1449
1412
|
import_geospatial3.Ellipsoid.WGS84.cartesianToCartographic(Array.from(vertex), scratchVector);
|
|
1450
|
-
|
|
1413
|
+
if (geoidHeightModel) {
|
|
1414
|
+
scratchVector[2] = scratchVector[2] - geoidHeightModel.getHeight(scratchVector[1], scratchVector[0]);
|
|
1415
|
+
}
|
|
1451
1416
|
scratchVector = scratchVector.subtract(cartographicOrigin);
|
|
1452
1417
|
attributes.positions.set(scratchVector, index);
|
|
1453
1418
|
}
|
|
@@ -2342,7 +2307,7 @@ function convertScreenThresholdToGeometricError(node) {
|
|
|
2342
2307
|
|
|
2343
2308
|
// dist/pgm-loader.js
|
|
2344
2309
|
var import_geoid = require("@math.gl/geoid");
|
|
2345
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
2310
|
+
var VERSION = true ? "4.3.0-alpha.4" : "latest";
|
|
2346
2311
|
var PGMLoader = {
|
|
2347
2312
|
dataType: null,
|
|
2348
2313
|
batchType: null,
|
|
@@ -3260,14 +3225,10 @@ var NodeIndexDocument = class {
|
|
|
3260
3225
|
*/
|
|
3261
3226
|
async write(node) {
|
|
3262
3227
|
const path = (0, import_path5.join)(this.converter.layers0Path, "nodes", this.id);
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
}, true);
|
|
3268
|
-
} else {
|
|
3269
|
-
await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
|
|
3270
|
-
}
|
|
3228
|
+
await this.converter.writeQueue.enqueue({
|
|
3229
|
+
archiveKey: `nodes/${this.id}/3dNodeIndexDocument.json.gz`,
|
|
3230
|
+
writePromise: () => writeFileForSlpk(path, JSON.stringify(node), "3dNodeIndexDocument.json", true, this.converter.compressList)
|
|
3231
|
+
}, true);
|
|
3271
3232
|
}
|
|
3272
3233
|
/**
|
|
3273
3234
|
* Load 3DNodeIndexDocument data from file on disk
|
|
@@ -3279,10 +3240,7 @@ var NodeIndexDocument = class {
|
|
|
3279
3240
|
}
|
|
3280
3241
|
const path = this.id;
|
|
3281
3242
|
const parentNodePath = (0, import_path5.join)(this.converter.layers0Path, "nodes", path);
|
|
3282
|
-
|
|
3283
|
-
if (this.converter.options.slpk) {
|
|
3284
|
-
parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3285
|
-
}
|
|
3243
|
+
const parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3286
3244
|
return await openJson(parentNodePath, parentNodeFileName);
|
|
3287
3245
|
}
|
|
3288
3246
|
/**
|
|
@@ -4361,8 +4319,6 @@ var I3SConverter = class {
|
|
|
4361
4319
|
* @param options.outputPath the output filename
|
|
4362
4320
|
* @param options.tilesetName the output name of the tileset
|
|
4363
4321
|
* @param options.maxDepth The max tree depth of conversion
|
|
4364
|
-
* @param options.slpk Generate slpk (Scene Layer Packages) output file
|
|
4365
|
-
* @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows
|
|
4366
4322
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
4367
4323
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
4368
4324
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
@@ -4378,13 +4334,11 @@ var I3SConverter = class {
|
|
|
4378
4334
|
return BROWSER_ERROR_MESSAGE;
|
|
4379
4335
|
}
|
|
4380
4336
|
this.conversionStartTime = import_process4.default.hrtime();
|
|
4381
|
-
const { tilesetName,
|
|
4337
|
+
const { tilesetName, egmFilePath, inputUrl, validate, outputPath, draco = true, maxDepth, token, generateTextures, generateBoundingVolumes, instantNodeWriting = false, mergeMaterials: mergeMaterials2 = true, inquirer, metadataClass, analyze = false, noEgm = false } = options;
|
|
4382
4338
|
this.options = {
|
|
4383
4339
|
outputPath,
|
|
4384
4340
|
tilesetName,
|
|
4385
4341
|
maxDepth,
|
|
4386
|
-
slpk,
|
|
4387
|
-
sevenZipExe,
|
|
4388
4342
|
egmFilePath,
|
|
4389
4343
|
draco,
|
|
4390
4344
|
token,
|
|
@@ -4402,12 +4356,14 @@ var I3SConverter = class {
|
|
|
4402
4356
|
this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
|
|
4403
4357
|
this.writeQueue = new WriteQueue(this.conversionDump);
|
|
4404
4358
|
this.writeQueue.startListening();
|
|
4405
|
-
|
|
4406
|
-
|
|
4407
|
-
|
|
4408
|
-
|
|
4409
|
-
this.
|
|
4359
|
+
if (!noEgm) {
|
|
4360
|
+
console.log("--no-egm option selected, skip loading egm file");
|
|
4361
|
+
} else {
|
|
4362
|
+
console.log("Loading egm file...");
|
|
4363
|
+
this.geoidHeightModel = await (0, import_core9.load)(egmFilePath, PGMLoader);
|
|
4364
|
+
console.log("Loading egm file completed!");
|
|
4410
4365
|
}
|
|
4366
|
+
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4411
4367
|
try {
|
|
4412
4368
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
4413
4369
|
let tilesetUrl = inputUrl;
|
|
@@ -4423,7 +4379,7 @@ var I3SConverter = class {
|
|
|
4423
4379
|
const selectMetadataClassResult = await this.selectMetadataClass();
|
|
4424
4380
|
if (selectMetadataClassResult) {
|
|
4425
4381
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
4426
|
-
await this._finishConversion({
|
|
4382
|
+
await this._finishConversion({ outputPath, tilesetName });
|
|
4427
4383
|
}
|
|
4428
4384
|
}
|
|
4429
4385
|
} catch (error) {
|
|
@@ -4654,16 +4610,10 @@ var I3SConverter = class {
|
|
|
4654
4610
|
* Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file
|
|
4655
4611
|
*/
|
|
4656
4612
|
async _writeLayers0() {
|
|
4657
|
-
|
|
4658
|
-
|
|
4659
|
-
|
|
4660
|
-
|
|
4661
|
-
});
|
|
4662
|
-
} else {
|
|
4663
|
-
await this.writeQueue.enqueue({
|
|
4664
|
-
writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
4665
|
-
});
|
|
4666
|
-
}
|
|
4613
|
+
await this.writeQueue.enqueue({
|
|
4614
|
+
archiveKey: "3dSceneLayer.json.gz",
|
|
4615
|
+
writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
|
|
4616
|
+
});
|
|
4667
4617
|
}
|
|
4668
4618
|
/**
|
|
4669
4619
|
* Pack files into *.slpk archive
|
|
@@ -4671,17 +4621,15 @@ var I3SConverter = class {
|
|
|
4671
4621
|
*/
|
|
4672
4622
|
async _createSlpk(tilesetPath) {
|
|
4673
4623
|
await this.conversionDump.deleteDumpFile();
|
|
4674
|
-
|
|
4675
|
-
|
|
4676
|
-
|
|
4677
|
-
|
|
4678
|
-
|
|
4679
|
-
|
|
4680
|
-
|
|
4681
|
-
|
|
4682
|
-
|
|
4683
|
-
} catch (e) {
|
|
4684
|
-
}
|
|
4624
|
+
const slpkTilesetPath = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
|
|
4625
|
+
const slpkFileName = `${tilesetPath}.slpk`;
|
|
4626
|
+
await (0, import_zip2.createZip)(slpkTilesetPath, slpkFileName, async (fileList) => ({
|
|
4627
|
+
path: "@specialIndexFileHASH128@",
|
|
4628
|
+
file: await (0, import_zip2.composeHashFile)(fileList)
|
|
4629
|
+
}));
|
|
4630
|
+
try {
|
|
4631
|
+
await removeDir(tilesetPath);
|
|
4632
|
+
} catch (e) {
|
|
4685
4633
|
}
|
|
4686
4634
|
}
|
|
4687
4635
|
/**
|
|
@@ -4918,9 +4866,9 @@ var I3SConverter = class {
|
|
|
4918
4866
|
propertyTable,
|
|
4919
4867
|
featuresHashArray: this.featuresHashArray,
|
|
4920
4868
|
attributeStorageInfo: this.attributeMetadataInfo.attributeStorageInfo,
|
|
4921
|
-
draco: this.options.draco,
|
|
4869
|
+
draco: this.options.draco ?? false,
|
|
4922
4870
|
generateBoundingVolumes: this.generateBoundingVolumes,
|
|
4923
|
-
shouldMergeMaterials: this.options.mergeMaterials,
|
|
4871
|
+
shouldMergeMaterials: this.options.mergeMaterials ?? false,
|
|
4924
4872
|
geoidHeightModel: this.geoidHeightModel,
|
|
4925
4873
|
libraries: this.loadOptions.modules,
|
|
4926
4874
|
metadataClass: this.options.metadataClass
|
|
@@ -5047,45 +4995,25 @@ var I3SConverter = class {
|
|
|
5047
4995
|
return;
|
|
5048
4996
|
}
|
|
5049
4997
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.GEOMETRY, false);
|
|
5050
|
-
|
|
5051
|
-
|
|
5052
|
-
|
|
5053
|
-
|
|
5054
|
-
|
|
5055
|
-
|
|
5056
|
-
|
|
5057
|
-
|
|
5058
|
-
|
|
5059
|
-
|
|
5060
|
-
const
|
|
4998
|
+
const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
4999
|
+
await this.writeQueue.enqueue({
|
|
5000
|
+
archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
|
|
5001
|
+
sourceId,
|
|
5002
|
+
outputId: nodeId,
|
|
5003
|
+
resourceType: ResourceType.GEOMETRY,
|
|
5004
|
+
writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
|
|
5005
|
+
});
|
|
5006
|
+
if (this.options.draco && compressedGeometry) {
|
|
5007
|
+
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
5008
|
+
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5061
5009
|
await this.writeQueue.enqueue({
|
|
5010
|
+
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5062
5011
|
sourceId,
|
|
5063
5012
|
outputId: nodeId,
|
|
5064
|
-
resourceType: ResourceType.
|
|
5065
|
-
writePromise: () =>
|
|
5013
|
+
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5014
|
+
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5066
5015
|
});
|
|
5067
5016
|
}
|
|
5068
|
-
if (this.options.draco && compressedGeometry) {
|
|
5069
|
-
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
5070
|
-
if (this.options.slpk) {
|
|
5071
|
-
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5072
|
-
await this.writeQueue.enqueue({
|
|
5073
|
-
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5074
|
-
sourceId,
|
|
5075
|
-
outputId: nodeId,
|
|
5076
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5077
|
-
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5078
|
-
});
|
|
5079
|
-
} else {
|
|
5080
|
-
const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
|
|
5081
|
-
await this.writeQueue.enqueue({
|
|
5082
|
-
sourceId,
|
|
5083
|
-
outputId: nodeId,
|
|
5084
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5085
|
-
writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, "index.bin")
|
|
5086
|
-
});
|
|
5087
|
-
}
|
|
5088
|
-
}
|
|
5089
5017
|
}
|
|
5090
5018
|
/**
|
|
5091
5019
|
* Write shared resources in a file
|
|
@@ -5104,24 +5032,14 @@ var I3SConverter = class {
|
|
|
5104
5032
|
const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
|
|
5105
5033
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
5106
5034
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.SHARED, false);
|
|
5107
|
-
|
|
5108
|
-
|
|
5109
|
-
|
|
5110
|
-
|
|
5111
|
-
|
|
5112
|
-
|
|
5113
|
-
|
|
5114
|
-
|
|
5115
|
-
});
|
|
5116
|
-
} else {
|
|
5117
|
-
const sharedPath = (0, import_path7.join)(childPath, "shared/");
|
|
5118
|
-
await this.writeQueue.enqueue({
|
|
5119
|
-
sourceId,
|
|
5120
|
-
outputId: nodeId,
|
|
5121
|
-
resourceType: ResourceType.SHARED,
|
|
5122
|
-
writePromise: () => writeFile(sharedPath, sharedDataStr)
|
|
5123
|
-
});
|
|
5124
|
-
}
|
|
5035
|
+
const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
|
|
5036
|
+
await this.writeQueue.enqueue({
|
|
5037
|
+
archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
|
|
5038
|
+
sourceId,
|
|
5039
|
+
outputId: nodeId,
|
|
5040
|
+
resourceType: ResourceType.SHARED,
|
|
5041
|
+
writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
|
|
5042
|
+
});
|
|
5125
5043
|
}
|
|
5126
5044
|
/**
|
|
5127
5045
|
* Generates textures based on texture mime type and fill in textureSetDefinitions data.
|
|
@@ -5233,25 +5151,15 @@ var I3SConverter = class {
|
|
|
5233
5151
|
* @param nodeId
|
|
5234
5152
|
*/
|
|
5235
5153
|
async writeTextureFile({ textureData, name, format, childPath, slpkChildPath, sourceId, nodeId }) {
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
|
|
5239
|
-
|
|
5240
|
-
|
|
5241
|
-
|
|
5242
|
-
|
|
5243
|
-
|
|
5244
|
-
|
|
5245
|
-
});
|
|
5246
|
-
} else {
|
|
5247
|
-
const texturePath = (0, import_path7.join)(childPath, `textures/${name}/`);
|
|
5248
|
-
await this.writeQueue.enqueue({
|
|
5249
|
-
sourceId,
|
|
5250
|
-
outputId: nodeId,
|
|
5251
|
-
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
5252
|
-
writePromise: () => writeFile(texturePath, textureData, `index.${format}`)
|
|
5253
|
-
});
|
|
5254
|
-
}
|
|
5154
|
+
const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
|
|
5155
|
+
const compress = false;
|
|
5156
|
+
await this.writeQueue.enqueue({
|
|
5157
|
+
archiveKey: `${slpkChildPath}/textures/${name}.${format}`,
|
|
5158
|
+
sourceId,
|
|
5159
|
+
outputId: nodeId,
|
|
5160
|
+
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
5161
|
+
writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)
|
|
5162
|
+
});
|
|
5255
5163
|
}
|
|
5256
5164
|
/**
|
|
5257
5165
|
* Write feature attributes in files
|
|
@@ -5268,24 +5176,14 @@ var I3SConverter = class {
|
|
|
5268
5176
|
const folderName = this.attributeMetadataInfo.attributeStorageInfo[index].key;
|
|
5269
5177
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
5270
5178
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.ATTRIBUTES}/${folderName}`, false);
|
|
5271
|
-
|
|
5272
|
-
|
|
5273
|
-
|
|
5274
|
-
|
|
5275
|
-
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5279
|
-
});
|
|
5280
|
-
} else {
|
|
5281
|
-
const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
|
|
5282
|
-
await this.writeQueue.enqueue({
|
|
5283
|
-
sourceId,
|
|
5284
|
-
outputId: nodeId,
|
|
5285
|
-
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
5286
|
-
writePromise: () => writeFile(attributesPath, fileBuffer, "index.bin")
|
|
5287
|
-
});
|
|
5288
|
-
}
|
|
5179
|
+
const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
|
|
5180
|
+
await this.writeQueue.enqueue({
|
|
5181
|
+
archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
|
|
5182
|
+
sourceId,
|
|
5183
|
+
outputId: nodeId,
|
|
5184
|
+
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
5185
|
+
writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
|
|
5186
|
+
});
|
|
5289
5187
|
}
|
|
5290
5188
|
}
|
|
5291
5189
|
}
|
|
@@ -5382,7 +5280,7 @@ var I3SConverter = class {
|
|
|
5382
5280
|
const options = {
|
|
5383
5281
|
"cesium-ion": { accessToken: this.options.token || ION_DEFAULT_TOKEN }
|
|
5384
5282
|
};
|
|
5385
|
-
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
5283
|
+
const preloadOptions = await this.Loader.preload(this.options.inputUrl ?? "", options);
|
|
5386
5284
|
this.refreshTokenTime = import_process4.default.hrtime();
|
|
5387
5285
|
return { ...options, ...preloadOptions };
|
|
5388
5286
|
}
|