From 65f88a90a22de8dfe0154edabec19e142ef666b9 Mon Sep 17 00:00:00 2001 From: Moritz Zwerger Date: Sat, 23 Dec 2023 00:47:18 +0100 Subject: [PATCH] fix fluid renderer top face invalidly culled --- .../gui/rendering/chunk/mesher/FluidSectionMesher.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/mesher/FluidSectionMesher.kt b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/mesher/FluidSectionMesher.kt index 01c75330c..21b45c3e1 100644 --- a/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/mesher/FluidSectionMesher.kt +++ b/src/main/java/de/bixilon/minosoft/gui/rendering/chunk/mesher/FluidSectionMesher.kt @@ -84,12 +84,15 @@ class FluidSectionMesher( val model = fluid.model ?: continue + val height = fluid.getHeight(state) + fun isSideCovered(direction: Directions): Boolean { val neighbour = direction.getBlock(x, y, z, section, neighbours) ?: return false if (fluid.matches(neighbour)) { return true } + if (direction == Directions.UP && height < 0.99f) return false return FaceCulling.canCull(state, model.properties, direction, neighbour) } @@ -106,7 +109,6 @@ class FluidSectionMesher( 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_RGB val cornerHeights = floatArrayOf( @@ -118,7 +120,7 @@ class FluidSectionMesher( val offsetPosition = Vec3(position - cameraOffset) - if (!skip[Directions.O_UP]) { + if (cornerHeights[0] < 1.0f && !skip[Directions.O_UP]) { val velocity = fluid.getVelocity(state, position, chunk) val still = velocity.x == 0.0 && velocity.z == 0.0 val texture: Texture