diff options
| author | Comment <tim@gray.(none)> | 2012-12-01 07:59:46 +0000 |
|---|---|---|
| committer | Comment <tim@gray.(none)> | 2012-12-01 07:59:46 +0000 |
| commit | 2b3eaa8dd74c373e7c82a414014c469fe415b66e (patch) | |
| tree | 987a37eb2b51bbda669db265e301c6ac1bd46997 /liveengine/src | |
| parent | 8c38b912458e60c8eab5a71b003e829bce5afe4a (diff) | |
whelans the 2nd
Diffstat (limited to 'liveengine/src')
| -rwxr-xr-x | liveengine/src/testApp.cpp | 11 | ||||
| -rwxr-xr-x | liveengine/src/testApp.h | 1 | ||||
| -rwxr-xr-x | liveengine/src/viewport.cpp | 83 | ||||
| -rwxr-xr-x | liveengine/src/viewport.h | 2 |
4 files changed, 76 insertions, 21 deletions
diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp index 238c6e7..cdff1af 100755 --- a/liveengine/src/testApp.cpp +++ b/liveengine/src/testApp.cpp @@ -50,7 +50,7 @@ void kinectWindow::setParent(testApp *p){ } void kinectWindow::draw(){ //parent->NIinstance.drawpreview(); - parent->NIinstance.recordDepth.draw(0,0,ofGetWidth(),ofGetHeight()); + //parent->NIinstance.recordDepth.draw(0,0,ofGetWidth(),ofGetHeight()); parent->NIinstance.recordUser.draw(ofGetWidth(),ofGetHeight()); } @@ -126,13 +126,13 @@ void testApp::setup(){ midiIn.openPort(midiPort);
midiIn.addListener(this);
- // to register only to one controller pass the id as first argument
+ //to register only to one controller pass the id as first argument
// midiIn.addListener(84,this);
// to debug
// midiIn.setVerbose(true); controllers=new unsigned char[NUM_CONTROLLERS]; - memset(controllers,NUM_CONTROLLERS,0); + memset(controllers,127,NUM_CONTROLLERS); note=0; makeColours(); @@ -158,7 +158,7 @@ void testApp::setup(){ fadetime=0; - mode=SOLID; + mode=BLOCKS; lastnoteTime=ofGetElapsedTimef(); decayTime=1.0f;
@@ -199,6 +199,7 @@ void testApp::setup(){ gui.add(resetDrawscale.setup("reset draw scale")); gui.add(resetFBscale.setup("reset FB scale")); gui.add(drawCloud.setup("draw pointCloud",false)); + //gui.add(drawSkel.setup("draw Skeleton",false)); resetDrawscale.addListener(this,&testApp::resetDrawscalePressed); resetFBscale.addListener(this,&testApp::resetFBscalePressed); @@ -263,7 +264,7 @@ void testApp::draw(){ //vp2.draw(lambda,controllers,reversemain?-xshift:xshift,yshift,list,transparentBlack,note,mode,controller_colours,controlColours,reversemain?1.0f/scale:scale,reversemain?1.0f/fscale:fscale,noteRandomiseColours?colShift:0.0f); for (int i=0;i<viewports.size();i++) { bool even=!(i%2); - if (viewports[i]->isMapped) viewports[i]->mapdraw(lambda,controllers,even&&reversemain?-xshift:xshift,yshift,list,transparentBlack,note,mode,controller_colours,controlColours,even&&reversemain?1.0f/scale:scale,even&&reversemain?1.0f/fscale:fscale,noteRandomiseColours?colShift:0.0f,drawCloud); + if (viewports[i]->isMapped) viewports[i]->mapdraw(lambda,controllers,even&&reversemain?-xshift:xshift,yshift,list,transparentBlack,note,mode,controller_colours,controlColours,even&&reversemain?1.0f/scale:scale,even&&reversemain?1.0f/fscale:fscale,noteRandomiseColours?colShift:0.0f,drawCloud,drawSkel); else viewports[i]->draw(lambda,controllers,even&&reversemain?-xshift:xshift,yshift,list,transparentBlack,note,mode,controller_colours,controlColours,even&&reversemain?1.0f/scale:scale,even&&reversemain?1.0f/fscale:fscale,noteRandomiseColours?colShift:0.0f); } diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h index 5064a23..689fb18 100755 --- a/liveengine/src/testApp.h +++ b/liveengine/src/testApp.h @@ -183,6 +183,7 @@ class testApp : public ofxFensterListener, public ofxMidiListener{ ofxButton resetDrawscale; ofxButton resetFBscale; ofxToggle drawCloud; + ofxToggle drawSkel; void resetDrawscalePressed(bool & pressed); void resetFBscalePressed(bool & pressed); diff --git a/liveengine/src/viewport.cpp b/liveengine/src/viewport.cpp index 44ba5ef..0311d30 100755 --- a/liveengine/src/viewport.cpp +++ b/liveengine/src/viewport.cpp @@ -201,7 +201,7 @@ double viewport::getSetting(const string& setting){ if (setting=="distort") return vars[8].getVal(); return 0.0; }
-void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,playlist &list,bool transparentBlack,int note,int mode,ofColor* controller_colours,bool controlColours,float scale,float fscale,float colShift,bool drawCloud){
+void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,playlist &list,bool transparentBlack,int note,int mode,ofColor* controller_colours,bool controlColours,float scale,float fscale,float colShift,bool drawCloud,bool drawSkel){
//printf("drawing mapped frame %i\n",ofGetFrameNum()); ofNode c=ofNode(); @@ -289,25 +289,78 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift, camera.begin(); if (drawCloud) { - - int step = 1; - glBegin(GL_POINTS); - for(int y = 0; y < 480; y += step) { - for(int x = 0; x < 640; x += step) { - ofPoint pos = rUser->getWorldCoordinateAt(x, y, 0); //userID); - //if (pos.z == 0 ) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd - ofColor color = rUser->getWorldColorAt(x,y, 0); //userID); - glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); - glVertex3f(pos.x, pos.y, pos.z); - } - } - glEnd(); - glColor3f(1.0f, 1.0f, 1.0f); + int step = 1; + glBegin(GL_POINTS); + for(int y = 0; y < 480; y += step) { + for(int x = 0; x < 640; x += step) { + ofPoint pos = rUser->getWorldCoordinateAt(x, y, 0); //userID); + //if (pos.z == 0 ) continue; // gets rid of background -> still a bit weird if userID > 0... //&& isCPBkgnd + ofColor color = rUser->getWorldColorAt(x,y, 0); //userID); + glColor4ub((unsigned char)color.r, (unsigned char)color.g, (unsigned char)color.b, (unsigned char)color.a); + glVertex3f(pos.x, pos.y, pos.z); + } + } + glEnd(); + glColor3f(1.0f, 1.0f, 1.0f); + }
+ if (drawSkel) {
+ ofSetColor(255,0,0);
+ glBegin(GL_LINES);
+ for (int i=0;i<rUser->getNumberOfTrackedUsers();i++) {
+ ofxTrackedUser *u=rUser->getTrackedUser(i);
+ glVertex3f(u->left_shoulder.position[0].X,u->left_shoulder.position[0].Y,u->left_shoulder.position[0].Z);
+ glVertex3f(u->left_shoulder.position[1].X,u->left_shoulder.position[1].Y,u->left_shoulder.position[1].Z);
+
+ glVertex3f(u-> left_upper_arm.position[0].X,u->left_upper_arm.position[0].Y,u-> left_upper_arm.position[0].Z);
+ glVertex3f(u-> left_upper_arm.position[1].X,u->left_upper_arm.position[1].Y,u-> left_upper_arm.position[1].Z);
+
+ glVertex3f(u-> left_lower_arm.position[0].X,u->left_lower_arm.position[0].Y,u-> left_lower_arm.position[0].Z);
+ glVertex3f(u-> left_lower_arm.position[1].X,u->left_lower_arm.position[0].Y,u-> left_lower_arm.position[1].Z);
+
+ glVertex3f(u-> right_shoulder.position[0].X,u->right_shoulder.position[0].Y,u-> right_shoulder.position[0].Z);
+ glVertex3f(u-> right_shoulder.position[1].X,u->right_shoulder.position[1].Y,u-> right_shoulder.position[1].Z);
+
+ glVertex3f(u-> right_upper_arm.position[0].X,u-> right_upper_arm.position[0].Y,u-> right_upper_arm.position[0].Z);
+ glVertex3f(u-> right_upper_arm.position[1].X,u-> right_upper_arm.position[1].Y,u-> right_upper_arm.position[1].Z);
+
+ glVertex3f(u-> right_lower_arm.position[0].X,u-> right_lower_arm.position[0].Y,u-> right_lower_arm.position[0].Z);
+ glVertex3f(u-> right_lower_arm.position[1].X,u-> right_lower_arm.position[1].Y,u-> right_lower_arm.position[1].Z);
+
+ glVertex3f(u-> left_upper_torso.position[0].X,u-> left_upper_torso.position[0].Y,u-> left_upper_torso.position[0].Z);
+ glVertex3f(u-> left_upper_torso.position[1].X,u-> left_upper_torso.position[1].Y,u-> left_upper_torso.position[1].Z);
+
+ glVertex3f(u->right_upper_torso.position[0].X,u->right_upper_torso.position[0].Y,u->right_upper_torso.position[0].Z);
+ glVertex3f(u->right_upper_torso.position[1].X,u->right_upper_torso.position[1].Y,u->right_upper_torso.position[1].Z);
+
+ glVertex3f(u->left_lower_torso.position[0].X,u->left_lower_torso.position[0].Y,u->left_lower_torso.position[0].Z);
+ glVertex3f(u->left_lower_torso.position[1].X,u->left_lower_torso.position[1].Y,u->left_lower_torso.position[1].Z);
+
+ glVertex3f(u->left_upper_leg.position[0].X,u->left_upper_leg.position[0].Y,u->left_upper_leg.position[0].Z);
+ glVertex3f(u->left_upper_leg.position[1].X,u->left_upper_leg.position[1].Y,u->left_upper_leg.position[1].Z);
+
+ glVertex3f(u->left_lower_leg.position[0].X,u->left_lower_leg.position[0].Y,u->left_lower_leg.position[0].Z);
+ glVertex3f(u->left_lower_leg.position[1].X,u->left_lower_leg.position[1].Y,u->left_lower_leg.position[1].Z);
+
+ glVertex3f(u->right_lower_torso.position[0].X,u->right_lower_torso.position[0].Y,u->right_lower_torso.position[0].Z);
+ glVertex3f(u->right_lower_torso.position[1].X,u->right_lower_torso.position[1].Y,u->right_lower_torso.position[1].Z);
+
+ glVertex3f(u->right_upper_leg.position[0].X,u->right_upper_leg.position[0].Y,u->right_upper_leg.position[0].Z);
+ glVertex3f(u->right_upper_leg.position[1].X,u->right_upper_leg.position[1].Y,u->right_upper_leg.position[1].Z);
+
+ glVertex3f(u->right_lower_leg.position[0].X,u->right_lower_leg.position[0].Y,u->right_lower_leg.position[0].Z);
+ glVertex3f(u->right_lower_leg.position[1].X,u->right_lower_leg.position[1].Y,u->right_lower_leg.position[1].Z);
+
+ glVertex3f(u->hip.position[0].X,u->hip.position[0].Y,u->hip.position[0].Z);
+ glVertex3f(u->hip.position[1].X,u->hip.position[1].Y,u->hip.position[1].Z);
+ }
+ glEnd();
+ ofSetColor(255,255,255);
} bindTexture(rb1); for (int i=0;i<rUser->getNumberOfTrackedUsers();i++){
+
ofxTrackedUser* u=(rUser->getTrackedUser(i+1));
if (u->neck.found) { diff --git a/liveengine/src/viewport.h b/liveengine/src/viewport.h index 4c59e2a..4e439b1 100755 --- a/liveengine/src/viewport.h +++ b/liveengine/src/viewport.h @@ -29,7 +29,7 @@ class viewport viewport(int _w,int _h,int _x,int _y,float _r,int _ox,int _oy);
void setup(int _w,int _h,int _x,int _y,float _r,int _ox,int _oy);
void draw(float a,unsigned char* controllers,int xshift,int yshift,playlist &list,bool transparentBlack,int note,int mode,ofColor* controller_colours,bool controlColours,float scale,float fscale,float colShift);
- void mapdraw(float a,unsigned char* controllers,int xshift,int yshift,playlist &list,bool transparentBlack,int note,int mode,ofColor* controller_colours,bool controlColours,float scale,float fscale,float colShift,bool drawCloud);
+ void mapdraw(float a,unsigned char* controllers,int xshift,int yshift,playlist &list,bool transparentBlack,int note,int mode,ofColor* controller_colours,bool controlColours,float scale,float fscale,float colShift,bool drawCloud,bool drawSkel);
void setcam(map<string,string>&settings); double getSetting(const string& setting); |
