From 9bd19b92541270eebfff7fe0a91b358712f109cf Mon Sep 17 00:00:00 2001 From: Glease <4586901+Glease@users.noreply.github.com> Date: Fri, 9 Sep 2022 17:43:12 +0800 Subject: [PATCH] fix frustrum culling using wrong bounding box --- .../java/com/gtnewhorizon/structurelib/ClientProxy.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java b/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java index 6eecee45..74626d54 100644 --- a/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java +++ b/src/main/java/com/gtnewhorizon/structurelib/ClientProxy.java @@ -268,7 +268,11 @@ public class ClientProxy extends CommonProxy { private static class HintParticleInfo { private final World w; + // these are the block coordinate for e.g. w.getBlock() private final int x, y, z; + // these are the lower bounds for rendering. the upper bound would be X + size + // currently size is fixed to be 0.5 + // it is not made into a constants because this will allow for easy changing during debug private final double X, Y, Z; private final IIcon[] icons; private short[] tint; @@ -319,7 +323,7 @@ public class ClientProxy extends CommonProxy { } public boolean isInFrustrum(Frustrum frustrum) { - return frustrum.isBoxInFrustum(x, y, z, X, Y, Z); + return frustrum.isBoxInFrustum(X, Y, Z, X + 0.5, Y + 0.5, Z + 0.5); } public void draw(Tessellator tes) {