X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEntity.hh;h=ee0f8602c6fd8585090251b9d89cab8f753aefd6;hp=7595054e68e8aa534b7c58966c6687cb22f5f487;hb=3f6e44698c38b74bb622ad81ea9d2daa636981d2;hpb=493ddb59a8620b49dfa0ff62ce93395ebfd02e86 diff --git a/src/Moof/Entity.hh b/src/Moof/Entity.hh index 7595054..ee0f860 100644 --- a/src/Moof/Entity.hh +++ b/src/Moof/Entity.hh @@ -34,29 +34,54 @@ #include #include #include +#include namespace Mf { +class Entity; +typedef boost::shared_ptr EntityP; + +class Frustum; + + /** - * Interface for game objects that can be drawn to the screen and half a - * specified size. + * Interface for game objects that can be drawn to the screen and have a + * 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: - const Aabb& getAabb() const + + virtual ~Entity() {} + + virtual void drawIfVisible(Scalar alpha, const Frustum& frustum) const { - return aabb_; + if (isVisible(frustum)) draw(alpha); } -protected: - Aabb aabb_; -}; + virtual bool isVisible(const Frustum& frustum) const + { + return mSphere.isVisible(frustum) && mAabb.isVisible(frustum); + } -typedef boost::shared_ptr EntityPtr; + const Aabb<3>& getAabb() const + { + return mAabb; + } + + const Sphere<3>& getSphere() const + { + return mSphere; + } +}; } // namespace Mf