X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FFrustum.hh;h=a50dc8338d0a10206bce3ebc900f93037b640e23;hp=82eba17140a0bcf6ecdb1e644d4969df0eb7ec82;hb=f72400af4fa3e7b54dab154b5a2b6503a6f9af18;hpb=29e3d45f7bbbf31eadf793c41ff2b3d9c47b7539 diff --git a/src/Moof/Frustum.hh b/src/Moof/Frustum.hh index 82eba17..a50dc83 100644 --- a/src/Moof/Frustum.hh +++ b/src/Moof/Frustum.hh @@ -29,22 +29,45 @@ #ifndef _MOOF_FRUSTUM_HH_ #define _MOOF_FRUSTUM_HH_ +#include #include namespace Mf { +class Aabb; +class Sphere; + class Frustum { - Matrix4 projection; - //Plane left, right, bottom, top, near, far; + Plane planes_[6]; // left, right, bottom, top, near, far public: - Frustum(Scalar l, Scalar r, Scalar b, Scalar t, Scalar n, Scalar f); - Frustum(Scalar fovy, Scalar aspect, Scalar near, Scalar far); + typedef enum + { + OUTSIDE = 0, + INSIDE = 1, + INTERSECT = 2 + } Collision; + + Frustum() {} + inline Frustum(const Matrix4& modelview, const Matrix4& projection) + { + init(modelview, projection); + } + inline Frustum(const Matrix4& modelview, Scalar fovy, Scalar aspect, + Scalar near, Scalar far) + { + init(modelview, fovy, aspect, near, far); + } + + void init(const Matrix4& modelview, const Matrix4& projection); + void init(const Matrix4& modelview, Scalar fovy, Scalar aspect, Scalar near, + Scalar far); - const Matrix4& getMatrix() const; + Collision containsAabb(const Aabb& aabb) const; + Collision containsSphere(const Sphere& sphere) const; };