minor test performance improvements

- ChunkHeightmap is now only calculated if dimension has light (aka. only in light tests)
- occlusion culling and light is just updated when dimension has light (world filling)
- ...
This commit is contained in:
Moritz Zwerger 2023-07-29 18:33:26 +02:00
parent bd549a1355
commit 9ec4eb8278
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
6 changed files with 9 additions and 8 deletions

View File

@ -91,6 +91,8 @@ object WorldTestUtil {
}
}
if (!dimension.light && !dimension.skyLight) return // no need for occlusion when light is ignored
if (superUnsafe) {
for (x in (start.x shr 4)..(end.x shr 4)) {
for (z in (start.z shr 4)..(end.z shr 4)) {
@ -107,10 +109,8 @@ object WorldTestUtil {
}
}
}
if (dimension.light || dimension.skyLight) {
recalculateLight(heightmap = true) // yah, might break the result, don't use fill if you want to test light
}
}
private val DATA = SectionDataProvider::class.java.getDeclaredField("data").apply { isAccessible = true }
}

View File

@ -18,6 +18,6 @@ import de.bixilon.minosoft.data.registries.dimension.DimensionProperties
object ChunkLightUtil {
fun DimensionProperties.hasSkyLight(): Boolean {
return this.skyLight || this.effects.skyLight
return this.light && this.skyLight
}
}

View File

@ -135,7 +135,8 @@ class ChunkManager(val world: World, chunkCapacity: Int = 0, prototypeCapacity:
size.onCreate(chunk.chunkPosition)
world.view.updateServerDistance()
val updates = hashSetOf<AbstractWorldUpdate>(ChunkCreateUpdate(chunk.chunkPosition, chunk))
val updates = HashSet<AbstractWorldUpdate>(9, 1.0f)
updates += ChunkCreateUpdate(chunk.chunkPosition, chunk)
for (index in 0 until ChunkNeighbours.COUNT) {
val offset = ChunkNeighbours.OFFSETS[index]