diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/world/WorldRenderer.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/world/WorldRenderer.kt index 3d192e866..1e5b32588 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/world/WorldRenderer.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/world/WorldRenderer.kt @@ -101,6 +101,7 @@ class WorldRenderer( private val culledQueue: MutableMap> = mutableMapOf() // Chunk sections that can be prepared or have changed, but are not required to get rendered yet (i.e. culled chunks) private val culledQueueLock = ReadWriteLock() + // ToDo: Sometimes if you clear the chunk cache a ton of times, the workers are maxed out and nothing happens anymore val maxMeshesToLoad = 100 // ToDo: Should depend on the system memory and other factors. private val meshesToLoad: MutableList = synchronizedListOf() // prepared meshes, that can be loaded in the (next) frame private val meshesToLoadLock = ReadWriteLock() @@ -370,6 +371,7 @@ class WorldRenderer( if (mesh.clearEmpty() == 0) { return@Runnable end() } + item.mesh = mesh meshesToLoadLock.lock() locked = true meshesToLoad.removeAll { it == item } // Remove duplicates