mirror of https://github.com/AxioDL/zeus.git
Add invalid state for CFrustum (always passes tests)
This commit is contained in:
parent
bf13f1f49c
commit
2c19667f42
|
@ -10,6 +10,7 @@ namespace zeus
|
||||||
class CFrustum
|
class CFrustum
|
||||||
{
|
{
|
||||||
CPlane planes[6];
|
CPlane planes[6];
|
||||||
|
bool valid = false;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
inline void updatePlanes(const CMatrix4f& modelview, const CMatrix4f& projection)
|
inline void updatePlanes(const CMatrix4f& modelview, const CMatrix4f& projection)
|
||||||
|
@ -82,6 +83,8 @@ public:
|
||||||
planes[3].normalize();
|
planes[3].normalize();
|
||||||
planes[4].normalize();
|
planes[4].normalize();
|
||||||
planes[5].normalize();
|
planes[5].normalize();
|
||||||
|
|
||||||
|
valid = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void updatePlanes(const CTransform& modelview, const CProjection& projection)
|
inline void updatePlanes(const CTransform& modelview, const CProjection& projection)
|
||||||
|
@ -91,6 +94,9 @@ public:
|
||||||
|
|
||||||
inline bool aabbFrustumTest(const CAABox& aabb) const
|
inline bool aabbFrustumTest(const CAABox& aabb) const
|
||||||
{
|
{
|
||||||
|
if (!valid)
|
||||||
|
return true;
|
||||||
|
|
||||||
CVector3f vmin, vmax;
|
CVector3f vmin, vmax;
|
||||||
for (uint32_t i = 0; i < 6; ++i)
|
for (uint32_t i = 0; i < 6; ++i)
|
||||||
{
|
{
|
||||||
|
@ -138,6 +144,9 @@ public:
|
||||||
|
|
||||||
inline bool sphereFrustumTest(const CSphere& sphere)
|
inline bool sphereFrustumTest(const CSphere& sphere)
|
||||||
{
|
{
|
||||||
|
if (!valid)
|
||||||
|
return true;
|
||||||
|
|
||||||
for (uint32_t i = 0 ; i<6 ; ++i)
|
for (uint32_t i = 0 ; i<6 ; ++i)
|
||||||
{
|
{
|
||||||
float dadot = planes[i].vec.dot(sphere.position);
|
float dadot = planes[i].vec.dot(sphere.position);
|
||||||
|
@ -149,6 +158,9 @@ public:
|
||||||
|
|
||||||
inline bool pointFrustumTest(const CVector3f& point)
|
inline bool pointFrustumTest(const CVector3f& point)
|
||||||
{
|
{
|
||||||
|
if (!valid)
|
||||||
|
return true;
|
||||||
|
|
||||||
for (uint32_t i = 0 ; i<6 ; ++i)
|
for (uint32_t i = 0 ; i<6 ; ++i)
|
||||||
{
|
{
|
||||||
float dadot = planes[i].vec.dot(point);
|
float dadot = planes[i].vec.dot(point);
|
||||||
|
|
Loading…
Reference in New Issue