1 | /* |
---|
2 | ----------------------------------------------------------------------------- |
---|
3 | This source file is part of OGRE |
---|
4 | (Object-oriented Graphics Rendering Engine) |
---|
5 | For the latest info, see http://www.ogre3d.org/ |
---|
6 | |
---|
7 | Copyright (c) 2000-2006 Torus Knot Software Ltd |
---|
8 | Also see acknowledgements in Readme.html |
---|
9 | |
---|
10 | This program is free software; you can redistribute it and/or modify it under |
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software |
---|
12 | Foundation; either version 2 of the License, or (at your option) any later |
---|
13 | version. |
---|
14 | |
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT |
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
---|
18 | |
---|
19 | You should have received a copy of the GNU Lesser General Public License along with |
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple |
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to |
---|
22 | http://www.gnu.org/copyleft/lesser.txt. |
---|
23 | |
---|
24 | You may alternatively use this source under the terms of a specific version of |
---|
25 | the OGRE Unrestricted License provided you have obtained such a license from |
---|
26 | Torus Knot Software Ltd. |
---|
27 | ----------------------------------------------------------------------------- |
---|
28 | */ |
---|
29 | #ifndef __DirectionRandomiserAffector_H__ |
---|
30 | #define __DirectionRandomiserAffector_H__ |
---|
31 | |
---|
32 | #include "OgreParticleFXPrerequisites.h" |
---|
33 | #include "OgreParticleAffector.h" |
---|
34 | #include "OgreVector3.h" |
---|
35 | |
---|
36 | |
---|
37 | namespace Ogre { |
---|
38 | |
---|
39 | /** This class defines a ParticleAffector which applies randomness to the movement of the particles. |
---|
40 | @remarks |
---|
41 | This affector (see ParticleAffector) applies randomness to the movement of the particles by |
---|
42 | changing the direction vectors. |
---|
43 | @par |
---|
44 | The most important parameter to control the effect is randomness. It controls the range in which changes |
---|
45 | are applied to each axis of the direction vector. |
---|
46 | The parameter scope can be used to limit the effect to a certain percentage of the particles. |
---|
47 | */ |
---|
48 | class _OgreParticleFXExport DirectionRandomiserAffector : public ParticleAffector |
---|
49 | { |
---|
50 | public: |
---|
51 | /** Command object for randomness (see ParamCommand).*/ |
---|
52 | class CmdRandomness : public ParamCommand |
---|
53 | { |
---|
54 | public: |
---|
55 | String doGet(const void* target) const; |
---|
56 | void doSet(void* target, const String& val); |
---|
57 | }; |
---|
58 | |
---|
59 | /** Command object for scope (see ParamCommand).*/ |
---|
60 | class CmdScope : public ParamCommand |
---|
61 | { |
---|
62 | public: |
---|
63 | String doGet(const void* target) const; |
---|
64 | void doSet(void* target, const String& val); |
---|
65 | }; |
---|
66 | |
---|
67 | /** Command object for keep_velocity (see ParamCommand).*/ |
---|
68 | class CmdKeepVelocity : public ParamCommand |
---|
69 | { |
---|
70 | public: |
---|
71 | String doGet(const void* target) const; |
---|
72 | void doSet(void* target, const String& val); |
---|
73 | }; |
---|
74 | |
---|
75 | /// Default constructor |
---|
76 | DirectionRandomiserAffector(ParticleSystem* psys); |
---|
77 | |
---|
78 | /** See ParticleAffector. */ |
---|
79 | void _affectParticles(ParticleSystem* pSystem, Real timeElapsed); |
---|
80 | |
---|
81 | |
---|
82 | /** Sets the randomness to apply to the particles in a system. */ |
---|
83 | void setRandomness(Real force); |
---|
84 | /** Sets the scope (percentage of particles which are randomised). */ |
---|
85 | void setScope(Real force); |
---|
86 | /** Set flag which detemines whether particle speed is changed. */ |
---|
87 | void setKeepVelocity(bool keepVelocity); |
---|
88 | |
---|
89 | /** Gets the randomness to apply to the particles in a system. */ |
---|
90 | Real getRandomness(void) const; |
---|
91 | /** Gets the scope (percentage of particles which are randomised). */ |
---|
92 | Real getScope(void) const; |
---|
93 | /** Gets flag which detemines whether particle speed is changed. */ |
---|
94 | bool getKeepVelocity(void) const; |
---|
95 | |
---|
96 | /// Command objects |
---|
97 | static CmdRandomness msRandomnessCmd; |
---|
98 | static CmdScope msScopeCmd; |
---|
99 | static CmdKeepVelocity msKeepVelocityCmd; |
---|
100 | |
---|
101 | protected: |
---|
102 | Real mRandomness; |
---|
103 | Real mScope; |
---|
104 | bool mKeepVelocity; |
---|
105 | |
---|
106 | }; |
---|
107 | |
---|
108 | } |
---|
109 | |
---|
110 | #endif |
---|