all-is-cubes icon indicating copy to clipboard operation
all-is-cubes copied to clipboard

Block mesh caching

Open kpreid opened this issue 1 year ago • 0 comments

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 MeshJobQueue background 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.

kpreid avatar May 25 '24 17:05 kpreid