Mercurial > hg > opencollidoscope
annotate CollidoscopeApp/include/ParticleController.h @ 1:b5bcad8e7803
renamed teensy files
added DeviceManageJack.cpp
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Fri, 08 Jul 2016 11:39:18 +0200 |
parents | 02467299402e |
children | 7fb593d53361 |
rev | line source |
---|---|
f@0 | 1 #pragma once |
f@0 | 2 |
f@0 | 3 #include "cinder/gl/gl.h" |
f@0 | 4 #include <vector> |
f@0 | 5 |
f@0 | 6 |
f@0 | 7 class ParticleController { |
f@0 | 8 |
f@0 | 9 struct Particle { |
f@0 | 10 |
f@0 | 11 ci::vec2 mCloudCenter; |
f@0 | 12 ci::vec2 mVel; |
f@0 | 13 float mCloudSize; |
f@0 | 14 |
f@0 | 15 int mAge; |
f@0 | 16 int mLifespan; |
f@0 | 17 bool mFlyOver; |
f@0 | 18 |
f@0 | 19 }; |
f@0 | 20 |
f@0 | 21 static const int kMaxParticles = 150; |
f@0 | 22 |
f@0 | 23 std::vector<Particle> mParticles; |
f@0 | 24 std::vector< ci::vec2 > mParticlePositions; |
f@0 | 25 |
f@0 | 26 size_t mNumParticles; |
f@0 | 27 |
f@0 | 28 ci::gl::VboRef mParticleVbo; |
f@0 | 29 ci::gl::BatchRef mParticleBatch; |
f@0 | 30 |
f@0 | 31 public: |
f@0 | 32 static const int kMaxParticleAdd = 22; |
f@0 | 33 |
f@0 | 34 ParticleController(); |
f@0 | 35 void addParticles(int amount, const ci::vec2 &initialLocation, const float cloudSize); |
f@0 | 36 |
f@0 | 37 void updateParticles(); |
f@0 | 38 |
f@0 | 39 inline void draw() |
f@0 | 40 { |
f@0 | 41 mParticleBatch->draw(); |
f@0 | 42 } |
f@0 | 43 |
f@0 | 44 }; |
f@0 | 45 |