RigsofRods
Soft-body Physics Simulation
AtmosphereManager.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_AtmosphereManager_H_
25 #define _SkyX_AtmosphereManager_H_
26 
27 #include "Prerequisites.h"
28 
29 namespace SkyX
30 {
31  class SkyX;
32 
34  {
35  public:
36 
39  struct Options
40  {
42  Ogre::Real InnerRadius;
44  Ogre::Real OuterRadius;
46  Ogre::Real HeightPosition;
47 
49  Ogre::Real RayleighMultiplier;
51  Ogre::Real MieMultiplier;
53  Ogre::Real SunIntensity;
54 
56  Ogre::Vector3 WaveLength;
57 
59  Ogre::Real G;
60 
62  Ogre::Real Exposure;
63 
66 
70  : InnerRadius(9.77501f)
71  , OuterRadius(10.2963f)
72  , HeightPosition(0.01f)
73  , RayleighMultiplier(0.0022f)
74  , MieMultiplier(0.000675f)
75  , SunIntensity(30)
76  , WaveLength(Ogre::Vector3(0.57f, 0.54f, 0.44f))
77  , G(-0.991f)
78  , Exposure(2.0f)
79  , NumberOfSamples(4)
80  {
81  }
82 
95  Options(const Ogre::Real& _InnerRadius,
96  const Ogre::Real& _OuterRadius,
97  const Ogre::Real& _HeightPosition,
98  const Ogre::Real& _RayleighMultiplier,
99  const Ogre::Real& _MieMultiplier,
100  const Ogre::Real& _SunIntensity,
101  const Ogre::Vector3& _WaveLength,
102  const Ogre::Real& _G,
103  const Ogre::Real& _Exposure,
104  const int& _NumerOfSamples)
105  : InnerRadius(_InnerRadius)
106  , OuterRadius(_OuterRadius)
107  , HeightPosition(_HeightPosition)
108  , RayleighMultiplier(_RayleighMultiplier)
109  , MieMultiplier(_MieMultiplier)
110  , SunIntensity(_SunIntensity)
111  , WaveLength(_WaveLength)
112  , G(_G)
113  , Exposure(_Exposure)
114  , NumberOfSamples(_NumerOfSamples)
115  {
116  }
117  };
118 
123 
127 
131  inline void setOptions(const Options& _Options)
132  {
133  _update(_Options);
134  }
135 
139  inline const Options& getOptions() const
140  {
141  return mOptions;
142  }
143 
148  const Ogre::Vector3 getColorAt(const Ogre::Vector3& Direction) const;
149 
155  void _update(const Options& NewOptions, const bool& ForceToUpdateAll = false);
156 
157  private:
163  const float _scale(const float& cos, const float& uScaleDepth) const;
164 
167 
170  };
171 }
172 
173 #endif
SkyX::AtmosphereManager::Options::G
Ogre::Real G
Phase function.
Definition: AtmosphereManager.h:59
SkyX::AtmosphereManager::Options::Options
Options(const Ogre::Real &_InnerRadius, const Ogre::Real &_OuterRadius, const Ogre::Real &_HeightPosition, const Ogre::Real &_RayleighMultiplier, const Ogre::Real &_MieMultiplier, const Ogre::Real &_SunIntensity, const Ogre::Vector3 &_WaveLength, const Ogre::Real &_G, const Ogre::Real &_Exposure, const int &_NumerOfSamples)
Constructor.
Definition: AtmosphereManager.h:95
SkyX::AtmosphereManager::getOptions
const Options & getOptions() const
Get current options.
Definition: AtmosphereManager.h:139
SkyX::AtmosphereManager::~AtmosphereManager
~AtmosphereManager()
Destructor.
Definition: AtmosphereManager.cpp:38
SkyX::AtmosphereManager::Options::Exposure
Ogre::Real Exposure
Exposure coeficient.
Definition: AtmosphereManager.h:62
Prerequisites.h
SkyX::AtmosphereManager::getColorAt
const Ogre::Vector3 getColorAt(const Ogre::Vector3 &Direction) const
Get current atmosphere color at the given direction.
Definition: AtmosphereManager.cpp:145
SkyX::AtmosphereManager::Options::HeightPosition
Ogre::Real HeightPosition
Height position, in [0, 1] range, 0=InnerRadius, 1=OuterRadius.
Definition: AtmosphereManager.h:46
SkyX::AtmosphereManager::mSkyX
SkyX * mSkyX
SkyX parent pointer.
Definition: AtmosphereManager.h:169
SkyX
Definition: AtmosphereManager.cpp:30
SkyX::AtmosphereManager
Definition: AtmosphereManager.h:33
SkyX::AtmosphereManager::Options::InnerRadius
Ogre::Real InnerRadius
Inner atmosphere radius.
Definition: AtmosphereManager.h:42
SkyX::AtmosphereManager::Options::Options
Options()
Default constructor.
Definition: AtmosphereManager.h:69
SkyX::AtmosphereManager::_scale
const float _scale(const float &cos, const float &uScaleDepth) const
Shader scale funtion.
Definition: AtmosphereManager.cpp:139
SkyX::AtmosphereManager::Options
Atmosphere options.
Definition: AtmosphereManager.h:39
SkyX::AtmosphereManager::_update
void _update(const Options &NewOptions, const bool &ForceToUpdateAll=false)
Update atmoshpere.
Definition: AtmosphereManager.cpp:42
SkyX::AtmosphereManager::setOptions
void setOptions(const Options &_Options)
Set options.
Definition: AtmosphereManager.h:131
SkyX::AtmosphereManager::Options::SunIntensity
Ogre::Real SunIntensity
Sun intensity.
Definition: AtmosphereManager.h:53
SkyX::AtmosphereManager::AtmosphereManager
AtmosphereManager(SkyX *s)
Constructor.
Definition: AtmosphereManager.cpp:32
Ogre
Definition: ExtinguishableFireAffector.cpp:35
SkyX::AtmosphereManager::Options::NumberOfSamples
int NumberOfSamples
Number of samples.
Definition: AtmosphereManager.h:65
SkyX::AtmosphereManager::Options::OuterRadius
Ogre::Real OuterRadius
Outer atmosphere radius.
Definition: AtmosphereManager.h:44
SkyX::AtmosphereManager::Options::WaveLength
Ogre::Vector3 WaveLength
WaveLength for RGB channels.
Definition: AtmosphereManager.h:56
SkyX::AtmosphereManager::Options::RayleighMultiplier
Ogre::Real RayleighMultiplier
Rayleigh multiplier.
Definition: AtmosphereManager.h:49
SkyX::AtmosphereManager::Options::MieMultiplier
Ogre::Real MieMultiplier
Mie multiplier.
Definition: AtmosphereManager.h:51
SkyX::AtmosphereManager::mOptions
Options mOptions
Our options.
Definition: AtmosphereManager.h:166