Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/include/ParticleController.h @ 4:ab6db404403a
commented JackDevice
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Wed, 13 Jul 2016 12:31:37 +0200 |
parents | 7fb593d53361 |
children | 75b744078d66 |
comparison
equal
deleted
inserted
replaced
3:7fb593d53361 | 4:ab6db404403a |
---|---|
8 */ | 8 */ |
9 class ParticleController { | 9 class ParticleController { |
10 | 10 |
11 struct Particle { | 11 struct Particle { |
12 | 12 |
13 ci::vec2 mCloudCenter; | 13 ci::vec2 mCloudCenter; // initial positin of the particle |
14 ci::vec2 mVel; | 14 ci::vec2 mVel; // velocity |
15 float mCloudSize; | 15 float mCloudSize; // how big is the area where particle float around. When a particle hits the |
16 // border of the area it gets deflected | |
16 | 17 |
17 int mAge; | 18 int mAge; // when mAge == mLifeSpan the particle is disposed |
18 int mLifespan; | 19 int mLifespan; // how long a particle lives |
19 bool mFlyOver; | 20 bool mFlyOver; // some particles last longer and fly over the screen and reach the other user |
20 | 21 |
21 }; | 22 }; |
22 | 23 |
23 static const int kMaxParticles = 150; | 24 static const int kMaxParticles = 150; |
24 | 25 |
26 std::vector< ci::vec2 > mParticlePositions; | 27 std::vector< ci::vec2 > mParticlePositions; |
27 | 28 |
28 // current number of active particles | 29 // current number of active particles |
29 size_t mNumParticles; | 30 size_t mNumParticles; |
30 | 31 |
31 ci::gl::VboRef mParticleVbo; | 32 ci::gl::VboRef mParticleVbo; // virtual buffer object |
32 ci::gl::BatchRef mParticleBatch; | 33 ci::gl::BatchRef mParticleBatch; |
33 | 34 |
34 public: | 35 public: |
35 /** | 36 /** |
36 * Every time addParticles is run, up to kMaxParticleAdd are added at once | 37 * Every time addParticles is run, up to kMaxParticleAdd are added at once |