@jdultra/threedtiles 11.1.1 → 11.1.3

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/README.md CHANGED
@@ -98,7 +98,7 @@ Contact: emeric.beaufays@jdultra.com
98
98
  - Occlusion culling
99
99
  - Instanced tilesets
100
100
  - Center tileset and re-orient geolocated data
101
- - draco and ktx2 compression support
101
+ - quantization, draco, mshopt and ktx2 compression support
102
102
  - point clouds (only through gltf/glb tiles)
103
103
  - loading strategy options ("incremental" or "immediate")
104
104
 
@@ -541,8 +541,9 @@ const ogc3DTile = new InstancedOGC3DTile({
541
541
  ogc3DTile.updateMatrix();
542
542
  },1000)
543
543
  ```
544
- ### Draco and Ktx2
545
- Compressed meshes via Draco and compressed textures in Ktx2 format are supported automatically using the threejs plugins.
544
+ ### Meshopt, Draco and Ktx2
545
+ Compressed meshes via Draco and compressed textures in Ktx2 format are supported automatically using the threejs plugins by passing the renderer at initialization.
546
+ The ktx and draco loader can also be passed manually (see jsdoc)
546
547
  KTX uses an external wasm loaded at runtime so if you have trouble packaging your app correctly, check out the
547
548
  [Getting started](https://drive.google.com/file/d/1kJ-yfYmy8ShOMMPPXgqW2gMgGkLOIidf/view?usp=share_link) project for a sample webpack configuration.
548
549
 
@@ -562,3 +563,27 @@ animate();
562
563
 
563
564
  However, if you have several OGC3DTiles loaded or when you use instancedTilesets, you may have hundreds or even thousands of LOD trees that need to be updated individually. In order to preserve frame-rate,
564
565
  you'll want to avoid updating every single tileset on every frame.
566
+
567
+ ### Memory
568
+ This is especially important for iOS that limits the memory per tab quite harshly and doesn't allow growing the memory allocated to a tab.
569
+
570
+ Once a mesh is loaded, the mesh and texture data stays in CPU memory which isn't necessary unless one intends to modify it.
571
+ A nice trick is to allow this data to be garbage collected. You might do something like this in the mesh callback:
572
+
573
+ ```
574
+ const tileLoader = new TileLoader({
575
+ ...
576
+ meshCallback: (mesh, geometricError) => {
577
+ mesh.onAfterRender = ()=>{
578
+ if(mesh.geometry.attributes.position) mesh.geometry.attributes.position.data.array = null
579
+ if(mesh.geometry.attributes.uv) mesh.geometry.attributes.position.data.array = null
580
+ if(mesh.geometry.attributes.normal) mesh.geometry.attributes.position.data.array = null
581
+ if(mesh.material.map) mesh.material.map.mipmaps = null;
582
+ }
583
+ }
584
+ });
585
+ ```
586
+
587
+ Be sure to call this in the mesh onAfterRender callback to make sure the data is on the GPU.
588
+
589
+ Depending on the mesh and texture type, different properties might hold data to be nullified so it can be garbage collected. It's up to the user to debug and see what geometry or material properties hold references to large data.