Skip to content

Commit d34d742

Browse files
committed
reset nv fog mode to planar if it ever gets set to radial
1 parent 171527f commit d34d742

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
package me.jellysquid.mods.sodium.mixin.features.options;
22

3-
import com.mojang.blaze3d.systems.RenderSystem;
3+
import com.mojang.blaze3d.platform.GlStateManager;
44
import me.jellysquid.mods.sodium.client.SodiumClientMod;
55
import net.minecraft.client.render.BackgroundRenderer;
6+
import org.lwjgl.opengl.GL;
7+
import org.lwjgl.opengl.NVFogDistance;
68
import org.spongepowered.asm.mixin.Mixin;
79
import org.spongepowered.asm.mixin.injection.At;
810
import org.spongepowered.asm.mixin.injection.Redirect;
@@ -11,10 +13,9 @@
1113
public abstract class MixinBackgroundRenderer {
1214
@Redirect(method = "applyFog", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/systems/RenderSystem;setupNvFogDistance()V"))
1315
private static void redirectSetupNvFogDistance() {
14-
if (SodiumClientMod.options().speedrun.usePlanarFog) {
15-
return;
16-
} else {
17-
RenderSystem.setupNvFogDistance();
16+
if (GL.getCapabilities().GL_NV_fog_distance) {
17+
int fogType = SodiumClientMod.options().speedrun.usePlanarFog ? NVFogDistance.GL_EYE_PLANE_ABSOLUTE_NV : NVFogDistance.GL_EYE_RADIAL_NV;
18+
GlStateManager.fogi(NVFogDistance.GL_FOG_DISTANCE_MODE_NV, fogType);
1819
}
1920
}
2021
}

0 commit comments

Comments
 (0)