kpreid / all-is-cubes

Yet another block/voxel game; in this one the blocks are made out of blocks. Runs in browsers on WebGL+WebAssembly.
https://kpreid.dreamwidth.org/tag/all+is+cubes
Apache License 2.0
147 stars 8 forks source link

Block mesh caching #494

Open kpreid opened 1 month ago

kpreid commented 1 month ago

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: