1 | #pragma once
|
---|
2 | #include "ElementaryRenderable.h"
|
---|
3 | #include "Ogre.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 to wrap different Ogre Renderable types
|
---|
18 | */
|
---|
19 | class OgreRenderable : public ElementaryRenderable
|
---|
20 | {
|
---|
21 | public:
|
---|
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);
|
---|
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 Retrieves if the renderable is hided or shown.
|
---|
69 | */
|
---|
70 | bool isVisible();
|
---|
71 | /**
|
---|
72 | @brief Sets the material to be used by the renderable.
|
---|
73 |
|
---|
74 | @param name the name of the material to use
|
---|
75 | */
|
---|
76 | void setMaterialName(String& name);
|
---|
77 |
|
---|
78 | /**
|
---|
79 | @brief Retrieves a resource pointer to the material used by the renderable.
|
---|
80 |
|
---|
81 | @return reference to the resource pointer
|
---|
82 | */
|
---|
83 | const MaterialPtr& getMaterialPtr();
|
---|
84 | /**
|
---|
85 | @brief Retrieves the name of the material used by the renderable.
|
---|
86 |
|
---|
87 | @return reference to the name of the material
|
---|
88 | */
|
---|
89 | const String& getMaterialName(){return getMaterial()->getName();}
|
---|
90 | /**
|
---|
91 | @brief Retrieves a pointer to the material used by the renderable.
|
---|
92 |
|
---|
93 | @return reference to the Material pointer
|
---|
94 | */
|
---|
95 | Material* getMaterial(){return getMaterialPtr().getPointer();}
|
---|
96 |
|
---|
97 | /**
|
---|
98 | @brief Retrieves the axis-aligned bouding box of the renderable.
|
---|
99 |
|
---|
100 | @return reference to the bouding box
|
---|
101 | */
|
---|
102 | AxisAlignedBox& getBoundingBox(){return boundingBox;}
|
---|
103 | /**
|
---|
104 | @brief Retrieves the bouding sphere of the renderable.
|
---|
105 |
|
---|
106 | @return reference to the bouding sphere
|
---|
107 | */
|
---|
108 | Sphere& getBoundingSphere(){return boundingSphere;}
|
---|
109 | /**
|
---|
110 | @brief Retrieves the unique name assigned to the renderable.
|
---|
111 |
|
---|
112 | @return reference to name of the renderable
|
---|
113 | */
|
---|
114 | String& getName(){return name;}
|
---|
115 | /**
|
---|
116 | @brief Updates bounding volumes.
|
---|
117 | */
|
---|
118 | void updateBounds();
|
---|
119 | /**
|
---|
120 | @brief Calls notifyCamera for the wrapped Renderable.
|
---|
121 |
|
---|
122 | @param pointer to the Camera to pass to notifyCamera()
|
---|
123 | */
|
---|
124 | void notifyCamera(Camera* cam);
|
---|
125 | /**
|
---|
126 | @brief Returns the wrapped Renderable.
|
---|
127 |
|
---|
128 | @return pointer to the wrapped Renderable
|
---|
129 | */
|
---|
130 | Renderable* getRenderable();
|
---|
131 |
|
---|
132 |
|
---|
133 | protected:
|
---|
134 |
|
---|
135 | /**
|
---|
136 | @brief unique name assigned to the renderable
|
---|
137 | */
|
---|
138 | String name;
|
---|
139 | /**
|
---|
140 | @brief pointer to the parent Entity if the renderable is a Subentity
|
---|
141 | */
|
---|
142 | Entity* parentEntity;
|
---|
143 | /**
|
---|
144 | @brief pointer to the wrapped Subentity (if the renderable is a Subentity)
|
---|
145 | */
|
---|
146 | SubEntity* subEntityRenderable;
|
---|
147 | /**
|
---|
148 | @brief pointer to the wrapped BillboardSet (if the renderable is a BillboardSet)
|
---|
149 | */
|
---|
150 | BillboardSet* billboardSetRenderable;
|
---|
151 |
|
---|
152 | /**
|
---|
153 | @brief axis-aligned bounding box of the wrapped renderable in world space
|
---|
154 | */
|
---|
155 | AxisAlignedBox boundingBox;
|
---|
156 | /**
|
---|
157 | @brief bounding sphere of the wrapped renderable in world space
|
---|
158 | */
|
---|
159 | Sphere boundingSphere;
|
---|
160 | /**
|
---|
161 | @brief type of the renderable (see Ogre_RenderableType)
|
---|
162 | */
|
---|
163 | Ogre_RenderableType renderableType;
|
---|
164 | };
|
---|