[3255] | 1 | #pragma once
|
---|
| 2 | #include "Ogre.h"
|
---|
| 3 | #include "ElementaryRenderable.h"
|
---|
| 4 |
|
---|
| 5 | using namespace Ogre;
|
---|
| 6 |
|
---|
| 7 | /**
|
---|
| 8 | @brief enum for Ogre Renderable types, that can have RenderTechniques attached
|
---|
| 9 | */
|
---|
| 10 | enum Ogre_RenderableType
|
---|
| 11 | {
|
---|
| 12 | OGRE_RENDERABLETYPE_SUBENTITY,
|
---|
| 13 | OGRE_RENDERABLETYPE_BILLBOARDSET
|
---|
| 14 | };
|
---|
| 15 |
|
---|
| 16 | /**
|
---|
| 17 | @brief class __declspec( dllexport ) to wrap different Ogre Renderable types
|
---|
| 18 | */
|
---|
| 19 | class __declspec( dllexport ) OgreRenderable : public ElementaryRenderable
|
---|
| 20 | {
|
---|
| 21 |
|
---|
| 22 | public:
|
---|
| 23 | /**
|
---|
| 24 | @brief Constructor.
|
---|
| 25 |
|
---|
| 26 | Creates an OgreRenderable from a SubEntity of an Entity.
|
---|
| 27 |
|
---|
| 28 | @param sube the subentity to wrap
|
---|
| 29 | @param parentEntity the parent of the wrapped subentity
|
---|
| 30 | */
|
---|
| 31 | OgreRenderable(SubEntity* sube, Entity* parentEntity);
|
---|
| 32 | /**
|
---|
| 33 | @brief Constructor.
|
---|
| 34 |
|
---|
| 35 | Creates an OgreRenderable from a SubEntity of an Entity.
|
---|
| 36 |
|
---|
| 37 | @param parentEntity the parent of the wrapped subentity
|
---|
| 38 | @param subEntityNum the number of the subentity to wrap
|
---|
| 39 | */
|
---|
| 40 | OgreRenderable(Entity* parentEntity, int subEntityNum);
|
---|
| 41 | /**
|
---|
| 42 | @brief Constructor.
|
---|
| 43 |
|
---|
| 44 | Creates an OgreRenderable from a SubEntity of a BillboardSet.
|
---|
| 45 |
|
---|
| 46 | @param billboardset the BillboardSet to wrap
|
---|
| 47 | */
|
---|
| 48 | OgreRenderable(BillboardSet* billboardset, ParticleSystem* sys = 0);
|
---|
| 49 | /**
|
---|
| 50 | @brief Destructor.
|
---|
| 51 | */
|
---|
| 52 | ~OgreRenderable(void);
|
---|
| 53 | /**
|
---|
| 54 | @brief Sets the visibility of the wrapped renderable.
|
---|
| 55 |
|
---|
| 56 | @param visible visibility
|
---|
| 57 | @see ElementaryRenderable::setVisible()
|
---|
| 58 | */
|
---|
| 59 | void setVisible(bool visible);
|
---|
| 60 | /**
|
---|
| 61 | @brief Sets the rendergroup of the wrapped renderable.
|
---|
| 62 |
|
---|
| 63 | @param groupID the ID of the group to use
|
---|
| 64 | @see ElementaryRenderable::setRenderGroup()
|
---|
| 65 | */
|
---|
| 66 | void setRenderGroup(unsigned char groupID);
|
---|
| 67 | /**
|
---|
| 68 | @brief Updates the given renderqueue for the wrapped renderable
|
---|
| 69 |
|
---|
| 70 | @param rq pointer to the renderqueue to be updated
|
---|
| 71 | */
|
---|
| 72 | void updateRenderQueue(RenderQueue* rq);
|
---|
| 73 | /**
|
---|
| 74 | @brief Retrieves if the renderable is hided or shown.
|
---|
| 75 | */
|
---|
| 76 | bool isVisible();
|
---|
| 77 | /**
|
---|
| 78 | @brief Sets the material to be used by the renderable.
|
---|
| 79 |
|
---|
| 80 | @param name the name of the material to use
|
---|
| 81 | */
|
---|
| 82 | void setMaterialName(String& name);
|
---|
| 83 |
|
---|
| 84 | /**
|
---|
| 85 | @brief Retrieves a resource pointer to the material used by the renderable.
|
---|
| 86 |
|
---|
| 87 | @return reference to the resource pointer
|
---|
| 88 | */
|
---|
| 89 | const MaterialPtr& getMaterialPtr();
|
---|
| 90 | /**
|
---|
| 91 | @brief Retrieves the name of the material used by the renderable.
|
---|
| 92 |
|
---|
| 93 | @return reference to the name of the material
|
---|
| 94 | */
|
---|
| 95 | const String& getMaterialName(){return getMaterial()->getName();}
|
---|
| 96 | /**
|
---|
| 97 | @brief Retrieves a pointer to the material used by the renderable.
|
---|
| 98 |
|
---|
| 99 | @return reference to the Material pointer
|
---|
| 100 | */
|
---|
| 101 | Material* getMaterial(){return getMaterialPtr().getPointer();}
|
---|
| 102 |
|
---|
| 103 | /**
|
---|
| 104 | @brief Retrieves the axis-aligned bouding box of the renderable.
|
---|
| 105 |
|
---|
| 106 | @return reference to the bouding box
|
---|
| 107 | */
|
---|
| 108 | AxisAlignedBox& getBoundingBox(){return boundingBox;}
|
---|
| 109 | /**
|
---|
| 110 | @brief Retrieves the bouding sphere of the renderable.
|
---|
| 111 |
|
---|
| 112 | @return reference to the bouding sphere
|
---|
| 113 | */
|
---|
| 114 | Sphere& getBoundingSphere(){return boundingSphere;}
|
---|
| 115 | /**
|
---|
| 116 | @brief Retrieves the unique name assigned to the renderable.
|
---|
| 117 |
|
---|
| 118 | @return reference to name of the renderable
|
---|
| 119 | */
|
---|
| 120 | String& getName(){return name;}
|
---|
| 121 | /**
|
---|
| 122 | @brief Updates bounding volumes.
|
---|
| 123 | */
|
---|
| 124 | void updateBounds();
|
---|
| 125 | /**
|
---|
| 126 | @brief Calls notifyCamera for the wrapped Renderable.
|
---|
| 127 |
|
---|
| 128 | @param pointer to the Camera to pass to notifyCamera()
|
---|
| 129 | */
|
---|
| 130 | void notifyCamera(Camera* cam);
|
---|
| 131 | /**
|
---|
| 132 | @brief Returns the wrapped Renderable.
|
---|
| 133 |
|
---|
| 134 | @return pointer to the wrapped Renderable
|
---|
| 135 | */
|
---|
| 136 | Renderable* getRenderable();
|
---|
| 137 |
|
---|
| 138 | SceneNode* getParentSceneNode();
|
---|
| 139 |
|
---|
| 140 | protected:
|
---|
| 141 | /**
|
---|
| 142 | @brief unique name assigned to the renderable
|
---|
| 143 | */
|
---|
| 144 | String name;
|
---|
| 145 | /**
|
---|
| 146 | @brief pointer to the parent Entity if the renderable is a Subentity
|
---|
| 147 | */
|
---|
| 148 | Entity* parentEntity;
|
---|
| 149 | /**
|
---|
| 150 | @brief pointer to the wrapped Subentity (if the renderable is a Subentity)
|
---|
| 151 | */
|
---|
| 152 | SubEntity* subEntityRenderable;
|
---|
| 153 | /**
|
---|
| 154 | @brief pointer to the wrapped BillboardSet (if the renderable is a BillboardSet)
|
---|
| 155 | */
|
---|
| 156 | BillboardSet* billboardSetRenderable;
|
---|
| 157 | /**
|
---|
| 158 | @brief pointer to the parent Particle System of the wrapped BillboardSet (if the renderable is a BillboardSet)
|
---|
| 159 | */
|
---|
| 160 | ParticleSystem* parentParticleSystem;
|
---|
| 161 | /**
|
---|
| 162 | @brief axis-aligned bounding box of the wrapped renderable in world space
|
---|
| 163 | */
|
---|
| 164 | AxisAlignedBox boundingBox;
|
---|
| 165 | /**
|
---|
| 166 | @brief bounding sphere of the wrapped renderable in world space
|
---|
| 167 | */
|
---|
| 168 | Sphere boundingSphere;
|
---|
| 169 | /**
|
---|
| 170 | @brief type of the renderable (see Ogre_RenderableType)
|
---|
| 171 | */
|
---|
| 172 | Ogre_RenderableType renderableType;
|
---|
| 173 | };
|
---|