diff --git a/src/main/java/com/seibel/lod/core/render/LodFogConfig.java b/src/main/java/com/seibel/lod/core/render/LodFogConfig.java index 7595f8235..943138596 100644 --- a/src/main/java/com/seibel/lod/core/render/LodFogConfig.java +++ b/src/main/java/com/seibel/lod/core/render/LodFogConfig.java @@ -54,7 +54,9 @@ public class LodFogConfig public final float heightFogHeight; final boolean drawNearFog; - + + final int earthCurveRatio; // FIXME: Move this out of here + public static LodFogConfig generateFogConfig() { @@ -68,6 +70,8 @@ public class LodFogConfig /** sets all fog options from the config */ private LodFogConfig(FogDrawMode fogDrawMode) { + earthCurveRatio = CONFIG.client().graphics().advancedGraphics().getEarthCurveRatio(); //FIXME: Move this out of here + if (fogDrawMode != FogDrawMode.FOG_DISABLED) { ILodConfigWrapperSingleton.IClient.IGraphics.IFogQuality fogSettings = CONFIG.client().graphics().fogQuality(); @@ -415,12 +419,15 @@ public class LodFogConfig if (o == null || getClass() != o.getClass()) return false; LodFogConfig that = (LodFogConfig) o; - return Float.compare(that.heightFogHeight, heightFogHeight) == 0 && drawNearFog == that.drawNearFog && Objects.equals(farFogSetting, that.farFogSetting) && Objects.equals(heightFogSetting, that.heightFogSetting) && heightFogMixMode == that.heightFogMixMode && heightFogMode == that.heightFogMode; + return Float.compare(that.heightFogHeight, heightFogHeight) == 0 && + drawNearFog == that.drawNearFog && Objects.equals(farFogSetting, that.farFogSetting) && + Objects.equals(heightFogSetting, that.heightFogSetting) && heightFogMixMode == that.heightFogMixMode && + heightFogMode == that.heightFogMode && earthCurveRatio == that.earthCurveRatio; } @Override public int hashCode() { - return Objects.hash(farFogSetting, heightFogSetting, heightFogMixMode, heightFogMode, heightFogHeight, drawNearFog); + return Objects.hash(farFogSetting, heightFogSetting, heightFogMixMode, heightFogMode, heightFogHeight, drawNearFog, earthCurveRatio); } } diff --git a/src/main/java/com/seibel/lod/core/render/LodRenderProgram.java b/src/main/java/com/seibel/lod/core/render/LodRenderProgram.java index d424c5a6e..a201709a6 100644 --- a/src/main/java/com/seibel/lod/core/render/LodRenderProgram.java +++ b/src/main/java/com/seibel/lod/core/render/LodRenderProgram.java @@ -30,6 +30,7 @@ import com.seibel.lod.core.wrapperInterfaces.IVersionConstants; public class LodRenderProgram extends ShaderProgram { public static final String VERTEX_SHADER_PATH = "shaders/standard.vert"; + public static final String VERTEX_CURVE_SHADER_PATH = "shaders/curve.vert"; public static final String FRAGMENT_SHADER_PATH = "shaders/flat_shaded.frag"; private static final IVersionConstants VERSION_CONSTANTS = SingletonHandler.get(IVersionConstants.class); @@ -57,7 +58,8 @@ public class LodRenderProgram extends ShaderProgram { // This will bind VertexAttribute public LodRenderProgram(LodFogConfig fogConfig) { - super(() -> Shader.loadFile(VERTEX_SHADER_PATH, false, new StringBuilder()).toString(), + super(() -> Shader.loadFile(fogConfig.earthCurveRatio!=0 ? VERTEX_CURVE_SHADER_PATH : VERTEX_SHADER_PATH, + false, new StringBuilder()).toString(), () -> fogConfig.loadAndProcessFragShader(FRAGMENT_SHADER_PATH, false).toString(), "fragColor", new String[] { "vPosition", "color" }); this.fogConfig = fogConfig; @@ -97,6 +99,9 @@ public class LodRenderProgram extends ShaderProgram { System.out.println(LodUtil.LOD_VERTEX_FORMAT); throw e; } + + if (earthRadiusUniform != -1) setUniform(earthRadiusUniform, + /*6371KM*/ 6371000.0f / fogConfig.earthCurveRatio); } // If not usable, return a new LodFogConfig to be constructed @@ -144,9 +149,6 @@ public class LodRenderProgram extends ShaderProgram { setUniform(lightMapUniform, lightmapBindPoint); if (worldYOffsetUniform != -1) setUniform(worldYOffsetUniform, (float)worldYOffset); - if (earthRadiusUniform != -1) setUniform(earthRadiusUniform, - 63710f); //radio of 1 to 100 to Earth radius (6,371 KM) - // (float)lodDrawDistance); // Fog setUniform(fullFogModeUniform, fullFogMode ? 1 : 0); diff --git a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java index f18c60b67..e68149c91 100644 --- a/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java +++ b/src/main/java/com/seibel/lod/core/wrapperInterfaces/config/ILodConfigWrapperSingleton.java @@ -542,6 +542,22 @@ public interface ILodConfigWrapperSingleton extends IBindable + " At what Y value should cave culling start? \n"; int getCaveCullingHeight(); void setCaveCullingHeight(int newCaveCullingHeight); + + + MinDefaultMax EARTH_CURVE_RATIO_MIN_DEFAULT_MAX = new MinDefaultMax<>(0,0,10000); + String EARTH_CURVE_RATIO_DESC = "" + + " This is the earth size ratio when applying the curvature shader effect. \n" + + "\n" + + " NOTE: This feature is just for fun and is VERY experimental! \n" + + "Please don't report any issues related to this feature. \n" + + "\n" + + " 0 = flat/disabled \n" + + " 1 = 1 to 1 (6,371,000 blocks) \n" + + " 100 = 1 to 100 (63,710 blocks) \n" + + " 10000 = 1 to 10000 (637.1 blocks) \n"; + int getEarthCurveRatio(); + void setEarthCurveRatio(int newEarthCurveRatio); + } } diff --git a/src/main/resources/assets/lod/lang/en_us.json b/src/main/resources/assets/lod/lang/en_us.json index 9379a7265..e36d78a76 100644 --- a/src/main/resources/assets/lod/lang/en_us.json +++ b/src/main/resources/assets/lod/lang/en_us.json @@ -172,6 +172,10 @@ "Cave Culling Height §6(EXPERIMENTAL)§r", "DistantHorizons.config.client.graphics.advancedGraphics.caveCullingHeight.@tooltip": "At what Y value should cave culling start? \n\n§6NOTE§r: This feature is under development and \n it is VERY experimental! Please don't report \nany issues related to this feature.", + "DistantHorizons.config.client.graphics.advancedGraphics.earthCurveRatio": + "Earth Curve Ratio §6(EXPERIMENTAL)§r", + "DistantHorizons.config.client.graphics.advancedGraphics.earthCurveRatio.@tooltip": + "This is the earth size ratio when applying the curvature shader effect. \n\n§6NOTE§r: This feature is just for fun and is VERY experimental! \nPlease don't report any issues related to this feature. \n\n0 = flat/disabled \n1 = 1 to 1 (6,371,000 blocks) \n100 = 1 to 100 (63,710 blocks) \n10000 = 1 to 10000 (637.1 blocks) \n", "DistantHorizons.config.client.worldGenerator": "World generator", "DistantHorizons.config.client.worldGenerator.generationPriority":