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-2005 The OGRE Team
|
---|
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 | */
|
---|
25 | #ifndef __DirectionRandomiserAffector_H__
|
---|
26 | #define __DirectionRandomiserAffector_H__
|
---|
27 |
|
---|
28 | #include "OgreParticleFXPrerequisites.h"
|
---|
29 | #include "OgreParticleAffector.h"
|
---|
30 | #include "OgreVector3.h"
|
---|
31 |
|
---|
32 |
|
---|
33 | namespace Ogre {
|
---|
34 |
|
---|
35 | /** This class defines a ParticleAffector which applies randomness to the movement of the particles.
|
---|
36 | @remarks
|
---|
37 | This affector (see ParticleAffector) applies randomness to the movement of the particles by
|
---|
38 | changing the direction vectors.
|
---|
39 | @par
|
---|
40 | The most important parameter to control the effect is randomness. It controls the range in which changes
|
---|
41 | are applied to each axis of the direction vector.
|
---|
42 | The parameter scope can be used to limit the effect to a certain percentage of the particles.
|
---|
43 | */
|
---|
44 | class _OgreParticleFXExport DirectionRandomiserAffector : public ParticleAffector
|
---|
45 | {
|
---|
46 | public:
|
---|
47 | /** Command object for randomness (see ParamCommand).*/
|
---|
48 | class CmdRandomness : public ParamCommand
|
---|
49 | {
|
---|
50 | public:
|
---|
51 | String doGet(const void* target) const;
|
---|
52 | void doSet(void* target, const String& val);
|
---|
53 | };
|
---|
54 |
|
---|
55 | /** Command object for scope (see ParamCommand).*/
|
---|
56 | class CmdScope : public ParamCommand
|
---|
57 | {
|
---|
58 | public:
|
---|
59 | String doGet(const void* target) const;
|
---|
60 | void doSet(void* target, const String& val);
|
---|
61 | };
|
---|
62 |
|
---|
63 | /** Command object for keep_velocity (see ParamCommand).*/
|
---|
64 | class CmdKeepVelocity : public ParamCommand
|
---|
65 | {
|
---|
66 | public:
|
---|
67 | String doGet(const void* target) const;
|
---|
68 | void doSet(void* target, const String& val);
|
---|
69 | };
|
---|
70 |
|
---|
71 | /// Default constructor
|
---|
72 | DirectionRandomiserAffector(ParticleSystem* psys);
|
---|
73 |
|
---|
74 | /** See ParticleAffector. */
|
---|
75 | void _affectParticles(ParticleSystem* pSystem, Real timeElapsed);
|
---|
76 |
|
---|
77 |
|
---|
78 | /** Sets the randomness to apply to the particles in a system. */
|
---|
79 | void setRandomness(Real force);
|
---|
80 | /** Sets the scope (percentage of particles which are randomised). */
|
---|
81 | void setScope(Real force);
|
---|
82 | /** Set flag which detemines whether particle speed is changed. */
|
---|
83 | void setKeepVelocity(bool keepVelocity);
|
---|
84 |
|
---|
85 | /** Gets the randomness to apply to the particles in a system. */
|
---|
86 | Real getRandomness(void) const;
|
---|
87 | /** Gets the scope (percentage of particles which are randomised). */
|
---|
88 | Real getScope(void) const;
|
---|
89 | /** Gets flag which detemines whether particle speed is changed. */
|
---|
90 | bool getKeepVelocity(void) const;
|
---|
91 |
|
---|
92 | /// Command objects
|
---|
93 | static CmdRandomness msRandomnessCmd;
|
---|
94 | static CmdScope msScopeCmd;
|
---|
95 | static CmdKeepVelocity msKeepVelocityCmd;
|
---|
96 |
|
---|
97 | protected:
|
---|
98 | Real mRandomness;
|
---|
99 | Real mScope;
|
---|
100 | bool mKeepVelocity;
|
---|
101 |
|
---|
102 | };
|
---|
103 |
|
---|
104 | }
|
---|
105 |
|
---|
106 | #endif
|
---|