It is automatically enqueued for unloading when calling `this.mesh = null`.
```
java.lang.IllegalStateException: Vertex buffer is not uploaded: UNLOADED
at de.bixilon.minosoft.gui.rendering.system.opengl.buffer.vertex.OpenGlVertexBuffer.unload(OpenGlVertexBuffer.kt:104)
at de.bixilon.minosoft.gui.rendering.util.mesh.Mesh.unload(Mesh.kt:33)
at de.bixilon.minosoft.gui.rendering.entities.feature.mesh.MeshedFeature.enqueueUnload$lambda$0(MeshedFeature.kt:48)
at de.bixilon.kutil.concurrent.queue.Queue.work(Queue.kt:46)
at de.bixilon.kutil.concurrent.queue.Queue.work$default(Queue.kt:36)
at de.bixilon.minosoft.gui.rendering.entities.EntitiesRenderer.postPrepareDraw(EntitiesRenderer.kt:83)
at de.bixilon.minosoft.gui.rendering.renderer.renderer.RendererManager.prepare(RendererManager.kt:116)
at de.bixilon.minosoft.gui.rendering.renderer.renderer.RendererManager.draw(RendererManager.kt:122)
at de.bixilon.minosoft.gui.RenderLoop.loop(RenderLoop.kt:75)
at de.bixilon.minosoft.gui.RenderLoop.startLoop(RenderLoop.kt:131)
at de.bixilon.minosoft.gui.rendering.Rendering.startRenderWindow(Rendering.kt:79)
at de.bixilon.minosoft.gui.rendering.Rendering.startRenderWindowThread$lambda$0(Rendering.kt:68)
at java.base/java.lang.Thread.run(Thread.java:1583)
```
Fixes GH-44
This only happens with custom servers, vanilla does not use the single chunk packet, only the batched chunk packet (always 5 afaik). This was seen on via backwards. Reported by Couleur on matrix.
I refactored this, somehow broke it and did not notice. Thanks to polarite for reporting.
Mesh invalidation happens when you go e.g. into water and the the mesh gets recrated, but never loaded. An assertion is hit (mesh not loaded yet) when attempting to draw it.
So, the idea was/is great and when just standing or barely moving this makes a performance difference (less work on cpu and gpu), but the constant remeshing kills performance ultimately.
There might be various ways to solve this (or combined):
- Async GPU mesh loading: https://gitlab.bixilon.de/bixilon/minosoft/-/merge_requests/121
- Way faster meshing on the CPU
- way less different types of LOD (just level 1/2 maybe 3)
- Increase effect (merge multiple blocks; reduce the number of vertices to a minimum; don't mesh every block)
- maybe more clever ways?
- mesh twice: lod and full (just swap them; not remesh then or so)
- merge similaur distances to not cause multiple remeshings when crossing borders
This commit disables them for now until something is worked out.