/*] Copyright (c) 2009-2010, Charles McGarvey [************************** **] All rights reserved. * * vi:ts=4 sw=4 tw=75 * * Distributable under the terms and conditions of the 2-clause BSD license; * see the file COPYING for a complete text of the license. * **************************************************************************/ #ifndef _MOOF_ENTITY_HH_ #define _MOOF_ENTITY_HH_ #include #include #include #include #include namespace Mf { class Frustum; /** * Interface for game objects that can be drawn to the screen and have a * specified volume (take up space). */ class Entity; typedef boost::shared_ptr EntityP; class Entity : public Cullable, public Drawable { protected: Aabb<3> mAabb; Sphere<3> mSphere; public: virtual ~Entity() {} virtual void drawIfVisible(Scalar alpha, const Frustum& frustum) const { if (isVisible(frustum)) draw(alpha); } virtual bool isVisible(const Frustum& frustum) const { return mSphere.isVisible(frustum) && mAabb.isVisible(frustum); } const Aabb<3>& getAabb() const { return mAabb; } const Sphere<3>& getSphere() const { return mSphere; } }; } // namespace Mf #endif // _MOOF_ENTITY_HH_