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

Revision 1425, 4.2 KB checked in by szirmay, 18 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        /**
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       
139protected:
140
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        ParticleSystem* parentParticleSystem;
158
159        /**
160                @brief axis-aligned bounding box of the wrapped renderable in world space
161        */
162        AxisAlignedBox boundingBox;
163        /**
164                @brief bounding sphere of the wrapped renderable in world space
165        */
166        Sphere boundingSphere; 
167        /**
168                @brief type of the renderable (see Ogre_RenderableType)
169        */
170        Ogre_RenderableType renderableType;
171};
Note: See TracBrowser for help on using the repository browser.