mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 13:37:58 +01:00
Skip applying the saturation shader if it's not required and remove unneccessary GL actions. Maybe Fixes #445
This commit is contained in:
parent
4f4ac3f809
commit
2b979d4fe4
1 changed files with 8 additions and 19 deletions
|
@ -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 {
|
||||
|
|
Loading…
Reference in a new issue