@loaders.gl/tile-converter 4.1.0-alpha.10 → 4.1.0-alpha.11
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/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +8 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/converter-cli.js +2 -2
- package/dist/converter-cli.js.map +1 -1
- package/dist/converter.min.cjs +131 -220
- package/dist/deps-installer/deps-installer.js +1 -1
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +6 -6
- package/dist/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/i3s-server/bin/i3s-server.min.cjs +76 -76
- package/dist/index.cjs +69 -106
- package/dist/lib/utils/compress-util.d.ts +0 -37
- package/dist/lib/utils/compress-util.d.ts.map +1 -1
- package/dist/lib/utils/compress-util.js +1 -149
- package/dist/lib/utils/compress-util.js.map +1 -1
- package/dist/lib/utils/conversion-dump.d.ts +2 -1
- package/dist/lib/utils/conversion-dump.d.ts.map +1 -1
- package/dist/lib/utils/conversion-dump.js +14 -10
- package/dist/lib/utils/conversion-dump.js.map +1 -1
- package/dist/pgm-loader.js +1 -1
- package/package.json +14 -14
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +19 -0
- package/src/converter-cli.ts +2 -2
- package/src/i3s-converter/i3s-converter.ts +8 -36
- package/src/lib/utils/compress-util.ts +1 -264
- package/src/lib/utils/conversion-dump.ts +16 -11
package/dist/index.cjs
CHANGED
|
@@ -250,14 +250,14 @@ var AttributeMetadataInfo = class {
|
|
|
250
250
|
// src/i3s-converter/i3s-converter.ts
|
|
251
251
|
var import_core9 = require("@loaders.gl/core");
|
|
252
252
|
var import_d_tiles2 = require("@loaders.gl/3d-tiles");
|
|
253
|
-
var
|
|
253
|
+
var import_path7 = require("path");
|
|
254
254
|
var import_uuid4 = require("uuid");
|
|
255
255
|
var import_process3 = __toESM(require("process"), 1);
|
|
256
256
|
var import_json_map_transform8 = __toESM(require("json-map-transform"), 1);
|
|
257
257
|
var import_md52 = __toESM(require("md5"), 1);
|
|
258
258
|
|
|
259
259
|
// src/i3s-converter/helpers/node-pages.ts
|
|
260
|
-
var
|
|
260
|
+
var import_path2 = require("path");
|
|
261
261
|
var import_json_map_transform = __toESM(require("json-map-transform"), 1);
|
|
262
262
|
|
|
263
263
|
// src/i3s-converter/json-templates/metadata.ts
|
|
@@ -287,17 +287,11 @@ var METADATA = () => ({
|
|
|
287
287
|
var import_core = require("@loaders.gl/core");
|
|
288
288
|
var import_loader_utils = require("@loaders.gl/loader-utils");
|
|
289
289
|
var import_fs2 = require("fs");
|
|
290
|
-
var
|
|
290
|
+
var import_path = require("path");
|
|
291
291
|
|
|
292
292
|
// src/lib/utils/compress-util.ts
|
|
293
293
|
var import_zlib = require("zlib");
|
|
294
|
-
var import_path = require("path");
|
|
295
294
|
var import_fs = require("fs");
|
|
296
|
-
var import_archiver = __toESM(require("archiver"), 1);
|
|
297
|
-
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
298
|
-
var import_jszip = __toESM(require("jszip"), 1);
|
|
299
|
-
var import_crypto = require("@loaders.gl/crypto");
|
|
300
|
-
var import_crypt = __toESM(require("crypt"), 1);
|
|
301
295
|
function compressFileWithGzip(pathFile) {
|
|
302
296
|
const compressedPathFile = `${pathFile}.gz`;
|
|
303
297
|
const gzip = (0, import_zlib.createGzip)();
|
|
@@ -315,42 +309,6 @@ function compressFileWithGzip(pathFile) {
|
|
|
315
309
|
input.pipe(gzip).pipe(output);
|
|
316
310
|
});
|
|
317
311
|
}
|
|
318
|
-
async function compressWithChildProcess(inputFolder, outputFile, level, inputFiles, sevenZipExe) {
|
|
319
|
-
if (process.platform === "win32") {
|
|
320
|
-
await compressWithChildProcessWindows(inputFolder, outputFile, level, inputFiles, sevenZipExe);
|
|
321
|
-
} else {
|
|
322
|
-
await compressWithChildProcessUnix(inputFolder, outputFile, level, inputFiles);
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
async function compressWithChildProcessUnix(inputFolder, outputFile, level = 0, inputFiles = ".") {
|
|
326
|
-
const fullOutputFile = getAbsoluteFilePath(outputFile);
|
|
327
|
-
const args = [`-${level}`, "-r", fullOutputFile, inputFiles];
|
|
328
|
-
const childProcess = new import_worker_utils.ChildProcessProxy();
|
|
329
|
-
await childProcess.start({
|
|
330
|
-
command: "zip",
|
|
331
|
-
arguments: args,
|
|
332
|
-
spawn: {
|
|
333
|
-
cwd: inputFolder
|
|
334
|
-
},
|
|
335
|
-
wait: 0
|
|
336
|
-
});
|
|
337
|
-
}
|
|
338
|
-
async function compressWithChildProcessWindows(inputFolder, outputFile, level = 0, inputFiles = (0, import_path.join)(".", "*"), sevenZipExe) {
|
|
339
|
-
if (inputFiles[0] === "@") {
|
|
340
|
-
inputFiles = `*${inputFiles.substr(1)}`;
|
|
341
|
-
}
|
|
342
|
-
const fullOutputFile = getAbsoluteFilePath(outputFile);
|
|
343
|
-
const args = ["a", "-tzip", `-mx=${level}`, fullOutputFile, inputFiles];
|
|
344
|
-
const childProcess = new import_worker_utils.ChildProcessProxy();
|
|
345
|
-
await childProcess.start({
|
|
346
|
-
command: sevenZipExe,
|
|
347
|
-
arguments: args,
|
|
348
|
-
spawn: {
|
|
349
|
-
cwd: `${inputFolder}`
|
|
350
|
-
},
|
|
351
|
-
wait: 0
|
|
352
|
-
});
|
|
353
|
-
}
|
|
354
312
|
|
|
355
313
|
// src/lib/utils/file-utils.ts
|
|
356
314
|
async function writeFile(path, data, fileName = "index.json") {
|
|
@@ -363,7 +321,7 @@ async function writeFile(path, data, fileName = "index.json") {
|
|
|
363
321
|
toWriteData = data;
|
|
364
322
|
}
|
|
365
323
|
await import_fs2.promises.mkdir(path, { recursive: true });
|
|
366
|
-
const pathFile = (0,
|
|
324
|
+
const pathFile = (0, import_path.join)(path, fileName);
|
|
367
325
|
try {
|
|
368
326
|
await import_fs2.promises.writeFile(pathFile, toWriteData);
|
|
369
327
|
} catch (err) {
|
|
@@ -395,7 +353,7 @@ async function openJson(path, fileName) {
|
|
|
395
353
|
let count = 0;
|
|
396
354
|
console.log(`load ${path}/${fileName}.`);
|
|
397
355
|
const intervalId = setInterval(() => {
|
|
398
|
-
const pathFile = (0,
|
|
356
|
+
const pathFile = (0, import_path.join)(path, fileName);
|
|
399
357
|
(0, import_core.load)(pathFile, import_loader_utils.JSONLoader).then((result) => {
|
|
400
358
|
clearInterval(intervalId);
|
|
401
359
|
resolve(result);
|
|
@@ -424,7 +382,7 @@ function removeFile(path) {
|
|
|
424
382
|
return import_fs2.promises.unlink(path);
|
|
425
383
|
}
|
|
426
384
|
function getAbsoluteFilePath(filePath) {
|
|
427
|
-
return (0,
|
|
385
|
+
return (0, import_path.isAbsolute)(filePath) ? filePath : (0, import_path.join)(process.cwd(), filePath);
|
|
428
386
|
}
|
|
429
387
|
|
|
430
388
|
// src/i3s-converter/helpers/node-pages.ts
|
|
@@ -461,10 +419,10 @@ var NodePages = class {
|
|
|
461
419
|
let filePath;
|
|
462
420
|
let fileName;
|
|
463
421
|
if (this.converter.options.slpk) {
|
|
464
|
-
filePath = (0,
|
|
422
|
+
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
465
423
|
fileName = `${nodePageId.toString()}.json`;
|
|
466
424
|
} else {
|
|
467
|
-
filePath = (0,
|
|
425
|
+
filePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", nodePageId.toString());
|
|
468
426
|
fileName = "index.json";
|
|
469
427
|
}
|
|
470
428
|
return { filePath, fileName };
|
|
@@ -476,7 +434,7 @@ var NodePages = class {
|
|
|
476
434
|
*/
|
|
477
435
|
async loadNodePage(nodePageId) {
|
|
478
436
|
const { filePath, fileName } = this.getNodePageFileName(nodePageId);
|
|
479
|
-
const fullName = (0,
|
|
437
|
+
const fullName = (0, import_path2.join)(filePath, fileName);
|
|
480
438
|
if (await isFileExists(fullName)) {
|
|
481
439
|
console.log(`load ${fullName}.`);
|
|
482
440
|
return await openJson(filePath, fileName);
|
|
@@ -613,7 +571,7 @@ var NodePages = class {
|
|
|
613
571
|
if (this.converter.options.slpk) {
|
|
614
572
|
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
615
573
|
const nodePageStr = JSON.stringify(nodePage);
|
|
616
|
-
const slpkPath = (0,
|
|
574
|
+
const slpkPath = (0, import_path2.join)(this.converter.layers0Path, "nodepages");
|
|
617
575
|
await this.converter.writeQueue.enqueue({
|
|
618
576
|
archiveKey: `nodePages/${index.toString()}.json.gz`,
|
|
619
577
|
writePromise: () => this.writeFile(slpkPath, nodePageStr, `${index.toString()}.json`)
|
|
@@ -623,7 +581,7 @@ var NodePages = class {
|
|
|
623
581
|
} else {
|
|
624
582
|
for (const [index, nodePage] of this.nodePages.entries()) {
|
|
625
583
|
const nodePageStr = JSON.stringify(nodePage);
|
|
626
|
-
const nodePagePath = (0,
|
|
584
|
+
const nodePagePath = (0, import_path2.join)(this.converter.layers0Path, "nodepages", index.toString());
|
|
627
585
|
await this.converter.writeQueue.enqueue({
|
|
628
586
|
writePromise: () => this.writeFile(nodePagePath, nodePageStr)
|
|
629
587
|
});
|
|
@@ -709,7 +667,7 @@ var NodePages = class {
|
|
|
709
667
|
};
|
|
710
668
|
|
|
711
669
|
// src/lib/utils/statistic-utills.ts
|
|
712
|
-
var
|
|
670
|
+
var import_path3 = require("path");
|
|
713
671
|
var import_fs3 = require("fs");
|
|
714
672
|
function timeConverter(time) {
|
|
715
673
|
if (typeof time === "number") {
|
|
@@ -750,11 +708,11 @@ async function calculateFilesSize(params) {
|
|
|
750
708
|
const fullOutputPath = getAbsoluteFilePath(outputPath);
|
|
751
709
|
try {
|
|
752
710
|
if (slpk) {
|
|
753
|
-
const slpkPath = (0,
|
|
711
|
+
const slpkPath = (0, import_path3.join)(fullOutputPath, `${tilesetName}.slpk`);
|
|
754
712
|
const stat = await import_fs3.promises.stat(slpkPath);
|
|
755
713
|
return stat.size;
|
|
756
714
|
}
|
|
757
|
-
const directoryPath = (0,
|
|
715
|
+
const directoryPath = (0, import_path3.join)(fullOutputPath, tilesetName);
|
|
758
716
|
const totalSize = await getTotalFilesSize(directoryPath);
|
|
759
717
|
return totalSize;
|
|
760
718
|
} catch (error) {
|
|
@@ -766,9 +724,9 @@ async function getTotalFilesSize(dirPath) {
|
|
|
766
724
|
let totalFileSize = 0;
|
|
767
725
|
const files = await import_fs3.promises.readdir(dirPath);
|
|
768
726
|
for (const file of files) {
|
|
769
|
-
const fileStat = await import_fs3.promises.stat((0,
|
|
727
|
+
const fileStat = await import_fs3.promises.stat((0, import_path3.join)(dirPath, file));
|
|
770
728
|
if (fileStat.isDirectory()) {
|
|
771
|
-
totalFileSize += await getTotalFilesSize((0,
|
|
729
|
+
totalFileSize += await getTotalFilesSize((0, import_path3.join)(dirPath, file));
|
|
772
730
|
} else {
|
|
773
731
|
totalFileSize += fileStat.size;
|
|
774
732
|
}
|
|
@@ -2436,7 +2394,7 @@ function getPropertyTableExtension(tileContent) {
|
|
|
2436
2394
|
// src/i3s-converter/helpers/create-scene-server-path.ts
|
|
2437
2395
|
var import_uuid2 = require("uuid");
|
|
2438
2396
|
var import_json_map_transform2 = __toESM(require("json-map-transform"), 1);
|
|
2439
|
-
var
|
|
2397
|
+
var import_path4 = require("path");
|
|
2440
2398
|
|
|
2441
2399
|
// src/i3s-converter/json-templates/scene-server.ts
|
|
2442
2400
|
var SCENE_SERVER = () => ({
|
|
@@ -2475,7 +2433,7 @@ async function createSceneServerPath(layerName, layers0, rootPath) {
|
|
|
2475
2433
|
layers0
|
|
2476
2434
|
};
|
|
2477
2435
|
const sceneServer = (0, import_json_map_transform2.default)(sceneServerData, SCENE_SERVER());
|
|
2478
|
-
const nodePagePath = (0,
|
|
2436
|
+
const nodePagePath = (0, import_path4.join)(rootPath, "SceneServer");
|
|
2479
2437
|
await writeFile(nodePagePath, JSON.stringify(sceneServer));
|
|
2480
2438
|
}
|
|
2481
2439
|
|
|
@@ -3134,9 +3092,8 @@ function isAllVerticesInsideBoundingVolume(boundingVolume, positions) {
|
|
|
3134
3092
|
|
|
3135
3093
|
// src/i3s-converter/i3s-converter.ts
|
|
3136
3094
|
var import_textures = require("@loaders.gl/textures");
|
|
3137
|
-
var import_loader_utils4 = require("@loaders.gl/loader-utils");
|
|
3138
3095
|
var import_images = require("@loaders.gl/images");
|
|
3139
|
-
var
|
|
3096
|
+
var import_worker_utils = require("@loaders.gl/worker-utils");
|
|
3140
3097
|
|
|
3141
3098
|
// src/lib/utils/queue.ts
|
|
3142
3099
|
var Queue = class extends Array {
|
|
@@ -3235,7 +3192,7 @@ var BROWSER_ERROR_MESSAGE = "Tile converter does not work in browser, only in no
|
|
|
3235
3192
|
var DUMP_FILE_SUFFIX = ".dump.json";
|
|
3236
3193
|
|
|
3237
3194
|
// src/i3s-converter/helpers/node-index-document.ts
|
|
3238
|
-
var
|
|
3195
|
+
var import_path5 = require("path");
|
|
3239
3196
|
var import_json_map_transform7 = __toESM(require("json-map-transform"), 1);
|
|
3240
3197
|
var import_uuid3 = require("uuid");
|
|
3241
3198
|
|
|
@@ -3438,7 +3395,7 @@ var NodeIndexDocument = class {
|
|
|
3438
3395
|
* @param node - Node3DIndexDocument object
|
|
3439
3396
|
*/
|
|
3440
3397
|
async write(node) {
|
|
3441
|
-
const path = (0,
|
|
3398
|
+
const path = (0, import_path5.join)(this.converter.layers0Path, "nodes", this.id);
|
|
3442
3399
|
if (this.converter.options.slpk) {
|
|
3443
3400
|
await this.converter.writeQueue.enqueue(
|
|
3444
3401
|
{
|
|
@@ -3469,7 +3426,7 @@ var NodeIndexDocument = class {
|
|
|
3469
3426
|
return this.data;
|
|
3470
3427
|
}
|
|
3471
3428
|
const path = this.id;
|
|
3472
|
-
const parentNodePath = (0,
|
|
3429
|
+
const parentNodePath = (0, import_path5.join)(this.converter.layers0Path, "nodes", path);
|
|
3473
3430
|
let parentNodeFileName = "index.json";
|
|
3474
3431
|
if (this.converter.options.slpk) {
|
|
3475
3432
|
parentNodeFileName = "3dNodeIndexDocument.json";
|
|
@@ -3912,7 +3869,7 @@ var Progress = class {
|
|
|
3912
3869
|
var import_zip = require("@loaders.gl/zip");
|
|
3913
3870
|
|
|
3914
3871
|
// src/lib/utils/conversion-dump.ts
|
|
3915
|
-
var
|
|
3872
|
+
var import_path6 = require("path");
|
|
3916
3873
|
var ConversionDump = class {
|
|
3917
3874
|
constructor() {
|
|
3918
3875
|
this.tilesConverted = {};
|
|
@@ -3989,7 +3946,7 @@ var ConversionDump = class {
|
|
|
3989
3946
|
var _a2;
|
|
3990
3947
|
if (((_a2 = this.options) == null ? void 0 : _a2.outputPath) && this.options.tilesetName) {
|
|
3991
3948
|
await removeFile(
|
|
3992
|
-
(0,
|
|
3949
|
+
(0, import_path6.join)(this.options.outputPath, `${this.options.tilesetName}${DUMP_FILE_SUFFIX}`)
|
|
3993
3950
|
);
|
|
3994
3951
|
}
|
|
3995
3952
|
}
|
|
@@ -4016,7 +3973,7 @@ var ConversionDump = class {
|
|
|
4016
3973
|
*/
|
|
4017
3974
|
async addNode(filename, nodeId) {
|
|
4018
3975
|
const { nodes } = this.getRecord(filename) || { nodes: [] };
|
|
4019
|
-
nodes.push({ nodeId, done: {} });
|
|
3976
|
+
nodes.push({ nodeId, done: false, progress: {} });
|
|
4020
3977
|
if (nodes.length === 1) {
|
|
4021
3978
|
this.setRecord(filename, { nodes });
|
|
4022
3979
|
}
|
|
@@ -4035,7 +3992,10 @@ var ConversionDump = class {
|
|
|
4035
3992
|
(element) => element.nodeId === nodeId
|
|
4036
3993
|
);
|
|
4037
3994
|
if (nodeDump) {
|
|
4038
|
-
nodeDump.
|
|
3995
|
+
nodeDump.progress[resourceType] = value;
|
|
3996
|
+
if (!value) {
|
|
3997
|
+
nodeDump.done = false;
|
|
3998
|
+
}
|
|
4039
3999
|
}
|
|
4040
4000
|
}
|
|
4041
4001
|
/**
|
|
@@ -4050,19 +4010,19 @@ var ConversionDump = class {
|
|
|
4050
4010
|
if (!sourceId || !resourceType || !outputId)
|
|
4051
4011
|
continue;
|
|
4052
4012
|
for (const node of this.tilesConverted[sourceId].nodes) {
|
|
4053
|
-
if (
|
|
4054
|
-
node.
|
|
4055
|
-
}
|
|
4056
|
-
if (typeof node.done !== "boolean") {
|
|
4013
|
+
if (node.nodeId === outputId) {
|
|
4014
|
+
node.progress[resourceType] = true;
|
|
4057
4015
|
let done = false;
|
|
4058
|
-
for (const key in node.
|
|
4059
|
-
done = node.
|
|
4016
|
+
for (const key in node.progress) {
|
|
4017
|
+
done = node.progress[key];
|
|
4060
4018
|
if (!done)
|
|
4061
4019
|
break;
|
|
4062
4020
|
}
|
|
4063
|
-
|
|
4064
|
-
|
|
4021
|
+
node.done = done;
|
|
4022
|
+
if (node.done) {
|
|
4023
|
+
node.progress = {};
|
|
4065
4024
|
}
|
|
4025
|
+
break;
|
|
4066
4026
|
}
|
|
4067
4027
|
}
|
|
4068
4028
|
}
|
|
@@ -4226,7 +4186,7 @@ var I3SConverter = class {
|
|
|
4226
4186
|
throw error;
|
|
4227
4187
|
} finally {
|
|
4228
4188
|
await this.writeQueue.finalize();
|
|
4229
|
-
const workerFarm =
|
|
4189
|
+
const workerFarm = import_worker_utils.WorkerFarm.getWorkerFarm({});
|
|
4230
4190
|
workerFarm.destroy();
|
|
4231
4191
|
}
|
|
4232
4192
|
return "success";
|
|
@@ -4337,12 +4297,12 @@ var I3SConverter = class {
|
|
|
4337
4297
|
*/
|
|
4338
4298
|
async _createAndSaveTileset(outputPath, tilesetName) {
|
|
4339
4299
|
var _a2, _b, _c;
|
|
4340
|
-
const tilesetPath = (0,
|
|
4300
|
+
const tilesetPath = (0, import_path7.join)(`${outputPath}`, `${tilesetName}`);
|
|
4341
4301
|
try {
|
|
4342
4302
|
await removeDir(tilesetPath);
|
|
4343
4303
|
} catch (e) {
|
|
4344
4304
|
}
|
|
4345
|
-
this.layers0Path = (0,
|
|
4305
|
+
this.layers0Path = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
|
|
4346
4306
|
this.materialDefinitions = [];
|
|
4347
4307
|
this.materialMap = /* @__PURE__ */ new Map();
|
|
4348
4308
|
const sourceRootTile = this.sourceTileset.root;
|
|
@@ -4461,17 +4421,12 @@ var I3SConverter = class {
|
|
|
4461
4421
|
async _createSlpk(tilesetPath) {
|
|
4462
4422
|
await this.conversionDump.deleteDumpFile();
|
|
4463
4423
|
if (this.options.slpk) {
|
|
4464
|
-
const slpkTilesetPath = (0,
|
|
4424
|
+
const slpkTilesetPath = (0, import_path7.join)(tilesetPath, "SceneServer", "layers", "0");
|
|
4465
4425
|
const slpkFileName = `${tilesetPath}.slpk`;
|
|
4466
|
-
await
|
|
4467
|
-
|
|
4468
|
-
|
|
4469
|
-
|
|
4470
|
-
".",
|
|
4471
|
-
this.options.sevenZipExe
|
|
4472
|
-
);
|
|
4473
|
-
const hashTable = await (0, import_zip.composeHashFile)(new import_loader_utils4.FileHandleFile(slpkFileName));
|
|
4474
|
-
await (0, import_zip.addOneFile)(slpkFileName, hashTable, "@specialIndexFileHASH128@");
|
|
4426
|
+
await (0, import_zip.createZip)(slpkTilesetPath, slpkFileName, async (fileList) => ({
|
|
4427
|
+
path: "@specialIndexFileHASH128@",
|
|
4428
|
+
file: await (0, import_zip.composeHashFile)(fileList)
|
|
4429
|
+
}));
|
|
4475
4430
|
try {
|
|
4476
4431
|
await removeDir(tilesetPath);
|
|
4477
4432
|
} catch (e) {
|
|
@@ -4751,8 +4706,8 @@ var I3SConverter = class {
|
|
|
4751
4706
|
sharedResources,
|
|
4752
4707
|
attributes
|
|
4753
4708
|
} = resources;
|
|
4754
|
-
const childPath = (0,
|
|
4755
|
-
const slpkChildPath = (0,
|
|
4709
|
+
const childPath = (0, import_path7.join)(this.layers0Path, "nodes", nodePath);
|
|
4710
|
+
const slpkChildPath = (0, import_path7.join)("nodes", nodePath);
|
|
4756
4711
|
await this._writeGeometries(
|
|
4757
4712
|
geometryBuffer,
|
|
4758
4713
|
compressedGeometry,
|
|
@@ -4796,7 +4751,7 @@ var I3SConverter = class {
|
|
|
4796
4751
|
async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath, sourceId, nodeId) {
|
|
4797
4752
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, "GEOMETRY" /* GEOMETRY */, false);
|
|
4798
4753
|
if (this.options.slpk) {
|
|
4799
|
-
const slpkGeometryPath = (0,
|
|
4754
|
+
const slpkGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
4800
4755
|
await this.writeQueue.enqueue({
|
|
4801
4756
|
archiveKey: `${slpkChildPath}/geometries/0.bin.gz`,
|
|
4802
4757
|
sourceId,
|
|
@@ -4805,7 +4760,7 @@ var I3SConverter = class {
|
|
|
4805
4760
|
writePromise: () => writeFileForSlpk(slpkGeometryPath, geometryBuffer, "0.bin")
|
|
4806
4761
|
});
|
|
4807
4762
|
} else {
|
|
4808
|
-
const geometryPath = (0,
|
|
4763
|
+
const geometryPath = (0, import_path7.join)(childPath, "geometries/0/");
|
|
4809
4764
|
await this.writeQueue.enqueue({
|
|
4810
4765
|
sourceId,
|
|
4811
4766
|
outputId: nodeId,
|
|
@@ -4816,7 +4771,7 @@ var I3SConverter = class {
|
|
|
4816
4771
|
if (this.options.draco) {
|
|
4817
4772
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, "DRACO_GEOMETRY" /* DRACO_GEOMETRY */, false);
|
|
4818
4773
|
if (this.options.slpk) {
|
|
4819
|
-
const slpkCompressedGeometryPath = (0,
|
|
4774
|
+
const slpkCompressedGeometryPath = (0, import_path7.join)(childPath, "geometries");
|
|
4820
4775
|
await this.writeQueue.enqueue({
|
|
4821
4776
|
archiveKey: `${slpkChildPath}/geometries/1.bin.gz`,
|
|
4822
4777
|
sourceId,
|
|
@@ -4825,7 +4780,7 @@ var I3SConverter = class {
|
|
|
4825
4780
|
writePromise: () => writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, "1.bin")
|
|
4826
4781
|
});
|
|
4827
4782
|
} else {
|
|
4828
|
-
const compressedGeometryPath = (0,
|
|
4783
|
+
const compressedGeometryPath = (0, import_path7.join)(childPath, "geometries/1/");
|
|
4829
4784
|
await this.writeQueue.enqueue({
|
|
4830
4785
|
sourceId,
|
|
4831
4786
|
outputId: nodeId,
|
|
@@ -4853,7 +4808,7 @@ var I3SConverter = class {
|
|
|
4853
4808
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
4854
4809
|
this.conversionDump.updateDoneStatus(sourceId, nodeId, "SHARED" /* SHARED */, false);
|
|
4855
4810
|
if (this.options.slpk) {
|
|
4856
|
-
const slpkSharedPath = (0,
|
|
4811
|
+
const slpkSharedPath = (0, import_path7.join)(childPath, "shared");
|
|
4857
4812
|
await this.writeQueue.enqueue({
|
|
4858
4813
|
archiveKey: `${slpkChildPath}/shared/sharedResource.json.gz`,
|
|
4859
4814
|
sourceId,
|
|
@@ -4862,7 +4817,7 @@ var I3SConverter = class {
|
|
|
4862
4817
|
writePromise: () => writeFileForSlpk(slpkSharedPath, sharedDataStr, "sharedResource.json")
|
|
4863
4818
|
});
|
|
4864
4819
|
} else {
|
|
4865
|
-
const sharedPath = (0,
|
|
4820
|
+
const sharedPath = (0, import_path7.join)(childPath, "shared/");
|
|
4866
4821
|
await this.writeQueue.enqueue({
|
|
4867
4822
|
sourceId,
|
|
4868
4823
|
outputId: nodeId,
|
|
@@ -4996,7 +4951,7 @@ var I3SConverter = class {
|
|
|
4996
4951
|
*/
|
|
4997
4952
|
async writeTextureFile(textureData, name, format, childPath, slpkChildPath, sourceId, nodeId) {
|
|
4998
4953
|
if (this.options.slpk) {
|
|
4999
|
-
const slpkTexturePath = (0,
|
|
4954
|
+
const slpkTexturePath = (0, import_path7.join)(childPath, "textures");
|
|
5000
4955
|
const compress = false;
|
|
5001
4956
|
await this.writeQueue.enqueue({
|
|
5002
4957
|
archiveKey: `${slpkChildPath}/textures/${name}.${format}`,
|
|
@@ -5006,7 +4961,7 @@ var I3SConverter = class {
|
|
|
5006
4961
|
writePromise: () => writeFileForSlpk(slpkTexturePath, textureData, `${name}.${format}`, compress)
|
|
5007
4962
|
});
|
|
5008
4963
|
} else {
|
|
5009
|
-
const texturePath = (0,
|
|
4964
|
+
const texturePath = (0, import_path7.join)(childPath, `textures/${name}/`);
|
|
5010
4965
|
await this.writeQueue.enqueue({
|
|
5011
4966
|
sourceId,
|
|
5012
4967
|
outputId: nodeId,
|
|
@@ -5036,7 +4991,7 @@ var I3SConverter = class {
|
|
|
5036
4991
|
false
|
|
5037
4992
|
);
|
|
5038
4993
|
if (this.options.slpk) {
|
|
5039
|
-
const slpkAttributesPath = (0,
|
|
4994
|
+
const slpkAttributesPath = (0, import_path7.join)(childPath, "attributes", folderName);
|
|
5040
4995
|
await this.writeQueue.enqueue({
|
|
5041
4996
|
archiveKey: `${slpkChildPath}/attributes/${folderName}.bin.gz`,
|
|
5042
4997
|
sourceId,
|
|
@@ -5045,7 +5000,7 @@ var I3SConverter = class {
|
|
|
5045
5000
|
writePromise: () => writeFileForSlpk(slpkAttributesPath, fileBuffer, "0.bin")
|
|
5046
5001
|
});
|
|
5047
5002
|
} else {
|
|
5048
|
-
const attributesPath = (0,
|
|
5003
|
+
const attributesPath = (0, import_path7.join)(childPath, `attributes/${folderName}/0`);
|
|
5049
5004
|
await this.writeQueue.enqueue({
|
|
5050
5005
|
sourceId,
|
|
5051
5006
|
outputId: nodeId,
|
|
@@ -5196,7 +5151,7 @@ var I3SConverter = class {
|
|
|
5196
5151
|
};
|
|
5197
5152
|
|
|
5198
5153
|
// src/3d-tiles-converter/3d-tiles-converter.ts
|
|
5199
|
-
var
|
|
5154
|
+
var import_path8 = require("path");
|
|
5200
5155
|
var import_process4 = __toESM(require("process"), 1);
|
|
5201
5156
|
var import_json_map_transform10 = __toESM(require("json-map-transform"), 1);
|
|
5202
5157
|
var import_core15 = require("@loaders.gl/core");
|
|
@@ -5260,7 +5215,7 @@ var TILESET = () => ({
|
|
|
5260
5215
|
});
|
|
5261
5216
|
|
|
5262
5217
|
// src/3d-tiles-converter/3d-tiles-converter.ts
|
|
5263
|
-
var
|
|
5218
|
+
var import_worker_utils2 = require("@loaders.gl/worker-utils");
|
|
5264
5219
|
|
|
5265
5220
|
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
5266
5221
|
var import_core12 = require("@loaders.gl/core");
|
|
@@ -5303,6 +5258,9 @@ function normalizeRegions(regions) {
|
|
|
5303
5258
|
// src/3d-tiles-converter/helpers/b3dm-converter.ts
|
|
5304
5259
|
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]);
|
|
5305
5260
|
var scratchVector2 = new import_core13.Vector3();
|
|
5261
|
+
var KHR_MATERIALS_UNLIT = "KHR_materials_unlit";
|
|
5262
|
+
var METALLIC_FACTOR_DEFAULT = 1;
|
|
5263
|
+
var ROUGHNESS_FACTOR_DEFAULT = 1;
|
|
5306
5264
|
var B3dmConverter = class {
|
|
5307
5265
|
/**
|
|
5308
5266
|
* The starter of content conversion
|
|
@@ -5332,6 +5290,11 @@ var B3dmConverter = class {
|
|
|
5332
5290
|
const { material, attributes, indices: originalIndices, modelMatrix } = tileContent;
|
|
5333
5291
|
const gltfBuilder = new import_gltf6.GLTFScenegraph();
|
|
5334
5292
|
const textureIndex = await this._addI3sTextureToGLTF(tileContent, textureFormat, gltfBuilder);
|
|
5293
|
+
const pbrMetallicRoughness = material == null ? void 0 : material.pbrMetallicRoughness;
|
|
5294
|
+
if (pbrMetallicRoughness && (pbrMetallicRoughness.metallicFactor === void 0 || pbrMetallicRoughness.metallicFactor === METALLIC_FACTOR_DEFAULT) && (pbrMetallicRoughness.roughnessFactor === void 0 || pbrMetallicRoughness.roughnessFactor === ROUGHNESS_FACTOR_DEFAULT)) {
|
|
5295
|
+
gltfBuilder.addObjectExtension(material, KHR_MATERIALS_UNLIT, {});
|
|
5296
|
+
gltfBuilder.addExtension(KHR_MATERIALS_UNLIT);
|
|
5297
|
+
}
|
|
5335
5298
|
const pbrMaterialInfo = this._convertI3sMaterialToGLTFMaterial(material, textureIndex);
|
|
5336
5299
|
const materialIndex = gltfBuilder.addMaterial(pbrMaterialInfo);
|
|
5337
5300
|
const positions = attributes.positions;
|
|
@@ -5644,7 +5607,7 @@ var Tiles3DConverter = class {
|
|
|
5644
5607
|
if (!rootNode.obb) {
|
|
5645
5608
|
rootNode.obb = createObbFromMbs(rootNode.mbs);
|
|
5646
5609
|
}
|
|
5647
|
-
this.tilesetPath = (0,
|
|
5610
|
+
this.tilesetPath = (0, import_path8.join)(`${outputPath}`, `${tilesetName}`);
|
|
5648
5611
|
this.attributeStorageInfo = this.sourceTileset.attributeStorageInfo;
|
|
5649
5612
|
try {
|
|
5650
5613
|
await removeDir(this.tilesetPath);
|
|
@@ -5661,7 +5624,7 @@ var Tiles3DConverter = class {
|
|
|
5661
5624
|
const tileset = (0, import_json_map_transform10.default)({ root: rootTile }, TILESET());
|
|
5662
5625
|
await writeFile(this.tilesetPath, JSON.stringify(tileset), "tileset.json");
|
|
5663
5626
|
this._finishConversion({ slpk: false, outputPath, tilesetName });
|
|
5664
|
-
const workerFarm =
|
|
5627
|
+
const workerFarm = import_worker_utils2.WorkerFarm.getWorkerFarm({});
|
|
5665
5628
|
workerFarm.destroy();
|
|
5666
5629
|
}
|
|
5667
5630
|
/**
|
|
@@ -5,41 +5,4 @@
|
|
|
5
5
|
* @return the path to the gzip file
|
|
6
6
|
*/
|
|
7
7
|
export declare function compressFileWithGzip(pathFile: string): Promise<string>;
|
|
8
|
-
/**
|
|
9
|
-
* Compress files from map into slpk file
|
|
10
|
-
*
|
|
11
|
-
* @param fileMap - map with file paths (key: output path, value: input path)
|
|
12
|
-
* @param outputFile - output slpk file
|
|
13
|
-
* @param level - compression level
|
|
14
|
-
*/
|
|
15
|
-
export declare function compressFilesWithZip(fileMap: {
|
|
16
|
-
[key: string]: string;
|
|
17
|
-
}, outputFile: string, level?: number): Promise<unknown>;
|
|
18
|
-
/**
|
|
19
|
-
* Compress files using external tool 'zip'/'7z'
|
|
20
|
-
*
|
|
21
|
-
* @param inputFolder - folder to archive - for cwd option
|
|
22
|
-
* @param outputFile - output slpk file
|
|
23
|
-
* @param level - compression level
|
|
24
|
-
* @param inputFiles - input files path to pass to the executable as option
|
|
25
|
-
* @param sevenZipExe - path to 7z.exe executable
|
|
26
|
-
*/
|
|
27
|
-
export declare function compressWithChildProcess(inputFolder: string, outputFile: string, level: number, inputFiles: string, sevenZipExe: string): Promise<void>;
|
|
28
|
-
/**
|
|
29
|
-
* Generate hash file from zip archive
|
|
30
|
-
* https://github.com/Esri/i3s-spec/blob/master/docs/1.7/slpk_hashtable.cmn.md
|
|
31
|
-
*
|
|
32
|
-
* @param inputZipFile
|
|
33
|
-
* @param outputFile
|
|
34
|
-
*/
|
|
35
|
-
export declare function generateHash128FromZip(inputZipFile: string, outputFile: string): Promise<unknown>;
|
|
36
|
-
/**
|
|
37
|
-
* Add file to zip archive
|
|
38
|
-
*
|
|
39
|
-
* @param inputFile
|
|
40
|
-
* @param fileName
|
|
41
|
-
* @param zipFile
|
|
42
|
-
* @param sevenZipExe
|
|
43
|
-
*/
|
|
44
|
-
export declare function addFileToZip(inputFolder: string, fileName: string, zipFile: string, sevenZipExe: string): Promise<void>;
|
|
45
8
|
//# sourceMappingURL=compress-util.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compress-util.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/compress-util.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"compress-util.d.ts","sourceRoot":"","sources":["../../../src/lib/utils/compress-util.ts"],"names":[],"mappings":"AAGA;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBtE"}
|