MeshManager.h
Go to the documentation of this file.
1 /*
2 --------------------------------------------------------------------------------
3 This source file is part of SkyX.
4 Visit http://www.paradise-studios.net/products/skyx/
5 
6 Copyright (C) 2009-2012 Xavier Verguín González <xavyiy@gmail.com>
7 
8 This program is free software; you can redistribute it and/or modify it under
9 the terms of the GNU Lesser General Public License as published by the Free Software
10 Foundation; either version 2 of the License, or (at your option) any later
11 version.
12 
13 This program is distributed in the hope that it will be useful, but WITHOUT
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16 
17 You should have received a copy of the GNU Lesser General Public License along with
18 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20 http://www.gnu.org/copyleft/lesser.txt.
21 --------------------------------------------------------------------------------
22 */
23 
24 #ifndef _SkyX_MeshManager_H_
25 #define _SkyX_MeshManager_H_
26 
27 #include "Prerequisites.h"
28 
29 namespace SkyX
30 {
31  class SkyX;
32 
33  class DllExport MeshManager
34  {
35  public:
38  struct VERTEX
39  {
40  // Position
41  float x, y, z,
42  // Normalized position
43  nx, ny, nz,
44  // Texture coords
45  u, v,
46  // Opacity
47  o;
48  };
49 
53  MeshManager(SkyX *s);
54 
57  ~MeshManager();
58 
62  void create();
63 
66  void remove();
67 
71  void updateGeometry(Ogre::Camera* cam);
72 
76  inline Ogre::MeshPtr getMesh()
77  {
78  return mMesh;
79  }
80 
84  inline Ogre::SubMesh* getSubMesh()
85  {
86  return mSubMesh;
87  }
88 
92  inline Ogre::Entity* getEntity()
93  {
94  return mEntity;
95  }
96 
100  inline const Ogre::String& getMaterialName() const
101  {
102  return mMaterialName;
103  }
104 
108  void setMaterialName(const Ogre::String &MaterialName);
109 
113  inline Ogre::HardwareVertexBufferSharedPtr &getHardwareVertexBuffer()
114  {
115  return mVertexBuffer;
116  }
117 
121  inline Ogre::HardwareIndexBufferSharedPtr &getHardwareIndexBuffer()
122  {
123  return mIndexBuffer;
124  }
125 
129  inline Ogre::SceneNode* getSceneNode()
130  {
131  return mSceneNode;
132  }
133 
137  inline const bool& isCreated() const
138  {
139  return mCreated;
140  }
141 
146  void setGeometryParameters(const int& Steps, const int& Circles);
147 
151  inline const int& getSteps() const
152  {
153  return mSteps;
154  }
155 
159  inline const int& getCircles() const
160  {
161  return mCircles;
162  }
163 
180  void setUnderHorizonParams(const int& UnderHorizonCircles = 15,
181  const bool& UnderHorizonFading = true,
182  const Ogre::Real& UnderHorizonFadingExponent = 1,
183  const Ogre::Real& UnderHorizonFadingMultiplier = 2);
184 
188  inline const int& getUnderHorizonCircles() const
189  {
190  return mUnderHorizonCircles;
191  }
192 
196  inline const bool& getUnderHorizonFading() const
197  {
198  return mUnderHorizonFading;
199  }
200 
204  inline const Ogre::Real& getUnderHorizonFadingExponent() const
205  {
206  return mUnderHorizonFadingExponent;
207  }
208 
212  inline const Ogre::Real& getUnderHorizonFadingMultiplier() const
213  {
214  return mUnderHorizonFadingMultiplier;
215  }
216 
222  inline void setRadiusMultiplier(const Ogre::Real& RadiusMultiplier)
223  {
224  mRadiusMultiplier = RadiusMultiplier;
225  }
226 
231  float getSkydomeRadius(Ogre::Camera* c) const;
232 
233  private:
236  void _createGeometry();
237 
239  SkyX* mSkyX;
240 
242  bool mCreated;
243 
245  Ogre::MeshPtr mMesh;
246 
248  Ogre::SubMesh *mSubMesh;
250  Ogre::Entity *mEntity;
251 
253  Ogre::HardwareVertexBufferSharedPtr mVertexBuffer;
254 
256  VERTEX* mVertices;
257 
259  Ogre::HardwareIndexBufferSharedPtr mIndexBuffer;
260 
262  Ogre::SceneNode* mSceneNode;
263 
265  int mSteps;
266 
268  int mCircles;
270  int mUnderHorizonCircles;
272  bool mUnderHorizonFading;
274  Ogre::Real mUnderHorizonFadingExponent;
277  Ogre::Real mUnderHorizonFadingMultiplier;
278 
280  Ogre::Real mRadiusMultiplier;
281 
283  Ogre::String mMaterialName;
284  };
285 }
286 
287 #endif
void create()
Create SkyX.
SkyX(Ogre::SceneManager *sm, Controller *c)
Contructor.
bool mCreated
Is SkyX created?
Definition: SkyX.h:422
#define DllExport
Include external headers.
Definition: Prerequisites.h:45
bool isCreated() const
Is SkyX created?
Definition: SkyX.h:147