Mercurial > hg > opencollidoscope
diff CollidoscopeApp/include/ParticleController.h @ 3:7fb593d53361
added comments
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Tue, 12 Jul 2016 18:29:38 +0200 |
parents | 02467299402e |
children | ab6db404403a |
line wrap: on
line diff
--- a/CollidoscopeApp/include/ParticleController.h Mon Jul 11 17:03:40 2016 +0200 +++ b/CollidoscopeApp/include/ParticleController.h Tue Jul 12 18:29:38 2016 +0200 @@ -3,7 +3,9 @@ #include "cinder/gl/gl.h" #include <vector> - +/** + * The ParticleController creates/updates/draws and destroys particles + */ class ParticleController { struct Particle { @@ -23,19 +25,34 @@ std::vector<Particle> mParticles; std::vector< ci::vec2 > mParticlePositions; + // current number of active particles size_t mNumParticles; ci::gl::VboRef mParticleVbo; ci::gl::BatchRef mParticleBatch; public: + /** + * Every time addParticles is run, up to kMaxParticleAdd are added at once + */ static const int kMaxParticleAdd = 22; ParticleController(); + + /** + * Adds \a amount particles and places them in \a initialLocation. + * \cloudSize determines how far the particles can go + */ void addParticles(int amount, const ci::vec2 &initialLocation, const float cloudSize); + /** + * Updates position and age of the particles + */ void updateParticles(); + /** + * Draws all the particles + */ inline void draw() { mParticleBatch->draw();