From 8c38b912458e60c8eab5a71b003e829bce5afe4a Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Tue, 20 Nov 2012 13:02:18 +0000 Subject: whelan's --- liveengine/bin/data/settings.xml | 5 ++++- liveengine/liveengine.cbp | 14 ++++++++++-- liveengine/liveengine.layout | 17 +++++++++------ liveengine/src/main.cpp | 2 +- liveengine/src/testApp.cpp | 47 +++++++++++----------------------------- liveengine/src/testApp.h | 14 +++--------- liveengine/src/viewport.cpp | 16 ++++++++------ 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 @@ - + + + + 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 @@ - - + + + + @@ -56,6 +60,12 @@ + + + + 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 @@ - + - + - - + + - + - + + + + - + 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); vectorkeys; @@ -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;iupdate(); - 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 -#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>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); -- cgit v1.2.3