diff options
| author | Tim <tim@Admins-Mac-Pro-2.local> | 2013-06-19 20:03:17 +0100 |
|---|---|---|
| committer | Tim <tim@Admins-Mac-Pro-2.local> | 2013-06-19 20:03:17 +0100 |
| commit | cdd0e0b630bd3a5a8ba15dbce7f5e03221b72f92 (patch) | |
| tree | 4ada26f9bf3d4e0bdb97889472e95729433518a6 /04_playobjects/src/testApp.h | |
| parent | 4fdd082d9a5657b0f9c613d47c2c58cea366a2e6 (diff) | |
working on performance version
Diffstat (limited to '04_playobjects/src/testApp.h')
| -rw-r--r-- | 04_playobjects/src/testApp.h | 95 |
1 files changed, 33 insertions, 62 deletions
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index e1f1e5c..873db31 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -20,7 +20,13 @@ struct record{ //in order to play different clips it seems necessary to have a player per clip class syncOniPlayer{ public: - syncOniPlayer() {drawable=false;} + int depthW; + int depthH; + syncOniPlayer() { + drawable=false; + depthW=320; + depthH=240; + } ~syncOniPlayer(){ stop(); } @@ -80,100 +86,64 @@ class syncOniPlayer{ players[i]->drawDepth(50, 0,520,390); players[i]->drawImage(600, 0,520,390); - const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap(); - + int count; + for (int i=0;i<players.size();i++) { - int range=2500; + const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap(); + //uint16_t* depthpixels=depthmap.getPixels(); + int range=2500; - - int dmw=players[i]->getWidth(); - - //for (int i=0;i<players[i]->getWidth();i+=2) { + for (int i=0;i<depthW;i+=2) { glBegin(GL_LINES); - //for (int j=0;j<players[i]->getHeight();j+=2) { + for (int j=0;j<depthH;j+=2) { - ofPoint p= players[i]->projectiveToWorld(ofPoint(300,150,(float)(depthmap[1200]))); -/* - ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*dmw+i]))); + + ofPoint p= players[i]->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 -> still a bit weird if userID > 0... //&& isCPBkgnd - //ofColor color = kinect->getColorAt(x,y); //userID); - //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); - // else + //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); - glVertex3f(p.x, p.y, p.z); + //glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255); + //glVertex3f(p.x, p.y, p.z); //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl; - */ - //} + } glEnd(); - //} + } + + } + } } void drawCloud(){ - /* - int num=0; - for (int i=0;i<players.size();i++) { - ofPushMatrix(); - ofEnableBlendMode(OF_BLENDMODE_ALPHA); - int numUsers = players[i]->getNumTrackedUsers(); - for (int nID = 0; nID < numUsers; nID++){ - ofxOpenNIUser & user = players[i]->getTrackedUser(nID); - //user.drawMask(); - ofPushMatrix(); - ofTranslate(0,0,-1000); - user.drawPointCloud(); - ofPopMatrix(); - } - num+=numUsers; - ofDisableBlendMode(); - ofPopMatrix(); - } - return num; - */ - //cerr<<"drawing "<<players.size()<<" clouds"<<endl; we are getting to here when unititialised - + int count; for (int i=0;i<players.size();i++) { - if (players[i]==0x00) { - cerr<<"more spooky shit....!"; - return; - } const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap(); //uint16_t* depthpixels=depthmap.getPixels(); int range=2500; - - - int dmw=players[i]->getWidth(); - - for (int i=0;i<players[i]->getWidth();i+=2) { + for (int i=0;i<depthW;i+=2) { glBegin(GL_LINES); - for (int j=0;j<players[i]->getHeight();j+=2) { - + for (int j=0;j<depthH;j+=2) { - ofPoint p= players[i]->projectiveToWorld(ofPoint(i,j,(float)(depthmap[j*dmw+i]))); + ofPoint p= players[i]->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 -> still a bit weird if userID > 0... //&& isCPBkgnd - //ofColor color = kinect->getColorAt(x,y); //userID); - //if (col) glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); - // else + //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); - glVertex3f(p.x, p.y, p.z); + //glColor4ub((unsigned char)255, (unsigned char)255, (unsigned char)255, (unsigned char)255); + //glVertex3f(p.x, p.y, p.z); //if (i==320&&j==160) cerr<<"world point: "<<p.x<<","<<p.y<<","<<p.z<<endl; } @@ -243,7 +213,8 @@ public: bool drawmovies,drawcloud; int offset; - ofxMayaCam cam; + ofCamera camera; + ofNode target; }; |
