From a1c720d588d25779ab43b30ad83910d54716ed96 Mon Sep 17 00:00:00 2001 From: James Seibel Date: Tue, 31 Aug 2021 21:05:53 -0500 Subject: [PATCH] Fix a issue where the projection matrix was given a depth of 0 This caused the depth buffer to stop working. --- src/main/java/com/seibel/lod/render/LodRenderer.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/main/java/com/seibel/lod/render/LodRenderer.java b/src/main/java/com/seibel/lod/render/LodRenderer.java index ed3031a48..4753b0f93 100644 --- a/src/main/java/com/seibel/lod/render/LodRenderer.java +++ b/src/main/java/com/seibel/lod/render/LodRenderer.java @@ -66,7 +66,7 @@ import net.minecraft.util.math.vector.Vector3f; * This is where LODs are draw to the world. * * @author James Seibel - * @version 8-30-2021 + * @version 8-31-2021 */ public class LodRenderer { @@ -246,6 +246,7 @@ public class LodRenderer GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_LINE); else GL11.glPolygonMode(GL11.GL_FRONT_AND_BACK, GL11.GL_FILL); + GL11.glDisable(GL11.GL_TEXTURE_2D); GL11.glEnable(GL11.GL_CULL_FACE); GL11.glEnable(GL11.GL_COLOR_MATERIAL); @@ -261,12 +262,15 @@ public class LodRenderer GL11.glGetFloatv(GL11.GL_PROJECTION_MATRIX, defaultProjMatrix); Matrix4f modelViewMatrix = generateModelViewMatrix(partialTicks); - + + // required for setupFog and setupProjectionMatrix + farPlaneBlockDistance = LodConfig.CLIENT.lodChunkRenderDistance.get() * LodUtil.CHUNK_WIDTH; + setupProjectionMatrix(partialTicks); setupLighting(lodDim, partialTicks); NearFarFogSettings fogSettings = determineFogSettings(); - + // determine the current fog settings so they can be // reset after drawing the LODs float defaultFogStartDist = GL11.glGetFloat(GL11.GL_FOG_START); @@ -395,8 +399,6 @@ public class LodRenderer glFogDistanceMode = NVFogDistance.GL_EYE_PLANE_ABSOLUTE_NV; } - farPlaneBlockDistance = LodConfig.CLIENT.lodChunkRenderDistance.get() * LodUtil.CHUNK_WIDTH; - // the multipliers are percentages // of the regular view distance. if (fogDistance == FogDistance.FAR)