From 5f10387ea9eeb5278f4be2c88049041dcc3530b2 Mon Sep 17 00:00:00 2001 From: Comment Date: Mon, 24 Jun 2013 01:39:45 +0100 Subject: new vector parts --- 06_performance/src/main.cpp | 4 ++-- 06_performance/src/oni.cpp | 32 +++++++++++++++++--------------- 06_performance/src/oni.h | 11 +++++++++++ 3 files changed, 30 insertions(+), 17 deletions(-) (limited to '06_performance/src') diff --git a/06_performance/src/main.cpp b/06_performance/src/main.cpp index d85180c..9343609 100644 --- a/06_performance/src/main.cpp +++ b/06_performance/src/main.cpp @@ -4,8 +4,8 @@ //======================================================================== int main( ){ - ofSetupOpenGL(4080,768, OF_WINDOW); // <-------- setup the GL context - //ofSetupOpenGL(1224,232, OF_WINDOW); // <-------- setup the GL context + //ofSetupOpenGL(4080,768, OF_WINDOW); // <-------- setup the GL context + ofSetupOpenGL(1550,296, OF_WINDOW); // <-------- setup the GL context 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;ngetWidth(); int depthH=players[n]->getHeight(); - + for (int i=0;iprojectiveToWorld(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;oprojectiveToWorld(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;oprojectiveToWorld(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::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 +} diff --git a/06_performance/src/oni.h b/06_performance/src/oni.h index 2492d79..898a7a2 100644 --- a/06_performance/src/oni.h +++ b/06_performance/src/oni.h @@ -21,6 +21,17 @@ class fpoint{ 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 points; + set pointPool; +}; class syncOniPlayer{ public: syncOniPlayer() { -- cgit v1.2.3