/**
* 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;
+ }
};