summaryrefslogtreecommitdiff
path: root/liveengine
diff options
context:
space:
mode:
Diffstat (limited to 'liveengine')
-rwxr-xr-xliveengine/bin/data/settings.xml2
-rwxr-xr-xliveengine/liveengine.layout22
-rwxr-xr-xliveengine/src/testApp.cpp13
-rwxr-xr-xliveengine/src/testApp.h2
-rwxr-xr-xliveengine/src/viewport.cpp181
-rwxr-xr-xliveengine/src/viewport.h5
6 files changed, 106 insertions, 119 deletions
diff --git a/liveengine/bin/data/settings.xml b/liveengine/bin/data/settings.xml
index 42e4a52..abe3343 100755
--- a/liveengine/bin/data/settings.xml
+++ b/liveengine/bin/data/settings.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" ?>
<liveEngine port="1" channel="0">
<viewport mapped="1" w="1024" h="768" x="0" y="0" rot="0" ox="-512" oy="-384">
- <settings fov="16.801397" roll="88.394318" targX="-35.044685" targY="119.056656" targZ="33.992996" lat="7.887337" lng="-59.895107" dolly="572.621643" />
+ <settings fov="17.5" roll="0" targX="0" targY="0" targZ="0" lat="0" lng="0" dolly="600" />
</viewport>
</liveEngine>
diff --git a/liveengine/liveengine.layout b/liveengine/liveengine.layout
index 131871b..77840d6 100755
--- a/liveengine/liveengine.layout
+++ b/liveengine/liveengine.layout
@@ -1,25 +1,25 @@
<?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="11">
- <Cursor position="157" topLine="0" />
+ <File name="bin/data/settings.xml" open="1" top="1" tabpos="5">
+ <Cursor position="234" 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="1" top="0" tabpos="12">
+ <File name="src/main.cpp" open="1" top="0" tabpos="6">
<Cursor position="290" topLine="0" />
</File>
- <File name="src/testApp.cpp" open="1" top="1" tabpos="8">
- <Cursor position="9568" topLine="0" />
+ <File name="src/testApp.cpp" open="1" top="0" tabpos="2">
+ <Cursor position="13919" topLine="138" />
</File>
- <File name="src/testApp.h" open="1" top="0" tabpos="7">
- <Cursor position="3551" topLine="135" />
+ <File name="src/testApp.h" open="1" top="0" tabpos="1">
+ <Cursor position="3971" topLine="162" />
</File>
- <File name="src/viewport.cpp" open="1" top="0" tabpos="10">
- <Cursor position="13003" topLine="382" />
+ <File name="src/viewport.cpp" open="1" top="0" tabpos="4">
+ <Cursor position="8472" topLine="272" />
</File>
- <File name="src/viewport.h" open="1" top="0" tabpos="9">
- <Cursor position="454" topLine="22" />
+ <File name="src/viewport.h" open="1" top="0" tabpos="3">
+ <Cursor position="283" topLine="0" />
</File>
</CodeBlocks_layout_file>
diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp
index d5288c1..fb531a5 100755
--- a/liveengine/src/testApp.cpp
+++ b/liveengine/src/testApp.cpp
@@ -143,7 +143,7 @@ void testApp::setup(){
controllers=new unsigned char[NUM_CONTROLLERS];
memset(controllers,NUM_CONTROLLERS,0);
- note=0;
+ note=1;
makeColours();
@@ -208,6 +208,7 @@ void testApp::setup(){
gui.add(transparentBlack.setup("transparent black", false));
gui.add(resetDrawscale.setup("reset draw scale"));
gui.add(resetFBscale.setup("reset FB scale"));
+ gui.add(drawCloud.setup("draw pointCloud",false));
resetDrawscale.addListener(this,&testApp::resetDrawscalePressed);
resetFBscale.addListener(this,&testApp::resetFBscalePressed);
@@ -278,7 +279,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);
+ 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);
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);
}
@@ -431,8 +432,8 @@ void testApp::keyPressed(int key){
else if (activeView<viewports.size()) viewports[activeView]->keyPressed(key);
- if (key>='1' && key <='6'){
- activeView=min(key-'3',(int)viewports.size());
+ if (key>='0' && key <='5'){
+ activeView=min(key-'2',(int)viewports.size());
switch (activeView){
case -2:
printf("deactivating viewport adjustment\n");
@@ -456,8 +457,8 @@ void testApp::keyPressed(int key){
if(key == 'f'){
toggleFPS();
}
- if(key >='7' && key <= '9'){
- mode=key-'7';
+ if(key >='6' && key <= '9'){
+ mode=key-'6';
}
if(key == 267){
xshift--;
diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h
index 2f4b4e1..3df1482 100755
--- a/liveengine/src/testApp.h
+++ b/liveengine/src/testApp.h
@@ -181,10 +181,12 @@ class testApp : public ofxFensterListener, public ofxMidiListener{
ofxToggle transparentBlack;
ofxButton resetDrawscale;
ofxButton resetFBscale;
+ ofxToggle drawCloud;
void resetDrawscalePressed(bool & pressed);
void resetFBscalePressed(bool & pressed);
+
//kinect stuff
bool useKinect;
diff --git a/liveengine/src/viewport.cpp b/liveengine/src/viewport.cpp
index 35a4036..5a5a5e2 100755
--- a/liveengine/src/viewport.cpp
+++ b/liveengine/src/viewport.cpp
@@ -109,7 +109,11 @@ void viewport::draw(float a,unsigned char* controllers,int xshift,int yshift,pla
ofPushStyle();
if (note>0) {
- switch(mode) {
+ switch(mode) {
+ case SOLID:
+ ofSetColor(255,0,0);
+ ofRect(0,0,ofGetWidth(),ofGetHeight());
+ break;
case BLOCKS:
for (int i=0;i<NUM_CONTROLLERS;i++){
ofSetColor(ofColor((controller_colours[i].r*controllers[i])>>7,(controller_colours[i].g*controllers[i])>>7,(controller_colours[i].b*controllers[i])>>7));
@@ -196,7 +200,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){
+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){
ofNode c=ofNode();
ofNode t=ofNode();
@@ -218,7 +222,6 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,
rb1.begin();
- camera.begin();
int startx=((w-(w*fscale))/2)+xshift;
while (startx>0) startx-=(w*fscale);
@@ -237,7 +240,11 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,
ofPushStyle();
if (note>0) {
- switch(mode) {
+ switch(mode) {
+ case SOLID:
+ ofSetColor(255,0,0);
+ ofRect(0,0,ofGetWidth(),ofGetHeight());
+ break;
case BLOCKS:
for (int i=0;i<NUM_CONTROLLERS;i++){
ofSetColor(ofColor((controller_colours[i].r*controllers[i])>>7,(controller_colours[i].g*controllers[i])>>7,(controller_colours[i].b*controllers[i])>>7));
@@ -260,8 +267,7 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,
break;
}
}
-
- camera.end();
+
rb1.end();
@@ -276,106 +282,83 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,
//rb1.draw(0,0);
//map onto kinect skeleton
- bindTexture(rb1);
+ bindTexture(rb1);
+
+ camera.begin();
+
+ if (drawCloud) {
+ int step = 1;
+
+ for(int y = 0; y < h; y += step) {
+ for(int x = 0; x < w; 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);
+ }
+
glPushMatrix();
glScalef(ofGetWidth()/640.0f,ofGetHeight()/480.0f, 1);
for (int i=0;i<rUser->getNumberOfTrackedUsers();i++){
ofxTrackedUser* u=(rUser->getTrackedUser(i+1));
- //if (u->skeletonTracking) {
- if (u->neck.found) {
- // u->debugDraw();
- //ofxTrackedUser* u=
- //printf("%i\n",(int)recordUser.getTrackedUser(i)->id);
- //printf("tracking\n");
-
- /*
- glBegin(GL_QUADS);
- glVertex3i(u->hip.position[0].X, u->hip.position[0].Y,u->hip.position[0].Z);
- glVertex3i(u->hip.position[1].X, u->hip.position[1].Y,u->hip.position[1].Z);
- glVertex3i(u->right_shoulder.position[1].X, u->right_shoulder.position[1].Y,u->right_shoulder.position[1].Z);
- glVertex3i(u->left_shoulder.position[1].X, u->left_shoulder.position[1].Y, u->left_shoulder.position[1].Z);
- glEnd();
- */
-
- /*
- glBegin(GL_QUADS);
- glVertex3i(u->hip.position[0].X, u->hip.position[0].Y,0);
- glVertex3i(u->hip.position[1].X, u->hip.position[1].Y,0);
- glVertex3i(u->right_shoulder.position[1].X, u->right_shoulder.position[1].Y,0);
- glVertex3i(u->left_shoulder.position[1].X, u->left_shoulder.position[1].Y,0);
- glEnd();
- */
-
- float ratio=16.0f/9.0f;
- float heightratio=0.8f;
- float widthratio=0.8f;
-
- float ax=((float)(u->hip.position[1].X-u->hip.position[0].X)); //hip width x
- float ay=((float)(u->hip.position[1].Y-u->hip.position[0].Y)); //hip width y
-
- float cx=(float)(u->hip.position[0].X)+(ax*0.5f); //centre of hips
- float cy=(float)(u->hip.position[0].Y)+(ay*0.5f);
-
- float hx=(((float)(u->left_shoulder.position[0].X))-cx); //height of torso
- float hy=(((float)(u->left_shoulder.position[0].Y))-cy);
-
- float p1x=cx+(hx*(1.0f-heightratio)*0.5f); //centre of frame bottom
- float p1y=cy+(hy*(1.0f-heightratio)*0.5f);
-
- float p2x=cx+(hx*(1.0f-((1.0f-heightratio)*0.5f))); //centre of frame top
- float p2y=cy+(hy*(1.0f-((1.0f-heightratio)*0.5f)));
-
- ofVec3f c1=ofVec3f(p2x-(ax*0.5*widthratio), p2y-(ay*0.5*widthratio),0);
- ofVec3f c2=ofVec3f(p2x+(ax*0.5*widthratio), p2y+(ay*0.5*widthratio),0);
- ofVec3f c3=ofVec3f(p1x-(ax*0.5*widthratio), p1y-(ay*0.5*widthratio),0);
- ofVec3f c4=ofVec3f(p1x+(ax*0.5*widthratio), p1y+(ay*0.5*widthratio),0);
-
-
- /*
- ofVec3f c1=ofVec3f(u->left_shoulder.position[1].X, u->left_shoulder.position[1].Y,0);
- ofVec3f c2=ofVec3f(u->right_shoulder.position[1].X, u->right_shoulder.position[1].Y,0);
- ofVec3f c3=ofVec3f(u->hip.position[1].X, u->hip.position[1].Y,0);
- ofVec3f c4=ofVec3f(u->hip.position[0].X, u->hip.position[0].Y,0);
- */
-
-
- /*
- glBegin(GL_QUADS);
- glVertex3i(u->hip.position[1].X, u->hip.position[1].Y,0);
- glVertex3i(u->hip.position[0].X, u->hip.position[0].Y,0);
- glVertex3i(u->left_shoulder.position[1].X, u->left_shoulder.position[1].Y,0);
- glVertex3i(u->right_shoulder.position[1].X, u->right_shoulder.position[1].Y,0);
- glEnd();
- */
-
-
- ofMesh targ;
- targ.addVertex(c1);
- targ.addTexCoord(ofVec2f(0,0));
- targ.addVertex(c2);
- targ.addTexCoord(ofVec2f(1,0));
- targ.addVertex(c3);
- targ.addTexCoord(ofVec2f(0,1));
- targ.addVertex(c3);
- targ.addTexCoord(ofVec2f(0,1));
- targ.addVertex(c2);
- targ.addTexCoord(ofVec2f(1,0));
- targ.addVertex(c4);
- targ.addTexCoord(ofVec2f(1,1));
- targ.draw();
-
-
-
- //ofLine(u->left_shoulder.position[1].X,u->left_shoulder.position[1].Y,u->left_shoulder.position[1].Z,u->right_shoulder.position[1].X,u->right_shoulder.position[1].Y,u->right_shoulder.position[1].Z);
- ofLine(u->right_shoulder.position[1].X,u->right_shoulder.position[1].Y,u->right_shoulder.position[1].Z,u->right_lower_torso.position[1].X,u->right_lower_torso.position[1].Y,u->right_lower_torso.position[1].Z);
- ofLine(u->right_lower_torso.position[1].X,u->right_lower_torso.position[1].Y,u->right_lower_torso.position[1].Z,u->left_lower_torso.position[1].X,u->left_lower_torso.position[1].Y,u->left_lower_torso.position[1].Z);
- ofLine(u->left_lower_torso.position[1].X,u->left_lower_torso.position[1].Y,u->left_lower_torso.position[1].Z,u->left_shoulder.position[1].X,u->left_shoulder.position[1].Y,u->left_shoulder.position[1].Z);
+ if (u->neck.found) {
+
+ float ratio=16.0f/9.0f;
+ float heightratio=0.8f;
+ float widthratio=0.8f;
+
+ float ax=((float)(u->hip.position[1].X-u->hip.position[0].X)); //hip vector
+ float ay=((float)(u->hip.position[1].Y-u->hip.position[0].Y));
+ float az=((float)(u->hip.position[1].Z-u->hip.position[0].Z));
+
+ float cx=(float)(u->hip.position[0].X)+(ax*0.5f); //centre of hips
+ float cy=(float)(u->hip.position[0].Y)+(ay*0.5f);
+ float cz=(float)(u->hip.position[0].Z)+(az*0.5f);
+
+ float hx=(((float)(u->left_shoulder.position[0].X))-cx); //torso vector
+ float hy=(((float)(u->left_shoulder.position[0].Y))-cy);
+ float hz=(((float)(u->left_shoulder.position[0].Z))-cz);
+
+ float p1x=cx+(hx*(1.0f-heightratio)*0.5f); //centre of frame bottom
+ float p1y=cy+(hy*(1.0f-heightratio)*0.5f);
+ float p1z=cz+(hz*(1.0f-heightratio)*0.5f);
+
+ float p2x=cx+(hx*(1.0f-((1.0f-heightratio)*0.5f))); //centre of frame top
+ float p2y=cy+(hy*(1.0f-((1.0f-heightratio)*0.5f)));
+ float p2z=cz+(hz*(1.0f-((1.0f-heightratio)*0.5f)));
+
+ ofVec3f c1=ofVec3f(p2x-(ax*0.5*widthratio), p2y-(ay*0.5*widthratio), p2z-(az*0.5*widthratio));
+ ofVec3f c2=ofVec3f(p2x+(ax*0.5*widthratio), p2y+(ay*0.5*widthratio), p2z+(az*0.5*widthratio));
+ ofVec3f c3=ofVec3f(p1x-(ax*0.5*widthratio), p1y-(ay*0.5*widthratio), p1z-(az*0.5*widthratio));
+ ofVec3f c4=ofVec3f(p1x+(ax*0.5*widthratio), p1y+(ay*0.5*widthratio), p1z+(az*0.5*widthratio));
+
+ ofMesh targ;
+ targ.addVertex(c1);
+ targ.addTexCoord(ofVec2f(0,0));
+ targ.addVertex(c2);
+ targ.addTexCoord(ofVec2f(1,0));
+ targ.addVertex(c3);
+ targ.addTexCoord(ofVec2f(0,1));
+ targ.addVertex(c3);
+ targ.addTexCoord(ofVec2f(0,1));
+ targ.addVertex(c2);
+ targ.addTexCoord(ofVec2f(1,0));
+ targ.addVertex(c4);
+ targ.addTexCoord(ofVec2f(1,1));
+ targ.draw();
+
+ }
+ }
+
+ camera.end();
- }
- }
- glPopMatrix();
unbindTexture(rb1);
diff --git a/liveengine/src/viewport.h b/liveengine/src/viewport.h
index 51c56c8..4c59e2a 100755
--- a/liveengine/src/viewport.h
+++ b/liveengine/src/viewport.h
@@ -12,7 +12,8 @@
#define NOTHING 0
#define BLOCKS 1
-#define LIST 2
+#define LIST 2
+#define SOLID 3
void bindTexture(ofBaseHasTexture &t);
void unbindTexture(ofBaseHasTexture &t);
@@ -28,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);
+ 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 setcam(map<string,string>&settings);
double getSetting(const string& setting);