@jdultra/threedtiles 13.1.6 → 13.1.7

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
@@ -648,52 +648,3 @@ you'll want to avoid updating every single tileset on every frame.
648
648
  #### Mobile performance
649
649
  just a note because this is valid for any heavy webgl app. mobiles throttle automatically when it deems the app heavy.
650
650
  if you control frame-rate manually by only doing updates and renders at 30fps, mobile apps will run more smoothly because the automatic throttling, which is very un-smooth, doesn't kick in as much.
651
-
652
- ### Memory
653
- 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.
654
-
655
- Once a mesh is loaded, the mesh and texture data stays in CPU memory which isn't necessary unless one intends to modify it.
656
- A nice trick is to allow this data to be garbage collected. However, three.js doesn't have API for this and the internal references are hard to find but this code
657
- seems to free a limited amount of memory:
658
-
659
- ```
660
- const tileLoader = new TileLoader({
661
- ...
662
- const previousOnAfterRender = mesh.onAfterRender;
663
- mesh.onAfterRender = () => {
664
- if(previousOnAfterRender) previousOnAfterRender();
665
- if(mesh.geometry && mesh.geometry.attributes){
666
- if (mesh.geometry.attributes.position) {
667
- mesh.geometry.attributes.position.array = undefined;
668
- if (mesh.geometry.attributes.position.data) {
669
- mesh.geometry.attributes.position.data.array = undefined;
670
- }
671
- }
672
- if (mesh.geometry.attributes.uv){
673
- mesh.geometry.attributes.uv.array = undefined;
674
- if (mesh.geometry.attributes.uv.data) {
675
- mesh.geometry.attributes.uv.data.array = undefined;
676
- }
677
- }
678
- if (mesh.geometry.attributes.normal) {
679
- mesh.geometry.attributes.normal.array = undefined;
680
- if (mesh.geometry.attributes.normal.data) {
681
- mesh.geometry.attributes.normal.data.array = undefined;
682
- }
683
- }
684
- }
685
- if (mesh.material && mesh.material.map) {
686
- mesh.material.map.mipmaps = undefined;
687
- if (mesh.material.map.source) {
688
- mesh.material.map.source.data = undefined;
689
- }
690
- }
691
-
692
- mesh.onAfterRender = previousOnAfterRender;
693
- }
694
- });
695
- ```
696
-
697
- Be sure to call this in the mesh onAfterRender callback to make sure the data is already on GPU.
698
-
699
- 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.