diff options
| author | Comment <tim@gray.(none)> | 2013-06-18 22:34:30 +0100 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2013-06-18 22:34:30 +0100 |
| commit | 04bc6345764e55ae249a622030f26496a0586541 (patch) | |
| tree | cdfd45f49c3eba96ec1c566925a085698ca2238a /04_playobjects/src/testApp.h | |
| parent | c42c63d30a31713ffc113d6a03795d4538bd5c84 (diff) | |
steaming pile of crap
Diffstat (limited to '04_playobjects/src/testApp.h')
| -rw-r--r-- | 04_playobjects/src/testApp.h | 75 |
1 files changed, 64 insertions, 11 deletions
diff --git a/04_playobjects/src/testApp.h b/04_playobjects/src/testApp.h index 0de2207..32e6dad 100644 --- a/04_playobjects/src/testApp.h +++ b/04_playobjects/src/testApp.h @@ -4,6 +4,7 @@ #include "ofxOpenNI.h" #include "ofMain.h" #include "ofxXmlSettings.h" +#include "ofxMayaCam.h" #include "ofxOsc.h" @@ -35,21 +36,22 @@ class syncOniPlayer{ //players[players.size()-1]->start(); //players[players.size()-1]->startPlayer(name); } - void play(ofxOpenNIUser user){ + void play(){ for (int i=0;i<players.size();i++) { players[i]=new ofxOpenNI(); //players[i]->setSafeThreading(true); - players[i]->setupFromONI(filenames[i],true); - players[i]->addUserGenerator(); - players[i]->setRegister(true); + players[i]->setupFromONI(filenames[i],false); + //players[i]->addDepthGenerator(); + //players[i]->addImageGenerator(); + //players[i]->setRegister(true); players[i]->setLooped(false); - players[i]->setBaseUserClass(user); + //players[i]->setBaseUserClass(user); players[i]->start(); //players[players.size()-1]->setSpeed(1.0f); if (audio!="") { soundplayer.loadSound(audio); soundplayer.play(); - } + }; } } void update(){ @@ -63,29 +65,81 @@ class syncOniPlayer{ players[i]->setPaused(true); } } + int getCurrentFrame(){ + if (players.size()) return players[0]->getCurrentFrame(); + else return -1; + } void drawWindows(){ 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); } } 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(); + //user.drawMask(); ofPushMatrix(); - ofTranslate(ofGetWidth()/2, ofGetHeight()/2, -1000); + 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++) { + + 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) { + + glBegin(GL_LINES); + + for (int j=0;j<players[i]->getHeight();j+=2) { + + + + 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(); + } + } + + return; } void stop(){ soundplayer.stop(); @@ -130,7 +184,6 @@ public: int numDevices; ofxOpenNI openNIPlayers[MAX_DEVICES]; - ofxOpenNIUser user; int playing; @@ -140,12 +193,12 @@ public: vector<syncOniPlayer> players; - ofSoundPlayer soundplayer; - ofxOscReceiver receiver; bool drawmovies,drawcloud; int offset; + + ofxMayaCam cam; }; |
