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 | |
| parent | 8c38b912458e60c8eab5a71b003e829bce5afe4a (diff) | |
whelans the 2nd
Diffstat (limited to 'liveengine')
| -rwxr-xr-x | liveengine/bin/data/settings.xml | 4 | ||||
| -rwxr-xr-x | liveengine/liveengine.layout | 20 | ||||
| -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 |
6 files changed, 88 insertions, 33 deletions
diff --git a/liveengine/bin/data/settings.xml b/liveengine/bin/data/settings.xml index de37112..8b82c1a 100755 --- a/liveengine/bin/data/settings.xml +++ b/liveengine/bin/data/settings.xml @@ -1,9 +1,9 @@ <?xml version="1.0" encoding="UTF-8" ?> <liveEngine port="1" channel="0"> - <viewport mapped="1" w="768" h="1024" x="0" y="0" rot="-90" ox="-256" oy="-384"> + <viewport mapped="0" w="768" h="1024" x="0" y="0" rot="-90" ox="-256" oy="-384"> <settings fov="17.500000" roll="0.000000" targX="-247.713226" targY="212.727859" targZ="0.000000" lat="0.000000" lng="180.000000" dolly="600.000000" /> </viewport> - <viewport mapped="1" w="768" h="1024" x="1024" y="0" rot="-90" ox="-256" oy="-384"> + <viewport mapped="0" w="768" h="1024" x="512" y="0" rot="-90" ox="-256" oy="-384"> <settings fov="17.500000" roll="0.000000" targX="-247.713226" targY="212.727859" targZ="0.000000" lat="0.000000" lng="180.000000" dolly="600.000000" /> </viewport> </liveEngine> diff --git a/liveengine/liveengine.layout b/liveengine/liveengine.layout index a27125b..d2474ee 100755 --- a/liveengine/liveengine.layout +++ b/liveengine/liveengine.layout @@ -1,26 +1,26 @@ <?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <CodeBlocks_layout_file> <ActiveTarget name="Debug" /> - <File name="bin/data/settings.xml" open="1" top="0" tabpos="1"> - <Cursor position="236" topLine="0" /> + <File name="bin/data/settings.xml" open="1" top="1" tabpos="1"> + <Cursor position="359" topLine="0" /> </File> <File name="config.make" open="0" top="0" tabpos="2"> <Cursor position="0" topLine="0" /> </File> - <File name="src/main.cpp" open="0" top="0" tabpos="6"> - <Cursor position="290" topLine="0" /> + <File name="src/main.cpp" open="1" top="0" tabpos="4"> + <Cursor position="267" topLine="0" /> </File> - <File name="src/testApp.cpp" open="1" top="0" tabpos="3"> - <Cursor position="1170" topLine="7" /> + <File name="src/testApp.cpp" open="1" top="0" tabpos="2"> + <Cursor position="4118" topLine="91" /> </File> <File name="src/testApp.h" open="0" top="0" tabpos="1"> <Cursor position="3971" topLine="162" /> </File> - <File name="src/threadNI.h" open="1" top="1" tabpos="2"> - <Cursor position="1499" topLine="0" /> + <File name="src/threadNI.h" open="0" top="0" tabpos="2"> + <Cursor position="1488" topLine="52" /> </File> - <File name="src/viewport.cpp" open="0" top="0" tabpos="4"> - <Cursor position="4871" topLine="271" /> + <File name="src/viewport.cpp" open="1" top="0" tabpos="3"> + <Cursor position="11259" topLine="296" /> </File> <File name="src/viewport.h" open="0" top="0" tabpos="3"> <Cursor position="283" topLine="0" /> 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); |
