X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FFrustum.hh;h=406e2304895db75ea5c519e6e8ec1a0a6685f799;hp=ac2b353e263409f1be648a60854f249fc263ff9b;hb=3f6e44698c38b74bb622ad81ea9d2daa636981d2;hpb=493ddb59a8620b49dfa0ff62ce93395ebfd02e86 diff --git a/src/Moof/Frustum.hh b/src/Moof/Frustum.hh index ac2b353..406e230 100644 --- a/src/Moof/Frustum.hh +++ b/src/Moof/Frustum.hh @@ -29,18 +29,19 @@ #ifndef _MOOF_FRUSTUM_HH_ #define _MOOF_FRUSTUM_HH_ +#include #include namespace Mf { -class Aabb; +template class Aabb; +template class Sphere; class Frustum { - //Matrix4 projection; - Plane left, right, bottom, top, near, far; + Plane mPlanes[6]; // left, right, bottom, top, near, far public: typedef enum @@ -50,16 +51,23 @@ public: INTERSECT = 2 } Collision; - //Frustum() {} - //Frustum(Scalar l, Scalar r, Scalar b, Scalar t, Scalar n, Scalar f); - //Frustum(Scalar fovy, Scalar aspect, Scalar near, Scalar far); - - inline Collision checkAabb(const Aabb& aabb) const + Frustum() {} + Frustum(const Matrix4& modelview, const Matrix4& projection) + { + init(modelview, projection); + } + Frustum(const Matrix4& modelview, Scalar fovy, Scalar aspect, + Scalar abutting, Scalar distant) { - return INSIDE; + init(modelview, fovy, aspect, abutting, distant); } + + void init(const Matrix4& modelview, const Matrix4& projection); + void init(const Matrix4& modelview, Scalar fovy, Scalar aspect, + Scalar abutting, Scalar distant); - //const Matrix4& getMatrix() const; + Collision contains(const Aabb<3>& aabb) const; + Collision contains(const Sphere<3>& sphere) const; };