From ed2d4581aa354d6c4040b061349fbe38f8af5e45 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Sun, 5 Feb 2012 23:13:12 +0000 Subject: restore settings correctly --- bin/data/defaults.xml | 30 ++++++++++++++++++++++++++++++ bin/data/settings.xml | 20 ++++++++++++++++---- bin/data/tigerbottle.3DS | Bin 0 -> 55201 bytes map4.cbp | 3 +++ map4.layout | 23 +++++++++++++---------- src/main.cpp | 4 ++-- src/testApp.cpp | 11 ++++++----- src/viewpoint.cpp | 16 ++++++++++------ src/viewpoint.h | 2 ++ 9 files changed, 82 insertions(+), 27 deletions(-) create mode 100644 bin/data/defaults.xml create mode 100755 bin/data/tigerbottle.3DS diff --git a/bin/data/defaults.xml b/bin/data/defaults.xml new file mode 100644 index 0000000..e39dc29 --- /dev/null +++ b/bin/data/defaults.xml @@ -0,0 +1,30 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/bin/data/settings.xml b/bin/data/settings.xml index 46a83b5..1804f5e 100644 --- a/bin/data/settings.xml +++ b/bin/data/settings.xml @@ -1,15 +1,27 @@ - + - + - + - + + + + + + + + + + + + + diff --git a/bin/data/tigerbottle.3DS b/bin/data/tigerbottle.3DS new file mode 100755 index 0000000..abf920a Binary files /dev/null and b/bin/data/tigerbottle.3DS differ diff --git a/map4.cbp b/map4.cbp index c0eaebd..13593e5 100644 --- a/map4.cbp +++ b/map4.cbp @@ -111,6 +111,9 @@ + + diff --git a/map4.layout b/map4.layout index 2967843..9ee2048 100644 --- a/map4.layout +++ b/map4.layout @@ -4,8 +4,11 @@ - - + + + + + @@ -13,8 +16,8 @@ - - + + @@ -22,16 +25,16 @@ - - + + - + - + - - + + diff --git a/src/main.cpp b/src/main.cpp index 15650ab..d8de5c8 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -17,8 +17,8 @@ int main( ){ ofAppGlutWindow window; - //ofSetupOpenGL(&window, 1024,768, OF_FULLSCREEN); // <-------- setup the GL context - ofSetupOpenGL(&window, 1024,300, OF_WINDOW); + ofSetupOpenGL(&window, 1440,900, OF_FULLSCREEN); // <-------- setup the GL context + //ofSetupOpenGL(&window, 1024,300, OF_WINDOW); glutIgnoreKeyRepeat(1); glutSetKeyRepeat(GLUT_KEY_REPEAT_OFF); //these don't work!!! printf("key repeat ignore: %i\n",glutDeviceGet(GLUT_DEVICE_IGNORE_KEY_REPEAT)); diff --git a/src/testApp.cpp b/src/testApp.cpp index 4aaa009..c2772aa 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -17,18 +17,19 @@ void testApp::setup(){ glEnable (GL_COLOR_MATERIAL); //load the bottle model - the 3ds and the texture file need to be in the same folder - bottle.loadModel("bottle.3DS", 1); + bottle.loadModel("tigerbottle.3DS", 1); bottle.setRotation(0, 180, 1, 0, 0); - bottle.setPosition(0, 112, 0); + bottle.setPosition(0, 101, 0); //ofDisableArbTex(); - mode=CALIBRATE; + mode=DISPLAY; loadSettings("settings.xml"); whichClip=0; texture.loadMovie(clips[whichClip]); + texture.setLoopState(OF_LOOP_NORMAL); texture.play(); light=true; @@ -109,14 +110,14 @@ void testApp::keyPressed(int key){ case '<': whichClip--; if (whichClip<0) whichClip+=numClips; - texture.close(); + texture.stop(); texture.loadMovie(clips[whichClip]); texture.play(); break; case '.': case '>': whichClip=(whichClip+1)%numClips; - texture.close(); + texture.stop(); texture.loadMovie(clips[whichClip]); texture.play(); break; diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index 6a12c99..287cf26 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -3,8 +3,12 @@ void viewpoint::setup(map&settings){ //setup(float w, float h, float x, float y) { - if (DEBUG) printf("window: %f,%f %fx%f n",ofGetWidth()*ofToFloat(settings["x"]),ofGetHeight()*ofToFloat(settings["y"]),ofGetWidth()*ofToFloat(settings["w"]),ofGetHeight()*ofToFloat(settings["h"])); - window=ofRectangle(ofGetWidth()*ofToFloat(settings["x"]),ofGetHeight()*ofToFloat(settings["y"]),ofGetWidth()*ofToFloat(settings["w"]),ofGetHeight()*ofToFloat(settings["h"])); + x=ofToFloat(settings["x"]); + y=ofToFloat(settings["y"]); + w=ofToFloat(settings["w"]); + h=ofToFloat(settings["h"]); + if (DEBUG) printf("window: %f,%f %fx%f n",ofGetWidth()*x,ofGetHeight()*y,ofGetWidth()*w,ofGetHeight()*h); + window=ofRectangle(ofGetWidth()*x,ofGetHeight()*y,ofGetWidth()*w,ofGetHeight()*h); distortFactor=ofToFloat(settings["distort"]); renderFBO.allocate(window.width,window.height,GL_RGB); @@ -30,10 +34,10 @@ void viewpoint::setup(map&settings){ light.setDirectional(); } double viewpoint::getSetting(const string& setting){ - if (setting=="x") return window.x/ofGetWidth(); - if (setting=="y") return window.y/ofGetHeight(); - if (setting=="w") return window.width/ofGetWidth(); - if (setting=="h") return window.height/ofGetHeight(); + if (setting=="x") return x; + if (setting=="y") return y; + if (setting=="w") return w; + if (setting=="h") return h; if (setting=="fov") return vars[0].getVal(); if (setting=="targX") return vars[1].getVal(); if (setting=="targY") return vars[2].getVal(); diff --git a/src/viewpoint.h b/src/viewpoint.h index b5923bd..5ee9b63 100644 --- a/src/viewpoint.h +++ b/src/viewpoint.h @@ -49,4 +49,6 @@ class viewpoint { ofLight light; + float x,y,w,h; + }; -- cgit v1.2.3