A bit of light culling refactor

This commit is contained in:
Dynamitos
2024-02-01 22:54:20 +01:00
parent 36aec0fa06
commit 18d22aeb4f
4 changed files with 20 additions and 21 deletions
+6 -2
View File
@@ -27,6 +27,10 @@ struct Plane
{
float3 n;
float d;
bool pointInside(float3 point)
{
return dot(n, point) - d > 0.0f;
}
};
struct Frustum
@@ -35,13 +39,13 @@ struct Frustum
Plane basePlane;
bool pointInside(float3 point)
{
if (dot(basePlane.n, point) + basePlane.d > 0.0f)
if (basePlane.pointInside(point))
{
return false;
}
for(int p = 0; p < 4; ++p)
{
if(dot(sides[p].n, point) + sides[p].d > 0.0f)
if(sides[p].pointInside(point))
{
return false;
}