From 4fdd082d9a5657b0f9c613d47c2c58cea366a2e6 Mon Sep 17 00:00:00 2001 From: Comment Date: Wed, 19 Jun 2013 02:33:45 +0100 Subject: finally all of the elements --- 04_playobjects/src/testApp.h | 55 ++++++++++++++++++++++++++++++++++++++++---- 1 file changed, 50 insertions(+), 5 deletions(-) (limited to '04_playobjects/src/testApp.h') 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;isetSafeThreading(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;idrawDepth(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;igetWidth();i+=2) { + + glBegin(GL_LINES); + + //for (int j=0;jgetHeight();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: "<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;igetWidth();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 players; vector filenames; ofSoundPlayer soundplayer; + bool drawable; }; -- cgit v1.2.3