From 50d706796801abf6e9cec1c9cb7e664bde73ab05 Mon Sep 17 00:00:00 2001 From: makamys Date: Mon, 24 May 2021 13:55:02 +0200 Subject: Tweak fog rendering, skybox edge is no longer visible --- src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java | 6 +----- src/main/java/makamys/lodmod/renderer/LODRenderer.java | 9 +++++++++ 2 files changed, 10 insertions(+), 5 deletions(-) (limited to 'src/main/java/makamys/lodmod') diff --git a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java index dda56a4..7f5aed0 100644 --- a/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java +++ b/src/main/java/makamys/lodmod/mixin/MixinEntityRenderer.java @@ -29,11 +29,7 @@ abstract class MixinEntityRenderer { @Inject(method = "setupFog", at = @At(value = "RETURN")) private void afterSetupFog(int mode, float alpha, CallbackInfo ci) { if(LODMod.isActive()) { - EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity; - if(LODMod.fogEventWasPosted && mode >= 0 && !Minecraft.getMinecraft().theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ)) { - GL11.glFogf(GL11.GL_FOG_START, farPlaneDistance * 0.2f); - GL11.glFogf(GL11.GL_FOG_END, farPlaneDistance); - } + LODMod.renderer.afterSetupFog(mode, alpha, farPlaneDistance); } } } diff --git a/src/main/java/makamys/lodmod/renderer/LODRenderer.java b/src/main/java/makamys/lodmod/renderer/LODRenderer.java index d4217b7..238e45c 100644 --- a/src/main/java/makamys/lodmod/renderer/LODRenderer.java +++ b/src/main/java/makamys/lodmod/renderer/LODRenderer.java @@ -8,6 +8,7 @@ import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.util.EnumFacing; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.IBlockAccess; @@ -209,6 +210,14 @@ public class LODRenderer { public int getFarPlaneDistanceMultiplier() { return renderRange / 12; } + + public void afterSetupFog(int mode, float alpha, float farPlaneDistance) { + EntityLivingBase entity = Minecraft.getMinecraft().renderViewEntity; + if(LODMod.fogEventWasPosted && !Minecraft.getMinecraft().theWorld.provider.doesXZShowFog((int)entity.posX, (int)entity.posZ)) { + GL11.glFogf(GL11.GL_FOG_START, mode < 0 ? 0 : farPlaneDistance * 0.2f); + GL11.glFogf(GL11.GL_FOG_END, mode < 0 ? farPlaneDistance/4 : farPlaneDistance * 0.8f); + } + } private void handleKeyboard() { if(Keyboard.isKeyDown(Keyboard.KEY_F) && !wasDown[Keyboard.KEY_F]) { -- cgit