diff -Naurw source/Irrlicht/CParticleAttractionAffector.cpp source/Irrlicht/CParticleAttractionAffector.cpp --- source/Irrlicht/CParticleAttractionAffector.cpp 2005-09-28 13:23:50.000000000 +0200 +++ source/Irrlicht/CParticleAttractionAffector.cpp 2005-09-29 14:46:14.000000000 +0200 @@ -12,12 +12,13 @@ //! constructor CParticleAttractionAffector::CParticleAttractionAffector( core::vector3df point, - f32 speed, bool affectX, bool affectY, bool affectZ ) + f32 speed, bool attract, bool affectX, bool affectY, bool affectZ ) : Point( point ) , Speed( speed ) , AffectX( affectX ) , AffectY( affectY ) , AffectZ( affectZ ) +, Attract( attract ) , LastTime( 0 ) { } @@ -42,6 +43,10 @@ core::vector3df tempPos = particlearray[i].pos; core::vector3df direction = (Point - particlearray[i].pos).normalize(); direction *= Speed * timeDelta; + + if( !Attract ) + direction *= -1.0f; + particlearray[i].pos += direction; if( !AffectX ) diff -Naurw source/Irrlicht/CParticleAttractionAffector.h source/Irrlicht/CParticleAttractionAffector.h --- source/Irrlicht/CParticleAttractionAffector.h 2005-09-28 10:16:40.000000000 +0200 +++ source/Irrlicht/CParticleAttractionAffector.h 2005-09-29 14:45:44.000000000 +0200 @@ -19,7 +19,8 @@ public: CParticleAttractionAffector( core::vector3df point, f32 speed, - bool affectX = true, bool affectY = true, bool affectZ = true ); + bool attract = true, bool affectX = true, + bool affectY = true, bool affectZ = true ); //! Affects a particle. virtual void affect(u32 now, SParticle* particlearray, u32 count); @@ -31,6 +32,9 @@ //! the specified point virtual void setSpeed( f32 speed ) { Speed = speed; } + //! Set whether or not the particles are attracting or detracting + virtual void setAttract( bool attract ) { Attract = attract; } + //! Set whether or not this will affect particles in the X direction virtual void setAffectX( bool affect ) { AffectX = affect; } @@ -46,6 +50,9 @@ //! Get the speed that points attract to the specified point virtual const f32& getSpeed() const { return Speed; } + //! Get whether or not the particles are attracting or detracting + virtual const bool& getAttract() const { return Attract; } + //! Get whether or not the particles X position are affected virtual const bool& getAffectX() const { return AffectX; } @@ -62,6 +69,7 @@ bool AffectX; bool AffectY; bool AffectZ; + bool Attract; u32 LastTime; }; diff -Naurw source/Irrlicht/CParticleSystemSceneNode.cpp source/Irrlicht/CParticleSystemSceneNode.cpp --- source/Irrlicht/CParticleSystemSceneNode.cpp 2005-09-28 12:10:30.000000000 +0200 +++ source/Irrlicht/CParticleSystemSceneNode.cpp 2005-11-26 15:08:36.000000000 +0100 @@ -193,10 +220,10 @@ //! Creates a point attraction affector. This affector modifies the positions of the //! particles and attracts them to a specified point at a specified speed per second. IParticleAttractionAffector* CParticleSystemSceneNode::createAttractionAffector( - core::vector3df point, f32 speed, + core::vector3df point, f32 speed, bool attract, bool affectX, bool affectY, bool affectZ ) { - return new CParticleAttractionAffector( point, speed, affectX, affectY, affectZ ); + return new CParticleAttractionAffector( point, speed, attract, affectX, affectY, affectZ ); } //! Creates a rotation affector. This affector rotates the particles around a specified pivot @@ -207,6 +234,7 @@ return new CParticleRotationAffector( speedX, speedY, speedZ, pivotPoint ); } + //! pre render event void CParticleSystemSceneNode::OnPreRender() { diff -Naurw source/Irrlicht/CParticleSystemSceneNode.h source/Irrlicht/CParticleSystemSceneNode.h --- source/Irrlicht/CParticleSystemSceneNode.h 2005-09-28 12:10:08.000000000 +0200 +++ source/Irrlicht/CParticleSystemSceneNode.h 2005-11-21 08:43:22.000000000 +0100 @@ -125,7 +147,7 @@ //! Creates a point attraction affector. This affector modifies the positions of the //! particles and attracts them to a specified point at a specified speed per second. virtual IParticleAttractionAffector* createAttractionAffector( - core::vector3df point, f32 speed, + core::vector3df point, f32 speed, bool attract = true, bool affectX = true, bool affectY = true, bool affectZ = true); //! Creates a rotation affector. This affector rotates the particles around a specified pivot diff -Naurw include/IParticleAttractionAffector.h include/IParticleAttractionAffector.h --- include/IParticleAttractionAffector.h 2005-09-28 10:48:50.000000000 +0200 +++ include/IParticleAttractionAffector.h 2005-09-29 14:45:22.000000000 +0200 @@ -26,9 +26,32 @@ //! Set the point that particles will attract to virtual void setPoint( core::vector3df point ) = 0; + //! Set whether or not the particles are attracting or detracting + virtual void setAttract( bool attract ) = 0; + + //! Set whether or not this will affect particles in the X direction + virtual void setAffectX( bool affect ) = 0; + + //! Set whether or not this will affect particles in the Y direction + virtual void setAffectY( bool affect ) = 0; + + //! Set whether or not this will affect particles in the Z direction + virtual void setAffectZ( bool affect ) = 0; + //! Get the point that particles are attracted to virtual const core::vector3df& getPoint() const = 0; + //! Get whether or not the particles are attracting or detracting + virtual const bool& getAttract() const = 0; + + //! Get whether or not the particles X position are affected + virtual const bool& getAffectX() const = 0; + + //! Get whether or not the particles Y position are affected + virtual const bool& getAffectY() const = 0; + + //! Get whether or not the particles Z position are affected + virtual const bool& getAffectZ() const = 0; }; } // end namespace scene diff -Naurw include/IParticleSystemSceneNode.h include/IParticleSystemSceneNode.h --- include/IParticleSystemSceneNode.h 2005-09-28 10:53:22.000000000 +0200 +++ include/IParticleSystemSceneNode.h 2005-09-30 16:41:14.000000000 +0200 @@ -304,6 +388,7 @@ //! particles and attracts them to a specified point at a specified speed per second. //! \param point: Point to attract particles to. //! \param speed: Speed in units per second, to attract to the specified point. + //! \param attract: Whether the particles attract or detract from this point. //! \param affectX: Whether or not this will affect the X position of the particle. //! \param affectY: Whether or not this will affect the Y position of the particle. //! \param affectZ: Whether or not this will affect the Z position of the particle. @@ -313,7 +398,7 @@ //! returned pointer, after you don't need it any more, see //! IUnknown::drop() for more informations. virtual IParticleAttractionAffector* createAttractionAffector( - core::vector3df point, f32 speed, + core::vector3df point, f32 speed, bool attract = true, bool affectX = true, bool affectY = true, bool affectZ = true) = 0; //! Creates a rotation affector. This affector modifies the positions of the diff -Naurw include/irrlicht.h source/Irrlicht/include/irrlicht.h --- include/irrlicht.h 2005-09-28 10:14:26.000000000 +0200 +++ include/irrlicht.h 2005-11-12 09:01:42.000000000 +0100 @@ -104,6 +104,7 @@ #include "IParticleFadeOutAffector.h" #include "IParticleGravityAffector.h" #include "IParticleAttractionAffector.h" +#include "IParticleRotationAffector.h" #include "IBillboardSceneNode.h" #include "ITexture.h" #include "IUnknown.h"