Mercurial > hg > opencollidoscope
comparison CollidoscopeApp/include/ParticleController.h @ 0:02467299402e
First import
CollidoscopeApp for Raspberry Pi
JackDevice
Teensy code for Collidoscope
author | Fiore Martin <f.martin@qmul.ac.uk> |
---|---|
date | Thu, 30 Jun 2016 14:50:06 +0200 |
parents | |
children | 7fb593d53361 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:02467299402e |
---|---|
1 #pragma once | |
2 | |
3 #include "cinder/gl/gl.h" | |
4 #include <vector> | |
5 | |
6 | |
7 class ParticleController { | |
8 | |
9 struct Particle { | |
10 | |
11 ci::vec2 mCloudCenter; | |
12 ci::vec2 mVel; | |
13 float mCloudSize; | |
14 | |
15 int mAge; | |
16 int mLifespan; | |
17 bool mFlyOver; | |
18 | |
19 }; | |
20 | |
21 static const int kMaxParticles = 150; | |
22 | |
23 std::vector<Particle> mParticles; | |
24 std::vector< ci::vec2 > mParticlePositions; | |
25 | |
26 size_t mNumParticles; | |
27 | |
28 ci::gl::VboRef mParticleVbo; | |
29 ci::gl::BatchRef mParticleBatch; | |
30 | |
31 public: | |
32 static const int kMaxParticleAdd = 22; | |
33 | |
34 ParticleController(); | |
35 void addParticles(int amount, const ci::vec2 &initialLocation, const float cloudSize); | |
36 | |
37 void updateParticles(); | |
38 | |
39 inline void draw() | |
40 { | |
41 mParticleBatch->draw(); | |
42 } | |
43 | |
44 }; | |
45 |