diff options
Diffstat (limited to 'src/libjin/graphics/particles/particle_system.h')
-rw-r--r-- | src/libjin/graphics/particles/particle_system.h | 334 |
1 files changed, 167 insertions, 167 deletions
diff --git a/src/libjin/graphics/particles/particle_system.h b/src/libjin/graphics/particles/particle_system.h index 83351a9..d3e3369 100644 --- a/src/libjin/graphics/particles/particle_system.h +++ b/src/libjin/graphics/particles/particle_system.h @@ -14,182 +14,182 @@ namespace JinEngine { - namespace Graphics - { - namespace Particles - { - - /// - /// Definition of particle system. - /// - struct ParticleSystemDef - { - ParticleSystemDef() {} - uint maxParticleCount = 1; ///< Max count of particles in pool. 1 by default. - ParticleEmitterDef emitterDef; ///< Particle emitter definition. - ParticleDef particleDef; ///< Particle definition. - }; - - /// - /// Particle emitter, handle all particles it emitts. - /// - class ParticleSystem : public Renderable, public Game::GameObject - { - public: - /// - /// Particle system constructor - /// - /// @param def Definition of particle system. - /// - ParticleSystem(const ParticleSystemDef& def); - - /// - /// - /// - ParticleSystem(uint maxCount = 64); - - /// - /// - /// - ParticleSystem(const std::string & config); - - /// - /// Particle system destructor. - /// - ~ParticleSystem(); - - /// - /// - /// - void setDefinition(const ParticleSystemDef& def); - - /// - /// Load definition from config. - /// - void setDefinition(const std::string& config); - - /// - /// Update particle system and all alive particles. - /// - void update(float dt); - - /// - /// Render particle system. - /// - void render(); - - /// - /// Set particle system position. - /// - void setPosition(float x, float y); - - /// - /// Set scale. - /// - void setScale(float sx, float sy); - - /// - /// Pause particle spawn. - /// - void pause(bool isPause); - - /// - /// Clear all particles. - /// - void clear(); - - ////////////////////////////////////////////////////////////////////////////////////////////////// - // Particle Emitter modification. - ////////////////////////////////////////////////////////////////////////////////////////////////// - - void setEmitRate(float floor, float ceil); - void setEmitRate(float rate); - - void setEmitForce(float floor, float ceil); - void setEmitForce(float force); - - void setEmitDirection(float floor, float ceil); - void setEmitDirection(float dir); - - void setEmitPosition(const Math::Vector2<float>& floor, const Math::Vector2<float>& ceil); - void setEmitPosition(const Math::Vector2<float>& position); - - ////////////////////////////////////////////////////////////////////////////////////////////////// - // Particle modification. - ////////////////////////////////////////////////////////////////////////////////////////////////// - - void setParticleLife(float floor, float ceil); - void setParticleLife(float time); - - void setParticleLinearAccelaration(Math::Vector2<float> ac); - - void setParticleRadialAccelaration(float ra); - - void setParticleAngularSpeed(float floor, float ceil); - void setParticleAngularSpeed(float speed); - - void setParticleSpritesMode(SpriteMode mode); - void addParticleSprite(const Sprite* sprite); - void addParticleSprites(uint count, ...); - void addParticleSprites(const std::vector<const Sprite*>& sprs); - void removeParticleSprite(uint i); - - void enableParticleBlendAdditive(bool enable); - - void setParticleScale(float scale); - void addParticleScalePoint(float scale, float t); - void removeParticleScalePoint(uint i); - - void setParticleColor(Color tint); - void addParticleColorPoint(Color tint, float t); - void removeParticleColorPoint(uint i); - - void setParticleTransparency(float transparency); - void addParticleTransparencyPoint(float transparency, float t); - void removeParticleTransparencyPoint(uint i); + namespace Graphics + { + namespace Particles + { + + /// + /// Definition of particle system. + /// + struct ParticleSystemDef + { + ParticleSystemDef() {} + uint maxParticleCount = 1; ///< Max count of particles in pool. 1 by default. + ParticleEmitterDef emitterDef; ///< Particle emitter definition. + ParticleDef particleDef; ///< Particle definition. + }; + + /// + /// Particle emitter, handle all particles it emitts. + /// + class ParticleSystem : public Renderable, public Game::GameObject + { + public: + /// + /// Particle system constructor + /// + /// @param def Definition of particle system. + /// + ParticleSystem(const ParticleSystemDef& def); + + /// + /// + /// + ParticleSystem(uint maxCount = 64); + + /// + /// + /// + ParticleSystem(const std::string & config); + + /// + /// Particle system destructor. + /// + ~ParticleSystem(); + + /// + /// + /// + void setDefinition(const ParticleSystemDef& def); + + /// + /// Load definition from config. + /// + void setDefinition(const std::string& config); + + /// + /// Update particle system and all alive particles. + /// + void update(float dt); + + /// + /// Render particle system. + /// + void render(); + + /// + /// Set particle system position. + /// + void setPosition(float x, float y); + + /// + /// Set scale. + /// + void setScale(float sx, float sy); + + /// + /// Pause particle spawn. + /// + void pause(bool isPause); + + /// + /// Clear all particles. + /// + void clear(); + + ////////////////////////////////////////////////////////////////////////////////////////////////// + // Particle Emitter modification. + ////////////////////////////////////////////////////////////////////////////////////////////////// + + void setEmitRate(float floor, float ceil); + void setEmitRate(float rate); + + void setEmitForce(float floor, float ceil); + void setEmitForce(float force); + + void setEmitDirection(float floor, float ceil); + void setEmitDirection(float dir); + + void setEmitPosition(const Math::Vector2<float>& floor, const Math::Vector2<float>& ceil); + void setEmitPosition(const Math::Vector2<float>& position); + + ////////////////////////////////////////////////////////////////////////////////////////////////// + // Particle modification. + ////////////////////////////////////////////////////////////////////////////////////////////////// + + void setParticleLife(float floor, float ceil); + void setParticleLife(float time); + + void setParticleLinearAccelaration(Math::Vector2<float> ac); + + void setParticleRadialAccelaration(float ra); + + void setParticleAngularSpeed(float floor, float ceil); + void setParticleAngularSpeed(float speed); + + void setParticleSpritesMode(SpriteMode mode); + void addParticleSprite(const Sprite* sprite); + void addParticleSprites(uint count, ...); + void addParticleSprites(const std::vector<const Sprite*>& sprs); + void removeParticleSprite(uint i); + + void enableParticleBlendAdditive(bool enable); + + void setParticleScale(float scale); + void addParticleScalePoint(float scale, float t); + void removeParticleScalePoint(uint i); + + void setParticleColor(Color tint); + void addParticleColorPoint(Color tint, float t); + void removeParticleColorPoint(uint i); + + void setParticleTransparency(float transparency); + void addParticleTransparencyPoint(float transparency, float t); + void removeParticleTransparencyPoint(uint i); - private: - friend class ParticleEmitter; - - /// - /// Particle system position. - /// - Math::Vector2<float> mPosition; + private: + friend class ParticleEmitter; + + /// + /// Particle system position. + /// + Math::Vector2<float> mPosition; - /// - /// - /// - Particle* claim(); + /// + /// + /// + Particle* claim(); - /// - /// - /// - void recycle(int i, Particle* p); + /// + /// + /// + void recycle(int i, Particle* p); - /// - /// Particle system definition. - /// - ParticleSystemDef mDef; + /// + /// Particle system definition. + /// + ParticleSystemDef mDef; - /// - /// Particle emitter. - /// - ParticleEmitter mEmitter; + /// + /// Particle emitter. + /// + ParticleEmitter mEmitter; - /// - /// Particle pool. - /// - ParticlePool mParticlePool; + /// + /// Particle pool. + /// + ParticlePool mParticlePool; - /// - /// Alive particles, that means these particles could join to the life cycle loop. - /// - std::vector<Particle*> mAliveParticles; + /// + /// Alive particles, that means these particles could join to the life cycle loop. + /// + std::vector<Particle*> mAliveParticles; - }; + }; - } // namespace Particles - } // namespace Graphics + } // namespace Particles + } // namespace Graphics } // namespace JinEngine #endif
\ No newline at end of file |