Fix cave culling affecting floating islands and add LOD reload to some configs
This commit is contained in:
@@ -54,7 +54,6 @@ import java.util.List;
|
||||
* Otherwise, you will have issues where only some of the config entries will exist when your listener is created.
|
||||
*
|
||||
* @author coolGi
|
||||
* @version 2023-7-16
|
||||
*/
|
||||
|
||||
public class Config
|
||||
@@ -179,6 +178,7 @@ public class Config
|
||||
+ "Lowest Quality: " + EDhApiVerticalQuality.HEIGHT_MAP + "\n"
|
||||
+ "Highest Quality: " + EDhApiVerticalQuality.EXTREME)
|
||||
.setPerformance(EConfigEntryPerformance.VERY_HIGH)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EDhApiHorizontalQuality> horizontalQuality = new ConfigEntry.Builder<EDhApiHorizontalQuality>()
|
||||
@@ -200,6 +200,7 @@ public class Config
|
||||
+ EDhApiTransparency.DISABLED + ": LODs will be opaque. \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.MEDIUM)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EDhApiBlocksToAvoid> blocksToIgnore = new ConfigEntry.Builder<EDhApiBlocksToAvoid>()
|
||||
@@ -211,6 +212,7 @@ public class Config
|
||||
+ EDhApiBlocksToAvoid.NON_COLLIDING + ": Only represent solid blocks in the LODs (tall grass, torches, etc. won't count for a LOD's height) \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> tintWithAvoidedBlocks = new ConfigEntry.Builder<Boolean>()
|
||||
@@ -222,6 +224,7 @@ public class Config
|
||||
+ "False: skipped blocks will not change color of surface below them. "
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
// TODO fixme
|
||||
@@ -587,6 +590,7 @@ public class Config
|
||||
+ "0 = black \n"
|
||||
+ "1 = normal \n"
|
||||
+ "2 = near white")
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> saturationMultiplier = new ConfigEntry.Builder<Double>() // TODO: Make this a float (the ClassicConfigGUI doesnt support floats)
|
||||
@@ -597,6 +601,7 @@ public class Config
|
||||
+ "0 = black and white \n"
|
||||
+ "1 = normal \n"
|
||||
+ "2 = very saturated")
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> enableCaveCulling = new ConfigEntry.Builder<Boolean>()
|
||||
@@ -611,14 +616,15 @@ public class Config
|
||||
+ "Additional Info: Currently this cull all faces \n"
|
||||
+ " with skylight value of 0 in dimensions that \n"
|
||||
+ " does not have a ceiling.")
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
@Deprecated
|
||||
public static ConfigEntry<Integer> caveCullingHeight = new ConfigEntry.Builder<Integer>()
|
||||
.setMinDefaultMax(-4096, 40, 4096)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_API)
|
||||
.setMinDefaultMax(-4096, 60, 4096)
|
||||
.comment(""
|
||||
+ "At what Y value should cave culling start?")
|
||||
+ "At what Y value should cave culling start? \n"
|
||||
+ "Lower this value if you get walls for areas with 0 light.")
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> earthCurveRatio = new ConfigEntry.Builder<Integer>()
|
||||
@@ -656,6 +662,7 @@ public class Config
|
||||
+ EDhApiLodShading.DISABLED + ": All LOD sides will be rendered with the same brightness. \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> disableFrustumCulling = new ConfigEntry.Builder<Boolean>()
|
||||
@@ -690,6 +697,7 @@ public class Config
|
||||
+ EDhApiGrassSideRendering.AS_DIRT + ": sides render entirely as dirt. \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
}
|
||||
@@ -1303,38 +1311,38 @@ public class Config
|
||||
public static ConfigEntry<Boolean> columnBuilderDebugEnable = new ConfigEntry.Builder<Boolean>()
|
||||
.set(false)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
public static ConfigEntry<Integer> columnBuilderDebugDetailLevel = new ConfigEntry.Builder<Integer>()
|
||||
.set((int) DhSectionPos.SECTION_MINIMUM_DETAIL_LEVEL)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
public static ConfigEntry<Integer> columnBuilderDebugXPos = new ConfigEntry.Builder<Integer>()
|
||||
.set(0)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
public static ConfigEntry<Integer> columnBuilderDebugZPos = new ConfigEntry.Builder<Integer>()
|
||||
.set(0)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Integer> columnBuilderDebugXRow = new ConfigEntry.Builder<Integer>()
|
||||
.set(-1)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
public static ConfigEntry<Integer> columnBuilderDebugZRow = new ConfigEntry.Builder<Integer>()
|
||||
.set(-1)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
public static ConfigEntry<Integer> columnBuilderDebugColumnIndex = new ConfigEntry.Builder<Integer>()
|
||||
.set(-1)
|
||||
.setAppearance(EConfigEntryAppearance.ONLY_IN_GUI)
|
||||
.addListener(DebugColumnConfigEventHandler.INSTANCE)
|
||||
.addListener(ReloadLodsConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
|
||||
|
||||
+2
-2
@@ -23,9 +23,9 @@ import com.seibel.distanthorizons.api.DhApi;
|
||||
import com.seibel.distanthorizons.api.interfaces.render.IDhApiRenderProxy;
|
||||
import com.seibel.distanthorizons.core.config.listeners.IConfigListener;
|
||||
|
||||
public class DebugColumnConfigEventHandler implements IConfigListener
|
||||
public class ReloadLodsConfigEventHandler implements IConfigListener
|
||||
{
|
||||
public static DebugColumnConfigEventHandler INSTANCE = new DebugColumnConfigEventHandler();
|
||||
public static ReloadLodsConfigEventHandler INSTANCE = new ReloadLodsConfigEventHandler();
|
||||
|
||||
@Override
|
||||
public void onConfigValueSet()
|
||||
+5
-1
@@ -178,6 +178,7 @@ public class FullDataToRenderDataTransformer
|
||||
HashSet<IBlockStateWrapper> blockStatesToIgnore = WRAPPER_FACTORY.getRendererIgnoredBlocks(level.getLevelWrapper());
|
||||
HashSet<IBlockStateWrapper> caveBlockStatesToIgnore = WRAPPER_FACTORY.getRendererIgnoredCaveBlocks(level.getLevelWrapper());
|
||||
|
||||
int caveCullingMaxY = Config.Client.Advanced.Graphics.AdvancedGraphics.caveCullingHeight.get() - level.getMinY();
|
||||
boolean caveCullingEnabled =
|
||||
Config.Client.Advanced.Graphics.AdvancedGraphics.enableCaveCulling.get()
|
||||
&& (
|
||||
@@ -211,6 +212,7 @@ public class FullDataToRenderDataTransformer
|
||||
|
||||
int bottomY = FullDataPointUtil.getBottomY(fullData);
|
||||
int blockHeight = FullDataPointUtil.getHeight(fullData);
|
||||
int topY = bottomY + blockHeight;
|
||||
int id = FullDataPointUtil.getId(fullData);
|
||||
int blockLight = FullDataPointUtil.getBlockLight(fullData);
|
||||
int skyLight = FullDataPointUtil.getSkyLight(fullData);
|
||||
@@ -252,7 +254,9 @@ public class FullDataToRenderDataTransformer
|
||||
{
|
||||
if (caveCullingEnabled
|
||||
// assume this data point is underground if it has no sky-light
|
||||
&& skyLight == LodUtil.MIN_MC_LIGHT
|
||||
&& skyLight == LodUtil.MIN_MC_LIGHT
|
||||
// ignore caves above a certain height to prevent floating islands from having walls underneath them
|
||||
&& topY < caveCullingMaxY
|
||||
// cave culling shouldn't happen when at the top of the world
|
||||
&& columnOffset != 0
|
||||
// cave culling can't happen when at the bottom of the world
|
||||
|
||||
Reference in New Issue
Block a user