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