summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xliveengine/bin/data/settings.xml5
-rwxr-xr-xliveengine/liveengine.cbp14
-rwxr-xr-xliveengine/liveengine.layout17
-rwxr-xr-xliveengine/src/main.cpp2
-rwxr-xr-xliveengine/src/testApp.cpp47
-rwxr-xr-xliveengine/src/testApp.h14
-rwxr-xr-xliveengine/src/viewport.cpp16
7 files changed, 52 insertions, 63 deletions
diff --git a/liveengine/bin/data/settings.xml b/liveengine/bin/data/settings.xml
index 6c31de3..de37112 100755
--- a/liveengine/bin/data/settings.xml
+++ b/liveengine/bin/data/settings.xml
@@ -1,6 +1,9 @@
<?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">
+ <viewport mapped="1" 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">
<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.cbp b/liveengine/liveengine.cbp
index f5c2ae5..428e2dc 100755
--- a/liveengine/liveengine.cbp
+++ b/liveengine/liveengine.cbp
@@ -33,8 +33,12 @@
<Unit filename="config.make">
<Option virtualFolder="build config" />
</Unit>
- <Unit filename="src/keyVar.cpp" />
- <Unit filename="src/keyVar.h" />
+ <Unit filename="src/keyVar.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/keyVar.h">
+ <Option virtualFolder="src/" />
+ </Unit>
<Unit filename="src/layers.cpp">
<Option virtualFolder="src/" />
</Unit>
@@ -56,6 +60,12 @@
<Unit filename="src/testApp.h">
<Option virtualFolder="src/" />
</Unit>
+ <Unit filename="src/threadNI.cpp">
+ <Option virtualFolder="src/" />
+ </Unit>
+ <Unit filename="src/threadNI.h">
+ <Option virtualFolder="src/" />
+ </Unit>
<Unit filename="src/viewport.cpp">
<Option virtualFolder="src/" />
</Unit>
diff --git a/liveengine/liveengine.layout b/liveengine/liveengine.layout
index 2831ed4..a27125b 100755
--- a/liveengine/liveengine.layout
+++ b/liveengine/liveengine.layout
@@ -1,25 +1,28 @@
<?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="5">
+ <File name="bin/data/settings.xml" open="1" top="0" tabpos="1">
<Cursor position="236" 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="6">
+ <File name="src/main.cpp" open="0" top="0" tabpos="6">
<Cursor position="290" topLine="0" />
</File>
- <File name="src/testApp.cpp" open="1" top="0" tabpos="2">
- <Cursor position="4343" topLine="98" />
+ <File name="src/testApp.cpp" open="1" top="0" tabpos="3">
+ <Cursor position="1170" topLine="7" />
</File>
- <File name="src/testApp.h" open="1" top="0" tabpos="1">
+ <File name="src/testApp.h" open="0" top="0" tabpos="1">
<Cursor position="3971" topLine="162" />
</File>
- <File name="src/viewport.cpp" open="1" top="1" tabpos="4">
+ <File name="src/threadNI.h" open="1" top="1" tabpos="2">
+ <Cursor position="1499" topLine="0" />
+ </File>
+ <File name="src/viewport.cpp" open="0" top="0" tabpos="4">
<Cursor position="4871" topLine="271" />
</File>
- <File name="src/viewport.h" open="1" top="0" tabpos="3">
+ <File name="src/viewport.h" open="0" top="0" tabpos="3">
<Cursor position="283" topLine="0" />
</File>
</CodeBlocks_layout_file>
diff --git a/liveengine/src/main.cpp b/liveengine/src/main.cpp
index f0c0c0f..6f40023 100755
--- a/liveengine/src/main.cpp
+++ b/liveengine/src/main.cpp
@@ -7,7 +7,7 @@
int main( ){
ofAppGlutWindow window;
- ofSetupOpenGL(ofxFensterManager::get(),1024,768, OF_WINDOW); //2048,768
+ ofSetupOpenGL(ofxFensterManager::get(),2048,768, OF_WINDOW); //2048,768
//ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context
//ofSetupOpenGL(&window, 1024,768, OF_WINDOW);
diff --git a/liveengine/src/testApp.cpp b/liveengine/src/testApp.cpp
index a2a242f..238c6e7 100755
--- a/liveengine/src/testApp.cpp
+++ b/liveengine/src/testApp.cpp
@@ -43,13 +43,15 @@ kinectWindow::~kinectWindow(){
cout << "kinect window destroyed" << endl;
}
void kinectWindow::setup(){
+ ofSetBackgroundAuto(false);
}
void kinectWindow::setParent(testApp *p){
parent=p;
}
void kinectWindow::draw(){
- parent->recordDepth.draw(0,0,ofGetWidth(),ofGetHeight());
- parent->recordUser.draw(ofGetWidth(),ofGetHeight());
+ //parent->NIinstance.drawpreview();
+ parent->NIinstance.recordDepth.draw(0,0,ofGetWidth(),ofGetHeight());
+ parent->NIinstance.recordUser.draw(ofGetWidth(),ofGetHeight());
}
@@ -77,8 +79,9 @@ void testApp::setup(){
int rot=XML.getAttribute("viewport", "rot",0,i);
int ox=XML.getAttribute("viewport", "ox",0,i);
int oy=XML.getAttribute("viewport", "oy",0,i);
- printf("viewport %i: %ix%i\n",i,w,h);
- if (XML.getAttribute("viewport", "mapped",0,i)==1) {
+ int mapped=XML.getAttribute("viewport", "mapped",0,i);
+ printf("viewport %i: %ix%i %s\n",i,w,h,mapped==1?"mapped":"unmapped");
+ if (mapped==1) {
if (!useKinect) {
//set up preview window and kinect classes
useKinect=true;
@@ -88,30 +91,12 @@ void testApp::setup(){
kw->addListener(kinectWin);
kinectWin->setup();
kinectWin->setParent(this);
+
+ NIinstance.start();
- isLive = true;
- isTracking = false;
- isFiltering = false;
- isMasking = true;
- isCloud = true;
-
- nearThreshold = 500;
- farThreshold = 1000;
-
- filterFactor = 10.0f;
-
- recordContext.setup();
- recordContext.setMirror(true);
- recordDepth.setup(&recordContext);
- recordImage.setup(&recordContext);
- recordUser.setup(&recordContext);
- recordUser.setSmoothing(filterFactor); // built in openni skeleton smoothing...
- recordUser.setUseMaskPixels(isMasking);
- recordUser.setUseCloudPoints(isCloud);
- recordUser.setMaxNumberOfUsers(2);
}
viewports.push_back(new viewport(w,h,x,y,rot,ox,oy));
- viewports[i]->setUG(&recordUser);
+ viewports[i]->setUG(&NIinstance.recordUser);
XML.pushTag("viewport",i);
vector<string>keys;
@@ -148,7 +133,7 @@ void testApp::setup(){
controllers=new unsigned char[NUM_CONTROLLERS];
memset(controllers,NUM_CONTROLLERS,0);
- note=1;
+ note=0;
makeColours();
@@ -173,7 +158,7 @@ void testApp::setup(){
fadetime=0;
- mode=BLOCKS;
+ mode=SOLID;
lastnoteTime=ofGetElapsedTimef();
decayTime=1.0f;
@@ -245,14 +230,8 @@ void testApp::makeColours() {
}
//--------------------------------------------------------------
void testApp::update(){
- //for (int i=0;i<numLayers;i++) layers[i]->update();
- if (useKinect) {
- recordContext.update();
- recordDepth.update();
- recordImage.update();
- recordUser.update();
- }
+
}
void testApp::saveSettings(string filename){
diff --git a/liveengine/src/testApp.h b/liveengine/src/testApp.h
index 3df1482..5064a23 100755
--- a/liveengine/src/testApp.h
+++ b/liveengine/src/testApp.h
@@ -2,7 +2,7 @@
//#include <GL/glxew.h>
-#include "ofxOpenNI.h"
+
#include "ofMain.h"
#include "ofxXmlSettings.h"
@@ -83,6 +83,7 @@ option to randomise colours on each note
#include "viewport.h"
+#include "threadNI.h"
/*
@@ -191,16 +192,7 @@ class testApp : public ofxFensterListener, public ofxMidiListener{
bool useKinect;
- bool isLive, isTracking, isMasking, isFiltering, isCloud;
-
- ofxOpenNIContext recordContext;
- ofxDepthGenerator recordDepth;
- ofxImageGenerator recordImage;
- ofxUserGenerator recordUser;
-
- int nearThreshold, farThreshold;
- float filterFactor;
-
+ threadNI NIinstance;
};
diff --git a/liveengine/src/viewport.cpp b/liveengine/src/viewport.cpp
index e5e5ef3..44ba5ef 100755
--- a/liveengine/src/viewport.cpp
+++ b/liveengine/src/viewport.cpp
@@ -53,6 +53,7 @@ void unbindTex(ofTexture &tex) {
viewport::viewport()
{
+
//ctor
}
viewport::viewport(int _w,int _h,int _x,int _y,float _r,int _ox,int _oy) {
@@ -70,7 +71,7 @@ void viewport::setup(int _w,int _h,int _x,int _y,float _r,int _ox,int _oy) {
rb1.allocate(w,h,GL_RGB);
rb2.allocate(w,h,GL_RGB);
rb3.allocate(w,h,GL_RGB);
-
+ isMapped=false;
printf("%ix%i, vp offset: %f,%f\n",w,h,-(sin(ofDegToRad(r))*h/2)-(cos(ofDegToRad(r))*w/2),-(sin(ofDegToRad(r))*w/2)-(cos(ofDegToRad(r))*h/2));
}
@@ -108,12 +109,12 @@ void viewport::draw(float a,unsigned char* controllers,int xshift,int yshift,pla
ofPushStyle();
- if (note>0) {
+ if (note>0||mode==SOLID) {
switch(mode) {
case SOLID:
- ofSetColor(255,0,0);
- ofRect(0,0,ofGetWidth(),ofGetHeight());
- break;
+ 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));
@@ -201,7 +202,8 @@ double viewport::getSetting(const string& setting){
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){
-
+
+ //printf("drawing mapped frame %i\n",ofGetFrameNum());
ofNode c=ofNode();
ofNode t=ofNode();
t.setParent(c);
@@ -239,7 +241,7 @@ void viewport::mapdraw(float a,unsigned char* controllers,int xshift,int yshift,
ofPushStyle();
- if (note>0) {
+ if (note>0||mode==SOLID) {
switch(mode) {
case SOLID:
ofSetColor(255,0,0);