diff options
| author | Tim Redfern <tim@gray.(none)> | 2012-11-20 13:02:18 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@gray.(none)> | 2012-11-20 13:02:18 +0000 |
| commit | 8c38b912458e60c8eab5a71b003e829bce5afe4a (patch) | |
| tree | effcaf0de129621cef4f583b27e3ca1cd8266da0 /liveengine/src | |
| parent | 4656e88bb1626fcc0e7941883ac475884e4c99b0 (diff) | |
whelan's
Diffstat (limited to 'liveengine/src')
| -rwxr-xr-x | liveengine/src/main.cpp | 2 | ||||
| -rwxr-xr-x | liveengine/src/testApp.cpp | 47 | ||||
| -rwxr-xr-x | liveengine/src/testApp.h | 14 | ||||
| -rwxr-xr-x | liveengine/src/viewport.cpp | 16 |
4 files changed, 26 insertions, 53 deletions
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); |
