Rigs of Rods 2023.09
Soft-body Physics Simulation
Loading...
Searching...
No Matches
LightningManager.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_LightningManager_H_
25#define _SkyX_VClouds_LightningManager_H_
26
27#include "Prerequisites.h"
28
29#include "Lightning.h"
30
31namespace SkyX { namespace VClouds{
32
33 class VClouds;
34
36 {
37 public:
40 class Listener
41 {
42 public:
50 inline virtual void lightningAdded(Lightning* l){}
51 };
52
57
61
64 void create();
65
68 void remove();
69
73 void update(const Ogre::Real& timeSinceLastFrame);
74
83 Lightning* addLightning(const Ogre::Vector3& p, const Ogre::Vector3& d, const Ogre::Real l, const Ogre::uint32& div = static_cast<Ogre::uint32>(Ogre::Math::RangeRandom(12, 30)));
84
88 void updateMaterial();
89
93 inline void addListener(Listener* listener)
94 {
95 mListeners.push_back(listener);
96 }
97
101 void removeListener(Listener* listener);
102
105 inline void removeListeners()
106 {
107 mListeners.clear();
108 }
109
113 inline const std::vector<Listener*>& getListeners() const
114 {
115 return mListeners;
116 }
117
121 void setEnabled(const bool& enable);
122
127 inline const bool& isEnabled() const
128 {
129 return mEnabled;
130 }
131
135 void setLightningColor(const Ogre::Vector3& c);
136
140 inline const Ogre::Vector3& getLightningColor() const
141 {
142 return mLightningColor;
143 }
144
149 void setLightningTimeMultiplier(const Ogre::Real& m)
150 {
152 }
153
157 inline const Ogre::Real& getLightningTimeMultiplier() const
158 {
160 }
161
165 inline void setAverageLightningApparitionTime(const Ogre::Real& alat)
166 {
168 mRemainingTime = alat;
169 }
170
174 inline const Ogre::Real& getAverageLightningApparitionTime() const
175 {
177 }
178
182 inline const bool& isCreated() const
183 {
184 return mCreated;
185 }
186
191 void _updateRenderQueueGroup(const Ogre::uint8& rqg);
192
197 void _setVisible(const bool& v);
198
199 private:
201 std::vector<Lightning*> mLightnings;
203 std::vector<Ogre::SceneNode*> mSceneNodes;
204
207
209 Ogre::Vector3 mLightningColor;
212
216 Ogre::Real mRemainingTime;
217
221 Ogre::MaterialPtr mLightningMaterial;
222
224 std::vector<Listener*> mListeners;
225
228
231 };
232
233}}
234
235#endif
virtual void lightningAdded(Lightning *l)
Lightning added.
Ogre::MaterialPtr mLightningMaterial
Lightning material.
const Ogre::Real & getLightningTimeMultiplier() const
Set lightning time multiplier.
const bool & isCreated() const
Has been create() already called?
std::vector< Listener * > mListeners
Listeners.
bool mCreated
Has been create() already called?
const bool & isEnabled() const
Get whether the lightning system is enabled or not.
void removeListener(Listener *listener)
Remove listener.
VClouds * mVClouds
VClouds pointer.
void setLightningColor(const Ogre::Vector3 &c)
Set lightning color.
void setLightningTimeMultiplier(const Ogre::Real &m)
Set lightning time multiplier.
Ogre::Real mLightningTimeMultiplier
Lightning time multiplier.
bool mEnabled
Is the lightning system enabled?
void addListener(Listener *listener)
Add listener.
Ogre::MaterialPtr mVolCloudsLightningMaterial
Vol. clouds + lightning material.
const Ogre::Vector3 & getLightningColor() const
Get lightning color.
std::vector< Ogre::SceneNode * > mSceneNodes
Scene nodes.
const Ogre::Real & getAverageLightningApparitionTime() const
Get average lightning apparition time.
std::vector< Lightning * > mLightnings
Lightnings.
void updateMaterial()
Update material.
void _updateRenderQueueGroup(const Ogre::uint8 &rqg)
Update render queue group.
Ogre::Real mAverageLightningApparitionTime
Average lightning apparition time (in seconds)
Ogre::Vector3 mLightningColor
Lightning color.
void setEnabled(const bool &enable)
Enable or disable the lightning system.
const std::vector< Listener * > & getListeners() const
Get listeners.
void removeListeners()
Remove listeners.
void update(const Ogre::Real &timeSinceLastFrame)
Update, to be invoked per frame.
Lightning * addLightning(const Ogre::Vector3 &p, const Ogre::Vector3 &d, const Ogre::Real l, const Ogre::uint32 &div=static_cast< Ogre::uint32 >(Ogre::Math::RangeRandom(12, 30)))
Add lightning.
void _setVisible(const bool &v)
Set visible.
Ogre::Real mRemainingTime
Remaining time for next lightning.
void setAverageLightningApparitionTime(const Ogre::Real &alat)
Set average lightning apparition time.