1 // Copyright (C) 2002-2012 Nikolaus Gebhardt
\r
2 // This file is part of the "Irrlicht Engine".
\r
3 // For conditions of distribution and use, see copyright notice in irrlicht.h
\r
5 #ifndef __C_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
\r
6 #define __C_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
\r
8 #include "IrrCompileConfig.h"
\r
9 #ifdef _IRR_COMPILE_WITH_PARTICLES_
\r
11 #include "IParticleAttractionAffector.h"
\r
18 //! Particle Affector for attracting particles to a point
\r
19 class CParticleAttractionAffector : public IParticleAttractionAffector
\r
23 CParticleAttractionAffector(
\r
24 const core::vector3df& point = core::vector3df(), f32 speed = 1.0f,
\r
25 bool attract = true, bool affectX = true,
\r
26 bool affectY = true, bool affectZ = true );
\r
28 //! Affects a particle.
\r
29 virtual void affect(u32 now, SParticle* particlearray, u32 count) _IRR_OVERRIDE_;
\r
31 //! Set the point that particles will attract to
\r
32 virtual void setPoint( const core::vector3df& point ) _IRR_OVERRIDE_ { Point = point; }
\r
34 //! Set the speed, in game units per second that the particles will attract to the specified point
\r
35 virtual void setSpeed( f32 speed ) _IRR_OVERRIDE_ { Speed = speed; }
\r
37 //! Set whether or not the particles are attracting or detracting
\r
38 virtual void setAttract( bool attract ) _IRR_OVERRIDE_ { Attract = attract; }
\r
40 //! Set whether or not this will affect particles in the X direction
\r
41 virtual void setAffectX( bool affect ) _IRR_OVERRIDE_ { AffectX = affect; }
\r
43 //! Set whether or not this will affect particles in the Y direction
\r
44 virtual void setAffectY( bool affect ) _IRR_OVERRIDE_ { AffectY = affect; }
\r
46 //! Set whether or not this will affect particles in the Z direction
\r
47 virtual void setAffectZ( bool affect ) _IRR_OVERRIDE_ { AffectZ = affect; }
\r
49 //! Get the point that particles are attracted to
\r
50 virtual const core::vector3df& getPoint() const _IRR_OVERRIDE_ { return Point; }
\r
52 //! Get the speed that points attract to the specified point
\r
53 virtual f32 getSpeed() const _IRR_OVERRIDE_ { return Speed; }
\r
55 //! Get whether or not the particles are attracting or detracting
\r
56 virtual bool getAttract() const _IRR_OVERRIDE_ { return Attract; }
\r
58 //! Get whether or not the particles X position are affected
\r
59 virtual bool getAffectX() const _IRR_OVERRIDE_ { return AffectX; }
\r
61 //! Get whether or not the particles Y position are affected
\r
62 virtual bool getAffectY() const _IRR_OVERRIDE_ { return AffectY; }
\r
64 //! Get whether or not the particles Z position are affected
\r
65 virtual bool getAffectZ() const _IRR_OVERRIDE_ { return AffectZ; }
\r
67 //! Writes attributes of the object.
\r
68 virtual void serializeAttributes(io::IAttributes* out, io::SAttributeReadWriteOptions* options) const _IRR_OVERRIDE_;
\r
70 //! Reads attributes of the object.
\r
71 virtual void deserializeAttributes(io::IAttributes* in, io::SAttributeReadWriteOptions* options) _IRR_OVERRIDE_;
\r
75 core::vector3df Point;
\r
84 } // end namespace scene
\r
85 } // end namespace irr
\r
87 #endif // _IRR_COMPILE_WITH_PARTICLES_
\r
89 #endif // __C_PARTICLE_ATTRACTION_AFFECTOR_H_INCLUDED__
\r