Fog rendering fixes
This commit is contained in:
parent
3cb78dd5a5
commit
c947af1211
3 changed files with 62 additions and 68 deletions
|
@ -27,9 +27,7 @@ public class CustomBackgroundRenderer {
|
||||||
private static float fogEnd = 192;
|
private static float fogEnd = 192;
|
||||||
|
|
||||||
public static boolean applyFogDensity(Camera camera, FogRenderer.FogMode fogMode, float viewDistance, boolean thickFog) {
|
public static boolean applyFogDensity(Camera camera, FogRenderer.FogMode fogMode, float viewDistance, boolean thickFog) {
|
||||||
FogType fogType = camera.getFluidInCamera();
|
if (fogMode != FogMode.FOG_SKY && fogMode != FogMode.FOG_TERRAIN) {
|
||||||
|
|
||||||
if (fogType == FogType.WATER || fogType == FogType.LAVA || fogMode != FogMode.FOG_SKY) {
|
|
||||||
BackgroundInfo.fogDensity = 1;
|
BackgroundInfo.fogDensity = 1;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +47,7 @@ public class CustomBackgroundRenderer {
|
||||||
fogEnd = Math.min(viewDistance, 192.0F) * 0.5F / fog;
|
fogEnd = Math.min(viewDistance, 192.0F) * 0.5F / fog;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
fogStart = viewDistance * 0.75F / fog;
|
fogStart = 0;//viewDistance * 0.75F / fog;
|
||||||
fogEnd = viewDistance / fog;
|
fogEnd = viewDistance / fog;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package ru.bclib.mixin.client;
|
package ru.bclib.mixin.client;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import net.minecraft.client.Camera;
|
import net.minecraft.client.Camera;
|
||||||
import net.minecraft.client.multiplayer.ClientLevel;
|
import net.minecraft.client.multiplayer.ClientLevel;
|
||||||
import net.minecraft.client.renderer.FogRenderer;
|
import net.minecraft.client.renderer.FogRenderer;
|
||||||
|
@ -19,12 +20,7 @@ import ru.bclib.client.render.CustomBackgroundRenderer;
|
||||||
import ru.bclib.util.BackgroundInfo;
|
import ru.bclib.util.BackgroundInfo;
|
||||||
|
|
||||||
@Mixin(FogRenderer.class)
|
@Mixin(FogRenderer.class)
|
||||||
public class BackgroundRendererMixin {
|
public class FogRendererMixin {
|
||||||
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;
|
|
||||||
|
|
||||||
@Shadow
|
@Shadow
|
||||||
private static float fogRed;
|
private static float fogRed;
|
||||||
@Shadow
|
@Shadow
|
|
@ -6,11 +6,11 @@
|
||||||
"client": [
|
"client": [
|
||||||
"SimpleReloadableResourceManagerMixin",
|
"SimpleReloadableResourceManagerMixin",
|
||||||
"EnchantingTableBlockMixin",
|
"EnchantingTableBlockMixin",
|
||||||
"BackgroundRendererMixin",
|
|
||||||
"ClientRecipeBookMixin",
|
"ClientRecipeBookMixin",
|
||||||
"ModelManagerMixin",
|
"ModelManagerMixin",
|
||||||
"TextureAtlasMixin",
|
"TextureAtlasMixin",
|
||||||
"AnvilScreenMixin",
|
"AnvilScreenMixin",
|
||||||
|
"FogRendererMixin",
|
||||||
"ModelBakeryMixin",
|
"ModelBakeryMixin",
|
||||||
"WorldPresetMixin",
|
"WorldPresetMixin",
|
||||||
"MinecraftMixin",
|
"MinecraftMixin",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue