Default to no culling for the shadow pass
This commit is contained in:
+4
-1
@@ -26,7 +26,10 @@ import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||
/**
|
||||
* The culling frustum used during Distant Horizons' shadow pass
|
||||
* if another mod has enabled Distant Horizons' shadow
|
||||
* pass via the API.
|
||||
* pass via the API. <br><br>
|
||||
*
|
||||
* If no {@link IDhApiShadowCullingFrustum} is bound then culling
|
||||
* will not be done in the shadow pass.
|
||||
*
|
||||
* @see IDhApiCullingFrustum
|
||||
*
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package com.seibel.distanthorizons.core.pos;
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiCullingFrustum;
|
||||
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverrideInjector;
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiCullingFrustum;
|
||||
import com.seibel.distanthorizons.coreapi.interfaces.dependencyInjection.IOverrideInjector;
|
||||
import com.seibel.distanthorizons.coreapi.util.math.Mat4f;
|
||||
|
||||
/**
|
||||
* Dummy {@link IDhApiCullingFrustum} that allows everything through. <br>
|
||||
* Useful when a frustum is required, but culling shouldn't be done.
|
||||
*/
|
||||
public class NeverCullFrustum implements IDhApiCullingFrustum
|
||||
{
|
||||
//=============//
|
||||
// constructor //
|
||||
//=============//
|
||||
|
||||
public NeverCullFrustum() { }
|
||||
|
||||
|
||||
|
||||
//=========//
|
||||
// methods //
|
||||
//=========//
|
||||
|
||||
@Override
|
||||
public void update(int worldMinBlockY, int worldMaxBlockY, Mat4f dhWorldViewProjection) { /* update isn't needed */ }
|
||||
|
||||
@Override
|
||||
public boolean intersects(int lodBlockPosMinX, int lodBlockPosMinZ, int lodBlockWidth, int lodDetailLevel) { return true; }
|
||||
|
||||
|
||||
|
||||
//=====================//
|
||||
// overridable methods //
|
||||
//=====================//
|
||||
|
||||
@Override
|
||||
public int getPriority() { return IOverrideInjector.CORE_PRIORITY; }
|
||||
|
||||
}
|
||||
@@ -20,7 +20,6 @@
|
||||
package com.seibel.distanthorizons.core.render;
|
||||
|
||||
import com.seibel.distanthorizons.api.DhApi;
|
||||
import com.seibel.distanthorizons.api.interfaces.override.IDhApiOverrideable;
|
||||
import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiCullingFrustum;
|
||||
import com.seibel.distanthorizons.api.interfaces.override.rendering.IDhApiShadowCullingFrustum;
|
||||
import com.seibel.distanthorizons.api.methods.events.sharedParameterObjects.DhApiRenderParam;
|
||||
@@ -30,7 +29,6 @@ import com.seibel.distanthorizons.core.dependencyInjection.SingletonInjector;
|
||||
import com.seibel.distanthorizons.core.enums.EDhDirection;
|
||||
import com.seibel.distanthorizons.core.logging.DhLoggerBuilder;
|
||||
import com.seibel.distanthorizons.core.logging.f3.F3Screen;
|
||||
import com.seibel.distanthorizons.core.pos.DhFrustumBounds;
|
||||
import com.seibel.distanthorizons.core.pos.DhLodPos;
|
||||
import com.seibel.distanthorizons.core.pos.DhSectionPos;
|
||||
import com.seibel.distanthorizons.core.pos.Pos2D;
|
||||
@@ -91,12 +89,20 @@ public class RenderBufferHandler implements AutoCloseable
|
||||
{
|
||||
this.lodQuadTree = lodQuadTree;
|
||||
|
||||
IDhApiCullingFrustum coreFrustum = DhApi.overrides.get(IDhApiCullingFrustum.class, IOverrideInjector.CORE_PRIORITY);
|
||||
if (coreFrustum == null)
|
||||
IDhApiCullingFrustum coreCameraFrustum = DhApi.overrides.get(IDhApiCullingFrustum.class, IOverrideInjector.CORE_PRIORITY);
|
||||
if (coreCameraFrustum == null)
|
||||
{
|
||||
DhApi.overrides.bind(IDhApiCullingFrustum.class, new DhFrustumBounds());
|
||||
}
|
||||
|
||||
// by default the shadow pass shouldn't have any frustum culling
|
||||
IDhApiShadowCullingFrustum coreShadowFrustum = DhApi.overrides.get(IDhApiShadowCullingFrustum.class, IOverrideInjector.CORE_PRIORITY);
|
||||
if (coreShadowFrustum == null)
|
||||
{
|
||||
DhApi.overrides.bind(IDhApiShadowCullingFrustum.class, new NeverCullFrustum());
|
||||
}
|
||||
|
||||
|
||||
this.f3Message = new F3Screen.MultiDynamicMessage(
|
||||
() ->
|
||||
{
|
||||
@@ -260,11 +266,6 @@ public class RenderBufferHandler implements AutoCloseable
|
||||
enableFrustumCulling = !Config.Client.Advanced.Graphics.AdvancedGraphics.disableFrustumCulling.get();
|
||||
frustum = DhApi.overrides.get(IDhApiCullingFrustum.class);
|
||||
}
|
||||
// use the core frustum if no override is present
|
||||
if (frustum == null)
|
||||
{
|
||||
frustum = DhApi.overrides.get(IDhApiCullingFrustum.class, IOverrideInjector.CORE_PRIORITY);
|
||||
}
|
||||
|
||||
|
||||
// update the frustum if necessary
|
||||
|
||||
Reference in New Issue
Block a user