X-Git-Url: https://git.dogcows.com/gitweb?p=chaz%2Fyoink;a=blobdiff_plain;f=src%2FMoof%2FEntity.hh;h=52cb79d442f2b4c6db1afe0faf7097468beedbef;hp=310e0a128cbb52c0371ec742390d3d46144fcaeb;hb=c9e20ac06383b20ceb5404c9237e319c2e90d157;hpb=25aefe01ef7dbdb603c51411e04b0d6a6107684f diff --git a/src/Moof/Entity.hh b/src/Moof/Entity.hh index 310e0a1..52cb79d 100644 --- a/src/Moof/Entity.hh +++ b/src/Moof/Entity.hh @@ -48,32 +48,39 @@ 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 Cullable, public Drawable { +protected: + + Aabb mAabb; + Sphere mSphere; + public: + virtual ~Entity() {} - const Aabb& getAabb() const + 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); } - void drawIfVisible(Scalar alpha, const Frustum& frustum) const + const Aabb& getAabb() const { - if (isVisible(frustum)) draw(alpha); + return mAabb; } -protected: - Aabb aabb_; - Sphere sphere_; + const Sphere& getSphere() const + { + return mSphere; + } };