diff options
| author | Comment <tim@gray.(none)> | 2013-06-24 01:39:45 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-24 01:39:45 +0100 |
| commit | 5f10387ea9eeb5278f4be2c88049041dcc3530b2 (patch) | |
| tree | ea4b11887ad9afe07903a6bccfe58b686051ef4a /06_performance/src/oni.cpp | |
| parent | dd4799273e806c91606d8246eae61255d44cef9a (diff) | |
new vector parts
Diffstat (limited to '06_performance/src/oni.cpp')
| -rw-r--r-- | 06_performance/src/oni.cpp | 32 |
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 +} |
