summaryrefslogtreecommitdiff
path: root/06_performance/src/oni.h
diff options
context:
space:
mode:
Diffstat (limited to '06_performance/src/oni.h')
-rw-r--r--06_performance/src/oni.h38
1 files changed, 20 insertions, 18 deletions
diff --git a/06_performance/src/oni.h b/06_performance/src/oni.h
index 898a7a2..36d216a 100644
--- a/06_performance/src/oni.h
+++ b/06_performance/src/oni.h
@@ -6,32 +6,33 @@
class fpoint{
public:
fpoint(float _x,float _y, float _z, unsigned char _r,unsigned char _g,unsigned char _b){
- x=_x;y=_y;z=_z;r=_r;g=_g;b=_b;st=ofGetElapsedTimef();
+ setup(x,y,z,r,g,b);
+ }
+ void setup(float _x,float _y, float _z, unsigned char _r,unsigned char _g,unsigned char _b){
+ x=_x;y=_y;z=_z;r=_r;g=_g;b=_b;st=ofGetElapsedTimef();active=true;
}
float x,y,z;
float st;
unsigned char r,g,b;
- bool draw(float life,float dx,float dy,float dz){
+ bool active;
+ bool draw(float life,float dx,float dy,float dz,float size=5.0f){
+ if (!active) {
+ return true;
+ }
float l=ofGetElapsedTimef()-st;
if (life>l) {
- glColor4ub(r,g,b,(unsigned char)255); // ((l/life)*255.0f));
+ glPointSize((1.0f-(l/life))*size);
+ glColor3ub(r,g,b);
+ //glColor4ub(r,g,b,(unsigned char)255); // ((l/life)*255.0f));
glVertex3f(x-(pow(l,2)*dx),y-(pow(l,2)*dy),z-(pow(l,2)*dz));
- return false;
+ return true;
+ }
+ else {
+ active=false;
+ return false;
}
- else return true;
}
};
-class fpointManager{
- void add(float x,float y,float z,uint8_t r,uint8_t g,uint8_t b){
- if (pointPool.size()) {//take 1st dead particle
- else {}//make a new one
- }
- void draw(int life,float dx,float dy,float dz){
- if (p.draw(life,dx,dy,dz))
- }
- vector<fpoint> points;
- set<int> pointPool;
-};
class syncOniPlayer{
public:
syncOniPlayer() {
@@ -48,7 +49,7 @@ class syncOniPlayer{
int getNumParticles();
void drawWindows();
void drawCloud(int step);
- void drawPoints(float birth,float life,float dx,float dy, float dz);
+ void drawPoints(float birth,float life,float dx,float dy, float dz,float size);
void stop();
string audio;
@@ -57,7 +58,8 @@ class syncOniPlayer{
vector<string> filenames;
ofSoundPlayer soundplayer;
bool drawable;
- list<fpoint> points;
+ vector<fpoint> points;
+ set<int> pointPool;
};
//========================================
class oniManager{