]> Dogcows Code - chaz/yoink/blobdiff - src/Moof/Entity.hh
cade lab fixes
[chaz/yoink] / src / Moof / Entity.hh
index f593d0cd316d872468e44b11b290750c4ffcc8fe..ee0f8602c6fd8585090251b9d89cab8f753aefd6 100644 (file)
 namespace Mf {
 
 
-class Camera;
+class Entity;
+typedef boost::shared_ptr<Entity> EntityP;
+
+class Frustum;
+
 
 /**
  * Interface for game objects that can be drawn to the screen and have a
- * specified size.
+ * specified volume (take up space).
  */
 
-class Entity : public Drawable, public Cullable
+class Entity : public Cullable, public Drawable
 {
+protected:
+
+       Aabb<3>         mAabb;
+       Sphere<3>       mSphere;
+
 public:
-       inline virtual ~Entity() {}
 
-       const Aabb& getAabb() const
+       virtual ~Entity() {}
+
+       virtual void drawIfVisible(Scalar alpha, const Frustum& frustum) const
        {
-               return aabb_;
+               if (isVisible(frustum)) draw(alpha);
        }
 
-       const Sphere& getSphere() const
+       virtual bool isVisible(const Frustum& frustum) const
        {
-               return sphere_;
+               return mSphere.isVisible(frustum) && mAabb.isVisible(frustum);
        }
 
-       virtual void drawIfVisible(Scalar alpha, const Camera& cam) const
+       const Aabb<3>& getAabb() const
        {
-               if (isVisible(cam)) draw(alpha);
+               return mAabb;
        }
 
-protected:
-       Aabb    aabb_;
-       Sphere  sphere_;
+       const Sphere<3>& getSphere() const
+       {
+               return mSphere;
+       }
 };
 
-typedef boost::shared_ptr<Entity> EntityPtr;
-
 
 } // namespace Mf
 
This page took 0.020985 seconds and 4 git commands to generate.