summaryrefslogtreecommitdiff
path: root/06_performance/src/oni.cpp
diff options
context:
space:
mode:
Diffstat (limited to '06_performance/src/oni.cpp')
-rw-r--r--06_performance/src/oni.cpp32
1 files changed, 17 insertions, 15 deletions
diff --git a/06_performance/src/oni.cpp b/06_performance/src/oni.cpp
index 099dd87..024594f 100644
--- a/06_performance/src/oni.cpp
+++ b/06_performance/src/oni.cpp
@@ -59,7 +59,7 @@ void syncOniPlayer::drawWindows(){
}
}
-void syncOniPlayer::drawCloud(int step){
+void syncOniPlayer::drawCloud(int step){
int count;
for (int n=0;n<players.size();n++) {
@@ -70,7 +70,7 @@ void syncOniPlayer::drawCloud(int step){
int depthW=players[n]->getWidth();
int depthH=players[n]->getHeight();
-
+
for (int i=0;i<depthW;i+=step) {
glBegin(GL_LINES);
@@ -80,8 +80,8 @@ void syncOniPlayer::drawCloud(int step){
ofPoint p= players[n]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*depthW+i])));
//ofPoint p= projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
-
- if (p.z == 0 || p.z>range) continue; // gets rid of background
+
+ if (p.z == 0 || p.z>range) continue; // gets rid of background
glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255);
@@ -91,7 +91,7 @@ void syncOniPlayer::drawCloud(int step){
glEnd();
}
-
+
}
return;
@@ -103,15 +103,17 @@ void syncOniPlayer::drawPoints(float birth,float life,float dx,float dy, float d
int range=1700;
int dmw=players[0]->getWidth();
int dmh=players[0]->getHeight();
- int step=pixels.getWidth()/dmw;
- for (int o=0;o<birth;o++) {
- int i=ofRandom(dmw);
- int j=ofRandom(dmh);
- ofPoint p= players[0]->projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
- if (p.z <100 || p.z>range) continue;
- points.push_back(fpoint(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2));
- //fpoint f=fpoint(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2);
- //f.draw(life,dx,dy,dz);
+ if (dmw&&dmh){
+ int step=pixels.getWidth()/dmw;
+ for (int o=0;o<birth;o++) {
+ int i=ofRandom(dmw);
+ int j=ofRandom(dmh);
+ ofPoint p= players[0]->projectiveToWorld(ofPoint(i,j,(float)depthmap[j*dmw+i]));
+ if (p.z <100 || p.z>range) continue;
+ points.push_back(fpoint(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2));
+ //fpoint f=fpoint(p.x, p.y, p.z,pixels[((j*step*dmw)+(i*step))*3],pixels[((j*step*dmw)+(i*step))*3]+1,pixels[((j*step*dmw)+(i*step))*3]+2);
+ //f.draw(life,dx,dy,dz);
+ }
}
std::list<fpoint>::iterator i = points.begin();
while (i != points.end())
@@ -205,4 +207,4 @@ void oniManager::drawPoints(float size,float birth,float life,float dx,float dy,
glDisable( GL_BLEND );
glDisable(GL_PROGRAM_POINT_SIZE);
}
-} \ No newline at end of file
+}