@loaders.gl/tile-converter 4.0.0-alpha.18 → 4.0.0-alpha.19

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.
Files changed (30) hide show
  1. package/bin/converter.js +1 -1
  2. package/dist/converter.min.js +73 -73
  3. package/dist/deps-installer/deps-installer.d.ts +3 -2
  4. package/dist/deps-installer/deps-installer.d.ts.map +1 -1
  5. package/dist/deps-installer/deps-installer.js +36 -10
  6. package/dist/dist.min.js +77 -67
  7. package/dist/es5/deps-installer/deps-installer.js +112 -38
  8. package/dist/es5/deps-installer/deps-installer.js.map +1 -1
  9. package/dist/es5/i3s-converter/helpers/geometry-converter.js +12 -9
  10. package/dist/es5/i3s-converter/helpers/geometry-converter.js.map +1 -1
  11. package/dist/es5/i3s-converter/i3s-converter.js +32 -87
  12. package/dist/es5/i3s-converter/i3s-converter.js.map +1 -1
  13. package/dist/es5/pgm-loader.js +1 -1
  14. package/dist/esm/deps-installer/deps-installer.js +37 -11
  15. package/dist/esm/deps-installer/deps-installer.js.map +1 -1
  16. package/dist/esm/i3s-converter/helpers/geometry-converter.js +10 -6
  17. package/dist/esm/i3s-converter/helpers/geometry-converter.js.map +1 -1
  18. package/dist/esm/i3s-converter/i3s-converter.js +11 -28
  19. package/dist/esm/i3s-converter/i3s-converter.js.map +1 -1
  20. package/dist/esm/pgm-loader.js +1 -1
  21. package/dist/i3s-converter/helpers/geometry-converter.d.ts +2 -4
  22. package/dist/i3s-converter/helpers/geometry-converter.d.ts.map +1 -1
  23. package/dist/i3s-converter/helpers/geometry-converter.js +18 -13
  24. package/dist/i3s-converter/i3s-converter.d.ts +0 -1
  25. package/dist/i3s-converter/i3s-converter.d.ts.map +1 -1
  26. package/dist/i3s-converter/i3s-converter.js +10 -22
  27. package/package.json +14 -14
  28. package/src/deps-installer/deps-installer.ts +55 -10
  29. package/src/i3s-converter/helpers/geometry-converter.ts +19 -14
  30. package/src/i3s-converter/i3s-converter.ts +12 -28
@@ -51,7 +51,6 @@ const textures_1 = require("@loaders.gl/textures");
51
51
  const images_1 = require("@loaders.gl/images");
52
52
  const types_1 = require("./types");
53
53
  const worker_utils_1 = require("@loaders.gl/worker-utils");
54
- const draco_1 = require("@loaders.gl/draco");
55
54
  const write_queue_1 = __importDefault(require("../lib/utils/write-queue"));
56
55
  const constants_1 = require("../constants");
57
56
  const feature_attributes_1 = require("./helpers/feature-attributes");
