Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix shadow render distance reset to 32 #856

Merged
merged 1 commit into from
Jan 31, 2025
Merged
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
18 changes: 9 additions & 9 deletions src/main/java/net/coderbot/iris/config/IrisConfig.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package net.coderbot.iris.config;

import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.option.IrisVideoSettings;

import java.io.IOException;
import java.io.InputStream;
Expand Down Expand Up @@ -122,13 +123,13 @@ public void load() throws IOException {
enableShaders = !"false".equals(properties.getProperty("enableShaders"));
disableUpdateMessage = "true".equals(properties.getProperty("disableUpdateMessage"));
// TODO: GUI
// try {
// IrisVideoSettings.shadowDistance = Integer.parseInt(properties.getProperty("maxShadowRenderDistance", "32"));
// } catch (NumberFormatException e) {
// Iris.logger.error("Shadow distance setting reset; value is invalid.");
// IrisVideoSettings.shadowDistance = 32;
// save();
// }
try {
IrisVideoSettings.shadowDistance = Integer.parseInt(properties.getProperty("maxShadowRenderDistance", "32"));
} catch (NumberFormatException e) {
Iris.logger.error("Shadow distance setting reset; value is invalid.");
IrisVideoSettings.shadowDistance = 32;
save();
}

if (shaderPackName != null) {
if (shaderPackName.equals("(internal)") || shaderPackName.isEmpty()) {
Expand All @@ -147,8 +148,7 @@ public void save() throws IOException {
properties.setProperty("shaderPack", getShaderPackName().orElse(""));
properties.setProperty("enableShaders", enableShaders ? "true" : "false");
properties.setProperty("disableUpdateMessage", disableUpdateMessage ? "true" : "false");
// properties.setProperty("maxShadowRenderDistance", String.valueOf(IrisVideoSettings.shadowDistance));
properties.setProperty("maxShadowRenderDistance", String.valueOf(32));
properties.setProperty("maxShadowRenderDistance", String.valueOf(IrisVideoSettings.shadowDistance));
// NB: This uses ISO-8859-1 with unicode escapes as the encoding
try (OutputStream os = Files.newOutputStream(propertiesPath)) {
properties.store(os, COMMENT);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ public class IrisVideoSettings {
public static int shadowDistance = 32;

// TODO: Tell the user to check in the shader options once that's supported.
private static final String DISABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.disabled");
private static final String ENABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.enabled");
// private static final String DISABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.disabled");
// private static final String ENABLED_TOOLTIP = I18n.format("options.iris.shadowDistance.enabled");

public static int getOverriddenShadowDistance(int base) {
return Iris.getPipelineManager().getPipeline()
Expand Down
5 changes: 3 additions & 2 deletions src/main/java/net/coderbot/iris/pipeline/ShadowRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.util.Objects;
import me.jellysquid.mods.sodium.client.render.SodiumWorldRenderer;
import net.coderbot.iris.Iris;
import net.coderbot.iris.gui.option.IrisVideoSettings;
import net.coderbot.iris.shaderpack.OptionalBoolean;
import net.coderbot.iris.shaderpack.PackDirectives;
import net.coderbot.iris.shaderpack.PackShadowDirectives;
Expand Down Expand Up @@ -284,8 +285,8 @@ private FrustumHolder createShadowFrustum(float renderMultiplier, FrustumHolder

if (renderMultiplier < 0) {
// TODO: GUI
// distance = IrisVideoSettings.shadowDistance * 16;
distance = 32 * 16;
distance = IrisVideoSettings.shadowDistance * 16; // can be zero :(
//distance = 32 * 16;
setter = "(set by user)";
}

Expand Down