RigsofRods
Soft-body Physics Simulation
SkyX.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_SkyX_H_
25 #define _SkyX_SkyX_H_
26 
27 #include "Prerequisites.h"
28 
29 #include "MeshManager.h"
30 #include "AtmosphereManager.h"
31 #include "GPUManager.h"
32 #include "MoonManager.h"
33 #include "CloudsManager.h"
34 #include "ColorGradient.h"
35 #include "Controller.h"
36 #include "BasicController.h"
37 #include "VCloudsManager.h"
38 #include "VClouds/VClouds.h"
40 #include "VClouds/GeometryBlock.h"
41 #include "VClouds/FastFakeRandom.h"
42 #include "VClouds/Ellipsoid.h"
43 #include "VClouds/DataManager.h"
44 #include "SCfgFileManager.h"
45 
46 namespace SkyX
47 {
61  class SkyX : public Ogre::FrameListener, public Ogre::RenderTargetListener
62  {
63  public:
67  {
74  inline RenderQueueGroups(const Ogre::uint8& s, const Ogre::uint8& vc, const Ogre::uint8& vclu, const Ogre::uint8& vclo)
75  : skydome(s), vclouds(vc), vcloudsLightningsUnder(vclu), vcloudsLightningsOver(vclo)
76  {
77  }
78 
80  Ogre::uint8 skydome;
82  Ogre::uint8 vclouds;
86  Ogre::uint8 vcloudsLightningsOver;
87  };
88 
97  {
99  LM_LDR = 0,
101  LM_HDR = 1
102  };
103 
108  SkyX(Ogre::SceneManager* sm, Controller* c);
109 
112  ~SkyX();
113 
116  void create();
117 
120  void remove();
121 
129  void update(const Ogre::Real &timeSinceLastFrame);
130 
138  void notifyCameraRender(Ogre::Camera* c);
139 
143  inline const bool isCreated() const
144  {
145  return mCreated;
146  }
147 
151  void setVisible(const bool& visible);
152 
156  inline const bool& isVisible() const
157  {
158  return mVisible;
159  }
160 
166  inline void setTimeMultiplier(const Ogre::Real& TimeMultiplier)
167  {
168  mTimeMultiplier = TimeMultiplier;
169  mVCloudsManager->_updateWindSpeedConfig();
170  }
171 
175  inline const Ogre::Real& getTimeMultiplier() const
176  {
177  return mTimeMultiplier;
178  }
179 
184  {
185  return mMeshManager;
186  }
187 
192  {
193  return mAtmosphereManager;
194  }
195 
200  {
201  return mGPUManager;
202  }
203 
208  {
209  return mMoonManager;
210  }
211 
216  {
217  return mCloudsManager;
218  }
219 
224  {
225  return mVCloudsManager;
226  }
227 
231  inline void setController(Controller* c)
232  {
233  if (mController->getDeleteBySkyX())
234  {
235  delete mController;
236  }
237 
238  mController = c;
239  }
240 
244  inline Controller* getController() const
245  {
246  return mController;
247  }
248 
252  void setRenderQueueGroups(const RenderQueueGroups& rqg);
253 
258  {
259  return mRenderQueueGroups;
260  }
261 
270  void setLightingMode(const LightingMode& lm);
271 
275  inline const LightingMode& getLightingMode() const
276  {
277  return mLightingMode;
278  }
279 
283  void setStarfieldEnabled(const bool& Enabled);
284 
288  inline const bool& isStarfieldEnabled() const
289  {
290  return mStarfield;
291  }
292 
299  inline void setInfiniteCameraFarClipDistance(const Ogre::Real& d)
300  {
301  mInfiniteCameraFarClipDistance = d;
302  }
303 
307  inline const Ogre::Real& getInfiniteCameraFarClipDistance() const
308  {
309  return mInfiniteCameraFarClipDistance;
310  }
311 
315  inline Ogre::SceneManager* getSceneManager()
316  {
317  return mSceneManager;
318  }
319 
323  inline Ogre::Camera* getCamera()
324  {
325  return mCamera;
326  }
327 
331  bool frameStarted(const Ogre::FrameEvent& evt);
332 
336  void preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt);
337 
342  inline const Ogre::Real& _getTimeOffset() const
343  {
344  return mTimeOffset;
345  }
346 
348  {
349  return mCfgFileManager;
350  }
351 
352  inline const bool loadCfg(const Ogre::String &File) const
353  {
354  return mCfgFileManager->load(File);
355  }
356 
357  private:
359  bool mCreated;
360 
373 
376 
379 
381  Ogre::SceneManager *mSceneManager;
383  Ogre::Camera* mCamera;
384 
386  Ogre::Vector3 mLastCameraPosition;
391 
393  bool mVisible;
394 
399 
401  Ogre::Real mTimeMultiplier;
403  Ogre::Real mTimeOffset;
404 
406  };
407 }
408 
409 #endif
BasicController.h
SkyX::SkyX::getRenderQueueGroups
const RenderQueueGroups & getRenderQueueGroups() const
Get render queue groups.
Definition: SkyX.h:257
VClouds.h
SkyX::SkyX::mInfiniteCameraFarClipDistance
Ogre::Real mInfiniteCameraFarClipDistance
Infinite camera far clip distance.
Definition: SkyX.h:390
DataManager.h
ColorGradient.h
FastFakeRandom.h
Prerequisites.h
GeometryManager.h
VCloudsManager.h
SkyX::SkyX::mLightingMode
LightingMode mLightingMode
Lighting mode.
Definition: SkyX.h:396
SkyX::SkyX::LightingMode
LightingMode
Lighting mode enumeration SkyX is designed for true HDR rendering, but there is a big number of appli...
Definition: SkyX.h:96
SkyX::SkyX::getLightingMode
const LightingMode & getLightingMode() const
Get lighting mode.
Definition: SkyX.h:275
Controller.h
SkyX::SkyX::getController
Controller * getController() const
Get current controller.
Definition: SkyX.h:244
SkyX::SkyX::mLastCameraFarClipDistance
Ogre::Real mLastCameraFarClipDistance
Last camera far clip distance.
Definition: SkyX.h:388
SkyX::SkyX::getSceneManager
Ogre::SceneManager * getSceneManager()
Get scene manager.
Definition: SkyX.h:315
SkyX
Definition: AtmosphereManager.cpp:30
SkyX::SkyX::mCreated
bool mCreated
Is SkyX created?
Definition: SkyX.h:359
SkyX::AtmosphereManager
Definition: AtmosphereManager.h:33
SkyX::MoonManager
Definition: MoonManager.h:33
SkyX::SkyX::getMeshManager
MeshManager * getMeshManager()
Get mesh manager.
Definition: SkyX.h:183
SkyX::SkyX::_getTimeOffset
const Ogre::Real & _getTimeOffset() const
Get time offset.
Definition: SkyX.h:342
SkyX::SkyX::RenderQueueGroups::vcloudsLightningsUnder
Ogre::uint8 vcloudsLightningsUnder
VClouds lightnings render queue group (when the camera is under the cloud field)
Definition: SkyX.h:84
SkyX::SkyX::isStarfieldEnabled
const bool & isStarfieldEnabled() const
Is the starfield enable?
Definition: SkyX.h:288
Ellipsoid.h
SkyX::SkyX::mTimeMultiplier
Ogre::Real mTimeMultiplier
Time multiplier.
Definition: SkyX.h:401
GPUManager.h
SkyX::SkyX::getInfiniteCameraFarClipDistance
const Ogre::Real & getInfiniteCameraFarClipDistance() const
Get infinite cmaera far clip distance.
Definition: SkyX.h:307
SkyX::SkyX::setController
void setController(Controller *c)
Set controller.
Definition: SkyX.h:231
SkyX::CloudsManager
Definition: CloudsManager.h:224
SkyX::VCloudsManager
Definition: VCloudsManager.h:36
SkyX::SkyX::RenderQueueGroups
Render queue groups.
Definition: SkyX.h:66
AtmosphereManager.h
SkyX::SkyX::getGPUManager
GPUManager * getGPUManager()
Get GPU manager.
Definition: SkyX.h:199
SkyX::SkyX::mGPUManager
GPUManager * mGPUManager
GPU manager.
Definition: SkyX.h:366
SkyX::SkyX::getCloudsManager
CloudsManager * getCloudsManager()
Get clouds manager.
Definition: SkyX.h:215
SkyX::SkyX::mRenderQueueGroups
RenderQueueGroups mRenderQueueGroups
Render queue groups.
Definition: SkyX.h:378
CloudsManager.h
SkyX::SkyX::getCamera
Ogre::Camera * getCamera()
Get current rendering camera.
Definition: SkyX.h:323
SkyX::SkyX::mAtmosphereManager
AtmosphereManager * mAtmosphereManager
Atmosphere manager.
Definition: SkyX.h:364
SkyX::SkyX::RenderQueueGroups::RenderQueueGroups
RenderQueueGroups(const Ogre::uint8 &s, const Ogre::uint8 &vc, const Ogre::uint8 &vclu, const Ogre::uint8 &vclo)
Constructor.
Definition: SkyX.h:74
SkyX::SkyX::getAtmosphereManager
AtmosphereManager * getAtmosphereManager()
Get atmosphere manager.
Definition: SkyX.h:191
SkyX::SkyX::setTimeMultiplier
void setTimeMultiplier(const Ogre::Real &TimeMultiplier)
Set time multiplier.
Definition: SkyX.h:166
SkyX::SkyX::mCamera
Ogre::Camera * mCamera
Current rendering camera.
Definition: SkyX.h:383
SkyX::SkyX::mSceneManager
Ogre::SceneManager * mSceneManager
Scene manager.
Definition: SkyX.h:381
SkyX::SkyX::getTimeMultiplier
const Ogre::Real & getTimeMultiplier() const
Get time multiplier.
Definition: SkyX.h:175
SkyX::SkyX::loadCfg
const bool loadCfg(const Ogre::String &File) const
Definition: SkyX.h:352
SkyX::SkyX::mLastCameraPosition
Ogre::Vector3 mLastCameraPosition
Last camera position.
Definition: SkyX.h:386
SkyX::SkyX::mVisible
bool mVisible
Is SkyX visible?
Definition: SkyX.h:393
SkyX::SkyX::mStarfield
bool mStarfield
Enable starfield?
Definition: SkyX.h:398
SkyX::SkyX::getCfgFileManager
CfgFileManager * getCfgFileManager()
Definition: SkyX.h:347
SkyX::SkyX::mMeshManager
MeshManager * mMeshManager
Mesh manager.
Definition: SkyX.h:362
MoonManager.h
GeometryBlock.h
SkyX::SkyX::mCloudsManager
CloudsManager * mCloudsManager
Clouds manager.
Definition: SkyX.h:370
SkyX::SkyX::mTimeOffset
Ogre::Real mTimeOffset
Time offset.
Definition: SkyX.h:403
SkyX::Controller
Controller base class.
Definition: Controller.h:33
SkyX::SkyX::isCreated
const bool isCreated() const
Is SkyX created?
Definition: SkyX.h:143
SCfgFileManager.h
SkyX::SkyX::RenderQueueGroups::skydome
Ogre::uint8 skydome
Skydome render queue group (Note: Moon = skydome_render_queue+1)
Definition: SkyX.h:80
MeshManager.h
SkyX::CfgFileManager
Config file manager.
Definition: SCfgFileManager.h:40
SkyX::SkyX::RenderQueueGroups::vcloudsLightningsOver
Ogre::uint8 vcloudsLightningsOver
VClouds lightnings render queue group (when the camera is over the cloud field)
Definition: SkyX.h:86
SkyX::MeshManager
Definition: MeshManager.h:33
SkyX::SkyX::isVisible
const bool & isVisible() const
Is SkyX visible?
Definition: SkyX.h:156
SkyX::SkyX::mMoonManager
MoonManager * mMoonManager
Moon manager.
Definition: SkyX.h:368
SkyX::SkyX::getVCloudsManager
VCloudsManager * getVCloudsManager()
Get volumetric clouds manager.
Definition: SkyX.h:223
SkyX::SkyX::mVCloudsManager
VCloudsManager * mVCloudsManager
Volumetric clouds manager.
Definition: SkyX.h:372
SkyX::GPUManager
Definition: GPUManager.h:33
SkyX::SkyX::RenderQueueGroups::vclouds
Ogre::uint8 vclouds
VClouds render queue group.
Definition: SkyX.h:82
SkyX::SkyX::mController
Controller * mController
Controller.
Definition: SkyX.h:375
SkyX::SkyX::getMoonManager
MoonManager * getMoonManager()
Get moon manager.
Definition: SkyX.h:207
SkyX::SkyX::setInfiniteCameraFarClipDistance
void setInfiniteCameraFarClipDistance(const Ogre::Real &d)
Set infinite camera far clip distance.
Definition: SkyX.h:299
SkyX::SkyX::mCfgFileManager
CfgFileManager * mCfgFileManager
Definition: SkyX.h:405