source: GTP/trunk/Lib/Illum/IllumModule/OgreIllumModule/include/OgreRenderable.h @ 2475

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