1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
|
#include "ofMain.h"
#include "ofxXmlSettings.h"
#include "ofxOpenNI.h"
//a colour video particle
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();
}
float x,y,z;
float st;
unsigned char r,g,b;
bool draw(float life,float dx,float dy,float dz){
float l=ofGetElapsedTimef()-st;
if (life>l) {
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;
}
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() {
drawable=false;
}
~syncOniPlayer(){
stop();
}
void addPlayer(string name);
void play();
void update();
void pause();
int getCurrentFrame();
int getNumParticles();
void drawWindows();
void drawCloud(int step);
void drawPoints(float birth,float life,float dx,float dy, float dz);
void stop();
string audio;
private:
vector<ofxOpenNI*> players;
vector<string> filenames;
ofSoundPlayer soundplayer;
bool drawable;
list<fpoint> points;
};
//========================================
class oniManager{
public:
void init(const char* filename);
void startPlayer(int num);
int getNumClips();
int getNumParticles();
void update();
void drawWindows();
void drawCloud(int step);
void drawPoints(float size,float birth,float life,float dx,float dy, float dz);
void previous();
void next();
int playing;
ofxXmlSettings XML;
vector<syncOniPlayer> players;
};
|