mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 03:44:54 -04:00
fix mesh loading bug
This commit is contained in:
parent
1c94e20cf4
commit
8f010c6b84
@ -101,6 +101,7 @@ class WorldRenderer(
|
||||
private val culledQueue: MutableMap<Vec2i, MutableSet<Int>> = 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<WorldQueueItem> = 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
|
||||
|
Loading…
x
Reference in New Issue
Block a user