diff options
| author | Comment <tim@gray.(none)> | 2013-06-19 02:33:45 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-19 02:33:45 +0100 |
| commit | 4fdd082d9a5657b0f9c613d47c2c58cea366a2e6 (patch) | |
| tree | 6c556338b9a9915b252488abfda33578b5b71f01 /04_playobjects/src/testApp.h | |
| parent | 04bc6345764e55ae249a622030f26496a0586541 (diff) | |
finally all of the elements
Diffstat (limited to '04_playobjects/src/testApp.h')
| -rw-r--r-- | 04_playobjects/src/testApp.h | 55 |
1 files changed, 50 insertions, 5 deletions
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index 32e6dad..e1f1e5c 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -20,6 +20,7 @@ struct record{ //in order to play different clips it seems necessary to have a player per clip class syncOniPlayer{ public: + syncOniPlayer() {drawable=false;} ~syncOniPlayer(){ stop(); } @@ -40,7 +41,7 @@ class syncOniPlayer{ for (int i=0;i<players.size();i++) { players[i]=new ofxOpenNI(); //players[i]->setSafeThreading(true); - players[i]->setupFromONI(filenames[i],false); + players[i]->setupFromONI(filenames[i],true); //players[i]->addDepthGenerator(); //players[i]->addImageGenerator(); //players[i]->setRegister(true); @@ -52,6 +53,8 @@ class syncOniPlayer{ soundplayer.loadSound(audio); soundplayer.play(); }; + //sleep(2); + drawable=true; } } void update(){ @@ -70,11 +73,47 @@ class syncOniPlayer{ else return -1; } void drawWindows(){ + if (!drawable) return; for (int i=0;i<players.size();i++) { if (players[i]==NULL) break; ofTranslate(0, i * 400); players[i]->drawDepth(50, 0,520,390); players[i]->drawImage(600, 0,520,390); + + const XnDepthPixel* depthmap=players[i]->getDepthGenerator().GetDepthMap(); + + + int range=2500; + + + + int dmw=players[i]->getWidth(); + + //for (int i=0;i<players[i]->getWidth();i+=2) { + + glBegin(GL_LINES); + + //for (int j=0;j<players[i]->getHeight();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= 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 + + + 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(){ @@ -103,14 +142,17 @@ class syncOniPlayer{ 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; - if (players[i]==NULL) { - cerr<<"more spooky shit....!"; - return; - } + + int dmw=players[i]->getWidth(); for (int i=0;i<players[i]->getWidth();i+=2) { @@ -137,6 +179,7 @@ class syncOniPlayer{ glEnd(); } + } return; @@ -150,6 +193,7 @@ class syncOniPlayer{ players[i]=NULL; } } + drawable=false; } string audio; @@ -157,6 +201,7 @@ class syncOniPlayer{ vector<ofxOpenNI*> players; vector<string> filenames; ofSoundPlayer soundplayer; + bool drawable; }; |
