Skip applying the saturation shader if it's not required and remove unneccessary GL actions. Maybe Fixes #445

This commit is contained in:
Sollace 2024-09-25 20:47:23 +01:00
parent 0a44fb066d
commit 5a17cec52f
No known key found for this signature in database
GPG key ID: E52FACE7B5C773DB

View file

@ -9,7 +9,6 @@ import com.google.common.collect.*;
import com.google.gson.JsonSyntaxException;
import com.minelittlepony.unicopia.Unicopia;
import com.minelittlepony.unicopia.entity.player.Pony;
import com.mojang.blaze3d.systems.RenderSystem;
import com.mojang.logging.LogUtils;
import it.unimi.dsi.fastutil.objects.Object2FloatMap;
@ -52,11 +51,7 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
}
}
if (shaderId == null) {
return;
}
if (Unicopia.getConfig().disableShaders.get()) {
if (shaderId == null || Unicopia.getConfig().disableShaders.get()) {
return;
}
@ -81,13 +76,10 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
}
if (shader != null && client.player != null) {
RenderSystem.disableBlend();
RenderSystem.disableDepthTest();
RenderSystem.resetTextureMatrix();
Pony pony = Pony.of(client.player);
float corruption = pony.getCorruption().getScaled(0.9F);
if (!MathHelper.approximatelyEquals(corruption, 0)) {
corruption = pony.getInterpolator().interpolate("corruption", corruption, 10);
corruption = 1 - corruption + 0.05F;
@ -96,14 +88,11 @@ public class ViewportShader implements SynchronousResourceReloader, Identifiable
shader.render(tickDelta);
}
}
}
@Override
public void reload(ResourceManager var1) {
if (shader != null) {
loadShader(shader.id);
} else {
loadShader(DESATURATION_SHADER);
}
loadShader(shader != null ? shader.id : DESATURATION_SHADER);
}
static class LoadedShader extends PostEffectProcessor {