Add a advanced graphics option to use a extended near clip plain

This prevents some overdraw issues but causes LODs in the ocean to render incorrectly.
This commit is contained in:
James Seibel
2021-10-25 22:20:00 -05:00
parent 936a3a7ece
commit 4ad081e0c6
2 changed files with 12 additions and 2 deletions
@@ -53,7 +53,7 @@ import net.minecraftforge.fml.config.ModConfig;
* This handles any configuration the user has access to.
* @author Leonardo Amato
* @author James Seibel
* @version 10-24-2021
* @version 10-25-2021
*/
@Mod.EventBusSubscriber
public class LodConfig
@@ -238,6 +238,8 @@ public class LodConfig
public final ForgeConfigSpec.EnumValue<GpuUploadMethod> gpuUploadMethod;
public final ForgeConfigSpec.BooleanValue useExtendedNearClipPlane;
AdvancedGraphicsOption(ForgeConfigSpec.Builder builder)
{
@@ -299,6 +301,14 @@ public class LodConfig
+ " " + GpuUploadMethod.BUFFER_MAPPING + ": Slow rendering but won't stutter when uploading. Possibly better than " + GpuUploadMethod.SUB_DATA + " if using a integrated GPU. \n")
.defineEnum("GPU Upload Method", GpuUploadMethod.BUFFER_STORAGE);
// This is a temporary fix (like vanilla overdraw)
// hopefully we can remove both once we get individual chunk rendering figured out
useExtendedNearClipPlane = builder
.comment("\n\n"
+ " Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n"
+ " especially when in/near an ocean. \n")
.define("Use Extended Near Clip Plane", false);
builder.pop();
}
@@ -568,7 +568,7 @@ public class LodRenderer
Matrix4f.perspective(
getFov(partialTicks, true),
(float) this.mc.getWindow().getScreenWidth() / (float) this.mc.getWindow().getScreenHeight(),
vanillaBlockRenderedDistance / 5,
LodConfig.CLIENT.graphics.advancedGraphicsOption.useExtendedNearClipPlane.get() ? vanillaBlockRenderedDistance / 5 : 1,
farPlaneBlockDistance * LodUtil.CHUNK_WIDTH / 2);
// get Minecraft's un-edited projection matrix