Remove near fog option
This commit is contained in:
-41
@@ -1,41 +0,0 @@
|
||||
/*
|
||||
* This file is part of the Distant Horizons mod
|
||||
* licensed under the GNU LGPL v3 License.
|
||||
*
|
||||
* Copyright (C) 2020-2023 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.rendering;
|
||||
|
||||
/**
|
||||
* NEAR, <br>
|
||||
* FAR, <br>
|
||||
* NEAR_AND_FAR <br>
|
||||
*
|
||||
* @author James Seibel
|
||||
* @version 2022-6-2
|
||||
* @since API 1.1.0
|
||||
*/
|
||||
@Deprecated
|
||||
public enum EDhApiFogDistance
|
||||
{
|
||||
// Reminder:
|
||||
// when adding items up the API minor version
|
||||
// when removing items up the API major version
|
||||
|
||||
NEAR,
|
||||
FAR,
|
||||
NEAR_AND_FAR
|
||||
}
|
||||
-4
@@ -20,7 +20,6 @@
|
||||
package com.seibel.distanthorizons.api.interfaces.config.client;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDistance;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDrawMode;
|
||||
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigGroup;
|
||||
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
|
||||
@@ -57,9 +56,6 @@ public interface IDhApiFogConfig extends IDhApiConfigGroup
|
||||
// basic fog settings //
|
||||
//====================//
|
||||
|
||||
/** Defines at what distance fog is rendered on fake chunks. */
|
||||
IDhApiConfigValue<EDhApiFogDistance> distance();
|
||||
|
||||
/** Should be used to enable/disable fog rendering. */
|
||||
IDhApiConfigValue<EDhApiFogDrawMode> drawMode();
|
||||
|
||||
|
||||
-5
@@ -20,7 +20,6 @@
|
||||
package com.seibel.distanthorizons.core.api.external.methods.config.client;
|
||||
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogColorMode;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDistance;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiFogDrawMode;
|
||||
import com.seibel.distanthorizons.api.interfaces.config.IDhApiConfigValue;
|
||||
import com.seibel.distanthorizons.api.interfaces.config.client.IDhApiFarFogConfig;
|
||||
@@ -52,10 +51,6 @@ public class DhApiFogConfig implements IDhApiFogConfig
|
||||
// basic fog settings //
|
||||
//====================//
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<EDhApiFogDistance> distance()
|
||||
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Fog.distance); }
|
||||
|
||||
@Override
|
||||
public IDhApiConfigValue<EDhApiFogDrawMode> drawMode()
|
||||
{ return new DhApiConfigValue<>(Config.Client.Advanced.Graphics.Fog.drawMode); }
|
||||
|
||||
@@ -250,12 +250,6 @@ public class Config
|
||||
.setPerformance(EConfigEntryPerformance.VERY_LOW)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EDhApiFogDistance> distance = new ConfigEntry.Builder<EDhApiFogDistance>()
|
||||
.set(EDhApiFogDistance.FAR)
|
||||
.comment("At what distance should Fog be drawn on the LODs?")
|
||||
.setPerformance(EConfigEntryPerformance.NONE)
|
||||
.build();
|
||||
|
||||
public static ConfigEntry<EDhApiFogColorMode> colorMode = new ConfigEntry.Builder<EDhApiFogColorMode>()
|
||||
.set(EDhApiFogColorMode.USE_WORLD_FOG_COLOR)
|
||||
.comment(""
|
||||
|
||||
@@ -52,8 +52,6 @@ public class LodFogConfig
|
||||
public final EDhApiHeightFogMode heightFogMode;
|
||||
public final float heightFogHeight;
|
||||
|
||||
final boolean drawNearFog;
|
||||
|
||||
// TODO: Move these out of here
|
||||
public final int earthCurveRatio;
|
||||
|
||||
@@ -88,72 +86,55 @@ public class LodFogConfig
|
||||
|
||||
if (fogDrawMode != EDhApiFogDrawMode.FOG_DISABLED)
|
||||
{
|
||||
EDhApiFogDistance fogDistance = Config.Client.Advanced.Graphics.Fog.distance.get();
|
||||
drawNearFog = (fogDistance == EDhApiFogDistance.NEAR || fogDistance == EDhApiFogDistance.NEAR_AND_FAR);
|
||||
// fog should be drawn
|
||||
|
||||
if (fogDistance == EDhApiFogDistance.FAR || fogDistance == EDhApiFogDistance.NEAR_AND_FAR)
|
||||
farFogSetting = new FogSettings(
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogStart.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogEnd.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogMin.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogMax.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogFalloff.get()
|
||||
);
|
||||
|
||||
heightFogMixMode = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMixMode.get();
|
||||
if (heightFogMixMode == EDhApiHeightFogMixMode.IGNORE_HEIGHT || heightFogMixMode == EDhApiHeightFogMixMode.BASIC)
|
||||
{
|
||||
// far fog should be drawn
|
||||
// basic fog mixing
|
||||
|
||||
farFogSetting = new FogSettings(
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogStart.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogEnd.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogMin.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogMax.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.farFogFalloff.get()
|
||||
heightFogSetting = null;
|
||||
heightFogMode = null;
|
||||
heightFogHeight = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// advanced fog mixing
|
||||
|
||||
heightFogSetting = new FogSettings(
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogEnd.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMin.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMax.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogFalloff.get()
|
||||
);
|
||||
|
||||
heightFogMixMode = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMixMode.get();
|
||||
if (heightFogMixMode == EDhApiHeightFogMixMode.IGNORE_HEIGHT || heightFogMixMode == EDhApiHeightFogMixMode.BASIC)
|
||||
heightFogMode = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMode.get();
|
||||
|
||||
if (heightFogMode.basedOnCamera)
|
||||
{
|
||||
// basic fog mixing
|
||||
|
||||
heightFogSetting = null;
|
||||
heightFogMode = null;
|
||||
heightFogHeight = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
// advanced fog mixing
|
||||
|
||||
heightFogSetting = new FogSettings(
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogEnd.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMin.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMax.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogDensity.get(),
|
||||
Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogFalloff.get()
|
||||
);
|
||||
|
||||
heightFogMode = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogMode.get();
|
||||
|
||||
if (heightFogMode.basedOnCamera)
|
||||
{
|
||||
heightFogHeight = 0.f;
|
||||
}
|
||||
else
|
||||
{
|
||||
heightFogHeight = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogBaseHeight.get().floatValue();
|
||||
}
|
||||
heightFogHeight = Config.Client.Advanced.Graphics.Fog.AdvancedFog.HeightFog.heightFogBaseHeight.get().floatValue();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// far fog should not be drawn
|
||||
|
||||
farFogSetting = null;
|
||||
heightFogSetting = null;
|
||||
heightFogMode = null;
|
||||
heightFogMixMode = null;
|
||||
heightFogHeight = 0.f;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// fog disabled
|
||||
|
||||
drawNearFog = false;
|
||||
farFogSetting = null;
|
||||
heightFogMixMode = null;
|
||||
heightFogMode = null;
|
||||
@@ -205,7 +186,7 @@ public class LodFogConfig
|
||||
"float calculateHeightFogDepth(float vertical, float realY) { return 0.0; } \n" +
|
||||
"float mixFogThickness(float near, float far, float height) \n" +
|
||||
"{ \n" +
|
||||
(drawNearFog ? "return 1.0-near;" : "return 0.0;") +
|
||||
" return 0.0; \n" +
|
||||
"} \n\n");
|
||||
}
|
||||
else
|
||||
@@ -247,7 +228,7 @@ public class LodFogConfig
|
||||
str.append("" +
|
||||
"float mixFogThickness(float near, float far, float height) \n" +
|
||||
"{ \n" +
|
||||
getMixFogLine(heightFogMixMode, drawNearFog) + "\n" +
|
||||
getMixFogLine(heightFogMixMode) + "\n" +
|
||||
"} \n");
|
||||
}
|
||||
}
|
||||
@@ -354,7 +335,7 @@ public class LodFogConfig
|
||||
* creates a line in the format <br>
|
||||
* <code>" return max(1.0-near, far);" </code>
|
||||
*/
|
||||
private static String getMixFogLine(EDhApiHeightFogMixMode heightFogMode, boolean drawNearFog)
|
||||
private static String getMixFogLine(EDhApiHeightFogMixMode heightFogMode)
|
||||
{
|
||||
String str = " return ";
|
||||
|
||||
@@ -362,65 +343,38 @@ public class LodFogConfig
|
||||
{
|
||||
case BASIC:
|
||||
case IGNORE_HEIGHT:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far);\n";
|
||||
else
|
||||
str += "near * far;\n";
|
||||
break;
|
||||
|
||||
case ADDITION:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far + height);\n";
|
||||
else
|
||||
str += "near * (far + height);\n";
|
||||
break;
|
||||
|
||||
case MAX:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, max(far, height));\n";
|
||||
else
|
||||
str += "near * max(far, height);\n";
|
||||
break;
|
||||
|
||||
case INVERSE_MULTIPLY:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, 1.0 - (1.0-far)*(1.0-height));\n";
|
||||
else
|
||||
str += "near * (1.0 - (1.0-far)*(1.0-height));\n";
|
||||
break;
|
||||
|
||||
case MULTIPLY:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far*height);\n";
|
||||
else
|
||||
str += "near * far * height;\n";
|
||||
break;
|
||||
|
||||
case LIMITED_ADDITION:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far + max(far, height));\n";
|
||||
else
|
||||
str += "near * (far + max(far, height));\n";
|
||||
break;
|
||||
|
||||
case MULTIPLY_ADDITION:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far + far*height);\n";
|
||||
else
|
||||
str += "near * (far + far*height);\n";
|
||||
break;
|
||||
|
||||
case INVERSE_MULTIPLY_ADDITION:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far + 1.0 - (1.0-far)*(1.0-height));\n";
|
||||
else
|
||||
str += "near * (far + 1.0 - (1.0-far)*(1.0-height));\n";
|
||||
break;
|
||||
|
||||
case AVERAGE:
|
||||
if (drawNearFog)
|
||||
str += "max(1.0-near, far*0.5 + height*0.5);\n";
|
||||
else
|
||||
str += "near * (far*0.5 + height*0.5);\n";
|
||||
break;
|
||||
|
||||
@@ -449,7 +403,7 @@ public class LodFogConfig
|
||||
return false;
|
||||
LodFogConfig that = (LodFogConfig) o;
|
||||
return Float.compare(that.heightFogHeight, heightFogHeight) == 0 &&
|
||||
drawNearFog == that.drawNearFog && Objects.equals(farFogSetting, that.farFogSetting) &&
|
||||
Objects.equals(farFogSetting, that.farFogSetting) &&
|
||||
Objects.equals(heightFogSetting, that.heightFogSetting) && heightFogMixMode == that.heightFogMixMode &&
|
||||
heightFogMode == that.heightFogMode
|
||||
// TODO: Move these out of here
|
||||
@@ -460,7 +414,7 @@ public class LodFogConfig
|
||||
@Override
|
||||
public int hashCode()
|
||||
{
|
||||
return Objects.hash(farFogSetting, heightFogSetting, heightFogMixMode, heightFogMode, heightFogHeight, drawNearFog, earthCurveRatio, noiseEnable, noiseSteps, noiseIntensity, noiseDropoff);
|
||||
return Objects.hash(farFogSetting, heightFogSetting, heightFogMixMode, heightFogMode, heightFogHeight, earthCurveRatio, noiseEnable, noiseSteps, noiseIntensity, noiseDropoff);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user