All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 
45 namespace SkyX
46 {
60  class DllExport SkyX : public Ogre::FrameListener,
61  public Ogre::RenderTargetListener
62  {
63  public:
66  struct RenderQueueGroups
67  {
74  inline RenderQueueGroups(const Ogre::uint8& s, const Ogre::uint8& vc,
75  const Ogre::uint8& vcl)
76  : skydome(s), vclouds(vc), vcloudsLightnings(vcl)
77  {
78  }
79 
81  Ogre::uint8 skydome;
83  Ogre::uint8 vclouds;
85  Ogre::uint8 vcloudsLightnings;
86  };
87 
99  {
101  LM_LDR = 0,
103  LM_HDR = 1
104  };
105 
110  SkyX(Ogre::SceneManager* sm, Controller* c);
111 
114  ~SkyX();
115 
118  void create();
119 
122  void remove();
123 
132  void update(const Ogre::Real &timeSinceLastFrame);
133 
142  void notifyCameraRender(Ogre::Camera* c);
143 
147  inline bool isCreated() const
148  {
149  return mCreated;
150  }
151 
155  void setVisible(const bool& visible);
156 
160  inline const bool& isVisible() const
161  {
162  return mVisible;
163  }
164 
171  inline void setTimeMultiplier(const Ogre::Real& TimeMultiplier)
172  {
173  mTimeMultiplier = TimeMultiplier;
174  mVCloudsManager->_updateWindSpeedConfig();
175  }
176 
180  inline const Ogre::Real& getTimeMultiplier() const
181  {
182  return mTimeMultiplier;
183  }
184 
188  inline MeshManager* getMeshManager()
189  {
190  return mMeshManager;
191  }
192 
196  inline AtmosphereManager* getAtmosphereManager()
197  {
198  return mAtmosphereManager;
199  }
200 
204  inline GPUManager* getGPUManager()
205  {
206  return mGPUManager;
207  }
208 
212  inline MoonManager* getMoonManager()
213  {
214  return mMoonManager;
215  }
216 
220  inline CloudsManager* getCloudsManager()
221  {
222  return mCloudsManager;
223  }
224 
228  inline VCloudsManager* getVCloudsManager()
229  {
230  return mVCloudsManager;
231  }
232 
236  inline void setController(Controller* c)
237  {
239  {
240  delete mController;
241  }
242 
243  mController = c;
244  }
245 
249  inline Controller* getController() const
250  {
251  return mController;
252  }
253 
257  void setRenderQueueGroups(const RenderQueueGroups& rqg);
258 
262  inline const RenderQueueGroups& getRenderQueueGroups() const
263  {
264  return mRenderQueueGroups;
265  }
266 
277  void setLightingMode(const LightingMode& lm);
278 
282  inline const LightingMode& getLightingMode() const
283  {
284  return mLightingMode;
285  }
286 
290  void setStarfieldEnabled(const bool& Enabled);
291 
295  inline const bool& isStarfieldEnabled() const
296  {
297  return mStarfield;
298  }
299 
307  inline void setInfiniteCameraFarClipDistance(const Ogre::Real& d)
308  {
310  }
311 
315  inline const Ogre::Real& getInfiniteCameraFarClipDistance() const
316  {
318  }
319 
323  inline Ogre::SceneManager* getSceneManager()
324  {
325  return mSceneManager;
326  }
327 
331  inline Ogre::Camera* getCamera()
332  {
333  return mCamera;
334  }
335 
339  bool frameStarted(const Ogre::FrameEvent& evt);
340 
344  void preViewportUpdate(const Ogre::RenderTargetViewportEvent& evt);
345 
350  inline const Ogre::Real& _getTimeOffset() const
351  {
352  return mTimeOffset;
353  }
354 
355  void setEnabled(bool _enabled)
356  {
357  this->mEnabled = _enabled;
358  this->setMoonEnabled(_enabled);
359  this->setCloudsEnabled(_enabled);
360  }
361 
362  inline bool getEnabled()
363  {
364  return this->mEnabled;
365  }
366 
367  void setMoonEnabled(bool _enabled)
368  {
369  this->mMoonEnabled = _enabled;
370  this->mMoonManager->setEnabled(_enabled);
371  }
372 
373  inline bool getMoonEnabled()
374  {
375  return this->mMoonEnabled;
376  }
377 
378  void setCloudsEnabled(bool _enabled)
379  {
380  this->mCloudsEnabled = _enabled;
381  this->mVCloudsManager->getVClouds()->setEnabled(_enabled);
382  }
383 
384  inline bool getCloudsEnabled()
385  {
386  return this->mCloudsEnabled;
387  }
388 
389  private:
390 
393 
396 
398  Ogre::SceneManager *mSceneManager;
399 
402 
404  Ogre::Camera* mCamera;
405 
407  MeshManager* mMeshManager;
408 
410  AtmosphereManager* mAtmosphereManager;
412  GPUManager* mGPUManager;
414  MoonManager* mMoonManager;
416  CloudsManager* mCloudsManager;
417 
419  RenderQueueGroups mRenderQueueGroups;
420 
422  bool mCreated;
423 
425  Ogre::Vector3 mLastCameraPosition;
430 
432  bool mVisible;
433 
435  Ogre::Real mTimeMultiplier;
437  Ogre::Real mTimeOffset;
438 
440  VCloudsManager* mVCloudsManager;
441 
444 
447 
449  bool mEnabled;
450  };
451 }
452 
453 #endif
VCloudsManager * getVCloudsManager()
Get volumetric clouds manager.
Definition: SkyX.h:228
bool mEnabled
True if skyx is enabled.
Definition: SkyX.h:449
const bool & isVisible() const
Is SkyX visible?
Definition: SkyX.h:160
void setLightingMode(const LightingMode &lm)
Set lighting mode.
bool mStarfield
Enable starfield?
Definition: SkyX.h:392
void setInfiniteCameraFarClipDistance(const Ogre::Real &d)
Set infinite camera far clip distance.
Definition: SkyX.h:307
Ogre::Real mTimeMultiplier
Time multiplier.
Definition: SkyX.h:435
Ogre::Camera * getCamera()
Get current rendering camera.
Definition: SkyX.h:331
High dynamic range.
Definition: SkyX.h:103
bool getMoonEnabled()
Definition: SkyX.h:373
void setTimeMultiplier(const Ogre::Real &TimeMultiplier)
Set time multiplier.
Definition: SkyX.h:171
Ogre::uint8 vclouds
VClouds render queue group.
Definition: SkyX.h:83
bool frameStarted(const Ogre::FrameEvent &evt)
Frame started.
void setController(Controller *c)
Set controller.
Definition: SkyX.h:236
const bool & isStarfieldEnabled() const
Is the starfield enable?
Definition: SkyX.h:295
const RenderQueueGroups & getRenderQueueGroups() const
Get render queue groups.
Definition: SkyX.h:262
void create()
Create SkyX.
Ogre::uint8 skydome
Skydome render queue group (Note: Moon = skydome_render_queue+1)
Definition: SkyX.h:81
Ogre::uint8 vcloudsLightnings
VClouds lightnings render queue group.
Definition: SkyX.h:85
void notifyCameraRender(Ogre::Camera *c)
Notify camera render (to be invoked per camera and per frame)
bool mCloudsEnabled
True if clouds are enabled.
Definition: SkyX.h:446
AtmosphereManager * mAtmosphereManager
Atmosphere manager.
Definition: SkyX.h:410
Low dynamic range.
Definition: SkyX.h:101
Ogre::SceneManager * getSceneManager()
Get scene manager.
Definition: SkyX.h:323
VCloudsManager * mVCloudsManager
Volumetric clouds manager.
Definition: SkyX.h:440
Ogre::Vector3 mLastCameraPosition
Last camera position.
Definition: SkyX.h:425
Ogre::Camera * mCamera
Current rendering camera.
Definition: SkyX.h:404
bool mMoonEnabled
True if moon is enabled.
Definition: SkyX.h:443
Ogre::Real mInfiniteCameraFarClipDistance
Infinite camera far clip distance.
Definition: SkyX.h:429
const Ogre::Real & getTimeMultiplier() const
Get time multiplier.
Definition: SkyX.h:180
Controller * getController() const
Get current controller.
Definition: SkyX.h:249
GPUManager * getGPUManager()
Get GPU manager.
Definition: SkyX.h:204
LightingMode
Lighting mode enumeration SkyX is designed for true HDR rendering, but there is a big number of appli...
Definition: SkyX.h:98
const Ogre::Real & _getTimeOffset() const
Get time offset.
Definition: SkyX.h:350
const bool & getDeleteBySkyX() const
Must the controller be destroyed by SkyX?
Definition: Controller.h:76
AtmosphereManager * getAtmosphereManager()
Get atmosphere manager.
Definition: SkyX.h:196
MoonManager * mMoonManager
Moon manager.
Definition: SkyX.h:414
SkyX(Ogre::SceneManager *sm, Controller *c)
Contructor.
const Ogre::Real & getInfiniteCameraFarClipDistance() const
Get infinite cmaera far clip distance.
Definition: SkyX.h:315
CloudsManager * mCloudsManager
Clouds manager.
Definition: SkyX.h:416
void setEnabled(bool _enabled)
Definition: SkyX.h:355
void preViewportUpdate(const Ogre::RenderTargetViewportEvent &evt)
Fired before update a render target viewport.
void setRenderQueueGroups(const RenderQueueGroups &rqg)
Set render queue groups.
Controller base class.
Definition: Controller.h:33
const LightingMode & getLightingMode() const
Get lighting mode.
Definition: SkyX.h:282
bool mCreated
Is SkyX created?
Definition: SkyX.h:422
LightingMode mLightingMode
Lighting mode.
Definition: SkyX.h:395
bool getEnabled()
Definition: SkyX.h:362
void setCloudsEnabled(bool _enabled)
Definition: SkyX.h:378
RenderQueueGroups mRenderQueueGroups
Render queue groups.
Definition: SkyX.h:419
MeshManager * mMeshManager
Mesh manager.
Definition: SkyX.h:407
Ogre::Real mTimeOffset
Time offset.
Definition: SkyX.h:437
MeshManager * getMeshManager()
Get mesh manager.
Definition: SkyX.h:188
void setMoonEnabled(bool _enabled)
Definition: SkyX.h:367
MoonManager * getMoonManager()
Get moon manager.
Definition: SkyX.h:212
void setVisible(const bool &visible)
Set visible.
CloudsManager * getCloudsManager()
Get clouds manager.
Definition: SkyX.h:220
GPUManager * mGPUManager
GPU manager.
Definition: SkyX.h:412
~SkyX()
Destructor.
Ogre::SceneManager * mSceneManager
Scene manager.
Definition: SkyX.h:398
bool getCloudsEnabled()
Definition: SkyX.h:384
class __declspec(dllimport) BasicController void update(const Ogre::Real &simDeltaTime)
Basic controller class.
#define DllExport
Include external headers.
Definition: Prerequisites.h:45
bool mVisible
Is SkyX visible?
Definition: SkyX.h:432
Ogre::Real mLastCameraFarClipDistance
Last camera far clip distance.
Definition: SkyX.h:427
void setStarfieldEnabled(const bool &Enabled)
Set the starfield enabled/disabled.
bool isCreated() const
Is SkyX created?
Definition: SkyX.h:147
Controller * mController
Controller.
Definition: SkyX.h:401