itowns 2.44.3-next.28 → 2.44.3-next.29

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.
@@ -54,10 +54,11 @@
54
54
  "three/addons/": "https://cdn.jsdelivr.net/npm/three@0.165.0/examples/jsm/"
55
55
  }
56
56
  }
57
- </script>
57
+ </script>
58
58
 
59
59
  <script type="module">
60
60
  import { AmbientLight } from 'three';
61
+ import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
61
62
  import {
62
63
  zoomToLayer,
63
64
  fillHTMLWithPickingInfo,
@@ -95,9 +96,11 @@
95
96
 
96
97
  // Enable various compression support for 3D Tiles tileset:
97
98
  // - `KHR_draco_mesh_compression` mesh compression extension
98
- // - `KHR_texture_basisu` texture compresion extension
99
+ // - `KHR_texture_basisu` texture compression extension
100
+ // - `EXT_meshopt_compression` data compression extension
99
101
  itowns.enableDracoLoader('./libs/draco/');
100
102
  itowns.enableKtx2Loader('./lib/basis/', view.renderer);
103
+ itowns.enableMeshoptDecoder(MeshoptDecoder);
101
104
 
102
105
  // Add ambient light to globally illuminates all objects
103
106
  const light = new AmbientLight(0x404040, 40);
@@ -105,6 +105,27 @@ export function enableKtx2Loader(path, renderer) {
105
105
  ktx2Loader.detectSupport(renderer);
106
106
  itownsGLTFLoader.setKTX2Loader(ktx2Loader);
107
107
  }
108
+
109
+ /**
110
+ * Enable loading 3D Tiles and GLTF with
111
+ * [meshopt](https://github.com/KhronosGroup/glTF/blob/main/extensions/2.0/Vendor/EXT_meshopt_compression/README.md) compression extension.
112
+ *
113
+ * @param {MeshOptDecoder.constructor} MeshOptDecoder - The Meshopt decoder
114
+ * module.
115
+ *
116
+ * @example
117
+ * import * as itowns from 'itowns';
118
+ * import { MeshoptDecoder } from 'three/addons/libs/meshopt_decoder.module.js';
119
+ *
120
+ * // Enable support of EXT_meshopt_compression
121
+ * itowns.enableMeshoptDecoder(MeshoptDecoder);
122
+ */
123
+ export function enableMeshoptDecoder(MeshOptDecoder) {
124
+ if (!MeshOptDecoder) {
125
+ throw new Error('MeshOptDecoder module is mandatory');
126
+ }
127
+ itownsGLTFLoader.setMeshoptDecoder(MeshOptDecoder);
128
+ }
108
129
  class OGC3DTilesLayer extends GeometryLayer {
109
130
  /**
110
131
  * Layer for [3D Tiles](https://www.ogc.org/standard/3dtiles/) datasets.
package/lib/Main.js CHANGED
@@ -53,7 +53,7 @@ export { default as PointCloudLayer } from "./Layer/PointCloudLayer.js";
53
53
  export { default as PotreeLayer } from "./Layer/PotreeLayer.js";
54
54
  export { default as Potree2Layer } from "./Layer/Potree2Layer.js";
55
55
  export { default as C3DTilesLayer, C3DTILES_LAYER_EVENTS } from "./Layer/C3DTilesLayer.js";
56
- export { default as OGC3DTilesLayer, OGC3DTILES_LAYER_EVENTS, enableDracoLoader, enableKtx2Loader } from "./Layer/OGC3DTilesLayer.js";
56
+ export { default as OGC3DTilesLayer, OGC3DTILES_LAYER_EVENTS, enableDracoLoader, enableKtx2Loader, enableMeshoptDecoder } from "./Layer/OGC3DTilesLayer.js";
57
57
  export { default as TiledGeometryLayer } from "./Layer/TiledGeometryLayer.js";
58
58
  export { default as OrientedImageLayer } from "./Layer/OrientedImageLayer.js";
59
59
  export { STRATEGY_MIN_NETWORK_TRAFFIC, STRATEGY_GROUP, STRATEGY_PROGRESSIVE, STRATEGY_DICHOTOMY } from "./Layer/LayerUpdateStrategy.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "itowns",
3
- "version": "2.44.3-next.28",
3
+ "version": "2.44.3-next.29",
4
4
  "description": "A JS/WebGL framework for 3D geospatial data visualization",
5
5
  "type": "module",
6
6
  "main": "lib/Main.js",