all-is-cubes
all-is-cubes copied to clipboard
Block mesh caching
Currently, ChunkedSpaceMesh will keep meshes for exactly and only the blocks currently in the Space's block palette. This is sometimes inefficient because a block might disappear and reappear; additionally, the same block might appear in multiple Spaces, such as in the UI, so computing it again is wasteful and also a visible glitch sometimes.
Therefore, we should cache block meshes that aren't currently visible — and possibly even some that are not yet visible. This is not hard in principle, but has some details:
- Integration with
MeshJobQueuebackground computation - Cache size and eviction policy (since we are now storing more data than strictly necessary for rendering)
- Efficiently looking up the right cache keys, without spending too much time comparing voxels.