itowns 2.43.2-next.9 → 2.44.0

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 (62) hide show
  1. package/CONTRIBUTORS.md +1 -0
  2. package/changelog.md +107 -0
  3. package/dist/455.js +2 -0
  4. package/dist/455.js.map +1 -0
  5. package/dist/debug.js +1 -1
  6. package/dist/debug.js.LICENSE.txt +2 -2
  7. package/dist/debug.js.map +1 -1
  8. package/dist/itowns.js +1 -1
  9. package/dist/itowns.js.LICENSE.txt +1 -22
  10. package/dist/itowns.js.map +1 -1
  11. package/dist/itowns_lasparser.js +2 -0
  12. package/dist/itowns_lasparser.js.map +1 -0
  13. package/dist/itowns_lasworker.js +2 -0
  14. package/dist/itowns_lasworker.js.map +1 -0
  15. package/dist/itowns_potree2worker.js +2 -0
  16. package/dist/itowns_potree2worker.js.map +1 -0
  17. package/dist/itowns_widgets.js +1 -1
  18. package/dist/itowns_widgets.js.map +1 -1
  19. package/examples/3dtiles_loader.html +150 -0
  20. package/examples/config.json +5 -0
  21. package/examples/jsm/.eslintrc.cjs +38 -0
  22. package/examples/jsm/OGC3DTilesHelper.js +105 -0
  23. package/examples/misc_instancing.html +2 -1
  24. package/examples/potree2_25d_map.html +127 -0
  25. package/lib/Core/3DTiles/C3DTFeature.js +6 -6
  26. package/lib/Core/Potree2Node.js +206 -0
  27. package/lib/Core/Potree2PointAttributes.js +139 -0
  28. package/lib/Core/Scheduler/Scheduler.js +1 -1
  29. package/lib/Core/Style.js +52 -49
  30. package/lib/Core/View.js +3 -0
  31. package/lib/Layer/C3DTilesLayer.js +6 -6
  32. package/lib/Layer/OGC3DTilesLayer.js +386 -0
  33. package/lib/Layer/PointCloudLayer.js +1 -1
  34. package/lib/Layer/Potree2Layer.js +165 -0
  35. package/lib/Layer/ReferencingLayerProperties.js +5 -0
  36. package/lib/Layer/TiledGeometryLayer.js +4 -1
  37. package/lib/Loader/Potree2BrotliLoader.js +261 -0
  38. package/lib/Loader/Potree2Loader.js +207 -0
  39. package/lib/Main.js +9 -2
  40. package/lib/Parser/B3dmParser.js +11 -22
  41. package/lib/Parser/LASParser.js +48 -16
  42. package/lib/Parser/Potree2BinParser.js +92 -0
  43. package/lib/Parser/ShapefileParser.js +2 -2
  44. package/lib/Parser/deprecated/LegacyGLTFLoader.js +25 -5
  45. package/lib/Parser/iGLTFLoader.js +169 -0
  46. package/lib/Process/3dTilesProcessing.js +2 -1
  47. package/lib/Provider/3dTilesProvider.js +6 -4
  48. package/lib/Renderer/PointsMaterial.js +128 -94
  49. package/lib/Source/FileSource.js +1 -1
  50. package/lib/Source/OGC3DTilesGoogleSource.js +32 -0
  51. package/lib/Source/OGC3DTilesIonSource.js +37 -0
  52. package/lib/Source/OGC3DTilesSource.js +24 -0
  53. package/lib/Source/Potree2Source.js +172 -0
  54. package/lib/ThreeExtended/loaders/DRACOLoader.js +5 -3
  55. package/lib/ThreeExtended/loaders/GLTFLoader.js +38 -2
  56. package/lib/ThreeExtended/loaders/KTX2Loader.js +17 -10
  57. package/lib/ThreeExtended/utils/BufferGeometryUtils.js +32 -30
  58. package/lib/Worker/LASLoaderWorker.js +19 -0
  59. package/lib/Worker/Potree2Worker.js +21 -0
  60. package/package.json +33 -31
  61. package/lib/Parser/GLTFParser.js +0 -88
  62. /package/lib/{Parser → Loader}/LASLoader.js +0 -0
