X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEntity.hh;h=52cb79d442f2b4c6db1afe0faf7097468beedbef;hp=33efcc9e77ca20afbc362184007306e0ca586c7f;hb=a31d65a998121df0651c57bfb68782e2a07d2e2f;hpb=fdfba4553433b9b2804c2772c7645211b828c2ea diff --git a/src/Moof/Entity.hh b/src/Moof/Entity.hh index 33efcc9..52cb79d 100644 --- a/src/Moof/Entity.hh +++ b/src/Moof/Entity.hh @@ -43,37 +43,44 @@ namespace Mf { class Entity; typedef boost::shared_ptr EntityP; -class Camera; +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 mAabb; + Sphere 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& getAabb() const { - if (isVisible(cam)) draw(alpha); + return mAabb; } -protected: - Aabb aabb_; - Sphere sphere_; + const Sphere& getSphere() const + { + return mSphere; + } };