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
VClouds.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_VClouds_VClouds_H_
25#define _SkyX_VClouds_VClouds_H_
26
27#include "Prerequisites.h"
28
29#include "DataManager.h"
30#include "GeometryManager.h"
31#include "LightningManager.h"
32
33namespace SkyX { namespace VClouds{
34
35 class VClouds
36 {
37 public:
41 {
47 inline RenderQueueGroups(const Ogre::uint8& vc, const Ogre::uint8& vclu, const Ogre::uint8& vclo)
49 {
50 }
51
53 Ogre::uint8 vclouds;
58 };
59
63 {
65 Ogre::Vector2 Height;
67 Ogre::Radian Alpha, Beta;
69 float Radius;
73 int Na, Nb, Nc;
74
78 : Height(Ogre::Vector2(10,50))
79 , Alpha(Ogre::Degree(12)), Beta(Ogre::Degree(40))
80 , Radius(100)
81 , NumberOfBlocks(12)
82 , Na(10), Nb(8), Nc(6)
83 {
84 }
85
96 GeometrySettings(const Ogre::Vector2& _Height, const float& _Radius,
97 const Ogre::Radian& _Alpha = Ogre::Degree(12), const Ogre::Radian& _Beta = Ogre::Degree(40),
98 const int& _NumberOfBlocks = 12, const int& _Na = 10, const int& _Nb = 8, const int& _Nc = 6)
99 : Height(_Height)
100 , Alpha(_Alpha), Beta(_Beta)
101 , Radius(_Radius)
102 , NumberOfBlocks(_NumberOfBlocks)
103 , Na(_Na), Nb(_Nb), Nc(_Nc)
104 {
105 }
106 };
107
111 {
112 public:
115 inline CameraData()
116 : camera(0)
117 , lastPosition(Ogre::Vector3(0,0,0))
118 , cameraOffset(Ogre::Vector2(0,0))
119 , geometryDisplacement(Ogre::Vector3(0,0,0))
120 {
121 }
122
126 inline CameraData(Ogre::Camera* c)
127 : camera(c)
128 , lastPosition(c->getDerivedPosition())
129 , cameraOffset(Ogre::Vector2(0,0))
130 , geometryDisplacement(Ogre::Vector3(0,0,0))
131 {
132 }
133
135 Ogre::Camera* camera;
137 Ogre::Vector3 lastPosition;
139 Ogre::Vector2 cameraOffset;
141 Ogre::Vector3 geometryDisplacement;
142 };
143
147 VClouds(Ogre::SceneManager *sm);
148
151 ~VClouds();
152
155 void create();
156
160 void create(const GeometrySettings& gs);
161
166 void create(const Ogre::Vector2& Height, const float& Radius);
167
170 void remove();
171
175 void update(const Ogre::Real& timeSinceLastFrame);
176
181 void notifyCameraRender(Ogre::Camera* c, const Ogre::Real& timeSinceLastCameraFrame);
182
189 void registerCamera(Ogre::Camera* c);
190
195 void unregisterCamera(Ogre::Camera* c);
196
200 inline const bool& isCreated() const
201 {
202 return mCreated;
203 }
204
210 {
212 }
213
218 {
219 return mGeometrySettings;
220 }
221
232 inline void setDistanceFallingParams(const Ogre::Vector2& DistanceFallingParams)
233 {
234 mDistanceFallingParams = DistanceFallingParams;
235 }
236
247 inline const Ogre::Vector2& getDistanceFallingParams() const
248 {
250 }
251
255 void setRenderQueueGroups(const RenderQueueGroups& rqg);
256
261 {
262 return mRenderQueueGroups;
263 }
264
268 inline void setWindDirection(const Ogre::Radian& WindDirection)
269 {
270 mWindDirection = WindDirection;
271 }
272
276 inline const Ogre::Radian& getWindDirection() const
277 {
278 return mWindDirection;
279 }
280
284 inline const Ogre::Vector2 getWindDirectionV2() const
285 {
286 return Ogre::Vector2(Ogre::Math::Cos(mWindDirection), Ogre::Math::Sin(mWindDirection));
287 }
288
292 inline void setWindSpeed(const float& WindSpeed)
293 {
294 mWindSpeed = WindSpeed;
295 }
296
300 inline const float& getWindSpeed() const
301 {
302 return mWindSpeed;
303 }
304
308 inline void setSunDirection(const Ogre::Vector3& SunDirection)
309 {
310 mSunDirection = SunDirection;
311 }
312
316 inline const Ogre::Vector3& getSunDirection() const
317 {
318 return mSunDirection;
319 }
320
324 void setSunColor(const Ogre::Vector3& SunColor);
325
329 inline const Ogre::Vector3& getSunColor() const
330 {
331 return mSunColor;
332 }
333
337 void setAmbientColor(const Ogre::Vector3& AmbientColor);
338
342 inline const Ogre::Vector3& getAmbientColor() const
343 {
344 return mAmbientColor;
345 }
346
354 void setLightResponse(const Ogre::Vector4& LightResponse);
355
359 inline const Ogre::Vector4& getLightResponse() const
360 {
361 return mLightResponse;
362 }
363
367 void setAmbientFactors(const Ogre::Vector4& AmbientFactors);
368
372 inline const Ogre::Vector4& getAmbientFactors() const
373 {
374 return mAmbientFactors;
375 }
376
380 inline void setGlobalOpacity(const Ogre::Real& GlobalOpacity)
381 {
382 mGlobalOpacity = GlobalOpacity;
383 }
384
388 inline const Ogre::Real& getGlobalOpacity() const
389 {
390 return mGlobalOpacity;
391 }
392
396 inline void setCloudFieldScale(const Ogre::Real& CloudFieldScale)
397 {
398 mCloudFieldScale = CloudFieldScale;
399 }
400
404 inline const Ogre::Real& getCloudFieldScale() const
405 {
406 return mCloudFieldScale;
407 }
408
412 inline void setNoiseScale(const Ogre::Real& NoiseScale)
413 {
414 mNoiseScale = NoiseScale;
415 }
416
420 inline const Ogre::Real& getNoiseScale() const
421 {
422 return mNoiseScale;
423 }
424
433 void setWheater(const float& Humidity, const float& AverageCloudsSize, const bool& DelayedResponse);
434
438 inline const Ogre::Vector2& getWheater() const
439 {
440 return mWheater;
441 }
442
446 void setVisible(const bool& visible);
447
451 inline const bool& isVisible() const
452 {
453 return mVisible;
454 }
455
459 inline Ogre::SceneManager* getSceneManager()
460 {
461 return mSceneManager;
462 }
463
467 inline Ogre::Camera* getCamera()
468 {
469 return mCamera;
470 }
471
476 {
477 return mDataManager;
478 }
479
484 {
485 return mGeometryManager;
486 }
487
492 {
493 return mLightningManager;
494 }
495
500 inline std::vector<CameraData>& _getCamerasData()
501 {
502 return mCamerasData;
503 }
504
505 private:
508
511
514
517
519 Ogre::Radian mWindDirection;
522
524 Ogre::Vector2 mWheater;
527
529 Ogre::Vector3 mSunDirection;
530
532 Ogre::Vector3 mSunColor;
534 Ogre::Vector3 mAmbientColor;
535
542 Ogre::Vector4 mLightResponse;
546 Ogre::Vector4 mAmbientFactors;
547
550
555
558
565
567 Ogre::SceneManager *mSceneManager;
569 Ogre::Camera* mCamera;
570
572 Ogre::MaterialPtr mVolCloudsMaterial;
575
577 std::vector<CameraData> mCamerasData;
578 };
579
580}}
581
582#endif
DataManager * getDataManager()
Get data manager.
Definition VClouds.h:475
GeometryManager * getGeometryManager()
Get geometry manager.
Definition VClouds.h:483
Ogre::Vector3 mAmbientColor
Ambient color.
Definition VClouds.h:534
~VClouds()
Destructor.
Definition VClouds.cpp:59
void setAmbientColor(const Ogre::Vector3 &AmbientColor)
Set ambient color.
Definition VClouds.cpp:272
Ogre::MaterialPtr mVolCloudsMaterial
Vol. clouds material.
Definition VClouds.h:572
void setVisible(const bool &visible)
Set visible.
Definition VClouds.cpp:232
Ogre::MaterialPtr mVolCloudsLightningMaterial
Vol. clouds + lightning material.
Definition VClouds.h:574
bool mCreated
Has been create(...) already called?
Definition VClouds.h:507
void setNoiseScale(const Ogre::Real &NoiseScale)
Set noise scale.
Definition VClouds.h:412
LightningManager * mLightningManager
Lightning manager.
Definition VClouds.h:564
const Ogre::Vector3 & getAmbientColor() const
Get Ambient color.
Definition VClouds.h:342
const Ogre::Vector3 & getSunColor() const
Get sun color.
Definition VClouds.h:329
const Ogre::Vector2 & getWheater() const
Get wheater.
Definition VClouds.h:438
void setRenderQueueGroups(const RenderQueueGroups &rqg)
Set render queue groups.
Definition VClouds.cpp:245
const Ogre::Real & getCloudFieldScale() const
Get cloud field scale.
Definition VClouds.h:404
void setWindDirection(const Ogre::Radian &WindDirection)
Set wind direction.
Definition VClouds.h:268
float mWindSpeed
Wind speed.
Definition VClouds.h:521
Ogre::Vector2 mWheater
Wheater parameters: x = Humidity, y = Average clouds size, both un [0,1] range.
Definition VClouds.h:524
bool mVisible
Is VClouds visible?
Definition VClouds.h:557
const RenderQueueGroups & getRenderQueueGroups() const
Get render queue groups.
Definition VClouds.h:260
const Ogre::Radian & getWindDirection() const
Get wind direction.
Definition VClouds.h:276
void create()
Create.
Definition VClouds.cpp:68
void setCloudFieldScale(const Ogre::Real &CloudFieldScale)
Set cloud field scale.
Definition VClouds.h:396
void setGlobalOpacity(const Ogre::Real &GlobalOpacity)
Set global opacity.
Definition VClouds.h:380
const Ogre::Vector4 & getLightResponse() const
Get light response.
Definition VClouds.h:359
std::vector< CameraData > mCamerasData
Cameras data.
Definition VClouds.h:577
RenderQueueGroups mRenderQueueGroups
Render queue groups.
Definition VClouds.h:516
void registerCamera(Ogre::Camera *c)
Register camera.
Definition VClouds.cpp:207
Ogre::Vector4 mLightResponse
Light response: x - Sun light power y - Sun beta multiplier z - Ambient color multiplier w - Distance...
Definition VClouds.h:542
Ogre::Radian mWindDirection
Wind direction.
Definition VClouds.h:519
const Ogre::Vector2 getWindDirectionV2() const
Get wind direction as a Vector2.
Definition VClouds.h:284
bool mDelayedResponse
Delayed response (This param is stored to allow the user call setWheater(...) before create() )
Definition VClouds.h:526
float mNoiseScale
Noise scale.
Definition VClouds.h:554
void setLightResponse(const Ogre::Vector4 &LightResponse)
Set light response.
Definition VClouds.cpp:287
LightningManager * getLightningManager()
Get lightning manager.
Definition VClouds.h:491
std::vector< CameraData > & _getCamerasData()
Get cameras data.
Definition VClouds.h:500
Ogre::Vector2 mDistanceFallingParams
Geometry distance falling params.
Definition VClouds.h:513
void setWindSpeed(const float &WindSpeed)
Set wind speed.
Definition VClouds.h:292
void setAmbientFactors(const Ogre::Vector4 &AmbientFactors)
Set ambient factors.
Definition VClouds.cpp:302
Ogre::Vector3 mSunDirection
Sun direction.
Definition VClouds.h:529
void notifyCameraRender(Ogre::Camera *c, const Ogre::Real &timeSinceLastCameraFrame)
Notify camera render, to be invoked per-camera and per-frame.
Definition VClouds.cpp:174
Ogre::Vector4 mAmbientFactors
Ambient factors x - constant, y - linear, z - cuadratic, w - cubic.
Definition VClouds.h:546
Ogre::SceneManager * mSceneManager
Ogre::SceneManager pointer.
Definition VClouds.h:567
void remove()
Remove.
Definition VClouds.cpp:127
const float & getWindSpeed() const
Get wind speed.
Definition VClouds.h:300
Ogre::Camera * mCamera
Current rendering camera.
Definition VClouds.h:569
const Ogre::Real & getNoiseScale() const
Get noise scale.
Definition VClouds.h:420
const bool & isCreated() const
Has been create() already called?
Definition VClouds.h:200
GeometryManager * mGeometryManager
Geometry manager.
Definition VClouds.h:562
const Ogre::Vector4 & getAmbientFactors() const
Get ambient factors.
Definition VClouds.h:372
void setWheater(const float &Humidity, const float &AverageCloudsSize, const bool &DelayedResponse)
Set wheater parameters Use this funtion to update the cloud field parameters, you'll get a smart and ...
Definition VClouds.cpp:317
void unregisterCamera(Ogre::Camera *c)
Unregister camera.
Definition VClouds.cpp:220
void setSunDirection(const Ogre::Vector3 &SunDirection)
Set sun direction.
Definition VClouds.h:308
const Ogre::Real & getGlobalOpacity() const
Get global opacity.
Definition VClouds.h:388
const Ogre::Vector2 & getDistanceFallingParams() const
Get distance falling params.
Definition VClouds.h:247
const bool & isVisible() const
Is VClouds visible?
Definition VClouds.h:451
float mGlobalOpacity
Global opacity.
Definition VClouds.h:549
void setGeometrySettings(const GeometrySettings &gs)
Set geometry settings.
Definition VClouds.h:209
void update(const Ogre::Real &timeSinceLastFrame)
Update, to be invoked per frame.
Definition VClouds.cpp:147
void setDistanceFallingParams(const Ogre::Vector2 &DistanceFallingParams)
Set distance falling params.
Definition VClouds.h:232
void setSunColor(const Ogre::Vector3 &SunColor)
Set sun color.
Definition VClouds.cpp:257
Ogre::Vector3 mSunColor
Sun color.
Definition VClouds.h:532
DataManager * mDataManager
Data manager.
Definition VClouds.h:560
const GeometrySettings & getGeometrySettings() const
Get geometry settings.
Definition VClouds.h:217
Ogre::Camera * getCamera()
Get current rendering camera.
Definition VClouds.h:467
Ogre::SceneManager * getSceneManager()
Get scene manager.
Definition VClouds.h:459
GeometrySettings mGeometrySettings
Geometry settings.
Definition VClouds.h:510
const Ogre::Vector3 & getSunDirection() const
Get sun direction.
Definition VClouds.h:316
float mCloudFieldScale
Cloud field scale.
Definition VClouds.h:552
Ogre::Camera * camera
Camera.
Definition VClouds.h:135
Ogre::Vector3 lastPosition
Last camera position.
Definition VClouds.h:137
CameraData(Ogre::Camera *c)
Constructor.
Definition VClouds.h:126
Ogre::Vector3 geometryDisplacement
Geometry displacement.
Definition VClouds.h:141
Ogre::Vector2 cameraOffset
Camera offset.
Definition VClouds.h:139
CameraData()
Default constructor.
Definition VClouds.h:115
GeometrySettings()
Default constructor.
Definition VClouds.h:77
int NumberOfBlocks
Number of blocks.
Definition VClouds.h:71
GeometrySettings(const Ogre::Vector2 &_Height, const float &_Radius, const Ogre::Radian &_Alpha=Ogre::Degree(12), const Ogre::Radian &_Beta=Ogre::Degree(40), const int &_NumberOfBlocks=12, const int &_Na=10, const int &_Nb=8, const int &_Nc=6)
Constructor.
Definition VClouds.h:96
int Na
Number of slices per geometry zone.
Definition VClouds.h:73
Ogre::Vector2 Height
Height: x = Altitude over the camera, y: Field height (both in world coordinates)
Definition VClouds.h:65
RenderQueueGroups(const Ogre::uint8 &vc, const Ogre::uint8 &vclu, const Ogre::uint8 &vclo)
Constructor.
Definition VClouds.h:47
Ogre::uint8 vclouds
VClouds render queue group.
Definition VClouds.h:53
Ogre::uint8 vcloudsLightningsUnder
VClouds lightnings render queue group (when the camera is under the cloud field)
Definition VClouds.h:55
Ogre::uint8 vcloudsLightningsOver
VClouds lightnings render queue group (when the camera is over the cloud field)
Definition VClouds.h:57