@@ -10,6 +10,9 @@ class GLTFLoader extends Loader {
10
10
  this.register(function (parser) {
11
11
  return new GLTFMaterialsClearcoatExtension(parser);
12
12
  });
13
+ this.register(function (parser) {
14
+ return new GLTFMaterialsDispersionExtension(parser);
15
+ });
13
16
  this.register(function (parser) {
14
17
  return new GLTFTextureBasisUExtension(parser);
15
18
  });
@@ -241,6 +244,7 @@ const EXTENSIONS = {
241
244
  KHR_DRACO_MESH_COMPRESSION: 'KHR_draco_mesh_compression',
242
245
  KHR_LIGHTS_PUNCTUAL: 'KHR_lights_punctual',
243
246
  KHR_MATERIALS_CLEARCOAT: 'KHR_materials_clearcoat',
247
+ KHR_MATERIALS_DISPERSION: 'KHR_materials_dispersion',
244
248
  KHR_MATERIALS_IOR: 'KHR_materials_ior',
245
249
  KHR_MATERIALS_SHEEN: 'KHR_materials_sheen',
246
250
  KHR_MATERIALS_SPECULAR: 'KHR_materials_specular',
@@ -456,6 +460,34 @@ class GLTFMaterialsClearcoatExtension {
456
460
  }
457
461
  }
458
462
 
463
+ /**
464
+ * Materials dispersion Extension
465
+ *
466
+ * Specification: https://github.com/KhronosGroup/glTF/tree/main/extensions/2.0/Khronos/KHR_materials_dispersion
467
+ */
468
+ class GLTFMaterialsDispersionExtension {
469
+ constructor(parser) {
470
+ this.parser = parser;
471
+ this.name = EXTENSIONS.KHR_MATERIALS_DISPERSION;
472
+ }
473
+ getMaterialType(materialIndex) {
474
+ const parser = this.parser;
475
+ const materialDef = parser.json.materials[materialIndex];
476
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) return null;
477
+ return MeshPhysicalMaterial;
478
+ }
479
+ extendMaterialParams(materialIndex, materialParams) {
480
+ const parser = this.parser;
481
+ const materialDef = parser.json.materials[materialIndex];
482
+ if (!materialDef.extensions || !materialDef.extensions[this.name]) {
483
+ return Promise.resolve();
484
+ }
485
+ const extension = materialDef.extensions[this.name];
486
+ materialParams.dispersion = extension.dispersion !== undefined ? extension.dispersion : 0;
487
+ return Promise.resolve();
488
+ }
489
+ }
490
+
459
491
  /**
460
492
  * Iridescence Materials Extension
461
493
  *
@@ -1119,7 +1151,7 @@ class GLTFDracoMeshCompressionExtension {
1119
1151
  }
1120
1152
  }
1121
1153
  return parser.getDependency('bufferView', bufferViewIndex).then(function (bufferView) {
1122
- return new Promise(function (resolve) {
1154
+ return new Promise(function (resolve, reject) {
1123
1155
  dracoLoader.decodeDracoFile(bufferView, function (geometry) {
1124
1156
  for (const attributeName in geometry.attributes) {
1125
1157
  const attribute = geometry.attributes[attributeName];
@@ -1127,7 +1159,7 @@ class GLTFDracoMeshCompressionExtension {
1127
1159
  if (normalized !== undefined) attribute.normalized = normalized;
1128
1160
  }
1129
1161
  resolve(geometry);
1130
- }, threeAttributeMap, attributeTypeMap);
1162
+ }, threeAttributeMap, attributeTypeMap, LinearSRGBColorSpace, reject);
1131
1163
  });
1132
1164
  });
1133
1165
  }
@@ -1590,6 +1622,9 @@ class GLTFParser {
1590
1622
  return Promise.all(parser._invokeAll(function (ext) {
1591
1623
  return ext.afterRoot && ext.afterRoot(result);
1592
1624
  })).then(function () {
1625
+ for (const scene of result.scenes) {
1626
+ scene.updateMatrixWorld();
1627
+ }
1593
1628
  onLoad(result);
1594
1629
  });
1595
1630
  }).catch(onError);
@@ -1995,6 +2030,7 @@ class GLTFParser {
1995
2030
  if (isObjectURL === true) {
1996
2031
  URL.revokeObjectURL(sourceURI);
1997
2032
  }
2033
+ assignExtrasToUserData(texture, sourceDef);
1998
2034
  texture.userData.mimeType = sourceDef.mimeType || getImageURIMimeType(sourceDef.uri);
1999
2035
  return texture;
2000
2036
  }).catch(function (error) {
@@ -11,7 +11,7 @@
11
11
  * - DFD: https://www.khronos.org/registry/DataFormat/specs/1.3/dataformat.1.3.html#basicdescriptor
12
12
  */
