Merge pull request #91790 from lawnjelly/fix_tight_light_cull_directional_colinear4

Tighter light culling - fix directional lights colinear case
This commit is contained in:
Rémi Verschelde 2024-05-10 10:48:54 +02:00
commit 2ba22d1554
No known key found for this signature in database
GPG key ID: C3336907360768E1

View file

@ -279,9 +279,11 @@ 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;
// Create plane from 3 points. if (!_is_colinear_tri(pt0, pt1, pt2)) {
Plane p(pt0, pt1, pt2); // Create plane from 3 points.
r_cull_planes.add_cull_plane(p); Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
}
} }
// Last to 0 edge. // Last to 0 edge.
@ -295,9 +297,11 @@ 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;
// Create plane from 3 points. if (!_is_colinear_tri(pt0, pt1, pt2)) {
Plane p(pt0, pt1, pt2); // Create plane from 3 points.
r_cull_planes.add_cull_plane(p); Plane p(pt0, pt1, pt2);
r_cull_planes.add_cull_plane(p);
}
} }
#ifdef LIGHT_CULLER_DEBUG_LOGGING #ifdef LIGHT_CULLER_DEBUG_LOGGING