fluid renderer: only query biome and height when actually rendering

The biome cache is now much smaller now, because if a fluid block is surrounded it won't get calculated
This commit is contained in:
Moritz Zwerger 2023-12-08 19:25:30 +01:00
parent 5e1bdbff64
commit 2bf802c961
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4

View File

@ -84,14 +84,9 @@ class FluidSectionMesher(
val fluid = state.getFluid() ?: continue
val model = fluid.model ?: continue
val height = fluid.getHeight(state)
position = Vec3i(offsetX + x, offsetY + y, offsetZ + z)
tint = tints.getFluidTint(chunk, fluid, height, position.x, position.y, position.z) ?: Colors.WHITE
fun isSideCovered(direction: Directions): Boolean {
val neighbourPosition = position + direction
val neighbour = direction.getBlock(x, y, z, section, neighbours) ?: return false
if (fluid.matches(neighbour)) {
@ -116,9 +111,11 @@ class FluidSectionMesher(
isSideCovered(Directions.EAST),
)
if (skip.isTrue) {
continue
}
if (skip.isTrue) continue
position = Vec3i(offsetX + x, offsetY + y, offsetZ + z)
val height = fluid.getHeight(state)
tint = tints.getFluidTint(chunk, fluid, height, position.x, position.y, position.z) ?: Colors.WHITE
val cornerHeights = floatArrayOf(
getCornerHeight(chunk, chunkPosition, position, fluid),