mirror of https://github.com/AxioDL/zeus.git
Add sphere->frustum and point->frustum intersection tests
This commit is contained in:
parent
b6a1241678
commit
08d2925689
|
@ -88,8 +88,7 @@ public:
|
|||
inline bool aabbFrustumTest(const CAABox& aabb) const
|
||||
{
|
||||
CVector3f vmin, vmax;
|
||||
int i;
|
||||
for (i = 0; i < 6; ++i)
|
||||
for (uint32_t i = 0; i < 6; ++i)
|
||||
{
|
||||
const CPlane& plane = planes[i];
|
||||
|
||||
|
@ -132,6 +131,28 @@ public:
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool sphereFrustumTest(const CSphere& sphere)
|
||||
{
|
||||
for (uint32_t i = 0 ; i<6 ; ++i)
|
||||
{
|
||||
float dadot = planes[i].vec.dot(sphere.position);
|
||||
if ((dadot + planes[i].d + sphere.radius) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
inline bool pointFrustumTest(const CVector3f& point)
|
||||
{
|
||||
for (uint32_t i = 0 ; i<6 ; ++i)
|
||||
{
|
||||
float dadot = planes[i].vec.dot(point);
|
||||
if ((dadot + planes[i].d) < 0)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
}
|
||||
#endif // CFRUSTUM_HPP
|
||||
|
|
Loading…
Reference in New Issue