]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Frustum.hh
initial port to win32
[chaz/yoink] / src / Moof / Frustum.hh
index 82eba17140a0bcf6ecdb1e644d4969df0eb7ec82..4154f1492cc98316ea72cd82b0c894359dac0010 100644 (file)
 #ifndef _MOOF_FRUSTUM_HH_
 #define _MOOF_FRUSTUM_HH_
        
+#include <Moof/Math.hh>
 #include <Moof/Plane.hh>
 
 
 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 abutting, Scalar distant)
+       {
+               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 containsAabb(const Aabb& aabb) const;
+       Collision containsSphere(const Sphere& sphere) const;
 };
 
 
This page took 0.017192 seconds and 4 git commands to generate.