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
Lightning.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_Lightning_H_
25#define _SkyX_VClouds_Lightning_H_
26
27#include "Prerequisites.h"
28
29namespace SkyX { namespace VClouds{
30
32 {
33 public:
36 struct Segment
37 {
38 public:
42 : a(Ogre::Vector3())
43 , b(Ogre::Vector3())
44 {
45 }
46
51 Segment(const Ogre::Vector3& a_, const Ogre::Vector3& b_)
52 : a(a_)
53 , b(b_)
54 {
55 }
56
58 Ogre::Vector3 a;
60 Ogre::Vector3 b;
61 };
62
75 Lightning(Ogre::SceneManager* sm, Ogre::SceneNode* sn, const Ogre::Vector3& orig, const Ogre::Vector3& dir, const Ogre::Real& l,
76 const Ogre::uint32& d, const Ogre::uint32& rec, const Ogre::Real& tm, const Ogre::Real& wm, const Ogre::Vector2& b = Ogre::Vector2(0,1));
77
80 ~Lightning();
81
84 void create();
85
88 void remove();
89
93 void update(Ogre::Real timeSinceLastFrame);
94
98 inline const Ogre::Vector3& getDirection() const
99 {
100 return mDirection;
101 }
102
106 inline const Ogre::Real& getLength() const
107 {
108 return mLength;
109 }
110
114 inline const Ogre::Real& getIntensity() const
115 {
116 return mIntensity;
117 }
118
122 inline Ogre::BillboardSet* getBillboardSet() const
123 {
124 return mBillboardSet;
125 }
126
130 inline Ogre::SceneNode* getSceneNode() const
131 {
132 return mSceneNode;
133 }
134
138 inline const bool& isFinished() const
139 {
140 return mFinished;
141 }
142
147 void _updateRenderQueueGroup(const Ogre::uint8& rqg);
148
149 private:
155 void _updateData(const Ogre::Real& alpha, const Ogre::Real& currentPos, const Ogre::Real& parentTime);
156
158 Ogre::Vector3 mOrigin;
160 Ogre::Vector3 mDirection;
162 Ogre::Real mLength;
163
165 Ogre::Real mRealLength;
167 Ogre::uint32 mDivisions;
169 Ogre::uint32 mRecursivity;
173 Ogre::Vector2 mBounds;
175 Ogre::Vector2 mAngleRange;
176
178 Ogre::Real mTime;
180 Ogre::Real mTimeMultiplier;
182 Ogre::Vector3 mTimeMultipliers;
183
185 Ogre::Real mIntensity;
186
188 std::vector<Segment> mSegments;
190 std::vector<Lightning*> mChildren;
191
193 Ogre::BillboardSet* mBillboardSet;
195 Ogre::SceneManager* mSceneManager;
197 Ogre::SceneNode* mSceneNode;
198
203 };
204
205}}
206
207#endif
const Ogre::Real & getIntensity() const
Get lightning intensity.
Definition Lightning.h:114
Ogre::Real mWidthMultiplier
Width multiplier.
Definition Lightning.h:171
const Ogre::Vector3 & getDirection() const
Get ray direction.
Definition Lightning.h:98
Ogre::SceneNode * getSceneNode() const
Get scene node.
Definition Lightning.h:130
Ogre::Real mTimeMultiplier
Global time multiplier.
Definition Lightning.h:180
void _updateData(const Ogre::Real &alpha, const Ogre::Real &currentPos, const Ogre::Real &parentTime)
Update data.
Ogre::uint32 mRecursivity
Recursivity level.
Definition Lightning.h:169
const Ogre::Real & getLength() const
Get ray length.
Definition Lightning.h:106
void _updateRenderQueueGroup(const Ogre::uint8 &rqg)
Update render queue group.
Ogre::BillboardSet * mBillboardSet
Billboard set.
Definition Lightning.h:193
std::vector< Lightning * > mChildren
Children lightnings.
Definition Lightning.h:190
Ogre::Real mRealLength
Real ray length (total segments length amount)
Definition Lightning.h:165
Ogre::Real mLength
Ray length.
Definition Lightning.h:162
const bool & isFinished() const
Has the ray finished?
Definition Lightning.h:138
Ogre::Vector3 mDirection
Ray direction.
Definition Lightning.h:160
bool mCreated
Has been create() already called?
Definition Lightning.h:200
Ogre::Real mIntensity
Lightning intensity.
Definition Lightning.h:185
Ogre::SceneNode * mSceneNode
Scene node.
Definition Lightning.h:197
Ogre::uint32 mDivisions
Number of divisions.
Definition Lightning.h:167
std::vector< Segment > mSegments
Segments.
Definition Lightning.h:188
Ogre::Vector3 mTimeMultipliers
Per step time multipliers.
Definition Lightning.h:182
void update(Ogre::Real timeSinceLastFrame)
Update.
Ogre::BillboardSet * getBillboardSet() const
Get billboard set.
Definition Lightning.h:122
Ogre::Real mTime
Current elapsed time.
Definition Lightning.h:178
Ogre::Vector3 mOrigin
Ray origin.
Definition Lightning.h:158
bool mFinished
Has the ray finished?
Definition Lightning.h:202
Ogre::Vector2 mBounds
Ray bounds (for internal visual calculations)
Definition Lightning.h:173
Ogre::SceneManager * mSceneManager
Scene manager.
Definition Lightning.h:195
Ogre::Vector2 mAngleRange
Angle range (Little values -> Less derivations, bigger values -> More derivations)
Definition Lightning.h:175
Segment(const Ogre::Vector3 &a_, const Ogre::Vector3 &b_)
Constructor.
Definition Lightning.h:51
Ogre::Vector3 a
Segment start.
Definition Lightning.h:58
Ogre::Vector3 b
Segment end.
Definition Lightning.h:60
Segment()
Default constructor.
Definition Lightning.h:41