[3] | 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 __DeflectorPlaneAffector_H__ |
---|
| 30 | #define __DeflectorPlaneAffector_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 deflects particles. |
---|
| 40 | @remarks |
---|
| 41 | This affector (see ParticleAffector) offers a simple (and inaccurate) physical deflection. |
---|
| 42 | All particles which hit the plane are reflected. |
---|
| 43 | @par |
---|
| 44 | The plane is defined by a point (plane_point) and the normal (plane_normal). |
---|
| 45 | In addition it is possible to change the strenght of the recoil by using the bounce parameter. |
---|
| 46 | */ |
---|
| 47 | class _OgreParticleFXExport DeflectorPlaneAffector : public ParticleAffector |
---|
| 48 | { |
---|
| 49 | public: |
---|
| 50 | /** Command object for plane point (see ParamCommand).*/ |
---|
| 51 | class CmdPlanePoint : public ParamCommand |
---|
| 52 | { |
---|
| 53 | public: |
---|
| 54 | String doGet(const void* target) const; |
---|
| 55 | void doSet(void* target, const String& val); |
---|
| 56 | }; |
---|
| 57 | |
---|
| 58 | /** Command object for plane normal (see ParamCommand).*/ |
---|
| 59 | class CmdPlaneNormal : public ParamCommand |
---|
| 60 | { |
---|
| 61 | public: |
---|
| 62 | String doGet(const void* target) const; |
---|
| 63 | void doSet(void* target, const String& val); |
---|
| 64 | }; |
---|
| 65 | |
---|
| 66 | /** Command object for bounce (see ParamCommand).*/ |
---|
| 67 | class CmdBounce : public ParamCommand |
---|
| 68 | { |
---|
| 69 | public: |
---|
| 70 | String doGet(const void* target) const; |
---|
| 71 | void doSet(void* target, const String& val); |
---|
| 72 | }; |
---|
| 73 | |
---|
| 74 | /// Default constructor |
---|
| 75 | DeflectorPlaneAffector(ParticleSystem* psys); |
---|
| 76 | |
---|
| 77 | /** See ParticleAffector. */ |
---|
| 78 | void _affectParticles(ParticleSystem* pSystem, Real timeElapsed); |
---|
| 79 | |
---|
| 80 | /** Sets the plane point of the deflector plane. */ |
---|
| 81 | void setPlanePoint(const Vector3& pos); |
---|
| 82 | |
---|
| 83 | /** Gets the plane point of the deflector plane. */ |
---|
| 84 | Vector3 getPlanePoint(void) const; |
---|
| 85 | |
---|
| 86 | /** Sets the plane normal of the deflector plane. */ |
---|
| 87 | void setPlaneNormal(const Vector3& normal); |
---|
| 88 | |
---|
| 89 | /** Gets the plane normal of the deflector plane. */ |
---|
| 90 | Vector3 getPlaneNormal(void) const; |
---|
| 91 | |
---|
| 92 | /** Sets the bounce value of the deflection. */ |
---|
| 93 | void setBounce(Real bounce); |
---|
| 94 | |
---|
| 95 | /** Gets the bounce value of the deflection. */ |
---|
| 96 | Real getBounce(void) const; |
---|
| 97 | |
---|
| 98 | /// Command objects |
---|
| 99 | static CmdPlanePoint msPlanePointCmd; |
---|
| 100 | static CmdPlaneNormal msPlaneNormalCmd; |
---|
| 101 | static CmdBounce msBounceCmd; |
---|
| 102 | |
---|
| 103 | protected: |
---|
| 104 | /// deflector plane point |
---|
| 105 | Vector3 mPlanePoint; |
---|
| 106 | /// deflector plane normal vector |
---|
| 107 | Vector3 mPlaneNormal; |
---|
| 108 | |
---|
| 109 | /// bounce factor (0.5 means 50 percent) |
---|
| 110 | Real mBounce; |
---|
| 111 | }; |
---|
| 112 | |
---|
| 113 | } |
---|
| 114 | |
---|
| 115 | #endif |
---|