Fix broken fog when using Chroma Key with Sodium (fixes #726)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.replaymod.render.mixin;
|
||||
|
||||
import com.mojang.blaze3d.platform.GlStateManager;
|
||||
import com.replaymod.core.versions.MCVer;
|
||||
import com.replaymod.render.hooks.EntityRendererHandler;
|
||||
import net.minecraft.client.render.BackgroundRenderer;
|
||||
@@ -20,6 +21,17 @@ public abstract class Mixin_ChromaKeyDisableFog {
|
||||
((EntityRendererHandler.IEntityRenderer) MCVer.getMinecraft().gameRenderer).replayModRender_getHandler();
|
||||
if (handler == null) return;
|
||||
if (handler.getSettings().getChromaKeyingColor() != null) {
|
||||
// Starting with 1.15, fog is no longer enabled in this method but is instead managed by the RenderLayer
|
||||
// system (and with 1.17, they are enabled permanently / depend only on the shader). Therefore, cancelling
|
||||
// this method is no longer sufficient, and we additionally also need to set the start value to get rid of
|
||||
// fog (this doesn't hurt on 1.14 either).
|
||||
// Note: This only becomes noticeable with Sodium because Vanilla would already set the start to max for
|
||||
// unrelated reasons. But Sodium does some math which gives wrong results if end isn't greater than
|
||||
// start, as would be the case in these cases. Sodium doing math is also the reason we don't set start
|
||||
// equal to end (that'll result in undefined behavior because it sticks those into a smoothstep on old
|
||||
// versions), and we don't set it to MAX_VALUE because that also gives wrong results.
|
||||
GlStateManager.fogStart(1E10F);
|
||||
GlStateManager.fogEnd(2E10F);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user