rename config extendedNearClip -> overdrawPrevention
Also add a few new options for it
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod (formerly the LOD Mod),
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2022 James Seibel
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package com.seibel.lod.api.enums.config;
|
||||
|
||||
/**
|
||||
* NONE <br>
|
||||
* LIGHT <br>
|
||||
* MEDIUM <br>
|
||||
* HEAVY <br> <br>
|
||||
*/
|
||||
public enum EOverdrawPrevention
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
NONE,
|
||||
LIGHT,
|
||||
MEDIUM,
|
||||
HEAVY;
|
||||
|
||||
}
|
||||
Vendored
+1
-2
@@ -24,7 +24,6 @@ import com.seibel.lod.api.interfaces.config.IDhApiConfigValue;
|
||||
import com.seibel.lod.api.interfaces.config.client.IDhApiGraphicsConfig;
|
||||
import com.seibel.lod.api.objects.config.DhApiConfigValue;
|
||||
import com.seibel.lod.coreapi.util.converters.RenderModeEnabledConverter;
|
||||
import com.seibel.lod.core.config.Config;
|
||||
import com.seibel.lod.api.enums.rendering.ERendererMode;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Graphics.Quality;
|
||||
import com.seibel.lod.core.config.Config.Client.Advanced.Debugging;
|
||||
@@ -94,7 +93,7 @@ public class DhApiGraphicsConfig implements IDhApiGraphicsConfig
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Boolean> getUseExtendedNearClipPlane()
|
||||
{ return new DhApiConfigValue<>(AdvancedGraphics.useExtendedNearClipPlane); }
|
||||
{ return new DhApiConfigValue<>(AdvancedGraphics.overdrawPrevention); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<Double> getBrightnessMultiplier()
|
||||
|
||||
@@ -497,12 +497,18 @@ public class Config
|
||||
// + "Disable this if you see LODs disappearing at the corners of your vision.")
|
||||
// .build();
|
||||
|
||||
// TODO replace with better options
|
||||
public static ConfigEntry<Boolean> useExtendedNearClipPlane = new ConfigEntry.Builder<Boolean>()
|
||||
.set(true)
|
||||
public static ConfigEntry<EOverdrawPrevention> overdrawPrevention = new ConfigEntry.Builder<EOverdrawPrevention>()
|
||||
.set(EOverdrawPrevention.MEDIUM)
|
||||
.comment(""
|
||||
+ "Will prevent some overdraw issues, but may cause nearby fake chunks to render incorrectly \n"
|
||||
+ " especially when in/near an ocean.")
|
||||
+ "Determines how far Distant Horizon's near clip plane will render. \n"
|
||||
+ "\n"
|
||||
+ "Higher values will prevent LODs from rendering behind vanilla blocks at a higher distance,\n"
|
||||
+ "but may cause holes to appear in the LODs. \n"
|
||||
+ "Holes are most likely at the left and right edges of the screen \n"
|
||||
+ "when flying through unloaded terrain. \n"
|
||||
+ "\n"
|
||||
+ "Increasing the vanilla render distance increases the effectiveness of these options."
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.build();
|
||||
|
||||
@@ -526,7 +532,6 @@ public class Config
|
||||
+ "2 = very saturated")
|
||||
.build();
|
||||
|
||||
// TODO replace with better options
|
||||
public static ConfigEntry<Boolean> enableCaveCulling = new ConfigEntry.Builder<Boolean>()
|
||||
.set(true)
|
||||
.comment(""
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
|
||||
package com.seibel.lod.core.util;
|
||||
|
||||
import com.seibel.lod.api.enums.config.EOverdrawPrevention;
|
||||
import com.seibel.lod.core.level.IDhClientLevel;
|
||||
import com.seibel.lod.core.world.IDhClientWorld;
|
||||
import com.seibel.lod.core.api.internal.SharedApi;
|
||||
@@ -176,20 +177,48 @@ public class RenderUtil
|
||||
|
||||
public static float getNearClipPlaneDistanceInBlocks(float partialTicks)
|
||||
{
|
||||
int vanillaBlockRenderedDistance = MC_RENDER.getRenderDistance() * LodUtil.CHUNK_WIDTH;
|
||||
int chunkRenderDistance = MC_RENDER.getRenderDistance();
|
||||
if (chunkRenderDistance % 2 == 0)
|
||||
{
|
||||
chunkRenderDistance += 1;
|
||||
}
|
||||
|
||||
int vanillaBlockRenderedDistance = chunkRenderDistance * LodUtil.CHUNK_WIDTH;
|
||||
vanillaBlockRenderedDistance *= 2;
|
||||
|
||||
float nearClipPlane;
|
||||
if (Config.Client.Advanced.Debugging.lodOnlyMode.get())
|
||||
{
|
||||
nearClipPlane = 0.1f;
|
||||
}
|
||||
else if (Config.Client.Advanced.Graphics.AdvancedGraphics.useExtendedNearClipPlane.get())
|
||||
else
|
||||
{
|
||||
nearClipPlane = Math.min(vanillaBlockRenderedDistance - LodUtil.CHUNK_WIDTH, (float) 8 * LodUtil.CHUNK_WIDTH); // allow a max near clip plane of 8 chunks
|
||||
}
|
||||
else
|
||||
{
|
||||
nearClipPlane = 16f;
|
||||
// TODO make this option dependent on player speed.
|
||||
// if the player is flying quickly, lower the near clip plane to account for slow chunk loading.
|
||||
// If the player is moving quickly they are less likely to notice overdraw.
|
||||
|
||||
EOverdrawPrevention clipPlaneDistance = Config.Client.Advanced.Graphics.AdvancedGraphics.overdrawPrevention.get();
|
||||
switch (clipPlaneDistance)
|
||||
{
|
||||
default: // shouldn't be necessary, just here to make the compiler happy
|
||||
case NONE:
|
||||
nearClipPlane = 0.1f;
|
||||
break;
|
||||
|
||||
case LIGHT:
|
||||
nearClipPlane = vanillaBlockRenderedDistance * 0.25f;
|
||||
break;
|
||||
|
||||
case MEDIUM:
|
||||
nearClipPlane = vanillaBlockRenderedDistance * 0.4f;
|
||||
break;
|
||||
|
||||
|
||||
case HEAVY:
|
||||
// recommend render distance ot 6 or higher, otherwise holes may appear
|
||||
nearClipPlane = vanillaBlockRenderedDistance * 0.6f;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// modify the based on the player's FOV
|
||||
|
||||
@@ -225,9 +225,9 @@
|
||||
"lod.config.client.advanced.graphics.advancedGraphics":
|
||||
"Advanced Graphics Options",
|
||||
|
||||
"lod.config.client.advanced.graphics.advancedGraphics.useExtendedNearClipPlane":
|
||||
"Use extended near clip plane",
|
||||
"lod.config.client.advanced.graphics.advancedGraphics.useExtendedNearClipPlane.@tooltip":
|
||||
"lod.config.client.advanced.graphics.advancedGraphics.overdrawPrevention":
|
||||
"Overdraw Prevention",
|
||||
"lod.config.client.advanced.graphics.advancedGraphics.overdrawPrevention.@tooltip":
|
||||
"Enabling this will prevent some overdraw issues,\nbut may cause nearby LODs to render incorrectly, especially when near fancy leaves or non-full blocks.\nLess noticeable with a longer vanilla render distance.",
|
||||
"lod.config.client.advanced.graphics.advancedGraphics.brightnessMultiplier":
|
||||
"Brightness Multiplier",
|
||||
@@ -598,6 +598,15 @@
|
||||
"lod.config.enum.EBlocksToAvoid.NON_COLLIDING":
|
||||
"Non-Colliding",
|
||||
|
||||
"lod.config.enum.EOverdrawPrevention.NONE":
|
||||
"None",
|
||||
"lod.config.enum.EOverdrawPrevention.LIGHT":
|
||||
"Light",
|
||||
"lod.config.enum.EOverdrawPrevention.MEDIUM":
|
||||
"Medium",
|
||||
"lod.config.enum.EOverdrawPrevention.HEAVY":
|
||||
"Heavy",
|
||||
|
||||
"lod.config.enum.EServerFolderNameMode.NAME_ONLY":
|
||||
"Name Only",
|
||||
"lod.config.enum.EServerFolderNameMode.NAME_IP":
|
||||
|
||||
Reference in New Issue
Block a user