@loaders.gl/tile-converter 4.3.0-alpha.4 → 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 +0 -13
- package/dist/converter.min.cjs +89 -89
- package/dist/deps-installer/deps-installer.js +1 -1
- 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 -23
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +60 -130
- 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/index.cjs +82 -194
- 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 +0 -19
- 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 +88 -154
- package/src/i3s-server/app.ts +7 -10
- package/src/i3s-server/bin/www.ts +6 -0
- 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. */
|
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");
|
|
@@ -2348,7 +2307,7 @@ function convertScreenThresholdToGeometricError(node) {
|
|
|
2348
2307
|
|
|
2349
2308
|
// dist/pgm-loader.js
|
|
2350
2309
|
var import_geoid = require("@math.gl/geoid");
|
|
2351
|
-
var VERSION = true ? "4.3.0-alpha.
|
|
2310
|
+
var VERSION = true ? "4.3.0-alpha.4" : "latest";
|
|
2352
2311
|
var PGMLoader = {
|
|
2353
2312
|
dataType: null,
|
|
2354
2313
|
batchType: null,
|
|
@@ -3266,14 +3225,10 @@ var NodeIndexDocument = class {
|
|
|
3266
3225
|
*/
|
|
3267
3226
|
async write(node) {
|
|
3268
3227
|
const path = (0, import_path5.join)(this.converter.layers0Path, "nodes", this.id);
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
}, true);
|
|
3274
|
-
} else {
|
|
3275
|
-
await this.converter.writeQueue.enqueue({ writePromise: () => writeFile(path, JSON.stringify(node)) }, true);
|
|
3276
|
-
}
|
|
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);
|
|
3277
3232
|
}
|
|
3278
3233
|
/**
|
|
3279
3234
|
* Load 3DNodeIndexDocument data from file on disk
|
|
@@ -3285,10 +3240,7 @@ var NodeIndexDocument = class {
|
|
|
3285
3240
|
}
|
|
3286
3241
|
const path = this.id;
|
|
3287
3242
|
const parentNodePath = (0, import_path5.join)(this.converter.layers0Path, "nodes", path);
|
|
3288
|
-
|
|
3289
|
-
if (this.converter.options.slpk) {
|
|
3290
|
-
parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3291
|
-
}
|
|
3243
|
+
const parentNodeFileName = "3dNodeIndexDocument.json";
|
|
3292
3244
|
return await openJson(parentNodePath, parentNodeFileName);
|
|
3293
3245
|
}
|
|
3294
3246
|
/**
|
|
@@ -4367,8 +4319,6 @@ var I3SConverter = class {
|
|
|
4367
4319
|
* @param options.outputPath the output filename
|
|
4368
4320
|
* @param options.tilesetName the output name of the tileset
|
|
4369
4321
|
* @param options.maxDepth The max tree depth of conversion
|
|
4370
|
-
* @param options.slpk Generate slpk (Scene Layer Packages) output file
|
|
4371
|
-
* @param options.sevenZipExe Location of 7z.exe archiver to create slpk on Windows
|
|
4372
4322
|
* @param options.egmFilePath location of *.pgm file to convert heights from ellipsoidal to gravity-related format
|
|
4373
4323
|
* @param options.token Token for Cesium ION tilesets authentication
|
|
4374
4324
|
* @param options.draco Generate I3S 1.7 draco compressed geometries
|
|
@@ -4384,13 +4334,11 @@ var I3SConverter = class {
|
|
|
4384
4334
|
return BROWSER_ERROR_MESSAGE;
|
|
4385
4335
|
}
|
|
4386
4336
|
this.conversionStartTime = import_process4.default.hrtime();
|
|
4387
|
-
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;
|
|
4388
4338
|
this.options = {
|
|
4389
4339
|
outputPath,
|
|
4390
4340
|
tilesetName,
|
|
4391
4341
|
maxDepth,
|
|
4392
|
-
slpk,
|
|
4393
|
-
sevenZipExe,
|
|
4394
4342
|
egmFilePath,
|
|
4395
4343
|
draco,
|
|
4396
4344
|
token,
|
|
@@ -4415,9 +4363,7 @@ var I3SConverter = class {
|
|
|
4415
4363
|
this.geoidHeightModel = await (0, import_core9.load)(egmFilePath, PGMLoader);
|
|
4416
4364
|
console.log("Loading egm file completed!");
|
|
4417
4365
|
}
|
|
4418
|
-
|
|
4419
|
-
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4420
|
-
}
|
|
4366
|
+
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
4421
4367
|
try {
|
|
4422
4368
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
4423
4369
|
let tilesetUrl = inputUrl;
|
|
@@ -4433,7 +4379,7 @@ var I3SConverter = class {
|
|
|
4433
4379
|
const selectMetadataClassResult = await this.selectMetadataClass();
|
|
4434
4380
|
if (selectMetadataClassResult) {
|
|
4435
4381
|
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
4436
|
-
await this._finishConversion({
|
|
4382
|
+
await this._finishConversion({ outputPath, tilesetName });
|
|
4437
4383
|
}
|
|
4438
4384
|
}
|
|
4439
4385
|
} catch (error) {
|
|
@@ -4664,16 +4610,10 @@ var I3SConverter = class {
|
|
|
4664
4610
|
* Write 3DSceneLayer https://github.com/Esri/i3s-spec/blob/master/docs/1.7/3DSceneLayer.cmn.md in file
|
|
4665
4611
|
*/
|
|
4666
4612
|
async _writeLayers0() {
|
|
4667
|
-
|
|
4668
|
-
|
|
4669
|
-
|
|
4670
|
-
|
|
4671
|
-
});
|
|
4672
|
-
} else {
|
|
4673
|
-
await this.writeQueue.enqueue({
|
|
4674
|
-
writePromise: () => writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
4675
|
-
});
|
|
4676
|
-
}
|
|
4613
|
+
await this.writeQueue.enqueue({
|
|
4614
|
+
archiveKey: "3dSceneLayer.json.gz",
|
|
4615
|
+
writePromise: () => writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), "3dSceneLayer.json")
|
|
4616
|
+
});
|
|
4677
4617
|
}
|
|
4678
4618
|
/**
|
|
4679
4619
|
* Pack files into *.slpk archive
|
|
@@ -4681,17 +4621,15 @@ var I3SConverter = class {
|
|
|
4681
4621
|
*/
|
|
4682
4622
|
async _createSlpk(tilesetPath) {
|
|
4683
4623
|
await this.conversionDump.deleteDumpFile();
|
|
4684
|
-
|
|
4685
|
-
|
|
4686
|
-
|
|
4687
|
-
|
|
4688
|
-
|
|
4689
|
-
|
|
4690
|
-
|
|
4691
|
-
|
|
4692
|
-
|
|
4693
|
-
} catch (e) {
|
|
4694
|
-
}
|
|
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) {
|
|
4695
4633
|
}
|
|
4696
4634
|
}
|
|
4697
4635
|
/**
|
|
@@ -4928,9 +4866,9 @@ var I3SConverter = class {
|
|
|
4928
4866
|
propertyTable,
|
|
4929
4867
|
featuresHashArray: this.featuresHashArray,
|
|
4930
4868
|
attributeStorageInfo: this.attributeMetadataInfo.attributeStorageInfo,
|
|
4931
|
-
draco: this.options.draco,
|
|
4869
|
+
draco: this.options.draco ?? false,
|
|
4932
4870
|
generateBoundingVolumes: this.generateBoundingVolumes,
|
|
4933
|
-
shouldMergeMaterials: this.options.mergeMaterials,
|
|
4871
|
+
shouldMergeMaterials: this.options.mergeMaterials ?? false,
|
|
4934
4872
|
geoidHeightModel: this.geoidHeightModel,
|
|
4935
4873
|
libraries: this.loadOptions.modules,
|
|
4936
4874
|
metadataClass: this.options.metadataClass
|
|
@@ -5057,45 +4995,25 @@ var I3SConverter = class {
|
|
|
5057
4995
|
return;
|
|
5058
4996
|
}
|
|
5059
4997
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.GEOMETRY, false);
|
|
5060
|
-
|
|
5061
|
-
|
|
5062
|
-
|
|
5063
|
-
|
|
5064
|
-
|
|
5065
|
-
|
|
5066
|
-
|
|
5067
|
-
|
|
5068
|
-
|
|
5069
|
-
|
|
5070
|
-
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");
|
|
5071
5009
|
await this.writeQueue.enqueue({
|
|
5010
|
+
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5072
5011
|
sourceId,
|
|
5073
5012
|
outputId: nodeId,
|
|
5074
|
-
resourceType: ResourceType.
|
|
5075
|
-
writePromise: () =>
|
|
5013
|
+
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5014
|
+
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5076
5015
|
});
|
|
5077
5016
|
}
|
|
5078
|
-
if (this.options.draco && compressedGeometry) {
|
|
5079
|
-
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.DRACO_GEOMETRY, false);
|
|
5080
|
-
if (this.options.slpk) {
|
|
5081
|
-
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
5082
|
-
await this.writeQueue.enqueue({
|
|
5083
|
-
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
5084
|
-
sourceId,
|
|
5085
|
-
outputId: nodeId,
|
|
5086
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5087
|
-
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
5088
|
-
});
|
|
5089
|
-
} else {
|
|
5090
|
-
const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
|
|
5091
|
-
await this.writeQueue.enqueue({
|
|
5092
|
-
sourceId,
|
|
5093
|
-
outputId: nodeId,
|
|
5094
|
-
resourceType: ResourceType.DRACO_GEOMETRY,
|
|
5095
|
-
writePromise: () => writeFile(compressedGeometryPath, compressedGeometry, "index.bin")
|
|
5096
|
-
});
|
|
5097
|
-
}
|
|
5098
|
-
}
|
|
5099
5017
|
}
|
|
5100
5018
|
/**
|
|
5101
5019
|
* Write shared resources in a file
|
|
@@ -5114,24 +5032,14 @@ var I3SConverter = class {
|
|
|
5114
5032
|
const sharedData = (0, import_json_map_transform8.default)(sharedResources, SHARED_RESOURCES());
|
|
5115
5033
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
5116
5034
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, ResourceType.SHARED, false);
|
|
5117
|
-
|
|
5118
|
-
|
|
5119
|
-
|
|
5120
|
-
|
|
5121
|
-
|
|
5122
|
-
|
|
5123
|
-
|
|
5124
|
-
|
|
5125
|
-
});
|
|
5126
|
-
} else {
|
|
5127
|
-
const sharedPath = (0, import_path7.join)(childPath, "shared/");
|
|
5128
|
-
await this.writeQueue.enqueue({
|
|
5129
|
-
sourceId,
|
|
5130
|
-
outputId: nodeId,
|
|
5131
|
-
resourceType: ResourceType.SHARED,
|
|
5132
|
-
writePromise: () => writeFile(sharedPath, sharedDataStr)
|
|
5133
|
-
});
|
|
5134
|
-
}
|
|
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
|
+
});
|
|
5135
5043
|
}
|
|
5136
5044
|
/**
|
|
5137
5045
|
* Generates textures based on texture mime type and fill in textureSetDefinitions data.
|
|
@@ -5243,25 +5151,15 @@ var I3SConverter = class {
|
|
|
5243
5151
|
* @param nodeId
|
|
5244
5152
|
*/
|
|
5245
5153
|
async writeTextureFile({ textureData, name, format, childPath, slpkChildPath, sourceId, nodeId }) {
|
|
5246
|
-
|
|
5247
|
-
|
|
5248
|
-
|
|
5249
|
-
|
|
5250
|
-
|
|
5251
|
-
|
|
5252
|
-
|
|
5253
|
-
|
|
5254
|
-
|
|
5255
|
-
});
|
|
5256
|
-
} else {
|
|
5257
|
-
const texturePath = (0, import_path7.join)(childPath, `textures/${name}/`);
|
|
5258
|
-
await this.writeQueue.enqueue({
|
|
5259
|
-
sourceId,
|
|
5260
|
-
outputId: nodeId,
|
|
5261
|
-
resourceType: `${ResourceType.TEXTURE}/${format}`,
|
|
5262
|
-
writePromise: () => writeFile(texturePath, textureData, `index.${format}`)
|
|
5263
|
-
});
|
|
5264
|
-
}
|
|
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
|
+
});
|
|
5265
5163
|
}
|
|
5266
5164
|
/**
|
|
5267
5165
|
* Write feature attributes in files
|
|
@@ -5278,24 +5176,14 @@ var I3SConverter = class {
|
|
|
5278
5176
|
const folderName = this.attributeMetadataInfo.attributeStorageInfo[index].key;
|
|
5279
5177
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
5280
5178
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, `${ResourceType.ATTRIBUTES}/${folderName}`, false);
|
|
5281
|
-
|
|
5282
|
-
|
|
5283
|
-
|
|
5284
|
-
|
|
5285
|
-
|
|
5286
|
-
|
|
5287
|
-
|
|
5288
|
-
|
|
5289
|
-
});
|
|
5290
|
-
} else {
|
|
5291
|
-
const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
|
|
5292
|
-
await this.writeQueue.enqueue({
|
|
5293
|
-
sourceId,
|
|
5294
|
-
outputId: nodeId,
|
|
5295
|
-
resourceType: `${ResourceType.ATTRIBUTES}/${folderName}`,
|
|
5296
|
-
writePromise: () => writeFile(attributesPath, fileBuffer, "index.bin")
|
|
5297
|
-
});
|
|
5298
|
-
}
|
|
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
|
+
});
|
|
5299
5187
|
}
|
|
5300
5188
|
}
|
|
5301
5189
|
}
|
|
@@ -5392,7 +5280,7 @@ var I3SConverter = class {
|
|
|
5392
5280
|
const options = {
|
|
5393
5281
|
"cesium-ion": { accessToken: this.options.token || ION_DEFAULT_TOKEN }
|
|
5394
5282
|
};
|
|
5395
|
-
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
5283
|
+
const preloadOptions = await this.Loader.preload(this.options.inputUrl ?? "", options);
|
|
5396
5284
|
this.refreshTokenTime = import_process4.default.hrtime();
|
|
5397
5285
|
return { ...options, ...preloadOptions };
|
|
5398
5286
|
}
|