Add config for Lod Shading so Old Lighting can be enabled for shaders
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
/*
|
||||
* 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.distanthorizons.api.enums.config;
|
||||
|
||||
/**
|
||||
* MINECRAFT <br>
|
||||
* OLD_LIGHTING <br>
|
||||
* NONE <br>
|
||||
*/
|
||||
public enum ELodShading
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
MINECRAFT,
|
||||
OLD_LIGHTING,
|
||||
NONE;
|
||||
|
||||
}
|
||||
@@ -586,6 +586,20 @@ public class Config
|
||||
+ "If set to 0 the mod wont overwrite vanilla's default (which so happens to also be 0)")
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<ELodShading> lodShading = new ConfigEntry.Builder<ELodShading>()
|
||||
.set(ELodShading.MINECRAFT)
|
||||
.comment(""
|
||||
+ "How should LODs be shaded? \n"
|
||||
+ "\n"
|
||||
+ ELodShading.MINECRAFT + ": Uses the same side shading as vanilla Minecraft blocks. \n"
|
||||
+ ELodShading.OLD_LIGHTING + ": Simulates Minecraft's block shading for LODs. \n"
|
||||
+ " Can be used to force LOD shading when using some shaders. \n"
|
||||
+ ELodShading.NONE + ": All LOD sides will be rendered with the same brightness. \n"
|
||||
+ "")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.addListener(RenderCacheConfigEventHandler.INSTANCE)
|
||||
.build();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+9
@@ -1,6 +1,7 @@
|
||||
package com.seibel.distanthorizons.core.config.eventHandlers;
|
||||
|
||||
import com.seibel.distanthorizons.api.DhApi;
|
||||
import com.seibel.distanthorizons.api.enums.config.ELodShading;
|
||||
import com.seibel.distanthorizons.api.enums.config.EMaxHorizontalResolution;
|
||||
import com.seibel.distanthorizons.api.enums.config.EVerticalQuality;
|
||||
import com.seibel.distanthorizons.core.config.listeners.IConfigListener;
|
||||
@@ -22,6 +23,7 @@ public class RenderCacheConfigEventHandler implements IConfigListener
|
||||
// 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;
|
||||
@@ -54,6 +56,13 @@ public class RenderCacheConfigEventHandler implements IConfigListener
|
||||
refreshRenderData = true;
|
||||
}
|
||||
|
||||
ELodShading newLodShading = Config.Client.Advanced.Graphics.AdvancedGraphics.lodShading.get();
|
||||
if (this.lodShading != newLodShading)
|
||||
{
|
||||
this.lodShading = newLodShading;
|
||||
refreshRenderData = true;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (refreshRenderData)
|
||||
|
||||
Reference in New Issue
Block a user