@loaders.gl/tile-converter 3.3.0-alpha.5 → 3.3.0-alpha.7
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.js +2 -3
- package/dist/3d-tiles-attributes-worker.js.map +3 -3
- package/dist/converter-cli.js +15 -2
- package/dist/converter.min.js +23 -20
- package/dist/dist.min.js +38236 -46911
- package/dist/es5/3d-tiles-attributes-worker.js +3 -6
- package/dist/es5/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js +12 -111
- package/dist/es5/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js +32 -72
- package/dist/es5/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +0 -8
- package/dist/es5/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js +0 -5
- package/dist/es5/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js +0 -6
- package/dist/es5/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/es5/bundle.js +0 -1
- package/dist/es5/bundle.js.map +1 -1
- package/dist/es5/constants.js.map +1 -1
- package/dist/es5/converter-cli.js +11 -56
- package/dist/es5/converter-cli.js.map +1 -1
- package/dist/es5/deps-installer/deps-installer.js +5 -35
- package/dist/es5/deps-installer/deps-installer.js.map +1 -1
- package/dist/es5/i3s-attributes-worker.js +3 -6
- package/dist/es5/i3s-attributes-worker.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js +2 -28
- package/dist/es5/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js +8 -25
- package/dist/es5/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js +0 -11
- package/dist/es5/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/feature-attributes.js +5 -34
- package/dist/es5/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js +13 -45
- package/dist/es5/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/geometry-converter.js +26 -221
- package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js +2 -16
- package/dist/es5/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-debug.js +4 -23
- package/dist/es5/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/es5/i3s-converter/helpers/node-pages.js +50 -86
- package/dist/es5/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/es5/i3s-converter/i3s-converter.js +69 -384
- package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/layers.js +1 -15
- package/dist/es5/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/metadata.js +0 -2
- package/dist/es5/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/node.js +2 -12
- package/dist/es5/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/scene-server.js +0 -2
- package/dist/es5/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/shared-resources.js +6 -29
- package/dist/es5/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/es5/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/es5/i3s-converter/types.js.map +1 -1
- package/dist/es5/i3s-server/app.js +0 -5
- package/dist/es5/i3s-server/app.js.map +1 -1
- package/dist/es5/i3s-server/controllers/index-controller.js +0 -16
- package/dist/es5/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/es5/i3s-server/routes/index.js +1 -10
- package/dist/es5/i3s-server/routes/index.js.map +1 -1
- package/dist/es5/index.js +0 -3
- package/dist/es5/index.js.map +1 -1
- package/dist/es5/lib/utils/compress-util.js +19 -74
- package/dist/es5/lib/utils/compress-util.js.map +1 -1
- package/dist/es5/lib/utils/file-utils.js +10 -38
- package/dist/es5/lib/utils/file-utils.js.map +1 -1
- package/dist/es5/lib/utils/lod-conversion-utils.js +0 -7
- package/dist/es5/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/es5/lib/utils/queue.js +0 -14
- package/dist/es5/lib/utils/queue.js.map +1 -1
- package/dist/es5/lib/utils/statistic-utills.js +1 -46
- package/dist/es5/lib/utils/statistic-utills.js.map +1 -1
- package/dist/es5/lib/utils/write-queue.js +0 -52
- package/dist/es5/lib/utils/write-queue.js.map +1 -1
- package/dist/es5/pgm-loader.js +1 -8
- package/dist/es5/pgm-loader.js.map +1 -1
- package/dist/es5/workers/3d-tiles-attributes-worker.js +1 -8
- package/dist/es5/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/es5/workers/i3s-attributes-worker.js +1 -9
- package/dist/es5/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-attributes-worker.js +3 -1
- package/dist/esm/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js +8 -40
- package/dist/esm/3d-tiles-converter/3d-tiles-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js +7 -38
- package/dist/esm/3d-tiles-converter/helpers/b3dm-converter.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js +1 -0
- package/dist/esm/3d-tiles-converter/helpers/i3s-obb-to-3d-tiles-obb.js.map +1 -1
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js +1 -4
- package/dist/esm/3d-tiles-converter/helpers/texture-atlas.js.map +1 -1
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js +0 -3
- package/dist/esm/3d-tiles-converter/json-templates/tileset.js.map +1 -1
- package/dist/esm/bundle.js +1 -1
- package/dist/esm/bundle.js.map +1 -1
- package/dist/esm/constants.js.map +1 -1
- package/dist/esm/converter-cli.js +12 -41
- package/dist/esm/converter-cli.js.map +1 -1
- package/dist/esm/deps-installer/deps-installer.js +6 -7
- package/dist/esm/deps-installer/deps-installer.js.map +1 -1
- package/dist/esm/i3s-attributes-worker.js +3 -1
- package/dist/esm/i3s-attributes-worker.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js +4 -23
- package/dist/esm/i3s-converter/helpers/batch-ids-extensions.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js +11 -12
- package/dist/esm/i3s-converter/helpers/coordinate-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js +1 -0
- package/dist/esm/i3s-converter/helpers/create-scene-server-path.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/feature-attributes.js +6 -20
- package/dist/esm/i3s-converter/helpers/feature-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js +3 -22
- package/dist/esm/i3s-converter/helpers/geometry-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/geometry-converter.js +28 -139
- package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js +7 -12
- package/dist/esm/i3s-converter/helpers/gltf-attributes.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-debug.js +3 -13
- package/dist/esm/i3s-converter/helpers/node-debug.js.map +1 -1
- package/dist/esm/i3s-converter/helpers/node-pages.js +2 -21
- package/dist/esm/i3s-converter/helpers/node-pages.js.map +1 -1
- package/dist/esm/i3s-converter/i3s-converter.js +59 -144
- package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/layers.js +1 -11
- package/dist/esm/i3s-converter/json-templates/layers.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/metadata.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/node.js +0 -4
- package/dist/esm/i3s-converter/json-templates/node.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/scene-server.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/shared-resources.js +0 -12
- package/dist/esm/i3s-converter/json-templates/shared-resources.js.map +1 -1
- package/dist/esm/i3s-converter/json-templates/store.js.map +1 -1
- package/dist/esm/i3s-converter/types.js.map +1 -1
- package/dist/esm/i3s-server/app.js +0 -5
- package/dist/esm/i3s-server/app.js.map +1 -1
- package/dist/esm/i3s-server/controllers/index-controller.js +0 -5
- package/dist/esm/i3s-server/controllers/index-controller.js.map +1 -1
- package/dist/esm/i3s-server/routes/index.js +0 -3
- package/dist/esm/i3s-server/routes/index.js.map +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/lib/utils/compress-util.js +19 -12
- package/dist/esm/lib/utils/compress-util.js.map +1 -1
- package/dist/esm/lib/utils/file-utils.js +10 -8
- package/dist/esm/lib/utils/file-utils.js.map +1 -1
- package/dist/esm/lib/utils/lod-conversion-utils.js +2 -6
- package/dist/esm/lib/utils/lod-conversion-utils.js.map +1 -1
- package/dist/esm/lib/utils/queue.js +0 -4
- package/dist/esm/lib/utils/queue.js.map +1 -1
- package/dist/esm/lib/utils/statistic-utills.js +0 -11
- package/dist/esm/lib/utils/statistic-utills.js.map +1 -1
- package/dist/esm/lib/utils/write-queue.js +5 -23
- package/dist/esm/lib/utils/write-queue.js.map +1 -1
- package/dist/esm/pgm-loader.js +3 -1
- package/dist/esm/pgm-loader.js.map +1 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js +4 -1
- package/dist/esm/workers/3d-tiles-attributes-worker.js.map +1 -1
- package/dist/esm/workers/i3s-attributes-worker.js +4 -1
- package/dist/esm/workers/i3s-attributes-worker.js.map +1 -1
- package/dist/i3s-attributes-worker.js +2 -3
- package/dist/i3s-attributes-worker.js.map +3 -3
- package/dist/i3s-converter/helpers/coordinate-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/coordinate-converter.js +8 -6
- package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +2 -0
- package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
- package/dist/i3s-converter/i3s-converter.js +14 -8
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +2 -1
- package/package.json +15 -15
- package/src/converter-cli.ts +16 -2
- package/src/i3s-converter/helpers/coordinate-converter.ts +8 -6
- package/src/i3s-converter/helpers/geometry-converter.ts +2 -0
- package/src/i3s-converter/i3s-converter.ts +17 -7
- package/src/pgm-loader.ts +2 -2
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
|
|
3
2
|
var _process$env;
|
|
4
|
-
|
|
5
3
|
import { load, encode, fetchFile, getLoaderOptions, isBrowser } from '@loaders.gl/core';
|
|
6
4
|
import { Tileset3D } from '@loaders.gl/tiles';
|
|
7
5
|
import { CesiumIonLoader, Tiles3DLoader } from '@loaders.gl/3d-tiles';
|
|
@@ -12,7 +10,8 @@ import transform from 'json-map-transform';
|
|
|
12
10
|
import md5 from 'md5';
|
|
13
11
|
import NodePages from './helpers/node-pages';
|
|
14
12
|
import { writeFile, removeDir, writeFileForSlpk } from '../lib/utils/file-utils';
|
|
15
|
-
import { compressWithChildProcess
|
|
13
|
+
import { compressWithChildProcess
|
|
14
|
+
} from '../lib/utils/compress-util';
|
|
16
15
|
import { calculateFilesSize, timeConverter } from '../lib/utils/statistic-utills';
|
|
17
16
|
import convertB3dmToI3sGeometry, { getPropertyTable } from './helpers/geometry-converter';
|
|
18
17
|
import { createBoundingVolumes, convertBoundingVolumeToI3SFullExtent } from './helpers/coordinate-converter';
|
|
@@ -31,56 +30,37 @@ import WriteQueue from '../lib/utils/write-queue';
|
|
|
31
30
|
import { I3SAttributesWorker } from '../i3s-attributes-worker';
|
|
32
31
|
import { BROWSER_ERROR_MESSAGE } from '../constants';
|
|
33
32
|
import { createdStorageAttribute, createFieldAttribute, createPopupInfo, getAttributeType, getFieldAttributeType } from './helpers/feature-attributes';
|
|
34
|
-
const ION_DEFAULT_TOKEN = ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.IonToken) ||
|
|
33
|
+
const ION_DEFAULT_TOKEN = ((_process$env = process.env) === null || _process$env === void 0 ? void 0 : _process$env.IonToken) ||
|
|
34
|
+
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJqdGkiOiJlYWMxMzcyYy0zZjJkLTQwODctODNlNi01MDRkZmMzMjIxOWIiLCJpZCI6OTYyMCwic2NvcGVzIjpbImFzbCIsImFzciIsImdjIl0sImlhdCI6MTU2Mjg2NjI3M30.1FNiClUyk00YH_nWfSGpiQAjR5V2OvREDq1PJ5QMjWQ';
|
|
35
35
|
const HARDCODED_NODES_PER_PAGE = 64;
|
|
36
36
|
const _3D_TILES = '3DTILES';
|
|
37
37
|
const _3D_OBJECT_LAYER_TYPE = '3DObject';
|
|
38
38
|
const REFRESH_TOKEN_TIMEOUT = 1800;
|
|
39
39
|
const CESIUM_DATASET_PREFIX = 'https://';
|
|
40
|
+
|
|
40
41
|
export default class I3SConverter {
|
|
41
42
|
constructor() {
|
|
42
43
|
_defineProperty(this, "nodePages", void 0);
|
|
43
|
-
|
|
44
44
|
_defineProperty(this, "options", void 0);
|
|
45
|
-
|
|
46
45
|
_defineProperty(this, "layers0Path", void 0);
|
|
47
|
-
|
|
48
46
|
_defineProperty(this, "materialMap", void 0);
|
|
49
|
-
|
|
50
47
|
_defineProperty(this, "materialDefinitions", void 0);
|
|
51
|
-
|
|
52
48
|
_defineProperty(this, "vertexCounter", void 0);
|
|
53
|
-
|
|
54
49
|
_defineProperty(this, "layers0", void 0);
|
|
55
|
-
|
|
56
50
|
_defineProperty(this, "featuresHashArray", void 0);
|
|
57
|
-
|
|
58
51
|
_defineProperty(this, "refinementCounter", void 0);
|
|
59
|
-
|
|
60
52
|
_defineProperty(this, "validate", void 0);
|
|
61
|
-
|
|
62
53
|
_defineProperty(this, "boundingVolumeWarnings", []);
|
|
63
|
-
|
|
64
54
|
_defineProperty(this, "conversionStartTime", [0, 0]);
|
|
65
|
-
|
|
66
55
|
_defineProperty(this, "refreshTokenTime", [0, 0]);
|
|
67
|
-
|
|
68
56
|
_defineProperty(this, "sourceTileset", null);
|
|
69
|
-
|
|
70
57
|
_defineProperty(this, "geoidHeightModel", null);
|
|
71
|
-
|
|
72
58
|
_defineProperty(this, "Loader", Tiles3DLoader);
|
|
73
|
-
|
|
74
59
|
_defineProperty(this, "generateTextures", void 0);
|
|
75
|
-
|
|
76
60
|
_defineProperty(this, "generateBoundingVolumes", void 0);
|
|
77
|
-
|
|
78
61
|
_defineProperty(this, "layersHasTexture", void 0);
|
|
79
|
-
|
|
80
62
|
_defineProperty(this, "workerSource", {});
|
|
81
|
-
|
|
82
63
|
_defineProperty(this, "writeQueue", new WriteQueue());
|
|
83
|
-
|
|
84
64
|
this.nodePages = new NodePages(writeFile, HARDCODED_NODES_PER_PAGE);
|
|
85
65
|
this.options = {};
|
|
86
66
|
this.layers0Path = '';
|
|
@@ -104,7 +84,6 @@ export default class I3SConverter {
|
|
|
104
84
|
console.log(BROWSER_ERROR_MESSAGE);
|
|
105
85
|
return BROWSER_ERROR_MESSAGE;
|
|
106
86
|
}
|
|
107
|
-
|
|
108
87
|
this.conversionStartTime = process.hrtime();
|
|
109
88
|
const {
|
|
110
89
|
tilesetName,
|
|
@@ -142,10 +121,9 @@ export default class I3SConverter {
|
|
|
142
121
|
if (slpk) {
|
|
143
122
|
this.nodePages.useWriteFunction(writeFileForSlpk);
|
|
144
123
|
}
|
|
145
|
-
|
|
146
124
|
await this.loadWorkers();
|
|
147
|
-
|
|
148
125
|
try {
|
|
126
|
+
var _sourceTilesetJson$ro, _sourceTilesetJson$ro2;
|
|
149
127
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
150
128
|
const tilesetOptions = {
|
|
151
129
|
loadOptions: {
|
|
@@ -163,17 +141,15 @@ export default class I3SConverter {
|
|
|
163
141
|
}
|
|
164
142
|
}
|
|
165
143
|
};
|
|
166
|
-
|
|
167
144
|
if (preloadOptions.headers) {
|
|
168
145
|
tilesetOptions.loadOptions.fetch = {
|
|
169
146
|
headers: preloadOptions.headers
|
|
170
147
|
};
|
|
171
148
|
}
|
|
172
|
-
|
|
173
149
|
Object.assign(tilesetOptions, preloadOptions);
|
|
174
150
|
const sourceTilesetJson = await load(inputUrl, this.Loader, tilesetOptions.loadOptions);
|
|
175
151
|
this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);
|
|
176
|
-
await this._createAndSaveTileset(outputPath, tilesetName);
|
|
152
|
+
await this._createAndSaveTileset(outputPath, tilesetName, sourceTilesetJson === null || sourceTilesetJson === void 0 ? void 0 : (_sourceTilesetJson$ro = sourceTilesetJson.root) === null || _sourceTilesetJson$ro === void 0 ? void 0 : (_sourceTilesetJson$ro2 = _sourceTilesetJson$ro.boundingVolume) === null || _sourceTilesetJson$ro2 === void 0 ? void 0 : _sourceTilesetJson$ro2.region);
|
|
177
153
|
await this._finishConversion({
|
|
178
154
|
slpk: Boolean(slpk),
|
|
179
155
|
outputPath,
|
|
@@ -188,17 +164,14 @@ export default class I3SConverter {
|
|
|
188
164
|
}
|
|
189
165
|
}
|
|
190
166
|
|
|
191
|
-
async _createAndSaveTileset(outputPath, tilesetName) {
|
|
167
|
+
async _createAndSaveTileset(outputPath, tilesetName, boundingVolumeRegion) {
|
|
192
168
|
const tilesetPath = join("".concat(outputPath), "".concat(tilesetName));
|
|
193
|
-
|
|
194
169
|
try {
|
|
195
170
|
await removeDir(tilesetPath);
|
|
196
|
-
} catch (e) {
|
|
197
|
-
|
|
171
|
+
} catch (e) {
|
|
172
|
+
}
|
|
198
173
|
this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');
|
|
199
|
-
|
|
200
|
-
this._formLayers0(tilesetName);
|
|
201
|
-
|
|
174
|
+
this._formLayers0(tilesetName, boundingVolumeRegion);
|
|
202
175
|
this.materialDefinitions = [];
|
|
203
176
|
this.materialMap = new Map();
|
|
204
177
|
const sourceRootTile = this.sourceTileset.root;
|
|
@@ -210,16 +183,12 @@ export default class I3SConverter {
|
|
|
210
183
|
children: []
|
|
211
184
|
});
|
|
212
185
|
const isCreateSlpk = this.options.slpk;
|
|
213
|
-
|
|
214
186
|
const root0 = this._formRootNodeIndexDocument(boundingVolumes);
|
|
215
|
-
|
|
216
187
|
await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
|
|
217
188
|
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
218
|
-
|
|
219
189
|
if (this.layersHasTexture === false) {
|
|
220
190
|
this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter(attribute => attribute !== 'uv0');
|
|
221
191
|
}
|
|
222
|
-
|
|
223
192
|
await this._writeLayers0();
|
|
224
193
|
createSceneServerPath(tilesetName, this.layers0, tilesetPath);
|
|
225
194
|
await this._writeNodeIndexDocument(root0, 'root', join(this.layers0Path, 'nodes', 'root'));
|
|
@@ -228,10 +197,13 @@ export default class I3SConverter {
|
|
|
228
197
|
await this._createSlpk(tilesetPath);
|
|
229
198
|
}
|
|
230
199
|
|
|
231
|
-
_formLayers0(tilesetName) {
|
|
200
|
+
_formLayers0(tilesetName, boundingVolumeRegion) {
|
|
232
201
|
var _this$sourceTileset, _this$sourceTileset2, _this$sourceTileset2$;
|
|
233
|
-
|
|
234
202
|
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));
|
|
203
|
+
if (boundingVolumeRegion) {
|
|
204
|
+
fullExtent.zmin = boundingVolumeRegion[4];
|
|
205
|
+
fullExtent.zmax = boundingVolumeRegion[5];
|
|
206
|
+
}
|
|
235
207
|
const extent = [fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax];
|
|
236
208
|
const layers0data = {
|
|
237
209
|
version: "{".concat(uuidv4().toUpperCase(), "}"),
|
|
@@ -271,7 +243,6 @@ export default class I3SConverter {
|
|
|
271
243
|
|
|
272
244
|
async _convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes) {
|
|
273
245
|
await this.sourceTileset._loadTile(sourceRootTile);
|
|
274
|
-
|
|
275
246
|
if (this.isContentSupported(sourceRootTile)) {
|
|
276
247
|
root0.children = root0.children || [];
|
|
277
248
|
root0.children.push({
|
|
@@ -281,7 +252,6 @@ export default class I3SConverter {
|
|
|
281
252
|
});
|
|
282
253
|
const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);
|
|
283
254
|
const childPath = join(this.layers0Path, 'nodes', child.path);
|
|
284
|
-
|
|
285
255
|
if (this.options.slpk) {
|
|
286
256
|
await this.writeQueue.enqueue({
|
|
287
257
|
archiveKey: 'nodes/1/3dNodeIndexDocument.json.gz',
|
|
@@ -300,7 +270,6 @@ export default class I3SConverter {
|
|
|
300
270
|
level: 1
|
|
301
271
|
});
|
|
302
272
|
}
|
|
303
|
-
|
|
304
273
|
await sourceRootTile.unloadContent();
|
|
305
274
|
}
|
|
306
275
|
|
|
@@ -338,25 +307,28 @@ export default class I3SConverter {
|
|
|
338
307
|
|
|
339
308
|
try {
|
|
340
309
|
await removeDir(tilesetPath);
|
|
341
|
-
} catch (e) {
|
|
310
|
+
} catch (e) {
|
|
311
|
+
}
|
|
342
312
|
}
|
|
343
313
|
}
|
|
344
314
|
|
|
345
315
|
async _addChildrenWithNeighborsAndWriteFile(data) {
|
|
346
316
|
const childNodes = [];
|
|
347
|
-
await this._addChildren({
|
|
317
|
+
await this._addChildren({
|
|
318
|
+
...data,
|
|
348
319
|
childNodes
|
|
349
320
|
});
|
|
350
321
|
await this._addNeighborsAndWriteFile(data.parentNode, childNodes);
|
|
351
322
|
}
|
|
352
323
|
|
|
353
|
-
async convertNestedTileset({
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
324
|
+
async convertNestedTileset(_ref) {
|
|
325
|
+
let {
|
|
326
|
+
sourceTile,
|
|
327
|
+
parentNode,
|
|
328
|
+
childNodes,
|
|
329
|
+
parentId,
|
|
330
|
+
level
|
|
331
|
+
} = _ref;
|
|
360
332
|
await this.sourceTileset._loadTile(sourceTile);
|
|
361
333
|
await this._addChildren({
|
|
362
334
|
parentNode,
|
|
@@ -368,16 +340,16 @@ export default class I3SConverter {
|
|
|
368
340
|
await sourceTile.unloadContent();
|
|
369
341
|
}
|
|
370
342
|
|
|
371
|
-
async convertNode({
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
343
|
+
async convertNode(_ref2) {
|
|
344
|
+
let {
|
|
345
|
+
sourceTile,
|
|
346
|
+
parentNode,
|
|
347
|
+
childNodes,
|
|
348
|
+
parentId,
|
|
349
|
+
level
|
|
350
|
+
} = _ref2;
|
|
378
351
|
const children = await this._createNode(parentNode, sourceTile, parentId, level);
|
|
379
352
|
parentNode.children = parentNode.children || [];
|
|
380
|
-
|
|
381
353
|
for (const child of children) {
|
|
382
354
|
parentNode.children.push({
|
|
383
355
|
id: child.id,
|
|
@@ -397,13 +369,10 @@ export default class I3SConverter {
|
|
|
397
369
|
parentId,
|
|
398
370
|
level
|
|
399
371
|
} = data;
|
|
400
|
-
|
|
401
372
|
if (this.options.maxDepth && level > this.options.maxDepth) {
|
|
402
373
|
return;
|
|
403
374
|
}
|
|
404
|
-
|
|
405
375
|
const promises = [];
|
|
406
|
-
|
|
407
376
|
for (const sourceTile of sourceTiles) {
|
|
408
377
|
if (sourceTile.type === 'json') {
|
|
409
378
|
promises.push(this.convertNestedTileset({
|
|
@@ -422,9 +391,7 @@ export default class I3SConverter {
|
|
|
422
391
|
level
|
|
423
392
|
}));
|
|
424
393
|
}
|
|
425
|
-
|
|
426
394
|
await Promise.all(promises);
|
|
427
|
-
|
|
428
395
|
if (sourceTile.id) {
|
|
429
396
|
console.log(sourceTile.id);
|
|
430
397
|
}
|
|
@@ -434,7 +401,6 @@ export default class I3SConverter {
|
|
|
434
401
|
async _addNeighborsAndWriteFile(parentNode, childNodes) {
|
|
435
402
|
for (const node of childNodes) {
|
|
436
403
|
var _parentNode$children;
|
|
437
|
-
|
|
438
404
|
const childPath = join(this.layers0Path, 'nodes', node.path);
|
|
439
405
|
const nodePath = node.path;
|
|
440
406
|
delete node.path;
|
|
@@ -446,7 +412,8 @@ export default class I3SConverter {
|
|
|
446
412
|
}
|
|
447
413
|
|
|
448
414
|
if (node.neighbors) {
|
|
449
|
-
node.neighbors.push({
|
|
415
|
+
node.neighbors.push({
|
|
416
|
+
...neighbor
|
|
450
417
|
});
|
|
451
418
|
}
|
|
452
419
|
}
|
|
@@ -454,7 +421,6 @@ export default class I3SConverter {
|
|
|
454
421
|
console.warn("Node ".concat(node.id, ": neighbors attribute is omited because of large number of neigbors"));
|
|
455
422
|
delete node.neighbors;
|
|
456
423
|
}
|
|
457
|
-
|
|
458
424
|
await this._writeNodeIndexDocument(node, nodePath, childPath);
|
|
459
425
|
node.neighbors = [];
|
|
460
426
|
}
|
|
@@ -462,20 +428,14 @@ export default class I3SConverter {
|
|
|
462
428
|
|
|
463
429
|
async _createNode(parentTile, sourceTile, parentId, level) {
|
|
464
430
|
var _this$layers, _this$layers$attribut;
|
|
465
|
-
|
|
466
|
-
if (this.validate) {
|
|
467
|
-
this._checkAddRefinementTypeForTile(sourceTile);
|
|
468
|
-
}
|
|
469
|
-
|
|
431
|
+
this._checkAddRefinementTypeForTile(sourceTile);
|
|
470
432
|
await this._updateTilesetOptions();
|
|
471
433
|
await this.sourceTileset._loadTile(sourceTile);
|
|
472
434
|
let boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
|
|
473
435
|
const propertyTable = getPropertyTable(sourceTile.content);
|
|
474
|
-
|
|
475
436
|
if (propertyTable && !((_this$layers = this.layers0) !== null && _this$layers !== void 0 && (_this$layers$attribut = _this$layers.attributeStorageInfo) !== null && _this$layers$attribut !== void 0 && _this$layers$attribut.length)) {
|
|
476
437
|
this._convertPropertyTableToNodeAttributes(propertyTable);
|
|
477
438
|
}
|
|
478
|
-
|
|
479
439
|
const resourcesData = await this._convertResources(sourceTile, parentId, propertyTable);
|
|
480
440
|
const nodes = [];
|
|
481
441
|
const nodesInPage = [];
|
|
@@ -490,30 +450,22 @@ export default class I3SConverter {
|
|
|
490
450
|
featureCount: null,
|
|
491
451
|
boundingVolumes: null
|
|
492
452
|
};
|
|
493
|
-
|
|
494
453
|
for (const resources of resourcesData || [emptyResources]) {
|
|
495
454
|
this.layersHasTexture = this.layersHasTexture || Boolean(resources.texture);
|
|
496
|
-
|
|
497
455
|
if (this.generateBoundingVolumes && resources.boundingVolumes) {
|
|
498
456
|
boundingVolumes = resources.boundingVolumes;
|
|
499
457
|
}
|
|
500
|
-
|
|
501
458
|
const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
|
|
502
459
|
const maxScreenThresholdSQ = lodSelection.find(val => val.metricType === 'maxScreenThresholdSQ') || {
|
|
503
460
|
maxError: 0
|
|
504
461
|
};
|
|
505
|
-
|
|
506
462
|
const nodeInPage = this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
|
|
507
|
-
|
|
508
463
|
const node = this._createNodeIndexDocument(parentTile, boundingVolumes, lodSelection, nodeInPage, resources);
|
|
509
|
-
|
|
510
464
|
if (nodeInPage.mesh) {
|
|
511
465
|
await this._writeResources(resources, node.path);
|
|
512
466
|
}
|
|
513
|
-
|
|
514
467
|
if (this.validate) {
|
|
515
468
|
this.boundingVolumeWarnings = validateNodeBoundingVolumes(node);
|
|
516
|
-
|
|
517
469
|
if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
|
|
518
470
|
console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings);
|
|
519
471
|
}
|
|
@@ -522,7 +474,6 @@ export default class I3SConverter {
|
|
|
522
474
|
nodes.push(node);
|
|
523
475
|
nodesInPage.push(nodeInPage);
|
|
524
476
|
}
|
|
525
|
-
|
|
526
477
|
sourceTile.unloadContent();
|
|
527
478
|
await this._addChildrenWithNeighborsAndWriteFile({
|
|
528
479
|
parentNode: nodes[0],
|
|
@@ -535,11 +486,9 @@ export default class I3SConverter {
|
|
|
535
486
|
|
|
536
487
|
async _convertResources(sourceTile, parentId, propertyTable) {
|
|
537
488
|
var _this$layers2;
|
|
538
|
-
|
|
539
489
|
if (!this.isContentSupported(sourceTile)) {
|
|
540
490
|
return null;
|
|
541
491
|
}
|
|
542
|
-
|
|
543
492
|
const draftObb = {
|
|
544
493
|
center: [],
|
|
545
494
|
halfSize: [],
|
|
@@ -566,7 +515,6 @@ export default class I3SConverter {
|
|
|
566
515
|
obb: boundingVolumes.obb,
|
|
567
516
|
children: []
|
|
568
517
|
};
|
|
569
|
-
|
|
570
518
|
if (geometry && this.isContentSupported(sourceTile)) {
|
|
571
519
|
nodeInPage.mesh = {
|
|
572
520
|
geometry: {
|
|
@@ -581,9 +529,7 @@ export default class I3SConverter {
|
|
|
581
529
|
}
|
|
582
530
|
};
|
|
583
531
|
}
|
|
584
|
-
|
|
585
532
|
let nodeId = resources.nodeId;
|
|
586
|
-
|
|
587
533
|
if (nodeId) {
|
|
588
534
|
this.nodePages.updateAll(nodeId, nodeInPage);
|
|
589
535
|
const node = this.nodePages.getNodeById(nodeId);
|
|
@@ -591,27 +537,21 @@ export default class I3SConverter {
|
|
|
591
537
|
} else {
|
|
592
538
|
nodeId = this.nodePages.push(nodeInPage, parentId);
|
|
593
539
|
}
|
|
594
|
-
|
|
595
540
|
if (meshMaterial) {
|
|
596
541
|
this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
|
|
597
542
|
}
|
|
598
|
-
|
|
599
543
|
if (texture) {
|
|
600
544
|
const texelCountHint = texture.image.height * texture.image.width;
|
|
601
545
|
this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);
|
|
602
546
|
}
|
|
603
|
-
|
|
604
547
|
if (vertexCount) {
|
|
605
548
|
this.vertexCounter += vertexCount;
|
|
606
549
|
this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);
|
|
607
550
|
}
|
|
608
|
-
|
|
609
551
|
this.nodePages.updateNodeAttributeByNodeId(nodeId);
|
|
610
|
-
|
|
611
552
|
if (featureCount) {
|
|
612
553
|
this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);
|
|
613
554
|
}
|
|
614
|
-
|
|
615
555
|
return this.nodePages.getNodeById(nodeId);
|
|
616
556
|
}
|
|
617
557
|
|
|
@@ -638,17 +578,14 @@ export default class I3SConverter {
|
|
|
638
578
|
neighbors: []
|
|
639
579
|
};
|
|
640
580
|
const node = transform(nodeData, nodeTemplate());
|
|
641
|
-
|
|
642
581
|
if (nodeInPage.mesh) {
|
|
643
582
|
var _this$layers3, _this$layers3$attribu;
|
|
644
|
-
|
|
645
583
|
node.geometryData = [{
|
|
646
584
|
href: './geometries/0'
|
|
647
585
|
}];
|
|
648
586
|
node.sharedResource = {
|
|
649
587
|
href: './shared'
|
|
650
588
|
};
|
|
651
|
-
|
|
652
589
|
if (texture) {
|
|
653
590
|
node.textureData = [{
|
|
654
591
|
href: './textures/0'
|
|
@@ -656,10 +593,8 @@ export default class I3SConverter {
|
|
|
656
593
|
href: './textures/1'
|
|
657
594
|
}];
|
|
658
595
|
}
|
|
659
|
-
|
|
660
596
|
if (attributes && attributes.length && (_this$layers3 = this.layers0) !== null && _this$layers3 !== void 0 && (_this$layers3$attribu = _this$layers3.attributeStorageInfo) !== null && _this$layers3$attribu !== void 0 && _this$layers3$attribu.length) {
|
|
661
597
|
node.attributeData = [];
|
|
662
|
-
|
|
663
598
|
for (let index = 0; index < attributes.length; index++) {
|
|
664
599
|
const folderName = this.layers0.attributeStorageInfo[index].key;
|
|
665
600
|
node.attributeData.push({
|
|
@@ -668,7 +603,6 @@ export default class I3SConverter {
|
|
|
668
603
|
}
|
|
669
604
|
}
|
|
670
605
|
}
|
|
671
|
-
|
|
672
606
|
return node;
|
|
673
607
|
}
|
|
674
608
|
|
|
@@ -701,7 +635,6 @@ export default class I3SConverter {
|
|
|
701
635
|
writePromise: writeFile(geometryPath, geometryBuffer, 'index.bin')
|
|
702
636
|
});
|
|
703
637
|
}
|
|
704
|
-
|
|
705
638
|
if (this.options.draco) {
|
|
706
639
|
if (this.options.slpk) {
|
|
707
640
|
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
@@ -722,11 +655,9 @@ export default class I3SConverter {
|
|
|
722
655
|
if (!sharedResources) {
|
|
723
656
|
return;
|
|
724
657
|
}
|
|
725
|
-
|
|
726
658
|
sharedResources.nodePath = nodePath;
|
|
727
659
|
const sharedData = transform(sharedResources, sharedResourcesTemplate());
|
|
728
660
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
729
|
-
|
|
730
661
|
if (this.options.slpk) {
|
|
731
662
|
const slpkSharedPath = join(childPath, 'shared');
|
|
732
663
|
await this.writeQueue.enqueue({
|
|
@@ -744,10 +675,8 @@ export default class I3SConverter {
|
|
|
744
675
|
async _writeTexture(texture, childPath, slpkChildPath) {
|
|
745
676
|
if (texture) {
|
|
746
677
|
const format = this._getFormatByMimeType(texture === null || texture === void 0 ? void 0 : texture.mimeType);
|
|
747
|
-
|
|
748
678
|
const formats = [];
|
|
749
679
|
const textureData = texture.bufferView.data;
|
|
750
|
-
|
|
751
680
|
switch (format) {
|
|
752
681
|
case 'jpg':
|
|
753
682
|
case 'png':
|
|
@@ -757,7 +686,6 @@ export default class I3SConverter {
|
|
|
757
686
|
format
|
|
758
687
|
});
|
|
759
688
|
await this.writeTextureFile(textureData, '0', format, childPath, slpkChildPath);
|
|
760
|
-
|
|
761
689
|
if (this.generateTextures) {
|
|
762
690
|
formats.push({
|
|
763
691
|
name: '1',
|
|
@@ -765,19 +693,19 @@ export default class I3SConverter {
|
|
|
765
693
|
});
|
|
766
694
|
const copyArrayBuffer = texture.image.data.subarray();
|
|
767
695
|
const arrayToEncode = new Uint8Array(copyArrayBuffer);
|
|
768
|
-
const ktx2TextureData = encode({
|
|
696
|
+
const ktx2TextureData = encode({
|
|
697
|
+
...texture.image,
|
|
769
698
|
data: arrayToEncode
|
|
770
|
-
}, KTX2BasisWriterWorker, {
|
|
699
|
+
}, KTX2BasisWriterWorker, {
|
|
700
|
+
...KTX2BasisWriterWorker.options,
|
|
771
701
|
source: this.workerSource.ktx2,
|
|
772
702
|
reuseWorkers: true,
|
|
773
703
|
_nodeWorkers: true
|
|
774
704
|
});
|
|
775
705
|
await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
|
|
776
706
|
}
|
|
777
|
-
|
|
778
707
|
break;
|
|
779
708
|
}
|
|
780
|
-
|
|
781
709
|
case 'ktx2':
|
|
782
710
|
{
|
|
783
711
|
formats.push({
|
|
@@ -785,7 +713,6 @@ export default class I3SConverter {
|
|
|
785
713
|
format
|
|
786
714
|
});
|
|
787
715
|
await this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);
|
|
788
|
-
|
|
789
716
|
if (this.generateTextures) {
|
|
790
717
|
formats.push({
|
|
791
718
|
name: '0',
|
|
@@ -796,7 +723,6 @@ export default class I3SConverter {
|
|
|
796
723
|
}
|
|
797
724
|
}
|
|
798
725
|
}
|
|
799
|
-
|
|
800
726
|
if (!this.layers0.textureSetDefinitions.length) {
|
|
801
727
|
this.layers0.textureSetDefinitions.push({
|
|
802
728
|
formats
|
|
@@ -821,14 +747,15 @@ export default class I3SConverter {
|
|
|
821
747
|
}
|
|
822
748
|
}
|
|
823
749
|
|
|
824
|
-
async _writeAttributes(
|
|
750
|
+
async _writeAttributes() {
|
|
825
751
|
var _this$layers4, _this$layers4$attribu;
|
|
826
|
-
|
|
752
|
+
let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
753
|
+
let childPath = arguments.length > 1 ? arguments[1] : undefined;
|
|
754
|
+
let slpkChildPath = arguments.length > 2 ? arguments[2] : undefined;
|
|
827
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) {
|
|
828
756
|
for (let index = 0; index < attributes.length; index++) {
|
|
829
757
|
const folderName = this.layers0.attributeStorageInfo[index].key;
|
|
830
758
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
831
|
-
|
|
832
759
|
if (this.options.slpk) {
|
|
833
760
|
const slpkAttributesPath = join(childPath, 'attributes', folderName);
|
|
834
761
|
await this.writeQueue.enqueue({
|
|
@@ -849,13 +776,10 @@ export default class I3SConverter {
|
|
|
849
776
|
switch (mimeType) {
|
|
850
777
|
case 'image/jpeg':
|
|
851
778
|
return 'jpg';
|
|
852
|
-
|
|
853
779
|
case 'image/png':
|
|
854
780
|
return 'png';
|
|
855
|
-
|
|
856
781
|
case 'image/ktx2':
|
|
857
782
|
return 'ktx2';
|
|
858
|
-
|
|
859
783
|
default:
|
|
860
784
|
return 'jpg';
|
|
861
785
|
}
|
|
@@ -863,11 +787,9 @@ export default class I3SConverter {
|
|
|
863
787
|
|
|
864
788
|
_findOrCreateMaterial(material) {
|
|
865
789
|
const hash = md5(JSON.stringify(material));
|
|
866
|
-
|
|
867
790
|
if (this.materialMap.has(hash)) {
|
|
868
791
|
return this.materialMap.get(hash);
|
|
869
792
|
}
|
|
870
|
-
|
|
871
793
|
const newMaterialId = this.materialDefinitions.push(material) - 1;
|
|
872
794
|
this.materialMap.set(hash, newMaterialId);
|
|
873
795
|
return newMaterialId;
|
|
@@ -879,7 +801,6 @@ export default class I3SConverter {
|
|
|
879
801
|
OBJECTID: [0],
|
|
880
802
|
...propertyTable
|
|
881
803
|
};
|
|
882
|
-
|
|
883
804
|
for (const key in propertyTableWithObjectId) {
|
|
884
805
|
const firstAttribute = propertyTableWithObjectId[key][0];
|
|
885
806
|
const attributeType = getAttributeType(key, firstAttribute);
|
|
@@ -917,7 +838,6 @@ export default class I3SConverter {
|
|
|
917
838
|
if (!this.Loader.preload) {
|
|
918
839
|
return {};
|
|
919
840
|
}
|
|
920
|
-
|
|
921
841
|
const options = {
|
|
922
842
|
'cesium-ion': {
|
|
923
843
|
accessToken: this.options.token || ION_DEFAULT_TOKEN
|
|
@@ -925,26 +845,26 @@ export default class I3SConverter {
|
|
|
925
845
|
};
|
|
926
846
|
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
927
847
|
this.refreshTokenTime = process.hrtime();
|
|
928
|
-
return {
|
|
848
|
+
return {
|
|
849
|
+
...options,
|
|
929
850
|
...preloadOptions
|
|
930
851
|
};
|
|
931
852
|
}
|
|
932
853
|
|
|
933
854
|
async _updateTilesetOptions() {
|
|
934
855
|
const diff = process.hrtime(this.refreshTokenTime);
|
|
935
|
-
|
|
936
856
|
if (diff[0] < REFRESH_TOKEN_TIMEOUT) {
|
|
937
857
|
return;
|
|
938
858
|
}
|
|
939
|
-
|
|
940
859
|
this.refreshTokenTime = process.hrtime();
|
|
941
860
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
942
|
-
this.sourceTileset.options = {
|
|
861
|
+
this.sourceTileset.options = {
|
|
862
|
+
...this.sourceTileset.options,
|
|
943
863
|
...preloadOptions
|
|
944
864
|
};
|
|
945
|
-
|
|
946
865
|
if (preloadOptions.headers) {
|
|
947
|
-
this.sourceTileset.loadOptions.fetch = {
|
|
866
|
+
this.sourceTileset.loadOptions.fetch = {
|
|
867
|
+
...this.sourceTileset.loadOptions.fetch,
|
|
948
868
|
headers: preloadOptions.headers
|
|
949
869
|
};
|
|
950
870
|
console.log('Authorization Bearer token has been updated');
|
|
@@ -953,7 +873,6 @@ export default class I3SConverter {
|
|
|
953
873
|
|
|
954
874
|
_checkAddRefinementTypeForTile(tile) {
|
|
955
875
|
const ADD_TILE_REFINEMENT = 1;
|
|
956
|
-
|
|
957
876
|
if (tile.refine === ADD_TILE_REFINEMENT) {
|
|
958
877
|
this.refinementCounter.tilesWithAddRefineCount += 1;
|
|
959
878
|
console.warn('This tile uses "ADD" type of refinement');
|
|
@@ -961,39 +880,35 @@ export default class I3SConverter {
|
|
|
961
880
|
|
|
962
881
|
this.refinementCounter.tilesCount += 1;
|
|
963
882
|
}
|
|
964
|
-
|
|
965
883
|
isContentSupported(sourceRootTile) {
|
|
966
884
|
var _sourceRootTile$conte;
|
|
967
|
-
|
|
968
885
|
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);
|
|
969
886
|
}
|
|
970
|
-
|
|
971
887
|
async loadWorkers() {
|
|
972
888
|
console.log("Loading workers source...");
|
|
973
|
-
|
|
974
889
|
if (this.options.draco) {
|
|
975
|
-
const url = getWorkerURL(DracoWriterWorker, {
|
|
890
|
+
const url = getWorkerURL(DracoWriterWorker, {
|
|
891
|
+
...getLoaderOptions()
|
|
976
892
|
});
|
|
977
893
|
const sourceResponse = await fetchFile(url);
|
|
978
894
|
const source = await sourceResponse.text();
|
|
979
895
|
this.workerSource.draco = source;
|
|
980
896
|
}
|
|
981
|
-
|
|
982
897
|
if (this.generateTextures) {
|
|
983
|
-
const url = getWorkerURL(KTX2BasisWriterWorker, {
|
|
898
|
+
const url = getWorkerURL(KTX2BasisWriterWorker, {
|
|
899
|
+
...getLoaderOptions()
|
|
984
900
|
});
|
|
985
901
|
const sourceResponse = await fetchFile(url);
|
|
986
902
|
const source = await sourceResponse.text();
|
|
987
903
|
this.workerSource.ktx2 = source;
|
|
988
904
|
}
|
|
989
|
-
|
|
990
|
-
|
|
905
|
+
const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, {
|
|
906
|
+
...getLoaderOptions()
|
|
991
907
|
});
|
|
992
908
|
const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
|
|
993
909
|
const source = await sourceResponse.text();
|
|
994
910
|
this.workerSource.I3SAttributes = source;
|
|
995
911
|
console.log("Loading workers source completed!");
|
|
996
912
|
}
|
|
997
|
-
|
|
998
913
|
}
|
|
999
914
|
//# sourceMappingURL=i3s-converter.js.map
|