/*! \file particle_e,otter.h \brief Definition of a ParticleEmitter */ #ifndef _PARTICLE_EMITTER_H #define _PARTICLE_EMITTER_H #include "p_node.h" // FORWARD DEFINITION struct Particle; class ParticleSystem; typedef enum EMITTER_TYPE {EMITTER_DOT, EMITTER_PLANE, EMITTER_SPHERE, EMITTER_CUBE}; //! A default singleton class. class ParticleEmitter : public PNode { public: ParticleEmitter(const Vector& direction, float angle = 20.0, float emissionRate = 1.0, float velocity = 1.0); virtual ~ParticleEmitter(void); /* controlling the emitter: interface */ void start(); void stop(); void tick(float dt, ParticleSystem* system); /* controlling the behavour: these can be used as Animation interfaces */ void setEmissionRate(float emissionRate); void setSpread(float angle, float randomAngle = 0.0); void setVelocity(float velocity, float random = 0.0); private: Vector direction; //!< emition direction float angle; //!< max angle from the direction of the emitter float angleRandom; //!< random emission angle (angle +- angleRandom is the emitted angle. float emissionRate; //!< amount of particles per seconds emitted by emiter float velocity; //!< the contant speed a particle gets if been emitted float saveTime; //!< The time that was missing by the last Tick (otherwise there would be no emission when framefate is too big). }; #endif /* _PARTICLE_EMITTER_H */