Improve config render cache invalidation logic and add missing config listeners
This commit is contained in:
@@ -200,6 +200,7 @@ public class Config
|
||||
+ ETransparency.DISABLED + ": LODs will be opaque. \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.MEDIUM)
|
||||
.addListener(RenderCacheConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EBlocksToAvoid> blocksToIgnore = new ConfigEntry.Builder<EBlocksToAvoid>()
|
||||
@@ -531,6 +532,7 @@ public class Config
|
||||
+ "0 = black \n"
|
||||
+ "1 = normal \n"
|
||||
+ "2 = near white")
|
||||
.addListener(RenderCacheConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Double> saturationMultiplier = new ConfigEntry.Builder<Double>() // TODO: Make this a float (the ClassicConfigGUI doesnt support floats)
|
||||
@@ -541,6 +543,7 @@ public class Config
|
||||
+ "0 = black and white \n"
|
||||
+ "1 = normal \n"
|
||||
+ "2 = very saturated")
|
||||
.addListener(RenderCacheConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<Boolean> enableCaveCulling = new ConfigEntry.Builder<Boolean>()
|
||||
|
||||
+2
-38
@@ -20,13 +20,8 @@ public class RenderCacheConfigEventHandler implements IConfigListener
|
||||
{
|
||||
public static RenderCacheConfigEventHandler INSTANCE = new RenderCacheConfigEventHandler();
|
||||
|
||||
// previous values used to check if a watched setting was actually modified
|
||||
private EVerticalQuality previousVerticalQualitySetting = null;
|
||||
private EMaxHorizontalResolution previousHorizontalResolution = null;
|
||||
private ELodShading lodShading = null;
|
||||
|
||||
/** how long to wait in milliseconds before applying the config changes */
|
||||
private static final long TIMEOUT_IN_MS = 400L;
|
||||
private static final long TIMEOUT_IN_MS = 4_000L;
|
||||
private Timer cacheClearingTimer;
|
||||
|
||||
|
||||
@@ -38,38 +33,7 @@ public class RenderCacheConfigEventHandler implements IConfigListener
|
||||
@Override
|
||||
public void onConfigValueSet()
|
||||
{
|
||||
// confirm a setting was actually changed
|
||||
boolean refreshRenderData = false;
|
||||
|
||||
|
||||
EVerticalQuality newVerticalQuality = Config.Client.Advanced.Graphics.Quality.verticalQuality.get();
|
||||
if (this.previousVerticalQualitySetting != newVerticalQuality)
|
||||
{
|
||||
this.previousVerticalQualitySetting = newVerticalQuality;
|
||||
refreshRenderData = true;
|
||||
}
|
||||
|
||||
EMaxHorizontalResolution newHorizontalResolution = Config.Client.Advanced.Graphics.Quality.maxHorizontalResolution.get();
|
||||
if (this.previousHorizontalResolution != newHorizontalResolution)
|
||||
{
|
||||
this.previousHorizontalResolution = newHorizontalResolution;
|
||||
refreshRenderData = true;
|
||||
}
|
||||
|
||||
ELodShading newLodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get();
|
||||
if (this.lodShading != newLodShading)
|
||||
{
|
||||
this.lodShading = newLodShading;
|
||||
refreshRenderData = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (refreshRenderData)
|
||||
{
|
||||
this.refreshRenderDataAfterTimeout();
|
||||
}
|
||||
|
||||
this.refreshRenderDataAfterTimeout();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user