@loaders.gl/tile-converter 3.1.7 → 3.2.0-alpha.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/3d-tiles-attributes-worker.d.ts +28 -0
- package/dist/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/3d-tiles-attributes-worker.js +4 -0
- package/dist/3d-tiles-attributes-worker.js.map +7 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts +82 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.d.ts.map +1 -0
- package/dist/3d-tiles-converter/3d-tiles-converter.js +268 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +84 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +278 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts +13 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +23 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts +9 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.d.ts.map +1 -0
- package/dist/3d-tiles-converter/helpers/texture-atlas.js +52 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts +15 -0
- package/dist/3d-tiles-converter/json-templates/tileset.d.ts.map +1 -0
- package/dist/3d-tiles-converter/json-templates/tileset.js +43 -0
- package/dist/bundle.d.ts +2 -0
- package/dist/bundle.d.ts.map +1 -0
- package/dist/bundle.js +5 -0
- package/dist/converter.min.js +20 -20
- package/dist/deps-installer/deps-installer.d.ts +4 -0
- package/dist/deps-installer/deps-installer.d.ts.map +1 -0
- package/dist/deps-installer/deps-installer.js +21 -0
- package/dist/dist.min.js +1082 -1131
- package/dist/es5/3d-tiles-attributes-worker.js +29 -0
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +104 -44
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +34 -43
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +29 -0
- package/dist/es5/i3s-attributes-worker.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +267 -178
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +71 -0
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/es5/i3s-converter/helpers/node-pages.js +43 -52
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +264 -219
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/index.js +8 -0
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +14 -17
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +39 -14
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +61 -0
- package/dist/es5/lib/utils/queue.js.map +1 -0
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +225 -0
- package/dist/es5/lib/utils/write-queue.js.map +1 -0
- package/dist/es5/pgm-loader.js +1 -1
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +37 -0
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/es5/workers/i3s-attributes-worker.js +40 -0
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-attributes-worker.js +16 -0
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +32 -5
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +23 -23
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +16 -0
- package/dist/esm/i3s-attributes-worker.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +19 -11
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +2 -2
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +117 -58
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +54 -0
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -0
- package/dist/esm/i3s-converter/helpers/node-pages.js +12 -9
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +115 -28
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +6 -8
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +11 -1
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +19 -0
- package/dist/esm/lib/utils/queue.js.map +1 -0
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +88 -0
- package/dist/esm/lib/utils/write-queue.js.map +1 -0
- package/dist/esm/pgm-loader.js +1 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +5 -0
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -0
- package/dist/esm/workers/i3s-attributes-worker.js +4 -0
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -0
- package/dist/i3s-attributes-worker.d.ts +33 -0
- package/dist/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/i3s-attributes-worker.js +10 -0
- package/dist/i3s-attributes-worker.js.map +7 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts +41 -0
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/coordinate-converter.js +122 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts +9 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/create-scene-server-path.js +28 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts +8 -0
- package/dist/i3s-converter/helpers/geometry-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/geometry-attributes.js +177 -0
- package/dist/i3s-converter/helpers/geometry-converter.d.ts +29 -0
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/geometry-converter.js +901 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts +9 -0
- package/dist/i3s-converter/helpers/gltf-attributes.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/gltf-attributes.js +56 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts +8 -0
- package/dist/i3s-converter/helpers/node-debug.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-debug.js +114 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts +117 -0
- package/dist/i3s-converter/helpers/node-pages.d.ts.map +1 -0
- package/dist/i3s-converter/helpers/node-pages.js +208 -0
- package/dist/i3s-converter/i3s-converter.d.ts +325 -0
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -0
- package/dist/i3s-converter/i3s-converter.js +1056 -0
- package/dist/i3s-converter/json-templates/layers.d.ts +95 -0
- package/dist/i3s-converter/json-templates/layers.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/layers.js +199 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts +22 -0
- package/dist/i3s-converter/json-templates/metadata.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/metadata.js +25 -0
- package/dist/i3s-converter/json-templates/node.d.ts +61 -0
- package/dist/i3s-converter/json-templates/node.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/node.js +89 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts +28 -0
- package/dist/i3s-converter/json-templates/scene-server.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/scene-server.js +31 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts +14 -0
- package/dist/i3s-converter/json-templates/shared-resources.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/shared-resources.js +129 -0
- package/dist/i3s-converter/json-templates/store.d.ts +95 -0
- package/dist/i3s-converter/json-templates/store.d.ts.map +1 -0
- package/dist/i3s-converter/json-templates/store.js +103 -0
- package/dist/i3s-converter/types.d.ts +114 -0
- package/dist/i3s-converter/types.d.ts.map +1 -0
- package/dist/i3s-converter/types.js +2 -0
- package/dist/i3s-server/app.d.ts +3 -0
- package/dist/i3s-server/app.d.ts.map +1 -0
- package/dist/i3s-server/app.js +14 -0
- package/dist/i3s-server/controllers/index-controller.d.ts +2 -0
- package/dist/i3s-server/controllers/index-controller.d.ts.map +1 -0
- package/dist/i3s-server/controllers/index-controller.js +23 -0
- package/dist/i3s-server/routes/index.d.ts +3 -0
- package/dist/i3s-server/routes/index.d.ts.map +1 -0
- package/dist/i3s-server/routes/index.js +16 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +16 -0
- package/dist/lib/utils/compress-util.d.ts +45 -0
- package/dist/lib/utils/compress-util.d.ts.map +1 -0
- package/dist/lib/utils/compress-util.js +257 -0
- package/{src → dist}/lib/utils/file-utils.d.ts +6 -14
- package/dist/lib/utils/file-utils.d.ts.map +1 -0
- package/dist/lib/utils/file-utils.js +81 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts +41 -0
- package/dist/lib/utils/lod-conversion-utils.d.ts.map +1 -0
- package/dist/lib/utils/lod-conversion-utils.js +76 -0
- package/dist/lib/utils/queue.d.ts +7 -0
- package/dist/lib/utils/queue.d.ts.map +1 -0
- package/dist/lib/utils/queue.js +18 -0
- package/dist/lib/utils/statistic-utills.d.ts +3 -0
- package/dist/lib/utils/statistic-utills.d.ts.map +1 -0
- package/dist/lib/utils/statistic-utills.js +64 -0
- package/dist/lib/utils/write-queue.d.ts +22 -0
- package/dist/lib/utils/write-queue.d.ts.map +1 -0
- package/dist/lib/utils/write-queue.js +62 -0
- package/dist/pgm-loader.d.ts +6 -0
- package/dist/pgm-loader.d.ts.map +1 -0
- package/dist/pgm-loader.js +23 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts +2 -0
- package/dist/workers/3d-tiles-attributes-worker.d.ts.map +1 -0
- package/dist/workers/3d-tiles-attributes-worker.js +9 -0
- package/dist/workers/i3s-attributes-worker.d.ts +2 -0
- package/dist/workers/i3s-attributes-worker.d.ts.map +1 -0
- package/dist/workers/i3s-attributes-worker.js +5 -0
- package/package.json +20 -18
- package/src/3d-tiles-attributes-worker.ts +43 -0
- package/src/3d-tiles-converter/3d-tiles-converter.ts +48 -5
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +21 -18
- package/src/i3s-attributes-worker.ts +46 -0
- package/src/i3s-converter/helpers/coordinate-converter.ts +29 -24
- package/src/i3s-converter/helpers/geometry-attributes.ts +4 -3
- package/src/i3s-converter/helpers/{geometry-converter.js → geometry-converter.ts} +421 -175
- package/src/i3s-converter/helpers/gltf-attributes.ts +68 -0
- package/src/i3s-converter/helpers/node-pages.ts +25 -17
- package/src/i3s-converter/i3s-converter.ts +124 -69
- package/src/i3s-converter/types.ts +90 -8
- package/src/index.ts +1 -0
- package/src/lib/utils/{compress-util.js → compress-util.ts} +105 -18
- package/src/lib/utils/file-utils.ts +84 -0
- package/src/lib/utils/{lod-conversion-utils.js → lod-conversion-utils.ts} +27 -5
- package/src/lib/utils/queue.ts +17 -0
- package/src/lib/utils/{statistic-utills.js → statistic-utills.ts} +0 -0
- package/src/lib/utils/write-queue.ts +75 -0
- package/src/workers/3d-tiles-attributes-worker.ts +6 -0
- package/src/workers/i3s-attributes-worker.ts +6 -0
- package/dist/es5/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/es5/lib/utils/compress-util.d.ts +0 -53
- package/dist/es5/lib/utils/file-utils.d.ts +0 -43
- package/dist/es5/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/dist/esm/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/dist/esm/lib/utils/compress-util.d.ts +0 -53
- package/dist/esm/lib/utils/file-utils.d.ts +0 -43
- package/dist/esm/lib/utils/lod-conversion-utils.d.ts +0 -32
- package/src/i3s-converter/helpers/geometry-converter.d.ts +0 -44
- package/src/lib/utils/compress-util.d.ts +0 -53
- package/src/lib/utils/file-utils.js +0 -38
- package/src/lib/utils/lod-conversion-utils.d.ts +0 -32
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import { load, encode } from '@loaders.gl/core';
|
|
2
|
+
import { load, encode, fetchFile, getLoaderOptions } from '@loaders.gl/core';
|
|
3
3
|
import { Tileset3D } from '@loaders.gl/tiles';
|
|
4
4
|
import { CesiumIonLoader, Tiles3DLoader } from '@loaders.gl/3d-tiles';
|
|
5
5
|
import { join } from 'path';
|
|
@@ -12,7 +12,7 @@ import { writeFile, removeDir, writeFileForSlpk } from '../lib/utils/file-utils'
|
|
|
12
12
|
import { compressWithChildProcess } from '../lib/utils/compress-util';
|
|
13
13
|
import { calculateFilesSize, timeConverter } from '../lib/utils/statistic-utills';
|
|
14
14
|
import convertB3dmToI3sGeometry from './helpers/geometry-converter';
|
|
15
|
-
import { createBoundingVolumes,
|
|
15
|
+
import { createBoundingVolumes, convertBoundingVolumeToI3SFullExtent } from './helpers/coordinate-converter';
|
|
16
16
|
import { createSceneServerPath } from './helpers/create-scene-server-path';
|
|
17
17
|
import { convertGeometricErrorToScreenThreshold } from '../lib/utils/lod-conversion-utils';
|
|
18
18
|
import { PGMLoader } from '../pgm-loader';
|
|
@@ -20,8 +20,12 @@ import { LAYERS as layersTemplate } from './json-templates/layers';
|
|
|
20
20
|
import { NODE as nodeTemplate } from './json-templates/node';
|
|
21
21
|
import { SHARED_RESOURCES as sharedResourcesTemplate } from './json-templates/shared-resources';
|
|
22
22
|
import { validateNodeBoundingVolumes } from './helpers/node-debug';
|
|
23
|
-
import {
|
|
23
|
+
import { KTX2BasisWriter } from '@loaders.gl/textures';
|
|
24
24
|
import { ImageWriter } from '@loaders.gl/images';
|
|
25
|
+
import { getWorkerURL, WorkerFarm } from '@loaders.gl/worker-utils';
|
|
26
|
+
import { DracoWriterWorker } from '@loaders.gl/draco';
|
|
27
|
+
import WriteQueue from '../lib/utils/write-queue';
|
|
28
|
+
import { I3SAttributesWorker } from '../i3s-attributes-worker';
|
|
25
29
|
const ION_DEFAULT_TOKEN = process.env.IonToken || 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ';
|
|
26
30
|
const HARDCODED_NODES_PER_PAGE = 64;
|
|
27
31
|
const _3D_TILES = '3DTILES';
|
|
@@ -36,8 +40,6 @@ export default class I3SConverter {
|
|
|
36
40
|
constructor() {
|
|
37
41
|
_defineProperty(this, "nodePages", void 0);
|
|
38
42
|
|
|
39
|
-
_defineProperty(this, "fileMap", void 0);
|
|
40
|
-
|
|
41
43
|
_defineProperty(this, "options", void 0);
|
|
42
44
|
|
|
43
45
|
_defineProperty(this, "layers0Path", void 0);
|
|
@@ -72,8 +74,13 @@ export default class I3SConverter {
|
|
|
72
74
|
|
|
73
75
|
_defineProperty(this, "generateBoundingVolumes", void 0);
|
|
74
76
|
|
|
77
|
+
_defineProperty(this, "layersHasTexture", void 0);
|
|
78
|
+
|
|
79
|
+
_defineProperty(this, "workerSource", {});
|
|
80
|
+
|
|
81
|
+
_defineProperty(this, "writeQueue", new WriteQueue());
|
|
82
|
+
|
|
75
83
|
this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
76
|
-
this.fileMap = {};
|
|
77
84
|
this.options = {};
|
|
78
85
|
this.layers0Path = '';
|
|
79
86
|
this.materialMap = new Map();
|
|
@@ -88,6 +95,7 @@ export default class I3SConverter {
|
|
|
88
95
|
this.validate = false;
|
|
89
96
|
this.generateTextures = false;
|
|
90
97
|
this.generateBoundingVolumes = false;
|
|
98
|
+
this.layersHasTexture = false;
|
|
91
99
|
}
|
|
92
100
|
|
|
93
101
|
async convert(options) {
|
|
@@ -119,6 +127,8 @@ export default class I3SConverter {
|
|
|
119
127
|
this.Loader = inputUrl.indexOf(CESIUM_DATASET_PREFIX) !== -1 ? CesiumIonLoader : Tiles3DLoader;
|
|
120
128
|
this.generateTextures = Boolean(generateTextures);
|
|
121
129
|
this.generateBoundingVolumes = Boolean(generateBoundingVolumes);
|
|
130
|
+
this.writeQueue = new WriteQueue();
|
|
131
|
+
this.writeQueue.startListening();
|
|
122
132
|
console.log('Loading egm file...');
|
|
123
133
|
this.geoidHeightModel = await load(egmFilePath, PGMLoader);
|
|
124
134
|
console.log('Loading egm file completed!');
|
|
@@ -127,6 +137,7 @@ export default class I3SConverter {
|
|
|
127
137
|
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
128
138
|
}
|
|
129
139
|
|
|
140
|
+
await this.loadWorkers();
|
|
130
141
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
131
142
|
const tilesetOptions = {
|
|
132
143
|
loadOptions: {
|
|
@@ -151,6 +162,8 @@ export default class I3SConverter {
|
|
|
151
162
|
outputPath,
|
|
152
163
|
tilesetName
|
|
153
164
|
});
|
|
165
|
+
const workerFarm = WorkerFarm.getWorkerFarm({});
|
|
166
|
+
workerFarm.destroy();
|
|
154
167
|
return sourceTilesetJson;
|
|
155
168
|
}
|
|
156
169
|
|
|
@@ -181,15 +194,24 @@ export default class I3SConverter {
|
|
|
181
194
|
|
|
182
195
|
await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
|
|
183
196
|
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
197
|
+
|
|
198
|
+
if (this.layersHasTexture === false) {
|
|
199
|
+
this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter(attribute => attribute !== 'uv0');
|
|
200
|
+
}
|
|
201
|
+
|
|
184
202
|
await this._writeLayers0();
|
|
185
203
|
createSceneServerPath(tilesetName, this.layers0, tilesetPath);
|
|
186
204
|
await this._writeNodeIndexDocument(root0, 'root', join(this.layers0Path, 'nodes', 'root'));
|
|
187
|
-
await this.nodePages.save(this.layers0Path, this.
|
|
205
|
+
await this.nodePages.save(this.layers0Path, this.writeQueue, isCreateSlpk);
|
|
206
|
+
await this.writeQueue.finalize();
|
|
188
207
|
await this._createSlpk(tilesetPath);
|
|
189
208
|
}
|
|
190
209
|
|
|
191
210
|
_formLayers0(tilesetName) {
|
|
192
|
-
|
|
211
|
+
var _this$sourceTileset, _this$sourceTileset2, _this$sourceTileset2$;
|
|
212
|
+
|
|
213
|
+
const fullExtent = convertBoundingVolumeToI3SFullExtent(((_this$sourceTileset = this.sourceTileset) === null || _this$sourceTileset === void 0 ? void 0 : _this$sourceTileset.boundingVolume) || ((_this$sourceTileset2 = this.sourceTileset) === null || _this$sourceTileset2 === void 0 ? void 0 : (_this$sourceTileset2$ = _this$sourceTileset2.root) === null || _this$sourceTileset2$ === void 0 ? void 0 : _this$sourceTileset2$.boundingVolume));
|
|
214
|
+
const extent = [fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax];
|
|
193
215
|
const layers0data = {
|
|
194
216
|
version: "{".concat(uuidv4().toUpperCase(), "}"),
|
|
195
217
|
id: 0,
|
|
@@ -239,9 +261,14 @@ export default class I3SConverter {
|
|
|
239
261
|
const childPath = join(this.layers0Path, 'nodes', child.path);
|
|
240
262
|
|
|
241
263
|
if (this.options.slpk) {
|
|
242
|
-
this.
|
|
264
|
+
this.writeQueue.enqueue({
|
|
265
|
+
archiveKey: 'nodes/1/3dNodeIndexDocument.json.gz',
|
|
266
|
+
writePromise: writeFileForSlpk(childPath, JSON.stringify(child), '3dNodeIndexDocument.json')
|
|
267
|
+
});
|
|
243
268
|
} else {
|
|
244
|
-
|
|
269
|
+
this.writeQueue.enqueue({
|
|
270
|
+
writePromise: writeFile(childPath, JSON.stringify(child))
|
|
271
|
+
});
|
|
245
272
|
}
|
|
246
273
|
} else {
|
|
247
274
|
await this._addChildrenWithNeighborsAndWriteFile({
|
|
@@ -257,17 +284,27 @@ export default class I3SConverter {
|
|
|
257
284
|
|
|
258
285
|
async _writeLayers0() {
|
|
259
286
|
if (this.options.slpk) {
|
|
260
|
-
this.
|
|
287
|
+
this.writeQueue.enqueue({
|
|
288
|
+
archiveKey: '3dSceneLayer.json.gz',
|
|
289
|
+
writePromise: writeFileForSlpk(this.layers0Path, JSON.stringify(this.layers0), '3dSceneLayer.json')
|
|
290
|
+
});
|
|
261
291
|
} else {
|
|
262
|
-
|
|
292
|
+
this.writeQueue.enqueue({
|
|
293
|
+
writePromise: writeFile(this.layers0Path, JSON.stringify(this.layers0))
|
|
294
|
+
});
|
|
263
295
|
}
|
|
264
296
|
}
|
|
265
297
|
|
|
266
298
|
async _writeNodeIndexDocument(root0, nodePath, rootPath) {
|
|
267
299
|
if (this.options.slpk) {
|
|
268
|
-
this.
|
|
300
|
+
this.writeQueue.enqueue({
|
|
301
|
+
archiveKey: "nodes/".concat(nodePath, "/3dNodeIndexDocument.json.gz"),
|
|
302
|
+
writePromise: writeFileForSlpk(rootPath, JSON.stringify(root0), '3dNodeIndexDocument.json')
|
|
303
|
+
});
|
|
269
304
|
} else {
|
|
270
|
-
|
|
305
|
+
this.writeQueue.enqueue({
|
|
306
|
+
writePromise: writeFile(rootPath, JSON.stringify(root0))
|
|
307
|
+
});
|
|
271
308
|
}
|
|
272
309
|
}
|
|
273
310
|
|
|
@@ -397,6 +434,8 @@ export default class I3SConverter {
|
|
|
397
434
|
};
|
|
398
435
|
|
|
399
436
|
for (const resources of resourcesData || [emptyResources]) {
|
|
437
|
+
this.layersHasTexture = this.layersHasTexture || Boolean(resources.texture);
|
|
438
|
+
|
|
400
439
|
if (this.generateBoundingVolumes && resources.boundingVolumes) {
|
|
401
440
|
boundingVolumes = resources.boundingVolumes;
|
|
402
441
|
}
|
|
@@ -453,7 +492,7 @@ export default class I3SConverter {
|
|
|
453
492
|
return null;
|
|
454
493
|
}
|
|
455
494
|
|
|
456
|
-
const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel);
|
|
495
|
+
const resourcesData = await convertB3dmToI3sGeometry(sourceTile.content, Number(this.nodePages.nodesCounter), this.featuresHashArray, (_this$layers2 = this.layers0) === null || _this$layers2 === void 0 ? void 0 : _this$layers2.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.geoidHeightModel, this.workerSource);
|
|
457
496
|
return resourcesData;
|
|
458
497
|
}
|
|
459
498
|
|
|
@@ -588,34 +627,53 @@ export default class I3SConverter {
|
|
|
588
627
|
async _writeGeometries(geometryBuffer, compressedGeometry, childPath, slpkChildPath) {
|
|
589
628
|
if (this.options.slpk) {
|
|
590
629
|
const slpkGeometryPath = join(childPath, 'geometries');
|
|
591
|
-
this.
|
|
630
|
+
this.writeQueue.enqueue({
|
|
631
|
+
archiveKey: "".concat(slpkChildPath, "/geometries/0.bin.gz"),
|
|
632
|
+
writePromise: writeFileForSlpk(slpkGeometryPath, geometryBuffer, '0.bin')
|
|
633
|
+
});
|
|
592
634
|
} else {
|
|
593
635
|
const geometryPath = join(childPath, 'geometries/0/');
|
|
594
|
-
|
|
636
|
+
this.writeQueue.enqueue({
|
|
637
|
+
writePromise: writeFile(geometryPath, geometryBuffer, 'index.bin')
|
|
638
|
+
});
|
|
595
639
|
}
|
|
596
640
|
|
|
597
641
|
if (this.options.draco) {
|
|
598
642
|
if (this.options.slpk) {
|
|
599
643
|
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
600
|
-
this.
|
|
644
|
+
this.writeQueue.enqueue({
|
|
645
|
+
archiveKey: "".concat(slpkChildPath, "/geometries/1.bin.gz"),
|
|
646
|
+
writePromise: writeFileForSlpk(slpkCompressedGeometryPath, compressedGeometry, '1.bin')
|
|
647
|
+
});
|
|
601
648
|
} else {
|
|
602
649
|
const compressedGeometryPath = join(childPath, 'geometries/1/');
|
|
603
|
-
|
|
650
|
+
this.writeQueue.enqueue({
|
|
651
|
+
writePromise: writeFile(compressedGeometryPath, compressedGeometry, 'index.bin')
|
|
652
|
+
});
|
|
604
653
|
}
|
|
605
654
|
}
|
|
606
655
|
}
|
|
607
656
|
|
|
608
657
|
async _writeShared(sharedResources, childPath, slpkChildPath, nodePath) {
|
|
658
|
+
if (!sharedResources) {
|
|
659
|
+
return;
|
|
660
|
+
}
|
|
661
|
+
|
|
609
662
|
sharedResources.nodePath = nodePath;
|
|
610
663
|
const sharedData = transform(sharedResources, sharedResourcesTemplate());
|
|
611
664
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
612
665
|
|
|
613
666
|
if (this.options.slpk) {
|
|
614
667
|
const slpkSharedPath = join(childPath, 'shared');
|
|
615
|
-
this.
|
|
668
|
+
this.writeQueue.enqueue({
|
|
669
|
+
archiveKey: "".concat(slpkChildPath, "/shared/sharedResource.json.gz"),
|
|
670
|
+
writePromise: writeFileForSlpk(slpkSharedPath, sharedDataStr, 'sharedResource.json')
|
|
671
|
+
});
|
|
616
672
|
} else {
|
|
617
673
|
const sharedPath = join(childPath, 'shared/');
|
|
618
|
-
|
|
674
|
+
this.writeQueue.enqueue({
|
|
675
|
+
writePromise: writeFile(sharedPath, sharedDataStr)
|
|
676
|
+
});
|
|
619
677
|
}
|
|
620
678
|
}
|
|
621
679
|
|
|
@@ -641,7 +699,7 @@ export default class I3SConverter {
|
|
|
641
699
|
name: '1',
|
|
642
700
|
format: 'ktx2'
|
|
643
701
|
});
|
|
644
|
-
const ktx2TextureData = new Uint8Array(await encode(texture.image,
|
|
702
|
+
const ktx2TextureData = new Uint8Array(await encode(texture.image, KTX2BasisWriter));
|
|
645
703
|
await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
|
|
646
704
|
}
|
|
647
705
|
|
|
@@ -679,27 +737,37 @@ export default class I3SConverter {
|
|
|
679
737
|
if (this.options.slpk) {
|
|
680
738
|
const slpkTexturePath = join(childPath, 'textures');
|
|
681
739
|
const compress = false;
|
|
682
|
-
this.
|
|
740
|
+
this.writeQueue.enqueue({
|
|
741
|
+
archiveKey: "".concat(slpkChildPath, "/textures/").concat(name, ".").concat(format),
|
|
742
|
+
writePromise: writeFileForSlpk(slpkTexturePath, textureData, "".concat(name, ".").concat(format), compress)
|
|
743
|
+
});
|
|
683
744
|
} else {
|
|
684
745
|
const texturePath = join(childPath, "textures/".concat(name, "/"));
|
|
685
|
-
|
|
746
|
+
this.writeQueue.enqueue({
|
|
747
|
+
writePromise: writeFile(texturePath, textureData, "index.".concat(format))
|
|
748
|
+
});
|
|
686
749
|
}
|
|
687
750
|
}
|
|
688
751
|
|
|
689
|
-
async _writeAttributes(attributes, childPath, slpkChildPath) {
|
|
752
|
+
async _writeAttributes(attributes = [], childPath, slpkChildPath) {
|
|
690
753
|
var _this$layers4, _this$layers4$attribu;
|
|
691
754
|
|
|
692
|
-
if (attributes.length && (_this$layers4 = this.layers0) !== null && _this$layers4 !== void 0 && (_this$layers4$attribu = _this$layers4.attributeStorageInfo) !== null && _this$layers4$attribu !== void 0 && _this$layers4$attribu.length) {
|
|
755
|
+
if (attributes !== null && attributes !== void 0 && attributes.length && (_this$layers4 = this.layers0) !== null && _this$layers4 !== void 0 && (_this$layers4$attribu = _this$layers4.attributeStorageInfo) !== null && _this$layers4$attribu !== void 0 && _this$layers4$attribu.length) {
|
|
693
756
|
for (let index = 0; index < attributes.length; index++) {
|
|
694
757
|
const folderName = this.layers0.attributeStorageInfo[index].key;
|
|
695
758
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
696
759
|
|
|
697
760
|
if (this.options.slpk) {
|
|
698
761
|
const slpkAttributesPath = join(childPath, 'attributes', folderName);
|
|
699
|
-
this.
|
|
762
|
+
this.writeQueue.enqueue({
|
|
763
|
+
archiveKey: "".concat(slpkChildPath, "/attributes/").concat(folderName, ".bin.gz"),
|
|
764
|
+
writePromise: writeFileForSlpk(slpkAttributesPath, fileBuffer, '0.bin')
|
|
765
|
+
});
|
|
700
766
|
} else {
|
|
701
767
|
const attributesPath = join(childPath, "attributes/".concat(folderName, "/0"));
|
|
702
|
-
|
|
768
|
+
this.writeQueue.enqueue({
|
|
769
|
+
writePromise: writeFile(attributesPath, fileBuffer, 'index.bin')
|
|
770
|
+
});
|
|
703
771
|
}
|
|
704
772
|
}
|
|
705
773
|
}
|
|
@@ -976,5 +1044,24 @@ export default class I3SConverter {
|
|
|
976
1044
|
return ['b3dm', 'glTF'].includes(sourceRootTile === null || sourceRootTile === void 0 ? void 0 : (_sourceRootTile$conte = sourceRootTile.content) === null || _sourceRootTile$conte === void 0 ? void 0 : _sourceRootTile$conte.type);
|
|
977
1045
|
}
|
|
978
1046
|
|
|
1047
|
+
async loadWorkers() {
|
|
1048
|
+
console.log("Loading workers source...");
|
|
1049
|
+
|
|
1050
|
+
if (this.options.draco) {
|
|
1051
|
+
const url = getWorkerURL(DracoWriterWorker, { ...getLoaderOptions()
|
|
1052
|
+
});
|
|
1053
|
+
const sourceResponse = await fetchFile(url);
|
|
1054
|
+
const source = await sourceResponse.text();
|
|
1055
|
+
this.workerSource.draco = source;
|
|
1056
|
+
}
|
|
1057
|
+
|
|
1058
|
+
const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, { ...getLoaderOptions()
|
|
1059
|
+
});
|
|
1060
|
+
const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
|
|
1061
|
+
const source = await sourceResponse.text();
|
|
1062
|
+
this.workerSource.I3SAttributes = source;
|
|
1063
|
+
console.log("Loading workers source completed!");
|
|
1064
|
+
}
|
|
1065
|
+
|
|
979
1066
|
}
|
|
980
1067
|
//# sourceMappingURL=i3s-converter.js.map
|