mirror of
https://gitlab.bixilon.de/bixilon/minosoft.git
synced 2025-09-18 11:54:59 -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 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()
|
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.
|
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 meshesToLoad: MutableList<WorldQueueItem> = synchronizedListOf() // prepared meshes, that can be loaded in the (next) frame
|
||||||
private val meshesToLoadLock = ReadWriteLock()
|
private val meshesToLoadLock = ReadWriteLock()
|
||||||
@ -370,6 +371,7 @@ class WorldRenderer(
|
|||||||
if (mesh.clearEmpty() == 0) {
|
if (mesh.clearEmpty() == 0) {
|
||||||
return@Runnable end()
|
return@Runnable end()
|
||||||
}
|
}
|
||||||
|
item.mesh = mesh
|
||||||
meshesToLoadLock.lock()
|
meshesToLoadLock.lock()
|
||||||
locked = true
|
locked = true
|
||||||
meshesToLoad.removeAll { it == item } // Remove duplicates
|
meshesToLoad.removeAll { it == item } // Remove duplicates
|
||||||
|
Loading…
x
Reference in New Issue
Block a user