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 
33  class DllExport AtmosphereManager
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 
65  int NumberOfSamples;
66 
69  Options()
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 
122  AtmosphereManager(SkyX *s);
123 
126  ~AtmosphereManager();
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 
157  void _update(const Options& NewOptions,
158  const bool& ForceToUpdateAll = false);
159 
160  private:
166  float _scale(const float& cos, const float& uScaleDepth) const;
167 
169  SkyX *mSkyX;
170 
172  Options mOptions;
173  };
174 }
175 
176 #endif
SkyX(Ogre::SceneManager *sm, Controller *c)
Contructor.
#define DllExport
Include external headers.
Definition: Prerequisites.h:45