#pragma once #include "ElementaryRenderable.h" #include "Ogre.h" using namespace Ogre; /** @brief enum for Ogre Renderable types, that can have RenderTechniques attached */ enum Ogre_RenderableType { OGRE_RENDERABLETYPE_SUBENTITY, OGRE_RENDERABLETYPE_BILLBOARDSET }; /** @brief Class to wrap different Ogre Renderable types */ class OgreRenderable : public ElementaryRenderable { public: /** @brief Constructor. Creates an OgreRenderable from a SubEntity of an Entity. @param sube the subentity to wrap @param parentEntity the parent of the wrapped subentity */ OgreRenderable(SubEntity* sube, Entity* parentEntity); /** @brief Constructor. Creates an OgreRenderable from a SubEntity of an Entity. @param parentEntity the parent of the wrapped subentity @param subEntityNum the number of the subentity to wrap */ OgreRenderable(Entity* parentEntity, int subEntityNum); /** @brief Constructor. Creates an OgreRenderable from a SubEntity of a BillboardSet. @param billboardset the BillboardSet to wrap */ OgreRenderable(BillboardSet* billboardset, ParticleSystem* sys = 0); /** @brief Destructor. */ ~OgreRenderable(void); /** @brief Sets the visibility of the wrapped renderable. @param visible visibility @see ElementaryRenderable::setVisible() */ void setVisible(bool visible); /** @brief Sets the rendergroup of the wrapped renderable. @param groupID the ID of the group to use @see ElementaryRenderable::setRenderGroup() */ void setRenderGroup (unsigned char groupID); /** @brief Retrieves if the renderable is hided or shown. */ bool isVisible(); /** @brief Sets the material to be used by the renderable. @param name the name of the material to use */ void setMaterialName(String& name); /** @brief Retrieves a resource pointer to the material used by the renderable. @return reference to the resource pointer */ const MaterialPtr& getMaterialPtr(); /** @brief Retrieves the name of the material used by the renderable. @return reference to the name of the material */ const String& getMaterialName(){return getMaterial()->getName();} /** @brief Retrieves a pointer to the material used by the renderable. @return reference to the Material pointer */ Material* getMaterial(){return getMaterialPtr().getPointer();} /** @brief Retrieves the axis-aligned bouding box of the renderable. @return reference to the bouding box */ AxisAlignedBox& getBoundingBox(){return boundingBox;} /** @brief Retrieves the bouding sphere of the renderable. @return reference to the bouding sphere */ Sphere& getBoundingSphere(){return boundingSphere;} /** @brief Retrieves the unique name assigned to the renderable. @return reference to name of the renderable */ String& getName(){return name;} /** @brief Updates bounding volumes. */ void updateBounds(); /** @brief Calls notifyCamera for the wrapped Renderable. @param pointer to the Camera to pass to notifyCamera() */ void notifyCamera(Camera* cam); /** @brief Returns the wrapped Renderable. @return pointer to the wrapped Renderable */ Renderable* getRenderable(); protected: /** @brief unique name assigned to the renderable */ String name; /** @brief pointer to the parent Entity if the renderable is a Subentity */ Entity* parentEntity; /** @brief pointer to the wrapped Subentity (if the renderable is a Subentity) */ SubEntity* subEntityRenderable; /** @brief pointer to the wrapped BillboardSet (if the renderable is a BillboardSet) */ BillboardSet* billboardSetRenderable; ParticleSystem* parentParticleSystem; /** @brief axis-aligned bounding box of the wrapped renderable in world space */ AxisAlignedBox boundingBox; /** @brief bounding sphere of the wrapped renderable in world space */ Sphere boundingSphere; /** @brief type of the renderable (see Ogre_RenderableType) */ Ogre_RenderableType renderableType; };