13
13
 
14
- import { CompressedTexture, CompressedArrayTexture, CompressedCubeTexture, Data3DTexture, DataTexture, DisplayP3ColorSpace, FileLoader, FloatType, HalfFloatType, NoColorSpace, LinearFilter, LinearMipmapLinearFilter, LinearDisplayP3ColorSpace, LinearSRGBColorSpace, Loader, RedFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_4BPPV1_Format, RGB_S3TC_DXT1_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_6x6_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBAFormat, RGFormat, SRGBColorSpace, UnsignedByteType } from 'three';
14
+ import { CompressedTexture, CompressedArrayTexture, CompressedCubeTexture, Data3DTexture, DataTexture, DisplayP3ColorSpace, FileLoader, FloatType, HalfFloatType, NoColorSpace, LinearFilter, LinearMipmapLinearFilter, LinearDisplayP3ColorSpace, LinearSRGBColorSpace, Loader, RedFormat, RGB_ETC1_Format, RGB_ETC2_Format, RGB_PVRTC_4BPPV1_Format, RGBA_ASTC_4x4_Format, RGBA_ASTC_6x6_Format, RGBA_BPTC_Format, RGBA_ETC2_EAC_Format, RGBA_PVRTC_4BPPV1_Format, RGBA_S3TC_DXT5_Format, RGBA_S3TC_DXT1_Format, RGBAFormat, RGFormat, SRGBColorSpace, UnsignedByteType } from 'three';
15
15
  import { WorkerPool } from "../utils/WorkerPool.js";
16
16
  import { read, KHR_DF_FLAG_ALPHA_PREMULTIPLIED, KHR_DF_TRANSFER_SRGB, KHR_SUPERCOMPRESSION_NONE, KHR_SUPERCOMPRESSION_ZSTD, VK_FORMAT_UNDEFINED, VK_FORMAT_R16_SFLOAT, VK_FORMAT_R16G16_SFLOAT, VK_FORMAT_R16G16B16A16_SFLOAT, VK_FORMAT_R32_SFLOAT, VK_FORMAT_R32G32_SFLOAT, VK_FORMAT_R32G32B32A32_SFLOAT, VK_FORMAT_R8_SRGB, VK_FORMAT_R8_UNORM, VK_FORMAT_R8G8_SRGB, VK_FORMAT_R8G8_UNORM, VK_FORMAT_R8G8B8A8_SRGB, VK_FORMAT_R8G8B8A8_UNORM, VK_FORMAT_ASTC_6x6_SRGB_BLOCK, VK_FORMAT_ASTC_6x6_UNORM_BLOCK, KHR_DF_PRIMARIES_UNSPECIFIED, KHR_DF_PRIMARIES_BT709, KHR_DF_PRIMARIES_DISPLAYP3 } from "../libs/ktx-parse.module.js";
17
17
  import { ZSTDDecoder } from "../libs/zstddec.module.js";
@@ -39,15 +39,26 @@ class KTX2Loader extends Loader {
39
39
  this.workerPool.setWorkerLimit(num);
40
40
  return this;
41
41
  }
