Rigs of Rods 2023.09
Soft-body Physics Simulation
All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Loading...
Searching...
No Matches
CloudsManager.h
Go to the documentation of this file.
1/*
2--------------------------------------------------------------------------------
3This source file is part of SkyX.
4Visit http://www.paradise-studios.net/products/skyx/
5
6Copyright (C) 2009-2012 Xavier Vergu�n Gonz�lez <xavyiy@gmail.com>
7
8This program is free software; you can redistribute it and/or modify it under
9the terms of the GNU Lesser General Public License as published by the Free Software
10Foundation; either version 2 of the License, or (at your option) any later
11version.
12
13This program is distributed in the hope that it will be useful, but WITHOUT
14ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
15FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
16
17You should have received a copy of the GNU Lesser General Public License along with
18this program; if not, write to the Free Software Foundation, Inc., 59 Temple
19Place - Suite 330, Boston, MA 02111-1307, USA, or go to
20http://www.gnu.org/copyleft/lesser.txt.
21--------------------------------------------------------------------------------
22*/
23
24#ifndef _SkyX_CloudsManager_H_
25#define _SkyX_CloudsManager_H_
26
27#include "Prerequisites.h"
28
29#include "ColorGradient.h"
30
31namespace SkyX
32{
33 class SkyX;
34
36 {
37 public:
40 struct Options
41 {
43 Ogre::Real Height;
45 Ogre::Real Scale;
47 Ogre::Vector2 WindDirection;
49 Ogre::Real TimeMultiplier;
50
56 Ogre::Real HeightVolume;
59
60
64 : Height(100)
65 , Scale(0.001f)
66 , WindDirection(Ogre::Vector2(1,1))
67 , TimeMultiplier(0.125f)
68 , DistanceAttenuation(0.05f)
70 , HeightVolume(0.25f)
72 {
73 }
74
81 Options(const Ogre::Real& _Height,
82 const Ogre::Real& _Scale,
83 const Ogre::Vector2& _WindDirection,
84 const Ogre::Real& _TimeMultiplier)
85 : Height(_Height)
86 , Scale(_Scale)
87 , WindDirection(_WindDirection)
88 , TimeMultiplier(_TimeMultiplier)
89 , DistanceAttenuation(0.05f)
91 , HeightVolume(0.25f)
93 {
94 }
95
107 Options(const Ogre::Real& _Height,
108 const Ogre::Real& _Scale,
109 const Ogre::Vector2& _WindDirection,
110 const Ogre::Real& _TimeMultiplier,
111 const Ogre::Real& _DistanceAttenuation,
112 const Ogre::Real& _DetailAttenuation,
113 const Ogre::Real& _HeightVolume,
114 const Ogre::Real& _VolumetricDisplacement)
115 : Height(_Height)
116 , Scale(_Scale)
117 , WindDirection(_WindDirection)
118 , TimeMultiplier(_TimeMultiplier)
119 , DistanceAttenuation(_DistanceAttenuation)
120 , DetailAttenuation(_DetailAttenuation)
121 , HeightVolume(_HeightVolume)
122 , VolumetricDisplacement(_VolumetricDisplacement)
123 {
124 }
125 };
126
127
131 CloudLayer(SkyX *s);
132
137 CloudLayer(SkyX *s, const Options& o);
138
141 ~CloudLayer();
142
146 inline void setOptions(const Options& o)
147 {
148 mOptions = o;
150 }
151
155 inline const Options& getOptions() const
156 {
157 return mOptions;
158 }
159
163 inline void setAmbientGradient(const ColorGradient& AmbientGradient)
164 {
165 mAmbientGradient = AmbientGradient;
166 }
167
171 inline const ColorGradient& getAmbientGradient() const
172 {
173 return mAmbientGradient;
174 }
175
179 inline void setSunGradient(const ColorGradient& SunGradient)
180 {
181 mSunGradient = SunGradient;
182 }
183
187 inline const ColorGradient& getSunGradient() const
188 {
189 return mSunGradient;
190 }
191
195 void _registerCloudLayer(Ogre::Pass* CloudLayerPass);
196
199 void _unregister();
200
204
205 private:
209
212
216
218 Ogre::Pass *mCloudLayerPass;
219
222 };
223
225 {
226 public:
231
235
238 void update();
239
245
248 void remove(CloudLayer *cl);
249
252 void removeAll();
253
256 void registerAll();
257
261 void unregister(CloudLayer* cl);
262
265 void unregisterAll();
266
270 inline const std::vector<CloudLayer*>& getCloudLayers() const
271 {
272 return mCloudLayers;
273 }
274
275 private:
277 std::vector<CloudLayer*> mCloudLayers;
279 std::vector<CloudLayer*>::iterator CloudLayersIt;
280
283 };
284}
285
286#endif
ColorGradient mSunGradient
void _unregister()
Unregister cloud pass.
SkyX * mSkyX
SkyX parent pointer.
Options mOptions
Cloud layer options.
Ogre::Pass * mCloudLayerPass
Cloud layer pass.
void setOptions(const Options &o)
Set options.
const ColorGradient & getSunGradient() const
Get sun color gradient.
void setSunGradient(const ColorGradient &SunGradient)
Set sun gradient.
~CloudLayer()
Destructor.
const Options & getOptions() const
Get options.
void _updateInternalPassParameters()
Update internal cloud pass parameters.
ColorGradient mAmbientGradient
Ambient and Sun color gradients.
void _registerCloudLayer(Ogre::Pass *CloudLayerPass)
Register layer.
void _updatePassParameters()
Update cloud pass parameters.
void setAmbientGradient(const ColorGradient &AmbientGradient)
Set ambient gradient.
const ColorGradient & getAmbientGradient() const
Get ambient color gradient.
~CloudsManager()
Destructor.
void unregister(CloudLayer *cl)
Unregister cloud layer.
void unregisterAll()
Unregister all cloud layers.
void update()
Update cloud layers.
CloudLayer * add(const CloudLayer::Options &o)
Add a cloud layer.
void registerAll()
Register all.
const std::vector< CloudLayer * > & getCloudLayers() const
Get cloud layers.
std::vector< CloudLayer * >::iterator CloudLayersIt
Cloud layers iterator.
SkyX * mSkyX
SkyX parent pointer.
std::vector< CloudLayer * > mCloudLayers
Cloud layers std::vector.
void removeAll()
Remove all cloud layers.
void remove(CloudLayer *cl)
Remove the specified cloud layer.
Cloud layer options.
Options(const Ogre::Real &_Height, const Ogre::Real &_Scale, const Ogre::Vector2 &_WindDirection, const Ogre::Real &_TimeMultiplier, const Ogre::Real &_DistanceAttenuation, const Ogre::Real &_DetailAttenuation, const Ogre::Real &_HeightVolume, const Ogre::Real &_VolumetricDisplacement)
Constructor.
Ogre::Vector2 WindDirection
Wind direction.
Ogre::Real Height
Cloud layer height.
Ogre::Real VolumetricDisplacement
Volumetric displacement(For volumetric effects on the gpu)
Options()
Default constructor.
Ogre::Real DistanceAttenuation
Distance attenuation.
Options(const Ogre::Real &_Height, const Ogre::Real &_Scale, const Ogre::Vector2 &_WindDirection, const Ogre::Real &_TimeMultiplier)
Constructor.
Ogre::Real DetailAttenuation
Detail attenuation.
Ogre::Real TimeMultiplier
Time multiplier.
Ogre::Real Scale
Cloud layer scale.
Ogre::Real HeightVolume
Cloud layer height volume(For volumetric effects on the gpu)