world renderer: work on meshing queue every frame

This should fix chunks only being prepared when changing the frustum and "wrongly" failing tests
This commit is contained in:
Bixilon 2023-02-06 11:06:53 +01:00
parent d4f065b356
commit 5713f2dcaf
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
2 changed files with 5 additions and 2 deletions

View File

@ -203,6 +203,9 @@ class WorldRenderer(
lock.unlock()
}
override fun prePrepareDraw() {
meshingQueue.work()
}
override fun postPrepareDraw() {
if (clearVisibleNextFrame) {

View File

@ -1,6 +1,6 @@
/*
* Minosoft
* Copyright (C) 2020-2022 Moritz Zwerger
* Copyright (C) 2020-2023 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
*
@ -21,7 +21,7 @@ import de.bixilon.minosoft.gui.rendering.world.WorldRenderer
class MeshPrepareTaskManager(
private val renderer: WorldRenderer,
val max: Int = maxOf(DefaultThreadPool.threadCount - 2, 1),
val max: Int = minOf(maxOf(Runtime.getRuntime().availableProcessors() - 1, 1), DefaultThreadPool.threadCount - 1),
) {
private val tasks: MutableSet<MeshPrepareTask> = mutableSetOf() // current running section preparing tasks
private val lock = SimpleLock()