use of net.coderbot.iris.shadows.frustum.advanced.AdvancedShadowCullingFrustum in project Iris by IrisShaders.
the class ShadowRenderer method createShadowFrustum.
private FrustumHolder createShadowFrustum(float renderMultiplier, FrustumHolder holder) {
// TODO: Cull entities / block entities with Advanced Frustum Culling even if voxelization is detected.
String distanceInfo;
String cullingInfo;
if ((packCullingState == OptionalBoolean.FALSE || packHasVoxelization || packHasIndirectSunBounceGi) && packCullingState != OptionalBoolean.TRUE) {
double distance = halfPlaneLength * renderMultiplier;
String reason;
if (packCullingState == OptionalBoolean.FALSE) {
reason = "(set by shader pack)";
} else if (packHasVoxelization) {
reason = "(voxelization detected)";
} else {
reason = "(indirect sunlight GI detected)";
}
if (distance <= 0 || distance > Minecraft.getInstance().options.renderDistance * 16) {
distanceInfo = +Minecraft.getInstance().options.renderDistance * 16 + " blocks (capped by normal render distance)";
cullingInfo = "disabled " + reason;
return holder.setInfo(new NonCullingFrustum(), distanceInfo, cullingInfo);
} else {
distanceInfo = distance + " blocks (set by shader pack)";
cullingInfo = "distance only " + reason;
BoxCuller boxCuller = new BoxCuller(distance);
holder.setInfo(new BoxCullingFrustum(boxCuller), distanceInfo, cullingInfo);
}
} else {
BoxCuller boxCuller;
double distance = halfPlaneLength * renderMultiplier;
String setter = "(set by shader pack)";
if (renderMultiplier < 0) {
distance = IrisVideoSettings.shadowDistance * 16;
setter = "(set by user)";
}
if (distance >= Minecraft.getInstance().options.renderDistance * 16) {
distanceInfo = Minecraft.getInstance().options.renderDistance * 16 + " blocks (capped by normal render distance)";
boxCuller = null;
} else {
distanceInfo = distance + " blocks " + setter;
if (distance == 0.0) {
cullingInfo = "no shadows rendered";
holder.setInfo(new CullEverythingFrustum(), distanceInfo, cullingInfo);
}
boxCuller = new BoxCuller(distance);
}
cullingInfo = "Advanced Frustum Culling enabled";
Vector4f shadowLightPosition = new CelestialUniforms(sunPathRotation).getShadowLightPositionInWorldSpace();
Vector3f shadowLightVectorFromOrigin = new Vector3f(shadowLightPosition.x(), shadowLightPosition.y(), shadowLightPosition.z());
shadowLightVectorFromOrigin.normalize();
return holder.setInfo(new AdvancedShadowCullingFrustum(CapturedRenderingState.INSTANCE.getGbufferModelView(), CapturedRenderingState.INSTANCE.getGbufferProjection(), shadowLightVectorFromOrigin, boxCuller), distanceInfo, cullingInfo);
}
return holder;
}
Aggregations