Tighter light culling - fix directional lights colinear case

Exactly the same fix as done already for non-directional lights.
This commit is contained in:
lawnjelly 2024-05-10 09:13:05 +01:00
parent da5714ad6e
commit a76243a549

View File

@ -279,10 +279,12 @@ bool RenderingLightCuller::add_light_camera_planes_directional(LightCullPlanes &
// Create a third point from the light direction. // Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir; Vector3 pt2 = pt0 - p_light_source.dir;
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points. // Create plane from 3 points.
Plane p(pt0, pt1, pt2); Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p); r_cull_planes.add_cull_plane(p);
} }
}
// Last to 0 edge. // Last to 0 edge.
if (n_edges) { if (n_edges) {
@ -295,10 +297,12 @@ bool RenderingLightCuller::add_light_camera_planes_directional(LightCullPlanes &
// Create a third point from the light direction. // Create a third point from the light direction.
Vector3 pt2 = pt0 - p_light_source.dir; Vector3 pt2 = pt0 - p_light_source.dir;
if (!_is_colinear_tri(pt0, pt1, pt2)) {
// Create plane from 3 points. // Create plane from 3 points.
Plane p(pt0, pt1, pt2); Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p); r_cull_planes.add_cull_plane(p);
} }
}
#ifdef LIGHT_CULLER_DEBUG_LOGGING #ifdef LIGHT_CULLER_DEBUG_LOGGING
if (is_logging()) { if (is_logging()) {