Force enable fog if MC is rendering fog
done to fix underwater/blindness rendering
This commit is contained in:
@@ -514,13 +514,7 @@ public class ClientApi
|
||||
// render prep and actual rendering into different threads/methods
|
||||
// this is annoying since it's possible to start a render with only
|
||||
// partially complete info, but there isn't a better option at the moment
|
||||
RenderParams renderParams =
|
||||
new RenderParams(
|
||||
renderPass,
|
||||
RENDER_STATE.partialTickTime,
|
||||
RENDER_STATE.mcProjectionMatrix, RENDER_STATE.mcModelViewMatrix,
|
||||
RENDER_STATE.clientLevelWrapper
|
||||
);
|
||||
RenderParams renderParams = new RenderParams(renderPass, RENDER_STATE);
|
||||
|
||||
///endregion
|
||||
|
||||
|
||||
+10
-7
@@ -30,6 +30,16 @@ public class DhRenderState
|
||||
public float partialTickTime = -1;
|
||||
public IClientLevelWrapper clientLevelWrapper = null;
|
||||
|
||||
/**
|
||||
* This will generally be true if the player is: <br>
|
||||
* - blinded <br>
|
||||
* - under lava/water <br>
|
||||
* <br>
|
||||
* In those cases some rendering logic may need to be changed
|
||||
* to look correct.
|
||||
*/
|
||||
public boolean vanillaFogEnabled = false;
|
||||
|
||||
|
||||
|
||||
//========//
|
||||
@@ -65,13 +75,6 @@ public class DhRenderState
|
||||
return errorReasons;
|
||||
}
|
||||
|
||||
public boolean canRender()
|
||||
{
|
||||
// separated variable to allow for easy checking with the debugger
|
||||
String errorReasons = this.unableToRenderBecause();
|
||||
return errorReasons.isEmpty();
|
||||
}
|
||||
|
||||
public void canRenderOrThrow() throws IllegalStateException
|
||||
{
|
||||
String errorReasons = this.unableToRenderBecause();
|
||||
|
||||
@@ -270,7 +270,9 @@ public class LodRenderer
|
||||
}
|
||||
|
||||
// fog
|
||||
if (Config.Client.Advanced.Graphics.Fog.enableDhFog.get())
|
||||
if (Config.Client.Advanced.Graphics.Fog.enableDhFog.get()
|
||||
// this is done to fix issues with: underwater fog, blindness effect, etc.
|
||||
|| renderParams.vanillaFogEnabled)
|
||||
{
|
||||
profiler.popPush("LOD Fog");
|
||||
|
||||
@@ -337,7 +339,9 @@ public class LodRenderer
|
||||
this.renderLodPass(lodShaderProgram, renderBufferHandler, renderParams, /*opaquePass*/ false);
|
||||
|
||||
|
||||
if (Config.Client.Advanced.Graphics.Fog.enableDhFog.get())
|
||||
if (Config.Client.Advanced.Graphics.Fog.enableDhFog.get()
|
||||
// this is done to fix issues with: underwater fog, blindness effect, etc.
|
||||
|| renderParams.vanillaFogEnabled)
|
||||
{
|
||||
profiler.popPush("LOD Fog");
|
||||
|
||||
|
||||
+23
-2
@@ -3,6 +3,7 @@ package com.seibel.distanthorizons.core.render.renderer;
|
||||
import com.seibel.distanthorizons.api.enums.rendering.EDhApiRenderPass;
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
import com.seibel.distanthorizons.core.api.internal.SharedApi;
|
||||
import com.seibel.distanthorizons.core.api.internal.rendering.DhRenderState;
|
||||
import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.jar.EPlatform;
|
||||
import com.seibel.distanthorizons.core.level.IDhClientLevel;
|
||||
@@ -39,6 +40,8 @@ public class RenderParams extends DhApiRenderParam
|
||||
public RenderBufferHandler renderBufferHandler;
|
||||
public GenericObjectRenderer genericRenderer;
|
||||
public Vec3d exactCameraPosition;
|
||||
/** @see DhRenderState#vanillaFogEnabled */
|
||||
public boolean vanillaFogEnabled;
|
||||
|
||||
public boolean validationRun = false;
|
||||
|
||||
@@ -47,12 +50,23 @@ public class RenderParams extends DhApiRenderParam
|
||||
//=============//
|
||||
// constructor //
|
||||
//=============//
|
||||
//region
|
||||
|
||||
public RenderParams(
|
||||
public RenderParams(EDhApiRenderPass renderPass, DhRenderState renderState)
|
||||
{
|
||||
this(renderPass,
|
||||
renderState.partialTickTime,
|
||||
renderState.mcProjectionMatrix, renderState.mcModelViewMatrix,
|
||||
renderState.clientLevelWrapper,
|
||||
renderState.vanillaFogEnabled
|
||||
);
|
||||
}
|
||||
private RenderParams(
|
||||
EDhApiRenderPass renderPass,
|
||||
float newPartialTicks,
|
||||
Mat4f newMcProjectionMatrix, Mat4f newMcModelViewMatrix,
|
||||
IClientLevelWrapper clientLevelWrapper
|
||||
IClientLevelWrapper clientLevelWrapper,
|
||||
boolean vanillaFogEnabled
|
||||
)
|
||||
{
|
||||
super(renderPass,
|
||||
@@ -83,13 +97,18 @@ public class RenderParams extends DhApiRenderParam
|
||||
this.exactCameraPosition = MC_RENDER.getCameraExactPosition();
|
||||
}
|
||||
|
||||
this.vanillaFogEnabled = vanillaFogEnabled;
|
||||
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
//======================//
|
||||
// parameter validation //
|
||||
//======================//
|
||||
//region
|
||||
|
||||
/**
|
||||
* Should be called before rendering is done.
|
||||
@@ -172,6 +191,8 @@ public class RenderParams extends DhApiRenderParam
|
||||
return null;
|
||||
}
|
||||
|
||||
//endregion
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user