diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/main.cpp | 2 | ||||
| -rw-r--r-- | src/testApp.cpp | 35 | ||||
| -rw-r--r-- | src/testApp.h | 8 | ||||
| -rw-r--r-- | src/viewpoint.cpp | 12 | ||||
| -rw-r--r-- | src/viewpoint.h | 6 |
5 files changed, 37 insertions, 26 deletions
diff --git a/src/main.cpp b/src/main.cpp index 5320f44..3d1510f 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,7 +17,7 @@ int main( ){ ofAppGlutWindow window; - ofSetupOpenGL(&window, 3840,720, OF_FULLSCREEN); // <-------- setup the GL context + ofSetupOpenGL(&window, 1024,768, OF_WINDOW); // <-------- setup the GL context //ofSetupOpenGL(&window, 1024,300, OF_WINDOW); glutIgnoreKeyRepeat(1); glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); //these don't work!!! diff --git a/src/testApp.cpp b/src/testApp.cpp index a7b90d1..afaaad0 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -39,8 +39,8 @@ void testApp::setup(){ transTime=0; transition=false; - whichClip=1; //0 is black - switchClip=1; //0 is black + whichClip=0; //0 is black + switchClip=0; //0 is black texture.loadMovie(clips[whichClip]); texture.setLoopState(OF_LOOP_NORMAL); texture.play(); @@ -62,11 +62,10 @@ void testApp::setup(){ videoInverted = new unsigned char[camWidth*camHeight*3]; videoTexture.allocate(camWidth,camHeight, GL_RGB); - ard.connect("/dev/ttyUSB0", 57600); - ofAddListener(ard.EInitialized, this, &testApp::setupArduino); - bSetupArduino = false; + bSetupArduino = ard.connect("/dev/ttyUSB0", 57600); + if (bSetupArduino) ofAddListener(ard.EInitialized, this, &testApp::setupArduino); bSwitchArduino = false; - + //----------------avahi stuff avahiService.start("ofMrmr","_mrmrsrvr._udp",1337); oscReceiver.setup(1337); //default mrmr port @@ -77,7 +76,7 @@ void testApp::setup(){ void testApp::update(){ texture.idleMovie(); calibrator_label.idleMovie(); - + //mixAmount=sin(ofGetElapsedTimef())+1.0; doTransition(); @@ -97,7 +96,7 @@ void testApp::update(){ } } updateArduino(); - + //----------------avahi stuff ProcessMessages(); } @@ -114,20 +113,22 @@ void testApp::setupArduino(const int & version) { } ard.sendDigitalPinMode(7, ARD_INPUT); - bSetupArduino = true; + printf("arduino ready\n"); } //-------------------------------------------------------------- void testApp::updateArduino(){ - // update the arduino, get any data or messages. - ard.update(); + // do not send anything until the arduino has been set up if (bSetupArduino) { - - + + // update the arduino, get any data or messages. + ard.update(); + + if (bSwitchArduino!=ard.getDigital(7)) { bSwitchArduino=ard.getDigital(7); printf("pin 7 %i\n",bSwitchArduino); @@ -140,7 +141,7 @@ void testApp::updateArduino(){ whichClip=0; transTime=ofGetElapsedTimef()+0.1; } - + transition=true; } } @@ -201,7 +202,7 @@ void testApp::ProcessMessages(){ { int ls = messageAddress.find_last_of("/"); int msg=-1; - + if(m.getNumArgs()) msg=m.getArgAsInt32( 0 ); if(startswith(messageAddress.c_str(),"/mrmr/pushbutton/1")) @@ -410,8 +411,8 @@ void testApp::loadSettings(string filename){ } //numViews=2; - //views[0].setup(ofGetWidth()/2,ofGetHeight(),0,0); - //views[1].setup(ofGetWidth()/2,ofGetHeight(),ofGetWidth()/2,0); + //views[0].setup(ofGetScreenWidth()/2,ofGetScreenHeight(),0,0); + //views[1].setup(ofGetScreenWidth()/2,ofGetScreenHeight(),ofGetScreenWidth()/2,0); //activeView=0; } //-------------------------------------------------------------- diff --git a/src/testApp.h b/src/testApp.h index 1bf2d7b..5ccf775 100644 --- a/src/testApp.h +++ b/src/testApp.h @@ -61,11 +61,11 @@ class testApp : public ofBaseApp{ void windowResized(int w, int h); void dragEvent(ofDragInfo dragInfo); void gotMessage(ofMessage msg); - + void doTransition(); float transTime; bool transition; - + void prevMovie(); void nextMovie(); @@ -106,9 +106,9 @@ class testApp : public ofBaseApp{ ofArduino ard; bool bSetupArduino; // flag variable for setting up arduino once int bSwitchArduino; - + //----------------avahi stuff - + ofxAvahiClientService avahiService; ofxTCPClient tcpClient; diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index fe8bb28..cf05663 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -53,7 +53,15 @@ double viewpoint::getSetting(const string& setting){ } //-------------------------------------------------------------- void viewpoint::setLight(){ - target.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal()); + + ofNode c=ofNode(); + ofNode t=ofNode(); + t.setParent(c); + t.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal()); + //make target controls relative to rotation + c.rotate(vars[5].getVal(), ofVec3f(0, 1, 0)); + + target.setPosition(t.getGlobalPosition()); //camera.orbit(vars[5].getVal(), vars[4].getVal(), vars[7].getVal(), target); camera.setFov(vars[0].getVal()); if (vertigo) { @@ -62,6 +70,8 @@ void viewpoint::setLight(){ vars[7].setVal((tan((vars[0].readVal()-vars[0].inc)*PI*0.0027777)*vars[7].readVal())/tan(vars[0].readVal()*PI*0.0027777)); } + + ofVec3f p(0, 0, vars[7].getVal()); //p.rotate(ofClamp(vars[2].getVal(), -89, 89), ofVec3f(1, 0, 0)); p.rotate(vars[4].getVal(), ofVec3f(1, 0, 0)); diff --git a/src/viewpoint.h b/src/viewpoint.h index 399f84c..6e85017 100644 --- a/src/viewpoint.h +++ b/src/viewpoint.h @@ -45,10 +45,10 @@ class viewpoint { keyVar* vars; - int lightNum; - GLfloat lightColour[]; + int lightNum; + GLfloat lightColour[]; - GLfloat* getLightPosition; + GLfloat* getLightPosition; ofLight light; |
