@loaders.gl/tile-converter 3.3.0-alpha.4 → 3.3.0-alpha.6
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 +1 -1
- package/dist/3d-tiles-attributes-worker.js +2 -3
- package/dist/3d-tiles-attributes-worker.js.map +3 -3
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts +5 -5
- package/dist/3d-tiles-converter/helpers/b3dm-converter.d.ts.map +1 -1
- package/dist/3d-tiles-converter/helpers/b3dm-converter.js +21 -17
- package/dist/converter.min.js +23 -20
- package/dist/dist.min.js +38223 -46900
- package/dist/es5/3d-tiles-attributes-worker.js +4 -7
- 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 +53 -85
- 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 +2 -53
- 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 +2 -20
- 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 +43 -360
- 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 +2 -9
- 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 +4 -2
- 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 +29 -50
- 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 +3 -38
- 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 +4 -6
- 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 +49 -137
- 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/geometry-converter.d.ts.map +1 -1
- package/dist/i3s-converter/helpers/geometry-converter.js +2 -0
- package/dist/i3s-converter/i3s-converter.js +5 -1
- package/dist/pgm-loader.d.ts.map +1 -1
- package/dist/pgm-loader.js +2 -1
- package/dist/workers/3d-tiles-attributes-worker.js +1 -1
- package/package.json +15 -15
- package/src/3d-tiles-attributes-worker.ts +1 -1
- package/src/3d-tiles-converter/helpers/b3dm-converter.ts +25 -18
- package/src/i3s-converter/helpers/geometry-converter.ts +2 -0
- package/src/pgm-loader.ts +2 -2
- package/src/workers/3d-tiles-attributes-worker.ts +1 -1
|
@@ -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,9 +121,7 @@ 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 {
|
|
149
126
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
150
127
|
const tilesetOptions = {
|
|
@@ -163,13 +140,11 @@ export default class I3SConverter {
|
|
|
163
140
|
}
|
|
164
141
|
}
|
|
165
142
|
};
|
|
166
|
-
|
|
167
143
|
if (preloadOptions.headers) {
|
|
168
144
|
tilesetOptions.loadOptions.fetch = {
|
|
169
145
|
headers: preloadOptions.headers
|
|
170
146
|
};
|
|
171
147
|
}
|
|
172
|
-
|
|
173
148
|
Object.assign(tilesetOptions, preloadOptions);
|
|
174
149
|
const sourceTilesetJson = await load(inputUrl, this.Loader, tilesetOptions.loadOptions);
|
|
175
150
|
this.sourceTileset = new Tileset3D(sourceTilesetJson, tilesetOptions);
|
|
@@ -190,15 +165,12 @@ export default class I3SConverter {
|
|
|
190
165
|
|
|
191
166
|
async _createAndSaveTileset(outputPath, tilesetName) {
|
|
192
167
|
const tilesetPath = join("".concat(outputPath), "".concat(tilesetName));
|
|
193
|
-
|
|
194
168
|
try {
|
|
195
169
|
await removeDir(tilesetPath);
|
|
196
|
-
} catch (e) {
|
|
197
|
-
|
|
170
|
+
} catch (e) {
|
|
171
|
+
}
|
|
198
172
|
this.layers0Path = join(tilesetPath, 'SceneServer', 'layers', '0');
|
|
199
|
-
|
|
200
173
|
this._formLayers0(tilesetName);
|
|
201
|
-
|
|
202
174
|
this.materialDefinitions = [];
|
|
203
175
|
this.materialMap = new Map();
|
|
204
176
|
const sourceRootTile = this.sourceTileset.root;
|
|
@@ -210,16 +182,12 @@ export default class I3SConverter {
|
|
|
210
182
|
children: []
|
|
211
183
|
});
|
|
212
184
|
const isCreateSlpk = this.options.slpk;
|
|
213
|
-
|
|
214
185
|
const root0 = this._formRootNodeIndexDocument(boundingVolumes);
|
|
215
|
-
|
|
216
186
|
await this._convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes);
|
|
217
187
|
this.layers0.materialDefinitions = this.materialDefinitions;
|
|
218
|
-
|
|
219
188
|
if (this.layersHasTexture === false) {
|
|
220
189
|
this.layers0.store.defaultGeometrySchema.ordering = this.layers0.store.defaultGeometrySchema.ordering.filter(attribute => attribute !== 'uv0');
|
|
221
190
|
}
|
|
222
|
-
|
|
223
191
|
await this._writeLayers0();
|
|
224
192
|
createSceneServerPath(tilesetName, this.layers0, tilesetPath);
|
|
225
193
|
await this._writeNodeIndexDocument(root0, 'root', join(this.layers0Path, 'nodes', 'root'));
|
|
@@ -230,7 +198,6 @@ export default class I3SConverter {
|
|
|
230
198
|
|
|
231
199
|
_formLayers0(tilesetName) {
|
|
232
200
|
var _this$sourceTileset, _this$sourceTileset2, _this$sourceTileset2$;
|
|
233
|
-
|
|
234
201
|
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));
|
|
235
202
|
const extent = [fullExtent.xmin, fullExtent.ymin, fullExtent.xmax, fullExtent.ymax];
|
|
236
203
|
const layers0data = {
|
|
@@ -271,7 +238,6 @@ export default class I3SConverter {
|
|
|
271
238
|
|
|
272
239
|
async _convertNodesTree(root0, sourceRootTile, parentId, boundingVolumes) {
|
|
273
240
|
await this.sourceTileset._loadTile(sourceRootTile);
|
|
274
|
-
|
|
275
241
|
if (this.isContentSupported(sourceRootTile)) {
|
|
276
242
|
root0.children = root0.children || [];
|
|
277
243
|
root0.children.push({
|
|
@@ -281,7 +247,6 @@ export default class I3SConverter {
|
|
|
281
247
|
});
|
|
282
248
|
const [child] = await this._createNode(root0, sourceRootTile, parentId, 0);
|
|
283
249
|
const childPath = join(this.layers0Path, 'nodes', child.path);
|
|
284
|
-
|
|
285
250
|
if (this.options.slpk) {
|
|
286
251
|
await this.writeQueue.enqueue({
|
|
287
252
|
archiveKey: 'nodes/1/3dNodeIndexDocument.json.gz',
|
|
@@ -300,7 +265,6 @@ export default class I3SConverter {
|
|
|
300
265
|
level: 1
|
|
301
266
|
});
|
|
302
267
|
}
|
|
303
|
-
|
|
304
268
|
await sourceRootTile.unloadContent();
|
|
305
269
|
}
|
|
306
270
|
|
|
@@ -338,25 +302,28 @@ export default class I3SConverter {
|
|
|
338
302
|
|
|
339
303
|
try {
|
|
340
304
|
await removeDir(tilesetPath);
|
|
341
|
-
} catch (e) {
|
|
305
|
+
} catch (e) {
|
|
306
|
+
}
|
|
342
307
|
}
|
|
343
308
|
}
|
|
344
309
|
|
|
345
310
|
async _addChildrenWithNeighborsAndWriteFile(data) {
|
|
346
311
|
const childNodes = [];
|
|
347
|
-
await this._addChildren({
|
|
312
|
+
await this._addChildren({
|
|
313
|
+
...data,
|
|
348
314
|
childNodes
|
|
349
315
|
});
|
|
350
316
|
await this._addNeighborsAndWriteFile(data.parentNode, childNodes);
|
|
351
317
|
}
|
|
352
318
|
|
|
353
|
-
async convertNestedTileset({
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
319
|
+
async convertNestedTileset(_ref) {
|
|
320
|
+
let {
|
|
321
|
+
sourceTile,
|
|
322
|
+
parentNode,
|
|
323
|
+
childNodes,
|
|
324
|
+
parentId,
|
|
325
|
+
level
|
|
326
|
+
} = _ref;
|
|
360
327
|
await this.sourceTileset._loadTile(sourceTile);
|
|
361
328
|
await this._addChildren({
|
|
362
329
|
parentNode,
|
|
@@ -368,16 +335,16 @@ export default class I3SConverter {
|
|
|
368
335
|
await sourceTile.unloadContent();
|
|
369
336
|
}
|
|
370
337
|
|
|
371
|
-
async convertNode({
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
338
|
+
async convertNode(_ref2) {
|
|
339
|
+
let {
|
|
340
|
+
sourceTile,
|
|
341
|
+
parentNode,
|
|
342
|
+
childNodes,
|
|
343
|
+
parentId,
|
|
344
|
+
level
|
|
345
|
+
} = _ref2;
|
|
378
346
|
const children = await this._createNode(parentNode, sourceTile, parentId, level);
|
|
379
347
|
parentNode.children = parentNode.children || [];
|
|
380
|
-
|
|
381
348
|
for (const child of children) {
|
|
382
349
|
parentNode.children.push({
|
|
383
350
|
id: child.id,
|
|
@@ -397,13 +364,10 @@ export default class I3SConverter {
|
|
|
397
364
|
parentId,
|
|
398
365
|
level
|
|
399
366
|
} = data;
|
|
400
|
-
|
|
401
367
|
if (this.options.maxDepth && level > this.options.maxDepth) {
|
|
402
368
|
return;
|
|
403
369
|
}
|
|
404
|
-
|
|
405
370
|
const promises = [];
|
|
406
|
-
|
|
407
371
|
for (const sourceTile of sourceTiles) {
|
|
408
372
|
if (sourceTile.type === 'json') {
|
|
409
373
|
promises.push(this.convertNestedTileset({
|
|
@@ -422,9 +386,7 @@ export default class I3SConverter {
|
|
|
422
386
|
level
|
|
423
387
|
}));
|
|
424
388
|
}
|
|
425
|
-
|
|
426
389
|
await Promise.all(promises);
|
|
427
|
-
|
|
428
390
|
if (sourceTile.id) {
|
|
429
391
|
console.log(sourceTile.id);
|
|
430
392
|
}
|
|
@@ -434,7 +396,6 @@ export default class I3SConverter {
|
|
|
434
396
|
async _addNeighborsAndWriteFile(parentNode, childNodes) {
|
|
435
397
|
for (const node of childNodes) {
|
|
436
398
|
var _parentNode$children;
|
|
437
|
-
|
|
438
399
|
const childPath = join(this.layers0Path, 'nodes', node.path);
|
|
439
400
|
const nodePath = node.path;
|
|
440
401
|
delete node.path;
|
|
@@ -446,7 +407,8 @@ export default class I3SConverter {
|
|
|
446
407
|
}
|
|
447
408
|
|
|
448
409
|
if (node.neighbors) {
|
|
449
|
-
node.neighbors.push({
|
|
410
|
+
node.neighbors.push({
|
|
411
|
+
...neighbor
|
|
450
412
|
});
|
|
451
413
|
}
|
|
452
414
|
}
|
|
@@ -454,7 +416,6 @@ export default class I3SConverter {
|
|
|
454
416
|
console.warn("Node ".concat(node.id, ": neighbors attribute is omited because of large number of neigbors"));
|
|
455
417
|
delete node.neighbors;
|
|
456
418
|
}
|
|
457
|
-
|
|
458
419
|
await this._writeNodeIndexDocument(node, nodePath, childPath);
|
|
459
420
|
node.neighbors = [];
|
|
460
421
|
}
|
|
@@ -462,20 +423,16 @@ export default class I3SConverter {
|
|
|
462
423
|
|
|
463
424
|
async _createNode(parentTile, sourceTile, parentId, level) {
|
|
464
425
|
var _this$layers, _this$layers$attribut;
|
|
465
|
-
|
|
466
426
|
if (this.validate) {
|
|
467
427
|
this._checkAddRefinementTypeForTile(sourceTile);
|
|
468
428
|
}
|
|
469
|
-
|
|
470
429
|
await this._updateTilesetOptions();
|
|
471
430
|
await this.sourceTileset._loadTile(sourceTile);
|
|
472
431
|
let boundingVolumes = createBoundingVolumes(sourceTile, this.geoidHeightModel);
|
|
473
432
|
const propertyTable = getPropertyTable(sourceTile.content);
|
|
474
|
-
|
|
475
433
|
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
434
|
this._convertPropertyTableToNodeAttributes(propertyTable);
|
|
477
435
|
}
|
|
478
|
-
|
|
479
436
|
const resourcesData = await this._convertResources(sourceTile, parentId, propertyTable);
|
|
480
437
|
const nodes = [];
|
|
481
438
|
const nodesInPage = [];
|
|
@@ -490,30 +447,22 @@ export default class I3SConverter {
|
|
|
490
447
|
featureCount: null,
|
|
491
448
|
boundingVolumes: null
|
|
492
449
|
};
|
|
493
|
-
|
|
494
450
|
for (const resources of resourcesData || [emptyResources]) {
|
|
495
451
|
this.layersHasTexture = this.layersHasTexture || Boolean(resources.texture);
|
|
496
|
-
|
|
497
452
|
if (this.generateBoundingVolumes && resources.boundingVolumes) {
|
|
498
453
|
boundingVolumes = resources.boundingVolumes;
|
|
499
454
|
}
|
|
500
|
-
|
|
501
455
|
const lodSelection = convertGeometricErrorToScreenThreshold(sourceTile, boundingVolumes);
|
|
502
456
|
const maxScreenThresholdSQ = lodSelection.find(val => val.metricType === 'maxScreenThresholdSQ') || {
|
|
503
457
|
maxError: 0
|
|
504
458
|
};
|
|
505
|
-
|
|
506
459
|
const nodeInPage = this._updateNodeInNodePages(maxScreenThresholdSQ, boundingVolumes, sourceTile, parentId, resources);
|
|
507
|
-
|
|
508
460
|
const node = this._createNodeIndexDocument(parentTile, boundingVolumes, lodSelection, nodeInPage, resources);
|
|
509
|
-
|
|
510
461
|
if (nodeInPage.mesh) {
|
|
511
462
|
await this._writeResources(resources, node.path);
|
|
512
463
|
}
|
|
513
|
-
|
|
514
464
|
if (this.validate) {
|
|
515
465
|
this.boundingVolumeWarnings = validateNodeBoundingVolumes(node);
|
|
516
|
-
|
|
517
466
|
if (this.boundingVolumeWarnings && this.boundingVolumeWarnings.length) {
|
|
518
467
|
console.warn('Bounding Volume Warnings: ', ...this.boundingVolumeWarnings);
|
|
519
468
|
}
|
|
@@ -522,7 +471,6 @@ export default class I3SConverter {
|
|
|
522
471
|
nodes.push(node);
|
|
523
472
|
nodesInPage.push(nodeInPage);
|
|
524
473
|
}
|
|
525
|
-
|
|
526
474
|
sourceTile.unloadContent();
|
|
527
475
|
await this._addChildrenWithNeighborsAndWriteFile({
|
|
528
476
|
parentNode: nodes[0],
|
|
@@ -535,11 +483,9 @@ export default class I3SConverter {
|
|
|
535
483
|
|
|
536
484
|
async _convertResources(sourceTile, parentId, propertyTable) {
|
|
537
485
|
var _this$layers2;
|
|
538
|
-
|
|
539
486
|
if (!this.isContentSupported(sourceTile)) {
|
|
540
487
|
return null;
|
|
541
488
|
}
|
|
542
|
-
|
|
543
489
|
const draftObb = {
|
|
544
490
|
center: [],
|
|
545
491
|
halfSize: [],
|
|
@@ -566,7 +512,6 @@ export default class I3SConverter {
|
|
|
566
512
|
obb: boundingVolumes.obb,
|
|
567
513
|
children: []
|
|
568
514
|
};
|
|
569
|
-
|
|
570
515
|
if (geometry && this.isContentSupported(sourceTile)) {
|
|
571
516
|
nodeInPage.mesh = {
|
|
572
517
|
geometry: {
|
|
@@ -581,9 +526,7 @@ export default class I3SConverter {
|
|
|
581
526
|
}
|
|
582
527
|
};
|
|
583
528
|
}
|
|
584
|
-
|
|
585
529
|
let nodeId = resources.nodeId;
|
|
586
|
-
|
|
587
530
|
if (nodeId) {
|
|
588
531
|
this.nodePages.updateAll(nodeId, nodeInPage);
|
|
589
532
|
const node = this.nodePages.getNodeById(nodeId);
|
|
@@ -591,27 +534,21 @@ export default class I3SConverter {
|
|
|
591
534
|
} else {
|
|
592
535
|
nodeId = this.nodePages.push(nodeInPage, parentId);
|
|
593
536
|
}
|
|
594
|
-
|
|
595
537
|
if (meshMaterial) {
|
|
596
538
|
this.nodePages.updateMaterialByNodeId(nodeId, this._findOrCreateMaterial(meshMaterial));
|
|
597
539
|
}
|
|
598
|
-
|
|
599
540
|
if (texture) {
|
|
600
541
|
const texelCountHint = texture.image.height * texture.image.width;
|
|
601
542
|
this.nodePages.updateTexelCountHintByNodeId(nodeId, texelCountHint);
|
|
602
543
|
}
|
|
603
|
-
|
|
604
544
|
if (vertexCount) {
|
|
605
545
|
this.vertexCounter += vertexCount;
|
|
606
546
|
this.nodePages.updateVertexCountByNodeId(nodeId, vertexCount);
|
|
607
547
|
}
|
|
608
|
-
|
|
609
548
|
this.nodePages.updateNodeAttributeByNodeId(nodeId);
|
|
610
|
-
|
|
611
549
|
if (featureCount) {
|
|
612
550
|
this.nodePages.updateFeatureCountByNodeId(nodeId, featureCount);
|
|
613
551
|
}
|
|
614
|
-
|
|
615
552
|
return this.nodePages.getNodeById(nodeId);
|
|
616
553
|
}
|
|
617
554
|
|
|
@@ -638,17 +575,14 @@ export default class I3SConverter {
|
|
|
638
575
|
neighbors: []
|
|
639
576
|
};
|
|
640
577
|
const node = transform(nodeData, nodeTemplate());
|
|
641
|
-
|
|
642
578
|
if (nodeInPage.mesh) {
|
|
643
579
|
var _this$layers3, _this$layers3$attribu;
|
|
644
|
-
|
|
645
580
|
node.geometryData = [{
|
|
646
581
|
href: './geometries/0'
|
|
647
582
|
}];
|
|
648
583
|
node.sharedResource = {
|
|
649
584
|
href: './shared'
|
|
650
585
|
};
|
|
651
|
-
|
|
652
586
|
if (texture) {
|
|
653
587
|
node.textureData = [{
|
|
654
588
|
href: './textures/0'
|
|
@@ -656,10 +590,8 @@ export default class I3SConverter {
|
|
|
656
590
|
href: './textures/1'
|
|
657
591
|
}];
|
|
658
592
|
}
|
|
659
|
-
|
|
660
593
|
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
594
|
node.attributeData = [];
|
|
662
|
-
|
|
663
595
|
for (let index = 0; index < attributes.length; index++) {
|
|
664
596
|
const folderName = this.layers0.attributeStorageInfo[index].key;
|
|
665
597
|
node.attributeData.push({
|
|
@@ -668,7 +600,6 @@ export default class I3SConverter {
|
|
|
668
600
|
}
|
|
669
601
|
}
|
|
670
602
|
}
|
|
671
|
-
|
|
672
603
|
return node;
|
|
673
604
|
}
|
|
674
605
|
|
|
@@ -701,7 +632,6 @@ export default class I3SConverter {
|
|
|
701
632
|
writePromise: writeFile(geometryPath, geometryBuffer, 'index.bin')
|
|
702
633
|
});
|
|
703
634
|
}
|
|
704
|
-
|
|
705
635
|
if (this.options.draco) {
|
|
706
636
|
if (this.options.slpk) {
|
|
707
637
|
const slpkCompressedGeometryPath = join(childPath, 'geometries');
|
|
@@ -722,11 +652,9 @@ export default class I3SConverter {
|
|
|
722
652
|
if (!sharedResources) {
|
|
723
653
|
return;
|
|
724
654
|
}
|
|
725
|
-
|
|
726
655
|
sharedResources.nodePath = nodePath;
|
|
727
656
|
const sharedData = transform(sharedResources, sharedResourcesTemplate());
|
|
728
657
|
const sharedDataStr = JSON.stringify(sharedData);
|
|
729
|
-
|
|
730
658
|
if (this.options.slpk) {
|
|
731
659
|
const slpkSharedPath = join(childPath, 'shared');
|
|
732
660
|
await this.writeQueue.enqueue({
|
|
@@ -744,10 +672,8 @@ export default class I3SConverter {
|
|
|
744
672
|
async _writeTexture(texture, childPath, slpkChildPath) {
|
|
745
673
|
if (texture) {
|
|
746
674
|
const format = this._getFormatByMimeType(texture === null || texture === void 0 ? void 0 : texture.mimeType);
|
|
747
|
-
|
|
748
675
|
const formats = [];
|
|
749
676
|
const textureData = texture.bufferView.data;
|
|
750
|
-
|
|
751
677
|
switch (format) {
|
|
752
678
|
case 'jpg':
|
|
753
679
|
case 'png':
|
|
@@ -757,7 +683,6 @@ export default class I3SConverter {
|
|
|
757
683
|
format
|
|
758
684
|
});
|
|
759
685
|
await this.writeTextureFile(textureData, '0', format, childPath, slpkChildPath);
|
|
760
|
-
|
|
761
686
|
if (this.generateTextures) {
|
|
762
687
|
formats.push({
|
|
763
688
|
name: '1',
|
|
@@ -765,19 +690,19 @@ export default class I3SConverter {
|
|
|
765
690
|
});
|
|
766
691
|
const copyArrayBuffer = texture.image.data.subarray();
|
|
767
692
|
const arrayToEncode = new Uint8Array(copyArrayBuffer);
|
|
768
|
-
const ktx2TextureData = encode({
|
|
693
|
+
const ktx2TextureData = encode({
|
|
694
|
+
...texture.image,
|
|
769
695
|
data: arrayToEncode
|
|
770
|
-
}, KTX2BasisWriterWorker, {
|
|
696
|
+
}, KTX2BasisWriterWorker, {
|
|
697
|
+
...KTX2BasisWriterWorker.options,
|
|
771
698
|
source: this.workerSource.ktx2,
|
|
772
699
|
reuseWorkers: true,
|
|
773
700
|
_nodeWorkers: true
|
|
774
701
|
});
|
|
775
702
|
await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
|
|
776
703
|
}
|
|
777
|
-
|
|
778
704
|
break;
|
|
779
705
|
}
|
|
780
|
-
|
|
781
706
|
case 'ktx2':
|
|
782
707
|
{
|
|
783
708
|
formats.push({
|
|
@@ -785,7 +710,6 @@ export default class I3SConverter {
|
|
|
785
710
|
format
|
|
786
711
|
});
|
|
787
712
|
await this.writeTextureFile(textureData, '1', format, childPath, slpkChildPath);
|
|
788
|
-
|
|
789
713
|
if (this.generateTextures) {
|
|
790
714
|
formats.push({
|
|
791
715
|
name: '0',
|
|
@@ -796,7 +720,6 @@ export default class I3SConverter {
|
|
|
796
720
|
}
|
|
797
721
|
}
|
|
798
722
|
}
|
|
799
|
-
|
|
800
723
|
if (!this.layers0.textureSetDefinitions.length) {
|
|
801
724
|
this.layers0.textureSetDefinitions.push({
|
|
802
725
|
formats
|
|
@@ -821,14 +744,15 @@ export default class I3SConverter {
|
|
|
821
744
|
}
|
|
822
745
|
}
|
|
823
746
|
|
|
824
|
-
async _writeAttributes(
|
|
747
|
+
async _writeAttributes() {
|
|
825
748
|
var _this$layers4, _this$layers4$attribu;
|
|
826
|
-
|
|
749
|
+
let attributes = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
750
|
+
let childPath = arguments.length > 1 ? arguments[1] : undefined;
|
|
751
|
+
let slpkChildPath = arguments.length > 2 ? arguments[2] : undefined;
|
|
827
752
|
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
753
|
for (let index = 0; index < attributes.length; index++) {
|
|
829
754
|
const folderName = this.layers0.attributeStorageInfo[index].key;
|
|
830
755
|
const fileBuffer = new Uint8Array(attributes[index]);
|
|
831
|
-
|
|
832
756
|
if (this.options.slpk) {
|
|
833
757
|
const slpkAttributesPath = join(childPath, 'attributes', folderName);
|
|
834
758
|
await this.writeQueue.enqueue({
|
|
@@ -849,13 +773,10 @@ export default class I3SConverter {
|
|
|
849
773
|
switch (mimeType) {
|
|
850
774
|
case 'image/jpeg':
|
|
851
775
|
return 'jpg';
|
|
852
|
-
|
|
853
776
|
case 'image/png':
|
|
854
777
|
return 'png';
|
|
855
|
-
|
|
856
778
|
case 'image/ktx2':
|
|
857
779
|
return 'ktx2';
|
|
858
|
-
|
|
859
780
|
default:
|
|
860
781
|
return 'jpg';
|
|
861
782
|
}
|
|
@@ -863,11 +784,9 @@ export default class I3SConverter {
|
|
|
863
784
|
|
|
864
785
|
_findOrCreateMaterial(material) {
|
|
865
786
|
const hash = md5(JSON.stringify(material));
|
|
866
|
-
|
|
867
787
|
if (this.materialMap.has(hash)) {
|
|
868
788
|
return this.materialMap.get(hash);
|
|
869
789
|
}
|
|
870
|
-
|
|
871
790
|
const newMaterialId = this.materialDefinitions.push(material) - 1;
|
|
872
791
|
this.materialMap.set(hash, newMaterialId);
|
|
873
792
|
return newMaterialId;
|
|
@@ -879,7 +798,6 @@ export default class I3SConverter {
|
|
|
879
798
|
OBJECTID: [0],
|
|
880
799
|
...propertyTable
|
|
881
800
|
};
|
|
882
|
-
|
|
883
801
|
for (const key in propertyTableWithObjectId) {
|
|
884
802
|
const firstAttribute = propertyTableWithObjectId[key][0];
|
|
885
803
|
const attributeType = getAttributeType(key, firstAttribute);
|
|
@@ -917,7 +835,6 @@ export default class I3SConverter {
|
|
|
917
835
|
if (!this.Loader.preload) {
|
|
918
836
|
return {};
|
|
919
837
|
}
|
|
920
|
-
|
|
921
838
|
const options = {
|
|
922
839
|
'cesium-ion': {
|
|
923
840
|
accessToken: this.options.token || ION_DEFAULT_TOKEN
|
|
@@ -925,26 +842,26 @@ export default class I3SConverter {
|
|
|
925
842
|
};
|
|
926
843
|
const preloadOptions = await this.Loader.preload(this.options.inputUrl, options);
|
|
927
844
|
this.refreshTokenTime = process.hrtime();
|
|
928
|
-
return {
|
|
845
|
+
return {
|
|
846
|
+
...options,
|
|
929
847
|
...preloadOptions
|
|
930
848
|
};
|
|
931
849
|
}
|
|
932
850
|
|
|
933
851
|
async _updateTilesetOptions() {
|
|
934
852
|
const diff = process.hrtime(this.refreshTokenTime);
|
|
935
|
-
|
|
936
853
|
if (diff[0] < REFRESH_TOKEN_TIMEOUT) {
|
|
937
854
|
return;
|
|
938
855
|
}
|
|
939
|
-
|
|
940
856
|
this.refreshTokenTime = process.hrtime();
|
|
941
857
|
const preloadOptions = await this._fetchPreloadOptions();
|
|
942
|
-
this.sourceTileset.options = {
|
|
858
|
+
this.sourceTileset.options = {
|
|
859
|
+
...this.sourceTileset.options,
|
|
943
860
|
...preloadOptions
|
|
944
861
|
};
|
|
945
|
-
|
|
946
862
|
if (preloadOptions.headers) {
|
|
947
|
-
this.sourceTileset.loadOptions.fetch = {
|
|
863
|
+
this.sourceTileset.loadOptions.fetch = {
|
|
864
|
+
...this.sourceTileset.loadOptions.fetch,
|
|
948
865
|
headers: preloadOptions.headers
|
|
949
866
|
};
|
|
950
867
|
console.log('Authorization Bearer token has been updated');
|
|
@@ -953,7 +870,6 @@ export default class I3SConverter {
|
|
|
953
870
|
|
|
954
871
|
_checkAddRefinementTypeForTile(tile) {
|
|
955
872
|
const ADD_TILE_REFINEMENT = 1;
|
|
956
|
-
|
|
957
873
|
if (tile.refine === ADD_TILE_REFINEMENT) {
|
|
958
874
|
this.refinementCounter.tilesWithAddRefineCount += 1;
|
|
959
875
|
console.warn('This tile uses "ADD" type of refinement');
|
|
@@ -961,39 +877,35 @@ export default class I3SConverter {
|
|
|
961
877
|
|
|
962
878
|
this.refinementCounter.tilesCount += 1;
|
|
963
879
|
}
|
|
964
|
-
|
|
965
880
|
isContentSupported(sourceRootTile) {
|
|
966
881
|
var _sourceRootTile$conte;
|
|
967
|
-
|
|
968
882
|
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
883
|
}
|
|
970
|
-
|
|
971
884
|
async loadWorkers() {
|
|
972
885
|
console.log("Loading workers source...");
|
|
973
|
-
|
|
974
886
|
if (this.options.draco) {
|
|
975
|
-
const url = getWorkerURL(DracoWriterWorker, {
|
|
887
|
+
const url = getWorkerURL(DracoWriterWorker, {
|
|
888
|
+
...getLoaderOptions()
|
|
976
889
|
});
|
|
977
890
|
const sourceResponse = await fetchFile(url);
|
|
978
891
|
const source = await sourceResponse.text();
|
|
979
892
|
this.workerSource.draco = source;
|
|
980
893
|
}
|
|
981
|
-
|
|
982
894
|
if (this.generateTextures) {
|
|
983
|
-
const url = getWorkerURL(KTX2BasisWriterWorker, {
|
|
895
|
+
const url = getWorkerURL(KTX2BasisWriterWorker, {
|
|
896
|
+
...getLoaderOptions()
|
|
984
897
|
});
|
|
985
898
|
const sourceResponse = await fetchFile(url);
|
|
986
899
|
const source = await sourceResponse.text();
|
|
987
900
|
this.workerSource.ktx2 = source;
|
|
988
901
|
}
|
|
989
|
-
|
|
990
|
-
|
|
902
|
+
const i3sAttributesWorkerUrl = getWorkerURL(I3SAttributesWorker, {
|
|
903
|
+
...getLoaderOptions()
|
|
991
904
|
});
|
|
992
905
|
const sourceResponse = await fetchFile(i3sAttributesWorkerUrl);
|
|
993
906
|
const source = await sourceResponse.text();
|
|
994
907
|
this.workerSource.I3SAttributes = source;
|
|
995
908
|
console.log("Loading workers source completed!");
|
|
996
909
|
}
|
|
997
|
-
|
|
998
910
|
}
|
|
999
911
|
//# sourceMappingURL=i3s-converter.js.map
|