42
+ async detectSupportAsync(renderer) {
43
+ this.workerConfig = {
44
+ astcSupported: await renderer.hasFeatureAsync('texture-compression-astc'),
45
+ etc1Supported: await renderer.hasFeatureAsync('texture-compression-etc1'),
46
+ etc2Supported: await renderer.hasFeatureAsync('texture-compression-etc2'),
47
+ dxtSupported: await renderer.hasFeatureAsync('texture-compression-bc'),
48
+ bptcSupported: await renderer.hasFeatureAsync('texture-compression-bptc'),
49
+ pvrtcSupported: await renderer.hasFeatureAsync('texture-compression-pvrtc')
50
+ };
51
+ return this;
52
+ }
42
53
  detectSupport(renderer) {
43
54
  if (renderer.isWebGPURenderer === true) {
44
55
  this.workerConfig = {
45
56
  astcSupported: renderer.hasFeature('texture-compression-astc'),
46
- etc1Supported: false,
57
+ etc1Supported: renderer.hasFeature('texture-compression-etc1'),
47
58
  etc2Supported: renderer.hasFeature('texture-compression-etc2'),
48
59
  dxtSupported: renderer.hasFeature('texture-compression-bc'),
49
- bptcSupported: false,
50
- pvrtcSupported: false
60
+ bptcSupported: renderer.hasFeature('texture-compression-bptc'),
61
+ pvrtcSupported: renderer.hasFeature('texture-compression-pvrtc')
51
62
  };
52
63
  } else {
53
64
  this.workerConfig = {
@@ -58,10 +69,6 @@ class KTX2Loader extends Loader {
58
69
  bptcSupported: renderer.extensions.has('EXT_texture_compression_bptc'),
59
70
  pvrtcSupported: renderer.extensions.has('WEBGL_compressed_texture_pvrtc') || renderer.extensions.has('WEBKIT_WEBGL_compressed_texture_pvrtc')
60
71
  };
61
- if (renderer.capabilities.isWebGL2) {
62
- // https://github.com/mrdoob/three.js/pull/22928
63
- this.workerConfig.etc1Supported = false;
64
- }
65
72
  }
66
73
  return this;
67
74
  }
@@ -220,7 +227,7 @@ KTX2Loader.EngineFormat = {
220
227
  RGB_ETC1_Format: RGB_ETC1_Format,
221
228
  RGB_ETC2_Format: RGB_ETC2_Format,
222
229
  RGB_PVRTC_4BPPV1_Format: RGB_PVRTC_4BPPV1_Format,
223
- RGB_S3TC_DXT1_Format: RGB_S3TC_DXT1_Format
230
+ RGBA_S3TC_DXT1_Format: RGBA_S3TC_DXT1_Format
224
231
  };
225
232
 
226
233
  /* WEB WORKER */
@@ -404,7 +411,7 @@ KTX2Loader.BasisWorker = function () {
404
411
  if: 'dxtSupported',
405
412
  basisFormat: [BasisFormat.ETC1S, BasisFormat.UASTC_4x4],
406
413
  transcoderFormat: [TranscoderFormat.BC1, TranscoderFormat.BC3],
407
- engineFormat: [EngineFormat.RGB_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
414
+ engineFormat: [EngineFormat.RGBA_S3TC_DXT1_Format, EngineFormat.RGBA_S3TC_DXT5_Format],
408
415
  priorityETC1S: 4,
409
416
  priorityUASTC: 5,
410
417
  needsPowerOfTwo: false
@@ -186,10 +186,6 @@ function mergeAttributes(attributes) {
186
186
  let arrayLength = 0;
187
187
  for (let i = 0; i < attributes.length; ++i) {
188
188
  const attribute = attributes[i];
189
- if (attribute.isInterleavedBufferAttribute) {
190
- console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. InterleavedBufferAttributes are not supported.');
191
- return null;
192
- }
193
189
  if (TypedArray === undefined) TypedArray = attribute.array.constructor;
194
190
  if (TypedArray !== attribute.array.constructor) {
195
191
  console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.array must be of consistent array types across matching attributes.');
@@ -210,15 +206,26 @@ function mergeAttributes(attributes) {
210
206
  console.error('THREE.BufferGeometryUtils: .mergeAttributes() failed. BufferAttribute.gpuType must be consistent across matching attributes.');
211
207
  return null;
212
208
  }
213
- arrayLength += attribute.array.length;
209
+ arrayLength += attribute.count * itemSize;
214
210
  }
215
211
  const array = new TypedArray(arrayLength);
212
+ const result = new BufferAttribute(array, itemSize, normalized);
216
213
  let offset = 0;
217
214
  for (let i = 0; i < attributes.length; ++i) {
218
- array.set(attributes[i].array, offset);
219
- offset += attributes[i].array.length;
215
+ const attribute = attributes[i];
216
+ if (attribute.isInterleavedBufferAttribute) {
217
+ const tupleOffset = offset / itemSize;
218
+ for (let j = 0, l = attribute.count; j < l; j++) {
219
+ for (let c = 0; c < itemSize; c++) {
220
+ const value = attribute.getComponent(j, c);
221
+ result.setComponent(j + tupleOffset, c, value);
222
+ }
223
+ }
224
+ } else {
225
+ array.set(attribute.array, offset);
226
+ }
227
+ offset += attribute.count * itemSize;
220
228
  }
221
- const result = new BufferAttribute(array, itemSize, normalized);
222
229
  if (gpuType !== undefined) {
223
230
  result.gpuType = gpuType;
224
231
  }
@@ -390,10 +397,14 @@ function mergeVertices(geometry) {
390
397
  for (let i = 0, l = attributeNames.length; i < l; i++) {
391
398
  const name = attributeNames[i];
392
399
  const attr = geometry.attributes[name];
393
- tmpAttributes[name] = new BufferAttribute(new attr.array.constructor(attr.count * attr.itemSize), attr.itemSize, attr.normalized);
394
- const morphAttr = geometry.morphAttributes[name];
395
- if (morphAttr) {
396
- tmpMorphAttributes[name] = new BufferAttribute(new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize), morphAttr.itemSize, morphAttr.normalized);
400
+ tmpAttributes[name] = new attr.constructor(new attr.array.constructor(attr.count * attr.itemSize), attr.itemSize, attr.normalized);
401
+ const morphAttributes = geometry.morphAttributes[name];
402
+ if (morphAttributes) {
403
+ if (!tmpMorphAttributes[name]) tmpMorphAttributes[name] = [];
404
+ morphAttributes.forEach((morphAttr, i) => {
405
+ const array = new morphAttr.array.constructor(morphAttr.count * morphAttr.itemSize);
406
+ tmpMorphAttributes[name][i] = new morphAttr.constructor(array, morphAttr.itemSize, morphAttr.normalized);
407
+ });
397
408
  }
398
409
  }
399
410
 
@@ -425,17 +436,17 @@ function mergeVertices(geometry) {
425
436
  for (let j = 0, l = attributeNames.length; j < l; j++) {
426
437
  const name = attributeNames[j];
427
438
  const attribute = geometry.getAttribute(name);
428
- const morphAttr = geometry.morphAttributes[name];
439
+ const morphAttributes = geometry.morphAttributes[name];
429
440
  const itemSize = attribute.itemSize;
430
- const newarray = tmpAttributes[name];
441
+ const newArray = tmpAttributes[name];
431
442
  const newMorphArrays = tmpMorphAttributes[name];
432
443
  for (let k = 0; k < itemSize; k++) {
433
444
  const getterFunc = getters[k];
434
445
  const setterFunc = setters[k];
435
- newarray[setterFunc](nextIndex, attribute[getterFunc](index));
436
- if (morphAttr) {
437
- for (let m = 0, ml = morphAttr.length; m < ml; m++) {
438
- newMorphArrays[m][setterFunc](nextIndex, morphAttr[m][getterFunc](index));
446
+ newArray[setterFunc](nextIndex, attribute[getterFunc](index));
447
+ if (morphAttributes) {
448
+ for (let m = 0, ml = morphAttributes.length; m < ml; m++) {
449
+ newMorphArrays[m][setterFunc](nextIndex, morphAttributes[m][getterFunc](index));
439
450
  }
440
451
  }
441
452
  }
@@ -450,11 +461,11 @@ function mergeVertices(geometry) {
450
461
  const result = geometry.clone();
451
462
  for (const name in geometry.attributes) {
452
463
  const tmpAttribute = tmpAttributes[name];
453
- result.setAttribute(name, new BufferAttribute(tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), tmpAttribute.itemSize, tmpAttribute.normalized));
464
+ result.setAttribute(name, new tmpAttribute.constructor(tmpAttribute.array.slice(0, nextIndex * tmpAttribute.itemSize), tmpAttribute.itemSize, tmpAttribute.normalized));
454
465
  if (!(name in tmpMorphAttributes)) continue;
455
466
  for (let j = 0; j < tmpMorphAttributes[name].length; j++) {
456
467
  const tmpMorphAttribute = tmpMorphAttributes[name][j];
457
- result.morphAttributes[name][j] = new BufferAttribute(tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), tmpMorphAttribute.itemSize, tmpMorphAttribute.normalized);
468
+ result.morphAttributes[name][j] = new tmpMorphAttribute.constructor(tmpMorphAttribute.array.slice(0, nextIndex * tmpMorphAttribute.itemSize), tmpMorphAttribute.itemSize, tmpMorphAttribute.normalized);
458
469
  }
459
470
  }
460
471
 
@@ -832,13 +843,4 @@ function toCreasedNormals(geometry) {
832
843
  resultGeometry.setAttribute('normal', normAttr);
833
844
  return resultGeometry;
834
845
  }
835
- function mergeBufferGeometries(geometries) {
836
- let useGroups = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
837
- console.warn('THREE.BufferGeometryUtils: mergeBufferGeometries() has been renamed to mergeGeometries().'); // @deprecated, r151
838
- return mergeGeometries(geometries, useGroups);
839
- }
840
- function mergeBufferAttributes(attributes) {
841
- console.warn('THREE.BufferGeometryUtils: mergeBufferAttributes() has been renamed to mergeAttributes().'); // @deprecated, r151
842
- return mergeAttributes(attributes);
843
- }
844
- export { computeMikkTSpaceTangents, mergeGeometries, mergeBufferGeometries, mergeAttributes, mergeBufferAttributes, interleaveAttributes, estimateBytesUsed, mergeVertices, toTrianglesDrawMode, computeMorphedAttributes, mergeGroups, toCreasedNormals };
846
+ export { computeMikkTSpaceTangents, mergeGeometries, mergeAttributes, interleaveAttributes, estimateBytesUsed, mergeVertices, toTrianglesDrawMode, computeMorphedAttributes, mergeGroups, toCreasedNormals };
@@ -0,0 +1,19 @@
1
+ import { expose, Transfer } from 'threads/worker';
2
+ import LASLoader from "../Loader/LASLoader.js";
3
+ const loader = new LASLoader();
4
+ function transferable(attributes) {
5
+ return Object.values(attributes).filter(ArrayBuffer.isView).map(a => a.buffer);
6
+ }
7
+ expose({
8
+ lazPerf(path) {
9
+ loader.lazPerf = path;
10
+ },
11
+ async parseChunk(data, options) {
12
+ const result = await loader.parseChunk(data, options);
13
+ return Transfer(result, transferable(result.attributes));
14
+ },
15
+ async parseFile(data, options) {
16
+ const result = await loader.parseFile(data, options);
17
+ return Transfer(result, transferable(result.attributes));
18
+ }
19
+ });
@@ -0,0 +1,21 @@
1
+ import load from "../Loader/Potree2Loader.js";
2
+ import loadBrotli from "../Loader/Potree2BrotliLoader.js";
3
+ import { expose, Transfer } from 'threads/worker';
4
+ function transfer(buffer, data) {
5
+ const transferables = [];
6
+ Object.keys(data.attributeBuffers).forEach(property => {
7
+ transferables.push(data.attributeBuffers[property].buffer);
8
+ });
9
+ transferables.push(buffer);
10
+ return transferables;
11
+ }
12
+ expose({
13
+ async parse(buffer, options) {
14
+ const data = await load(buffer, options);
15
+ return Transfer(data, transfer(buffer, data));
16
+ },
17
+ async parseBrotli(buffer, options) {
18
+ const data = await loadBrotli(buffer, options);
19
+ return Transfer(data, transfer(buffer, data));
20
+ }
21
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.43.2-next.9",
3
+ "version": "2.44.0",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "type": "module",
6
6
  "main": "lib/Main.js",
@@ -18,7 +18,7 @@
18
18
  "test-functional": "mocha -t 100000 --require test/hooks_functional.js --recursive test/functional",
19
19
  "test-with-coverage": "c8 -n src -r html cross-env npm run test-unit",
20
20
  "test-with-coverage_lcov": "c8 -n src --reporter=lcov cross-env npm run test-unit",
21
- "base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --file test/unit/bootstrap.js --loader=babel-register-esm",
21
+ "base-test-unit": "cross-env BABEL_DISABLE_CACHE=1 mocha --file test/unit/bootstrap.js --import=./config/babel-register/register.mjs",
22
22
  "build": "cross-env NODE_ENV=production webpack",
23
23
  "build-dev": "cross-env NODE_ENV=development webpack",
24
24
  "transpile": "cross-env BABEL_DISABLE_CACHE=1 babel src --out-dir lib",
@@ -58,26 +58,29 @@
58
58
  "homepage": "https://itowns.github.io/",
59
59
  "dependencies": {
60
60
  "@mapbox/mapbox-gl-style-spec": "^13.28.0",
61
- "@mapbox/vector-tile": "^1.3.1",
61
+ "@mapbox/vector-tile": "^2.0.3",
62
62
  "@tmcw/togeojson": "^5.8.1",
63
- "@tweenjs/tween.js": "^18.6.4",
63
+ "@tweenjs/tween.js": "^23.1.2",
64
+ "3d-tiles-renderer": "^0.3.37",
65
+ "brotli-compress": "^1.3.3",
64
66
  "copc": "^0.0.6",
65
- "earcut": "^2.2.4",
67
+ "earcut": "^3.0.0",
66
68
  "js-priority-queue": "^0.1.5",
67
- "pbf": "^3.2.1",
68
- "shpjs": "^4.0.4"
69
+ "pbf": "^4.0.1",
70
+ "shpjs": "^6.0.1",
71
+ "threads": "^1.7.0"
69
72
  },
70
73
  "peerDependencies": {
71
- "proj4": "^2.9.2",
72
- "three": "^0.159.0"
74
+ "proj4": "^2.11.0",
75
+ "three": "^0.165.0"
73
76
  },
74
77
  "devDependencies": {
75
- "@babel/cli": "^7.24.6",
76
- "@babel/core": "^7.24.6",
77
- "@babel/plugin-transform-runtime": "^7.24.6",
78
- "@babel/preset-env": "^7.24.6",
78
+ "@babel/cli": "^7.24.8",
79
+ "@babel/core": "^7.24.9",
80
+ "@babel/plugin-transform-runtime": "^7.24.7",
81
+ "@babel/preset-env": "^7.24.8",
79
82
  "@babel/register": "^7.24.6",
80
- "@types/three": "^0.159.0",
83
+ "@types/three": "^0.165.0",
81
84
  "@xmldom/xmldom": "^0.8.10",
82
85
  "babel-inline-import-loader": "^1.0.1",
83
86
  "babel-loader": "^9.1.3",
@@ -85,38 +88,37 @@
85
88
  "babel-plugin-minify-dead-code-elimination": "^0.5.2",
86
89
  "babel-plugin-minify-replace": "^0.5.0",
87
90
  "babel-plugin-module-extension-resolver": "^1.0.0",
88
- "babel-plugin-module-resolver": "^5.0.0",
89
- "babel-register-esm": "^1.2.5",
90
- "c8": "^9.1.0",
91
+ "babel-plugin-module-resolver": "^5.0.2",
92
+ "c8": "^10.1.2",
91
93
  "chalk": "^5.3.0",
92
- "chart.js": "^4.4.1",
94
+ "chart.js": "^4.4.3",
93
95
  "compare-func": "^2.0.0",
94
96
  "conventional-changelog-cli": "^4.1.0",
95
97
  "copyfiles": "^2.4.1",
96
- "core-js": "^3.34.0",
98
+ "core-js": "^3.37.1",
97
99
  "cross-env": "^7.0.3",
98
100
  "eslint": "^8.55.0",
99
101
  "eslint-config-airbnb-base": "^15.0.0",
100
- "eslint-import-resolver-webpack": "^0.13.8",
102
+ "eslint-import-resolver-babel-module": "^5.3.2",
101
103
  "eslint-plugin-import": "^2.29.0",
102
104
  "eslint-webpack-plugin": "^4.0.1",
103
105
  "github-url-from-git": "^1.5.0",
104
106
  "grunt": "^1.6.1",
105
107
  "grunt-bump": "^0.8.0",
106
- "https-proxy-agent": "^7.0.2",
107
- "jsdoc": "^4.0.2",
108
- "marked": "^11.0.1",
108
+ "https-proxy-agent": "^7.0.5",
109
+ "jsdoc": "^4.0.3",
109
110
  "mocha": "^10.2.0",
110
111
  "node-fetch": "^2.7.0",
111
- "proj4": "^2.9.2",
112
- "puppeteer": "^21.6.0",
112
+ "proj4": "^2.11.0",
113
+ "puppeteer": "^22.13.1",
113
114
  "q": "^1.5.1",
114
- "replace-in-file": "^7.0.2",
115
- "sinon": "^17.0.1",
116
- "three": "^0.159.0",
117
- "typescript": "^5.3.3",
118
- "webpack": "^5.89.0",
115
+ "replace-in-file": "^7.2.0",
116
+ "sinon": "^18.0.0",
117
+ "three": "^0.165.0",
118
+ "typescript": "^5.5.2",
119
+ "webgl-mock": "^0.1.7",
120
+ "webpack": "^5.93.0",
119
121
  "webpack-cli": "^5.1.4",
120
- "webpack-dev-server": "^4.15.1"
122
+ "webpack-dev-server": "^5.0.4"
121
123
  }
122
124
  }
@@ -1,88 +0,0 @@
1
- import * as THREE from 'three';
2
- import { GLTFLoader } from "../ThreeExtended/loaders/GLTFLoader.js";
3
- import { DRACOLoader } from "../ThreeExtended/loaders/DRACOLoader.js";
4
- import { KTX2Loader } from "../ThreeExtended/loaders/KTX2Loader.js";
5
- import LegacyGLTFLoader from "./deprecated/LegacyGLTFLoader.js";
6
- const matrixChangeUpVectorYtoZ = new THREE.Matrix4().makeRotationX(Math.PI / 2);
7
- export const glTFLoader = new GLTFLoader();
8
- export const legacyGLTFLoader = new LegacyGLTFLoader();
9
-
10
- /**
11
- * @module GLTFParser
12
- * @description Parses [glTF](https://www.khronos.org/gltf/) 1.0 and 2.0 files.
13
- *
14
- * Under the hood, glTF 2.0 files are parsed with THREE.GltfLoader() and GLTF 1.0 are parsed with the previous THREE
15
- * GltfLoader (for 1.0 glTF) that has been kept and maintained in iTowns.
16
- */
17
-
18
- /**
19
- * Enable loading gltf files with [Draco](https://google.github.io/draco/) geometry extension.
20
- *
21
- * @param {String} path path to draco library folder containing the JS and WASM decoder libraries. They can be found in
22
- * [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/draco).
23
- * @param {Object} [config] optional configuration for Draco decoder (see threejs'
24
- * [setDecoderConfig](https://threejs.org/docs/index.html?q=draco#examples/en/loaders/DRACOLoader.setDecoderConfig) that
25
- * is called under the hood with this configuration for details.
26
- */
27
- export function enableDracoLoader(path, config) {
28
- if (!path) {
29
- throw new Error('Path to draco folder is mandatory');
30
- }
31
- const dracoLoader = new DRACOLoader();
32
- dracoLoader.setDecoderPath(path);
33
- if (config) {
34
- dracoLoader.setDecoderConfig(config);
35
- }
36
- glTFLoader.setDRACOLoader(dracoLoader);
37
- }
38
-
39
- /**
40
- * Enable loading gltf files with [KTX2](https://www.khronos.org/ktx/) texture extension.
41
- *
42
- * @param {String} path path to ktx2 library folder containing the JS and WASM decoder libraries. They can be found in
43
- * [itowns examples](https://github.com/iTowns/itowns/tree/master/examples/libs/basis).
44
- * @param {THREE.WebGLRenderer} renderer the threejs renderer
45
- */
46
- export function enableKtx2Loader(path, renderer) {
47
- if (!path || !renderer) {
48
- throw new Error('Path to ktx2 folder and renderer are mandatory');
49
- }
50
- const ktx2Loader = new KTX2Loader();
51
- ktx2Loader.setTranscoderPath(path);
52
- ktx2Loader.detectSupport(renderer);
53
- glTFLoader.setKTX2Loader(ktx2Loader);
54
- }
55
- export default {
56
- /** Parses a gltf buffer to an object with threejs structures and applies a y-up to z-up conversion to align with
57
- * itowns convention. Essentially calls THREE.GltfLoader.parse() for glTF 2.0 files and the legacy threejs parser
58
- * for gtTF 1.0 files.
59
- * @param {ArrayBuffer} buffer - the glTF asset to parse, as an ArrayBuffer, JSON string or object.
60
- * @param {String} path - the base path from which to find subsequent glTF resources such as textures and .bin data files.
61
- * @return {Promise} - a promise that resolves with an object containing an Object that contains loaded parts:
62
- * .scene, .scenes, .cameras, .animations, and .asset.
63
- */
64
- parse(buffer, path) {
65
- return new Promise((resolve, reject) => {
66
- if (!buffer || !path) {
67
- reject(new Error('[GLTFParser]: Buffer and path are mandatory to parse a glTF.'));
68
- return;
69
- }
70
-
71
- // Apply y-up (gltf convention) to z-up (itowns convention) conversion
72
- const onload = gltf => {
73
- gltf.scene.applyMatrix4(matrixChangeUpVectorYtoZ);
74
- resolve(gltf);
75
- };
76
- const onError = e => {
77
- reject(new Error(`[GLTFParser]: Failed to parse gltf with error: ${e}`));
78
- };
79
- const headerView = new DataView(buffer, 0, 20);
80
- const version = headerView.getUint32(4, true);
81
- if (version === 1) {
82
- legacyGLTFLoader.parse(buffer, path, onload, onError);
83
- } else {
84
- glTFLoader.parse(buffer, path, onload, onError);
85
- }
86
- });
87
- }
88
- };
File without changes