Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 29 additions & 19 deletions src/main/java/rs117/hd/HdPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -411,7 +411,7 @@ enum ComputeMode
@Override
protected void startUp()
{
convertOldBrightnessConfig();
convertOldConfigs();

configGroundTextures = config.groundTextures();
configGroundBlending = config.groundBlending();
Expand Down Expand Up @@ -1783,8 +1783,8 @@ else if (config.fogDepthMode() == FogDepthMode.NONE)
gl.glUniform1i(uniPointLightsCount, config.maxDynamicLights().getValue() > 0 ? lightManager.visibleLightsCount : 0);

gl.glUniform1i(uniWaterEffects, configWaterEffects.getMode());
gl.glUniform1f(uniSaturation, config.saturation().getAmount());
gl.glUniform1f(uniContrast, config.contrast().getAmount());
gl.glUniform1f(uniSaturation, (float)config.saturation() / 20);
gl.glUniform1f(uniContrast, 0.8f + (float)config.contrast() / 70);

double lightPitchRadians = Math.toRadians(lightPitch);
double lightYawRadians = Math.toRadians(lightYaw);
Expand Down Expand Up @@ -2473,32 +2473,42 @@ else if (data != null)
}
}

//Sets the new brightness setting from the old brightness setting.
//Sets the new brightness, saturation and contrast settings from the old ones
//This can be removed later on when most people have updated the plugin
private void convertOldBrightnessConfig()
private void convertOldConfigs()
{
try
String[] oldSettingNames = {"brightness", "saturation", "contrast"};

for (int i = 0; i < oldSettingNames.length; i++)
{
String oldBrightnessValue = configManager.getConfiguration("hd", "brightness");
String setting = oldSettingNames[i];

if (!oldBrightnessValue.equals("set"))
try
{
String[][] newBrightnessValues = {{"LOWEST", "10"}, {"LOWER", "15"}, {"DEFAULT", "20"}, {"HIGHER", "25"}, {"HIGHEST", "30"}};
for (String[] newValue : newBrightnessValues)
String oldValue = configManager.getConfiguration("hd", setting);
if (!oldValue.equals("set"))
{
if (newValue[0].equals(oldBrightnessValue))
String[][][] newValues =
{{{"LOWEST", "10"}, {"LOWER", "15"}, {"DEFAULT", "20"}, {"HIGHER", "25"}, {"HIGHEST", "30"}}, //brightness
{{"NONE", "0"}, {"LOWEST", "16"}, {"LOWER", "18"}, {"DEFAULT", "20"}, {"HIGHER", "22"}, {"HIGHEST", "24"}}, //saturation
{{"LOWEST", "7"}, {"LOWER", "10"}, {"DEFAULT", "14"}, {"HIGHER", "21"}, {"HIGHEST", "17"}}}; //contrast

for (String[] newValue : newValues[i])
{
configManager.setConfiguration("hd", "brightness2", newValue[1]);
break;
if (newValue[0].equals(oldValue))
{
configManager.setConfiguration("hd", setting + "2", newValue[1]);
break;
}
}
}

configManager.setConfiguration("hd", "brightness", "set");
configManager.setConfiguration("hd", setting, "set");
}
}
catch (Exception e)
{
//Happens if people don't have the old setting saved, then it doesn't need converting anyway.
}
}
catch (Exception e)
{
//Happens if people don't have the old brightness setting, then it doesn't need converting anyway.
}
}

Expand Down
34 changes: 17 additions & 17 deletions src/main/java/rs117/hd/HdPluginConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@
import static rs117.hd.HdPlugin.MAX_FOG_DEPTH;
import rs117.hd.config.AntiAliasingMode;
import rs117.hd.config.ColorBlindMode;
import rs117.hd.config.Contrast;
import rs117.hd.config.LevelOfDetail;
import rs117.hd.config.MaxDynamicLights;
import rs117.hd.config.Saturation;
import rs117.hd.config.DefaultSkyColor;
import rs117.hd.config.FogDepthMode;
import rs117.hd.config.ShadowDistance;
Expand Down Expand Up @@ -137,29 +135,31 @@ default boolean flashingEffects()
return false;
}

@Range(
min = 1,
max = 25
)
@ConfigItem(
keyName = "saturation",
keyName = "saturation2",
name = "Saturation",
description = "Controls the saturation of the final rendered image.",
position = 7,
section = generalSettings
)
default Saturation saturation()
{
return Saturation.DEFAULT;
}
default int saturation() { return 20; }

@Range(
min = 1,
max = 25
)
@ConfigItem(
keyName = "contrast",
keyName = "contrast2",
name = "Contrast",
description = "Controls the contrast of the final rendered image.",
position = 8,
section = generalSettings
)
default Contrast contrast()
{
return Contrast.DEFAULT;
}
default int contrast() { return 15; }

@Range(
min = 1,
Expand Down Expand Up @@ -381,11 +381,11 @@ default boolean groundTextures()
}

@ConfigItem(
keyName = "groundBlending",
name = "Ground Blending",
description = "Affects the quality of blending between different ground/terrain textures.",
position = 207,
section = environmentSettings
keyName = "groundBlending",
name = "Ground Blending",
description = "Affects the quality of blending between different ground/terrain textures.",
position = 207,
section = environmentSettings
)
default boolean groundBlending()
{
Expand Down
48 changes: 0 additions & 48 deletions src/main/java/rs117/hd/config/Contrast.java

This file was deleted.

49 changes: 0 additions & 49 deletions src/main/java/rs117/hd/config/Saturation.java

This file was deleted.