@@ -81,6 +80,7 @@ class I3SConverter {
81
80
  this.loadOptions = {
82
81
  _nodeWorkers: true,
83
82
  reuseWorkers: true,
83
+ useLocalLibraries: true,
84
84
  basis: {
85
85
  format: 'rgba32',
86
86
  // We need to load local fs workers because nodejs can't load workers from the Internet
@@ -88,7 +88,8 @@ class I3SConverter {
88
88
  },
89
89
  // We need to load local fs workers because nodejs can't load workers from the Internet
90
90
  draco: { workerUrl: './modules/draco/dist/draco-worker-node.js' },
91
- fetch: {}
91
+ fetch: {},
92
+ modules: {}
92
93
  };
93
94
  this.geoidHeightModel = null;
94
95
  this.Loader = _3d_tiles_1.Tiles3DLoader;
@@ -166,7 +167,6 @@ class I3SConverter {
166
167
  if (slpk) {
167
168
  this.nodePages.useWriteFunction(file_utils_1.writeFileForSlpk);
168
169
  }
169
- await this.loadWorkers();
170
170
  try {
171
171
  const preloadOptions = await this._fetchPreloadOptions();
172
172
  let tilesetUrl = inputUrl;
@@ -513,7 +513,7 @@ class I3SConverter {
513
513
  halfSize: [],
514
514
  quaternion: []
515
515
  };
516
- const resourcesData = await (0, geometry_converter_1.default)(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.workerSource);
516
+ const resourcesData = await (0, geometry_converter_1.default)(tileContent, transformationMatrix, boundingVolume, async () => (await this.nodePages.push({ index: 0, obb: draftObb }, parentId)).index, propertyTable, this.featuresHashArray, this.layers0?.attributeStorageInfo, this.options.draco, this.generateBoundingVolumes, this.options.mergeMaterials, this.geoidHeightModel, this.loadOptions.modules);
517
517
  return resourcesData;
518
518
  }
519
519
  /**
@@ -688,9 +688,13 @@ class I3SConverter {
688
688
  const arrayToEncode = new Uint8Array(copyArrayBuffer);
689
689
  const ktx2TextureData = (0, core_1.encode)({ ...texture.image, data: arrayToEncode }, textures_1.KTX2BasisWriterWorker, {
690
690
  ...textures_1.KTX2BasisWriterWorker.options,
691
- source: this.workerSource.ktx2,
691
+ ['ktx2-basis-writer']: {
692
+ // We need to load local fs workers because nodejs can't load workers from the Internet
693
+ workerUrl: './modules/textures/dist/ktx2-basis-writer-worker-node.js'
694
+ },
692
695
  reuseWorkers: true,
693
- _nodeWorkers: true
696
+ _nodeWorkers: true,
697
+ useLocalLibraries: true
694
698
  });
695
699
  await this.writeTextureFile(ktx2TextureData, '1', 'ktx2', childPath, slpkChildPath);
696
700
  }
@@ -905,21 +909,5 @@ class I3SConverter {
905
909
  isContentSupported(sourceTile) {
906
910
  return ['b3dm', 'glTF', 'scenegraph'].includes(sourceTile.type || '');
907
911
  }
908
- async loadWorkers() {
909
- console.log(`Loading workers source...`); // eslint-disable-line no-undef, no-console
910
- if (this.options.draco) {
911
- const url = (0, worker_utils_1.getWorkerURL)(draco_1.DracoWriterWorker, { ...(0, core_1.getLoaderOptions)() });
912
- const sourceResponse = await (0, core_1.fetchFile)(url);
913
- const source = await sourceResponse.text();
914
- this.workerSource.draco = source;
915
- }
916
- if (this.generateTextures) {
917
- const url = (0, worker_utils_1.getWorkerURL)(textures_1.KTX2BasisWriterWorker, { ...(0, core_1.getLoaderOptions)() });
918
- const sourceResponse = await (0, core_1.fetchFile)(url);
919
- const source = await sourceResponse.text();
920
- this.workerSource.ktx2 = source;
921
- }
922
- console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
923
- }
924
912
  }
925
913
  exports.default = I3SConverter;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@loaders.gl/tile-converter",
3
- "version": "4.0.0-alpha.18",
3
+ "version": "4.0.0-alpha.19",
4
4
  "description": "Converter",
5
5
  "license": "MIT",
6
6
  "publishConfig": {
@@ -45,18 +45,18 @@
45
45
  "build-i3s-server-bundle": "esbuild src/i3s-server/bin/www.ts --outfile=dist/esm/i3s-server/bin/i3s-server.min.js --platform=node --target=esnext,node14 --external:join-images --minify --bundle --define:__VERSION__=\\\"$npm_package_version\\\""
46
46
  },
47
47
  "dependencies": {
48
- "@loaders.gl/3d-tiles": "4.0.0-alpha.18",
49
- "@loaders.gl/crypto": "4.0.0-alpha.18",
50
- "@loaders.gl/draco": "4.0.0-alpha.18",
51
- "@loaders.gl/gltf": "4.0.0-alpha.18",
52
- "@loaders.gl/i3s": "4.0.0-alpha.18",
53
- "@loaders.gl/images": "4.0.0-alpha.18",
54
- "@loaders.gl/loader-utils": "4.0.0-alpha.18",
55
- "@loaders.gl/polyfills": "4.0.0-alpha.18",
56
- "@loaders.gl/textures": "4.0.0-alpha.18",
57
- "@loaders.gl/tiles": "4.0.0-alpha.18",
58
- "@loaders.gl/worker-utils": "4.0.0-alpha.18",
59
- "@loaders.gl/zip": "4.0.0-alpha.18",
48
+ "@loaders.gl/3d-tiles": "4.0.0-alpha.19",
49
+ "@loaders.gl/crypto": "4.0.0-alpha.19",
50
+ "@loaders.gl/draco": "4.0.0-alpha.19",
51
+ "@loaders.gl/gltf": "4.0.0-alpha.19",
52
+ "@loaders.gl/i3s": "4.0.0-alpha.19",
53
+ "@loaders.gl/images": "4.0.0-alpha.19",
54
+ "@loaders.gl/loader-utils": "4.0.0-alpha.19",
55
+ "@loaders.gl/polyfills": "4.0.0-alpha.19",
56
+ "@loaders.gl/textures": "4.0.0-alpha.19",
57
+ "@loaders.gl/tiles": "4.0.0-alpha.19",
58
+ "@loaders.gl/worker-utils": "4.0.0-alpha.19",
59
+ "@loaders.gl/zip": "4.0.0-alpha.19",
60
60
  "@math.gl/core": "^3.5.1",
61
61
  "@math.gl/culling": "^3.5.1",
62
62
  "@math.gl/geoid": "^3.5.1",
@@ -79,7 +79,7 @@
79
79
  "join-images": "^1.1.3",
80
80
  "sharp": "^0.31.3"
81
81
  },
82
- "gitHead": "7bc633f46560f661bdd46cf1015ea27b3694ebce",
82
+ "gitHead": "2ca50ec4e1d312c124eb7c93c60ab6fd17ee833e",
83
83
  "devDependencies": {
84
84
  "@types/express": "^4.17.17",
85
85
  "@types/node": "^20.4.2"
@@ -3,6 +3,8 @@ import {ZipLoader} from '@loaders.gl/zip';
3
3
  import {writeFile} from '../lib/utils/file-utils';
4
4
  import {join} from 'path';
5
5
  import {ChildProcessProxy} from '@loaders.gl/worker-utils';
6
+ import {DRACO_EXTERNAL_LIBRARIES, DRACO_EXTERNAL_LIBRARY_URLS} from '@loaders.gl/draco';
7
+ import {BASIS_EXTERNAL_LIBRARIES} from '@loaders.gl/textures';
6
8
 
7
9
  // @ts-ignore TS2304: Cannot find name '__VERSION__'.
8
10
  const VERSION = typeof __VERSION__ !== 'undefined' ? __VERSION__ : 'beta';
@@ -23,7 +25,7 @@ export class DepsInstaller {
23
25
  * This path is '' by default and is not used by tile-converter.
24
26
  * It is used in tests to prevent rewriting actual workers during tests running
25
27
  */
26
- async install(path: string = '', workersPath: string = ''): Promise<void> {
28
+ async install(path: string = ''): Promise<void> {
27
29
  console.log('Installing "EGM2008-5" model...'); // eslint-disable-line no-console
28
30
  const fileMap = await load(PGM_LINK, ZipLoader, {});
29
31
 
@@ -34,14 +36,47 @@ export class DepsInstaller {
34
36
 
35
37
  await writeFile(depsPath, new Uint8Array(fileMap['geoids/egm2008-5.pgm']), 'egm2008-5.pgm');
36
38
 
37
- console.log('Installing "I3S Content Loader worker"'); // eslint-disable-line no-console
38
- await this.installWorker('i3s', 'i3s-content-worker-node.js', workersPath);
39
+ console.log('Installing "I3S Content Loader" worker'); // eslint-disable-line no-console
40
+ await this.installFromNpm('i3s', 'i3s-content-worker-node.js');
39
41
 
40
- console.log('Installing "Draco Loader worker"'); // eslint-disable-line no-console
41
- await this.installWorker('draco', 'draco-worker-node.js', workersPath);
42
+ console.log('Installing "Draco Loader" worker'); // eslint-disable-line no-console
43
+ await this.installFromNpm('draco', 'draco-worker-node.js');
42
44
 
43
- console.log('Installing "Basis Loader worker"'); // eslint-disable-line no-console
44
- await this.installWorker('textures', 'basis-worker-node.js', workersPath);
45
+ console.log('Installing "Draco Writer" worker'); // eslint-disable-line no-console
46
+ await this.installFromNpm('draco', 'draco-writer-worker-node.js');
47
+
48
+ console.log('Installing "Basis Loader" worker'); // eslint-disable-line no-console
49
+ await this.installFromNpm('textures', 'basis-worker-node.js');
50
+
51
+ console.log('Installing "KTX2 Basis Writer" worker'); // eslint-disable-line no-console
52
+ await this.installFromNpm('textures', 'ktx2-basis-writer-worker-node.js');
53
+
54
+ console.log('Installing "Draco decoder" library'); // eslint-disable-line no-console
55
+ await this.installFromUrl(
56
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER],
57
+ 'draco',
58
+ DRACO_EXTERNAL_LIBRARIES.DECODER
59
+ );
60
+ await this.installFromUrl(
61
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.DECODER_WASM],
62
+ 'draco',
63
+ DRACO_EXTERNAL_LIBRARIES.DECODER_WASM
64
+ );
65
+
66
+ console.log('Installing "Draco encoder" library'); // eslint-disable-line no-console
67
+ await this.installFromUrl(
68
+ DRACO_EXTERNAL_LIBRARY_URLS[DRACO_EXTERNAL_LIBRARIES.ENCODER],
69
+ 'draco',
70
+ DRACO_EXTERNAL_LIBRARIES.ENCODER
71
+ );
72
+
73
+ console.log('Installing "Basis transcoder" library'); // eslint-disable-line no-console
74
+ await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER, 'libs');
75
+ await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.TRANSCODER_WASM, 'libs');
76
+
77
+ console.log('Installing "Basis encoder" library'); // eslint-disable-line no-console
78
+ await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER, 'libs');
79
+ await this.installFromNpm('textures', BASIS_EXTERNAL_LIBRARIES.ENCODER_WASM, 'libs');
45
80
 
46
81
  console.log('Installing "join-images" npm package');
47
82
  const childProcess = new ChildProcessProxy();
@@ -58,15 +93,25 @@ export class DepsInstaller {
58
93
  console.log('All dependencies were installed succesfully.'); // eslint-disable-line no-console
59
94
  }
60
95
 
61
- private async installWorker(module: string, name: string, extraPath: string) {
96
+ private async installFromNpm(module: string, name: string, extraPath: string = '') {
62
97
  const fileResponse = await fetchFile(
63
- `https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${name}`
98
+ `https://unpkg.com/@loaders.gl/${module}@${VERSION}/dist/${extraPath}/${name}`
64
99
  );
65
100
  const fileData = await fileResponse.arrayBuffer();
66
101
  if (!fileData) {
67
102
  return;
68
103
  }
69
- const path = join(process.cwd(), extraPath, 'modules', module, 'dist');
104
+ const path = join(process.cwd(), 'modules', module, 'dist', extraPath);
105
+ await writeFile(path, fileData, name);
106
+ }
107
+
108
+ private async installFromUrl(url: string, module: string, name: string) {
109
+ const fileResponse = await fetchFile(url);
110
+ const fileData = await fileResponse.arrayBuffer();
111
+ if (!fileData) {
112
+ return;
113
+ }
114
+ const path = join(process.cwd(), 'modules', module, 'dist', 'libs');
70
115
  await writeFile(path, fileData, name);
71
116
  }
72
117
  }
@@ -87,7 +87,7 @@ let scratchVector = new Vector3();
87
87
  * @param generateBoundingVolumes - is converter should create accurate bounding voulmes from geometry attributes
88
88
  * @param shouldMergeMaterials - Try to merge similar materials to be able to merge meshes into one node
89
89
  * @param geoidHeightModel - model to convert elevation from elipsoidal to geoid
90
- * @param workerSource - source code of used workers
90
+ * @param libraries - dynamicaly loaded 3rd-party libraries
91
91
  * @returns Array of node resources to create one or more i3s nodes
92
92
  */
93
93
  export default async function convertB3dmToI3sGeometry(
@@ -102,7 +102,7 @@ export default async function convertB3dmToI3sGeometry(
102
102
  generateBoundingVolumes: boolean,
103
103
  shouldMergeMaterials: boolean,
104
104
  geoidHeightModel: Geoid,
105
- workerSource: {[key: string]: string}
105
+ libraries: Record<string, string>
106
106
  ): Promise<I3SConvertedResources[] | null> {
107
107
  const useCartesianPositions = generateBoundingVolumes;
108
108
  const materialAndTextureList: I3SMaterialWithTexture[] = await convertMaterials(
@@ -156,7 +156,7 @@ export default async function convertB3dmToI3sGeometry(
156
156
  propertyTable,
157
157
  attributeStorageInfo,
158
158
  draco,
159
- workerSource
159
+ libraries
160
160
  })
161
161
  );
162
162
  }
@@ -208,7 +208,7 @@ function _generateBoundingVolumesFromGeometry(
208
208
  * @param params.propertyTable - batch table (corresponding to feature attributes data)
209
209
  * @param params.attributeStorageInfo - attributes metadata from 3DSceneLayer json
210
210
  * @param params.draco - is converter should create draco compressed geometry
211
- * @param params.workerSource - source code of used workers
211
+ * @param libraries - dynamicaly loaded 3rd-party libraries
212
212
  * @returns Array of I3S node resources
213
213
  */
214
214
  async function _makeNodeResources({
@@ -221,7 +221,7 @@ async function _makeNodeResources({
221
221
  propertyTable,
222
222
  attributeStorageInfo,
223
223
  draco,
224
- workerSource
224
+ libraries
225
225
  }: {
226
226
  convertedAttributes: ConvertedAttributes;
227
227
  material: I3SMaterialDefinition;
@@ -232,7 +232,7 @@ async function _makeNodeResources({
232
232
  propertyTable: FeatureTableJson | null;
233
233
  attributeStorageInfo?: AttributeStorageInfo[];
234
234
  draco: boolean;
235
- workerSource: {[key: string]: string};
235
+ libraries: Record<string, string>;
236
236
  }): Promise<I3SConvertedResources> {
237
237
  const boundingVolumes = convertedAttributes.boundingVolumes;
238
238
  const vertexCount = convertedAttributes.positions.length / VALUES_PER_VERTEX;
@@ -277,7 +277,7 @@ async function _makeNodeResources({
277
277
  featureIds,
278
278
  faceRange
279
279
  },
280
- workerSource.draco
280
+ libraries
281
281
  )
282
282
  : null;
283
283
 
@@ -1451,17 +1451,17 @@ function generateBigUint64Array(featureIds: any[]): BigUint64Array {
1451
1451
 
1452
1452
  /**
1453
1453
  * Generates draco compressed geometry
1454
- * @param {Number} vertexCount
1455
- * @param {Object} convertedAttributes - get rid of this argument here
1456
- * @param {Object} attributes - geometry attributes to compress
1457
- * @param {string} dracoWorkerSoure - draco worker source code
1458
- * @returns {Promise<object>} - COmpressed geometry.
1454
+ * @param vertexCount
1455
+ * @param convertedAttributes - get rid of this argument here
1456
+ * @param attributes - geometry attributes to compress
1457
+ * @param libraries - dynamicaly loaded 3rd-party libraries
1458
+ * @returns - Compressed geometry.
1459
1459
  */
1460
1460
  async function generateCompressedGeometry(
1461
1461
  vertexCount: number,
1462
1462
  convertedAttributes: Record<string, any>,
1463
1463
  attributes: Record<string, any>,
1464
- dracoWorkerSoure: string
1464
+ libraries: Record<string, string>
1465
1465
  ): Promise<ArrayBuffer> {
1466
1466
  const {positions, normals, texCoords, colors, uvRegions, featureIds, faceRange} = attributes;
1467
1467
  const indices = new Uint32Array(vertexCount);
@@ -1510,12 +1510,17 @@ async function generateCompressedGeometry(
1510
1510
 
1511
1511
  return encode({attributes: compressedAttributes, indices}, DracoWriterWorker, {
1512
1512
  ...DracoWriterWorker.options,
1513
- source: dracoWorkerSoure,
1514
1513
  reuseWorkers: true,
1515
1514
  _nodeWorkers: true,
1515
+ modules: libraries,
1516
+ useLocalLibraries: true,
1516
1517
  draco: {
1517
1518
  method: 'MESH_SEQUENTIAL_ENCODING',
1518
1519
  attributesMetadata
1520
+ },
1521
+ ['draco-writer']: {
1522
+ // We need to load local fs workers because nodejs can't load workers from the Internet
1523
+ workerUrl: './modules/draco/dist/draco-writer-worker-node.js'
1519
1524
  }
1520
1525
  });
1521
1526
  }
@@ -14,7 +14,7 @@ import type {
14
14
  MaxScreenThresholdSQ,
15
15
  NodeInPage
16
16
  } from '@loaders.gl/i3s';
17
- import {load, encode, fetchFile, getLoaderOptions, isBrowser} from '@loaders.gl/core';
17
+ import {load, encode, isBrowser} from '@loaders.gl/core';
18
18
  import {CesiumIonLoader, Tiles3DLoader} from '@loaders.gl/3d-tiles';
19
19
  import {Geoid} from '@math.gl/geoid';
20
20
  import {join} from 'path';
@@ -56,8 +56,7 @@ import {
56
56
  PreprocessData,
57
57
  SharedResourcesArrays
58
58
  } from './types';
59
- import {getWorkerURL, WorkerFarm} from '@loaders.gl/worker-utils';
60
- import {DracoWriterWorker} from '@loaders.gl/draco';
59
+ import {WorkerFarm} from '@loaders.gl/worker-utils';
61
60
  import WriteQueue from '../lib/utils/write-queue';
62
61
  import {BROWSER_ERROR_MESSAGE} from '../constants';
63
62
  import {
@@ -111,6 +110,7 @@ export default class I3SConverter {
111
110
  loadOptions: Tiles3DLoaderOptions = {
112
111
  _nodeWorkers: true,
113
112
  reuseWorkers: true,
113
+ useLocalLibraries: true,
114
114
  basis: {
115
115
  format: 'rgba32',
116
116
  // We need to load local fs workers because nodejs can't load workers from the Internet
@@ -118,7 +118,8 @@ export default class I3SConverter {
118
118
  },
119
119
  // We need to load local fs workers because nodejs can't load workers from the Internet
120
120
  draco: {workerUrl: './modules/draco/dist/draco-worker-node.js'},
121
- fetch: {}
121
+ fetch: {},
122
+ modules: {}
122
123
  };
123
124
  geoidHeightModel: Geoid | null = null;
124
125
  Loader: LoaderWithParser = Tiles3DLoader;
@@ -236,8 +237,6 @@ export default class I3SConverter {
236
237
  this.nodePages.useWriteFunction(writeFileForSlpk);
237
238
  }
238
239
 
239
- await this.loadWorkers();
240
-
241
240
  try {
242
241
  const preloadOptions = await this._fetchPreloadOptions();
243
242
  let tilesetUrl = inputUrl;
@@ -719,7 +718,7 @@ export default class I3SConverter {
719
718
  this.generateBoundingVolumes,
720
719
  this.options.mergeMaterials,
721
720
  this.geoidHeightModel!,
722
- this.workerSource
721
+ this.loadOptions.modules as Record<string, string>
723
722
  );
724
723
  return resourcesData;
725
724
  }
@@ -935,9 +934,13 @@ export default class I3SConverter {
935
934
  KTX2BasisWriterWorker,
936
935
  {
937
936
  ...KTX2BasisWriterWorker.options,
938
- source: this.workerSource.ktx2,
937
+ ['ktx2-basis-writer']: {
938
+ // We need to load local fs workers because nodejs can't load workers from the Internet
939
+ workerUrl: './modules/textures/dist/ktx2-basis-writer-worker-node.js'
940
+ },
939
941
  reuseWorkers: true,
940
- _nodeWorkers: true
942
+ _nodeWorkers: true,
943
+ useLocalLibraries: true
941
944
  }
942
945
  );
943
946
 
@@ -1197,23 +1200,4 @@ export default class I3SConverter {
1197
1200
  private isContentSupported(sourceTile: Tiles3DTileJSONPostprocessed): boolean {
1198
1201
  return ['b3dm', 'glTF', 'scenegraph'].includes(sourceTile.type || '');
1199
1202
  }
1200
-
1201
- private async loadWorkers(): Promise<void> {
1202
- console.log(`Loading workers source...`); // eslint-disable-line no-undef, no-console
1203
- if (this.options.draco) {
1204
- const url = getWorkerURL(DracoWriterWorker, {...getLoaderOptions()});
1205
- const sourceResponse = await fetchFile(url);
1206
- const source = await sourceResponse.text();
1207
- this.workerSource.draco = source;
1208
- }
1209
-
1210
- if (this.generateTextures) {
1211
- const url = getWorkerURL(KTX2BasisWriterWorker, {...getLoaderOptions()});
1212
- const sourceResponse = await fetchFile(url);
1213
- const source = await sourceResponse.text();
1214
- this.workerSource.ktx2 = source;
1215
- }
1216
-
1217
- console.log(`Loading workers source completed!`); // eslint-disable-line no-undef, no-console
1218
- }
1219
1203
  }