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 __RotationAffector_H__ |
---|
30 | #define __RotationAffector_H__ |
---|
31 | |
---|
32 | #include "OgreMath.h" |
---|
33 | #include "OgreParticleFXPrerequisites.h" |
---|
34 | #include "OgreParticleAffector.h" |
---|
35 | #include "OgreStringInterface.h" |
---|
36 | |
---|
37 | namespace Ogre { |
---|
38 | |
---|
39 | |
---|
40 | /** This plugin subclass of ParticleAffector allows you to alter the rotation of particles. |
---|
41 | @remarks |
---|
42 | This class supplies the ParticleAffector implementation required to make the particle expand |
---|
43 | or contract in mid-flight. |
---|
44 | */ |
---|
45 | class _OgreParticleFXExport RotationAffector : public ParticleAffector |
---|
46 | { |
---|
47 | public: |
---|
48 | /// Command object for particle emitter - see ParamCommand |
---|
49 | class CmdRotationSpeedRangeStart : public ParamCommand |
---|
50 | { |
---|
51 | public: |
---|
52 | String doGet(const void* target) const; |
---|
53 | void doSet(void* target, const String& val); |
---|
54 | }; |
---|
55 | |
---|
56 | /// Command object for particle emitter - see ParamCommand |
---|
57 | class CmdRotationSpeedRangeEnd : public ParamCommand |
---|
58 | { |
---|
59 | public: |
---|
60 | String doGet(const void* target) const; |
---|
61 | void doSet(void* target, const String& val); |
---|
62 | }; |
---|
63 | |
---|
64 | /// Command object for particle emitter - see ParamCommand |
---|
65 | class CmdRotationRangeStart : public ParamCommand |
---|
66 | { |
---|
67 | public: |
---|
68 | String doGet(const void* target) const; |
---|
69 | void doSet(void* target, const String& val); |
---|
70 | }; |
---|
71 | |
---|
72 | /// Command object for particle emitter - see ParamCommand |
---|
73 | class CmdRotationRangeEnd : public ParamCommand |
---|
74 | { |
---|
75 | public: |
---|
76 | String doGet(const void* target) const; |
---|
77 | void doSet(void* target, const String& val); |
---|
78 | }; |
---|
79 | |
---|
80 | /** Default constructor. */ |
---|
81 | RotationAffector(ParticleSystem* psys); |
---|
82 | |
---|
83 | /** See ParticleAffector. */ |
---|
84 | void _initParticle(Particle* pParticle); |
---|
85 | |
---|
86 | /** See ParticleAffector. */ |
---|
87 | void _affectParticles(ParticleSystem* pSystem, Real timeElapsed); |
---|
88 | |
---|
89 | |
---|
90 | |
---|
91 | /** Sets the minimum rotation speed of particles to be emitted. */ |
---|
92 | void setRotationSpeedRangeStart(const Radian& angle); |
---|
93 | #ifndef OGRE_FORCE_ANGLE_TYPES |
---|
94 | inline void setRotationSpeedRangeStart(Real angle) { |
---|
95 | setRotationSpeedRangeStart(Angle(angle)); |
---|
96 | } |
---|
97 | #endif//OGRE_FORCE_ANGLE_TYPES |
---|
98 | /** Sets the maximum rotation speed of particles to be emitted. */ |
---|
99 | void setRotationSpeedRangeEnd(const Radian& angle); |
---|
100 | #ifndef OGRE_FORCE_ANGLE_TYPES |
---|
101 | inline void setRotationSpeedRangeEnd(Real angle) { |
---|
102 | setRotationSpeedRangeEnd(Angle(angle)); |
---|
103 | } |
---|
104 | #endif//OGRE_FORCE_ANGLE_TYPES |
---|
105 | /** Gets the minimum rotation speed of particles to be emitted. */ |
---|
106 | const Radian& getRotationSpeedRangeStart(void) const; |
---|
107 | /** Gets the maximum rotation speed of particles to be emitted. */ |
---|
108 | const Radian& getRotationSpeedRangeEnd(void) const; |
---|
109 | |
---|
110 | |
---|
111 | /** Sets the minimum rotation angle of particles to be emitted. */ |
---|
112 | void setRotationRangeStart(const Radian& angle); |
---|
113 | #ifndef OGRE_FORCE_ANGLE_TYPES |
---|
114 | inline void setRotationRangeStart(Real angle) { |
---|
115 | setRotationRangeStart(Angle(angle)); |
---|
116 | } |
---|
117 | #endif//OGRE_FORCE_ANGLE_TYPES |
---|
118 | /** Sets the maximum rotation angle of particles to be emitted. */ |
---|
119 | void setRotationRangeEnd(const Radian& angle); |
---|
120 | #ifndef OGRE_FORCE_ANGLE_TYPES |
---|
121 | inline void setRotationRangeEnd(Real angle) { |
---|
122 | setRotationRangeEnd(Angle(angle)); |
---|
123 | } |
---|
124 | #endif//OGRE_FORCE_ANGLE_TYPES |
---|
125 | /** Gets the minimum rotation of particles to be emitted. */ |
---|
126 | const Radian& getRotationRangeStart(void) const; |
---|
127 | /** Gets the maximum rotation of particles to be emitted. */ |
---|
128 | const Radian& getRotationRangeEnd(void) const; |
---|
129 | |
---|
130 | static CmdRotationSpeedRangeStart msRotationSpeedRangeStartCmd; |
---|
131 | static CmdRotationSpeedRangeEnd msRotationSpeedRangeEndCmd; |
---|
132 | static CmdRotationRangeStart msRotationRangeStartCmd; |
---|
133 | static CmdRotationRangeEnd msRotationRangeEndCmd; |
---|
134 | |
---|
135 | protected: |
---|
136 | /// Initial rotation speed of particles (range start) |
---|
137 | Radian mRotationSpeedRangeStart; |
---|
138 | /// Initial rotation speed of particles (range end) |
---|
139 | Radian mRotationSpeedRangeEnd; |
---|
140 | /// Initial rotation angle of particles (range start) |
---|
141 | Radian mRotationRangeStart; |
---|
142 | /// Initial rotation angle of particles (range end) |
---|
143 | Radian mRotationRangeEnd; |
---|
144 | |
---|
145 | }; |
---|
146 | |
---|
147 | |
---|
148 | } |
---|
149 | |
---|
150 | |
---|
151 | #endif |
---|
152 | |
---|