Fix the API seeing the wrong far clip plane

This commit is contained in:
James Seibel
2024-02-10 22:02:15 -06:00
parent 97e7f05636
commit c718733104
2 changed files with 6 additions and 5 deletions
@@ -96,8 +96,8 @@ public class SSAOApplyShader extends AbstractShaderRenderer
if (this.gFarUniform >= 0)
{
float far = (float) ((RenderUtil.getFarClipPlaneDistanceInBlocks() + LodUtil.REGION_WIDTH) * Math.sqrt(2));
GL32.glUniform1f(this.gFarUniform, far);
float farClipPlane = RenderUtil.getFarClipPlaneDistanceInBlocks();
GL32.glUniform1f(this.gFarUniform, farClipPlane);
}
}
@@ -153,8 +153,7 @@ public class RenderUtil
nearClipDist = 0.1f;
}
int farPlaneDistanceInBlocks = RenderUtil.getFarClipPlaneDistanceInBlocks();
float farClipDist = (float) ((farPlaneDistanceInBlocks + LodUtil.REGION_WIDTH) * Math.sqrt(2));
float farClipDist = (float) RenderUtil.getFarClipPlaneDistanceInBlocks();
// Create a copy of the current matrix, so it won't be modified.
Mat4f lodProj = mcProjMat.copy();
@@ -228,7 +227,9 @@ public class RenderUtil
public static int getFarClipPlaneDistanceInBlocks()
{
int lodChunkDist = Config.Client.Advanced.Graphics.Quality.lodChunkRenderDistanceRadius.get();
return lodChunkDist * LodUtil.CHUNK_WIDTH;
int lodBlockDist = lodChunkDist * LodUtil.CHUNK_WIDTH;
// sqrt 2 to prevent the corners from being cut off
return (int)((lodBlockDist + LodUtil.REGION_WIDTH) * Math.sqrt(2));
}
/** @return false if LODs shouldn't be rendered for any reason */