Fog rendering fixes

This commit is contained in:
paulevsGitch 2021-12-23 09:23:26 +03:00
parent 3cb78dd5a5
commit c947af1211
3 changed files with 62 additions and 68 deletions

View file

@ -27,9 +27,7 @@ public class CustomBackgroundRenderer {
private static float fogEnd = 192;
public static boolean applyFogDensity(Camera camera, FogRenderer.FogMode fogMode, float viewDistance, boolean thickFog) {
FogType fogType = camera.getFluidInCamera();
if (fogType == FogType.WATER || fogType == FogType.LAVA || fogMode != FogMode.FOG_SKY) {
if (fogMode != FogMode.FOG_SKY && fogMode != FogMode.FOG_TERRAIN) {
BackgroundInfo.fogDensity = 1;
return false;
}
@ -49,7 +47,7 @@ public class CustomBackgroundRenderer {
fogEnd = Math.min(viewDistance, 192.0F) * 0.5F / fog;
}
else {
fogStart = viewDistance * 0.75F / fog;
fogStart = 0;//viewDistance * 0.75F / fog;
fogEnd = viewDistance / fog;
}

View file

@ -1,5 +1,6 @@
package ru.bclib.mixin.client;
import com.mojang.blaze3d.systems.RenderSystem;
import net.minecraft.client.Camera;
import net.minecraft.client.multiplayer.ClientLevel;
import net.minecraft.client.renderer.FogRenderer;
@ -19,12 +20,7 @@ import ru.bclib.client.render.CustomBackgroundRenderer;
import ru.bclib.util.BackgroundInfo;
@Mixin(FogRenderer.class)
public class BackgroundRendererMixin {
private static final MutableBlockPos BCLIB_LAST_POS = new MutableBlockPos(0, -100, 0);
private static final MutableBlockPos BCLIB_MUT_POS = new MutableBlockPos();
private static final float[] BCLIB_FOG_DENSITY = new float[8];
//private static boolean isEnd;
public class FogRendererMixin {
@Shadow
private static float fogRed;
@Shadow

View file

@ -6,11 +6,11 @@
"client": [
"SimpleReloadableResourceManagerMixin",
"EnchantingTableBlockMixin",
"BackgroundRendererMixin",
"ClientRecipeBookMixin",
"ModelManagerMixin",
"TextureAtlasMixin",
"AnvilScreenMixin",
"FogRendererMixin",
"ModelBakeryMixin",
"WorldPresetMixin",
"MinecraftMixin",