All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Lightning.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_VClouds_Lightning_H_
25 #define _SkyX_VClouds_Lightning_H_
26 
27 #include <vector>
28 #include "Prerequisites.h"
29 
30 namespace SkyX { namespace VClouds {
31 
33  {
34  public:
37  struct Segment
38  {
39  public:
43  : a(Ogre::Vector3())
44  , b(Ogre::Vector3())
45  {
46  }
47 
52  Segment(const Ogre::Vector3& a_, const Ogre::Vector3& b_)
53  : a(a_)
54  , b(b_)
55  {
56  }
57 
59  Ogre::Vector3 a;
61  Ogre::Vector3 b;
62  };
63 
76  Lightning(Ogre::SceneManager* sm, Ogre::SceneNode* sn,
77  const Ogre::Vector3& orig, const Ogre::Vector3& dir,
78  const Ogre::Real& l,
79  const Ogre::uint32& d, const Ogre::uint32& rec,
80  const Ogre::Real& tm, const Ogre::Real& wm,
81  const Ogre::Vector2& b = Ogre::Vector2(0, 1));
82 
85  ~Lightning();
86 
89  void create();
90 
93  void remove();
94 
98  void update(Ogre::Real timeSinceLastFrame);
99 
103  inline const Ogre::Vector3& getDirection() const
104  {
105  return mDirection;
106  }
107 
111  inline const Ogre::Real& getLength() const
112  {
113  return mLength;
114  }
115 
119  inline const Ogre::Real& getIntensity() const
120  {
121  return mIntensity;
122  }
123 
127  inline Ogre::BillboardSet* getBillboardSet() const
128  {
129  return mBillboardSet;
130  }
131 
135  inline Ogre::SceneNode* getSceneNode() const
136  {
137  return mSceneNode;
138  }
139 
143  inline const bool& isFinished() const
144  {
145  return mFinished;
146  }
147 
152  void _updateRenderQueueGroup(const Ogre::uint8& rqg);
153 
154  private:
160  void _updateData(const Ogre::Real& alpha, const Ogre::Real& currentPos,
161  const Ogre::Real& parentTime);
162 
164  Ogre::Vector3 mOrigin;
166  Ogre::Vector3 mDirection;
168  Ogre::Real mLength;
169 
171  Ogre::Real mRealLength;
173  Ogre::uint32 mDivisions;
175  Ogre::uint32 mRecursivity;
177  Ogre::Real mTime;
179  Ogre::Real mTimeMultiplier;
180 
182  Ogre::Real mIntensity;
183 
185  Ogre::Real mWidthMultiplier;
186 
188  Ogre::Vector2 mBounds;
191  Ogre::Vector2 mAngleRange;
192 
193 
195  Ogre::Vector3 mTimeMultipliers;
196 
198  std::vector<Segment> mSegments;
200  std::vector<Lightning*> mChildren;
201 
203  Ogre::BillboardSet* mBillboardSet;
205  Ogre::SceneManager* mSceneManager;
207  Ogre::SceneNode* mSceneNode;
208 
210  bool mCreated;
212  bool mFinished;
213  };
214 }}
215 
216 #endif
const bool & isFinished() const
Has the ray finished?
Definition: Lightning.h:143
const Ogre::Real & getLength() const
Get ray length.
Definition: Lightning.h:111
Ogre::Real mTimeMultiplier
Time multiplier.
Definition: SkyX.h:435
Ogre::Vector3 mTime
Time information: x = time in [0, 24]h range, y = sunrise hour in [0, 24]h range, z = sunset hour in ...
Definition: BasicController.h:125
Segment()
Default constructor.
Definition: Lightning.h:42
void create()
Create SkyX.
Ogre::BillboardSet * getBillboardSet() const
Get billboard set.
Definition: Lightning.h:127
Segment(const Ogre::Vector3 &a_, const Ogre::Vector3 &b_)
Constructor.
Definition: Lightning.h:52
Ogre::Vector3 a
Segment start.
Definition: Lightning.h:59
Ogre::Vector3 b
Segment end.
Definition: Lightning.h:61
Ogre::SceneNode * getSceneNode() const
Get scene node.
Definition: Lightning.h:135
SkyX(Ogre::SceneManager *sm, Controller *c)
Contructor.
const Ogre::Real & getIntensity() const
Get lightning intensity.
Definition: Lightning.h:119
Segment struct.
Definition: Lightning.h:37
const Ogre::Vector3 & getDirection() const
Get ray direction.
Definition: Lightning.h:103
bool mCreated
Is SkyX created?
Definition: SkyX.h:422
Definition: Lightning.h:32
Ogre::SceneManager * mSceneManager
Scene manager.
Definition: SkyX.h:398
class __declspec(dllimport) BasicController void update(const Ogre::Real &simDeltaTime)
Basic controller class.
#define DllExport
Include external headers.
Definition: Prerequisites.h:45