diff options
| author | Tim Redfern <tim@eclectronics.org> | 2012-01-04 23:03:45 +0000 |
|---|---|---|
| committer | Tim Redfern <tim@eclectronics.org> | 2012-01-04 23:03:45 +0000 |
| commit | 16cc03c435982383627dd01341656d0371ca1f2b (patch) | |
| tree | b4faad19f0c6b28da72a2050e49c22bb2322a3ce | |
| parent | 64a4a42ee6826584c38c09a2b5976356e4488993 (diff) | |
tidied up
| -rw-r--r-- | map4.xcodeproj/tim.mode1v3 | 23 | ||||
| -rw-r--r-- | map4.xcodeproj/tim.pbxuser | 58 | ||||
| -rw-r--r-- | src/keyVar.cpp | 1 | ||||
| -rw-r--r-- | src/testApp.cpp | 10 | ||||
| -rw-r--r-- | src/viewpoint.cpp | 53 | ||||
| -rw-r--r-- | src/viewpoint.h | 2 |
6 files changed, 55 insertions, 92 deletions
diff --git a/map4.xcodeproj/tim.mode1v3 b/map4.xcodeproj/tim.mode1v3 index 4394d02..df4c30e 100644 --- a/map4.xcodeproj/tim.mode1v3 +++ b/map4.xcodeproj/tim.mode1v3 @@ -326,7 +326,7 @@ <key>_historyCapacity</key> <integer>0</integer> <key>bookmark</key> - <string>22D4C35D14B4FAF600BC7337</string> + <string>226875A614B5000F006FAF1F</string> <key>history</key> <array> <string>220EA1EF14925D45004424ED</string> @@ -343,7 +343,7 @@ <string>2226A47A14B3C58400A9FC9F</string> <string>2226A47C14B3C58400A9FC9F</string> <string>2226A4A514B3CAB700A9FC9F</string> - <string>22AABA5214B4EBFD00280662</string> + <string>22D4C35D14B4FAF600BC7337</string> </array> </dict> <key>SplitCount</key> @@ -355,14 +355,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 0}, {816, 431}}</string> + <string>{{0, 0}, {816, 429}}</string> <key>RubberWindowFrame</key> <string>0 59 1024 519 0 0 1024 578 </string> </dict> <key>Module</key> <string>PBXNavigatorGroup</string> <key>Proportion</key> - <string>431pt</string> + <string>429pt</string> </dict> <dict> <key>ContentConfiguration</key> @@ -375,14 +375,14 @@ <key>GeometryConfiguration</key> <dict> <key>Frame</key> - <string>{{0, 436}, {816, 42}}</string> + <string>{{0, 434}, {816, 44}}</string> <key>RubberWindowFrame</key> <string>0 59 1024 519 0 0 1024 578 </string> </dict> <key>Module</key> <string>XCDetailModule</string> <key>Proportion</key> - <string>42pt</string> + <string>44pt</string> </dict> </array> <key>Proportion</key> @@ -401,9 +401,9 @@ </array> <key>TableOfContents</key> <array> - <string>22D4C34214B4ED2D00BC7337</string> + <string>226875A714B5000F006FAF1F</string> <string>1CE0B1FE06471DED0097A5F4</string> - <string>22D4C34314B4ED2D00BC7337</string> + <string>226875A814B5000F006FAF1F</string> <string>1CE0B20306471E060097A5F4</string> <string>1CE0B20506471E060097A5F4</string> </array> @@ -541,11 +541,6 @@ <integer>5</integer> <key>WindowOrderList</key> <array> - <string>22D4C35E14B4FAF600BC7337</string> - <string>22D4C35314B4F03D00BC7337</string> - <string>22D4C35414B4F03D00BC7337</string> - <string>1C78EAAD065D492600B07095</string> - <string>1CD10A99069EF8BA00B06720</string> <string>22C080D114918C2F00E6B4C0</string> <string>/Developer/Library/openFrameworks/custom/dev/map4/map4.xcodeproj</string> </array> @@ -627,7 +622,7 @@ <key>TableOfContents</key> <array> <string>22C080D114918C2F00E6B4C0</string> - <string>22D4C34414B4ED2D00BC7337</string> + <string>226875A914B5000F006FAF1F</string> <string>1CD0528F0623707200166675</string> <string>XCMainBuildResultsModuleGUID</string> </array> diff --git a/map4.xcodeproj/tim.pbxuser b/map4.xcodeproj/tim.pbxuser index ced6680..82ec3ca 100644 --- a/map4.xcodeproj/tim.pbxuser +++ b/map4.xcodeproj/tim.pbxuser @@ -109,7 +109,7 @@ fRef = 223429A314AF70B100D0B406 /* viewpoint.cpp */; name = "viewpoint.cpp: 34"; rLen = 0; - rLoc = 877; + rLoc = 651; rType = 0; vrLen = 835; vrLoc = 0; @@ -119,23 +119,30 @@ fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; name = "testApp.cpp: 14"; rLen = 0; - rLoc = 291; + rLoc = 255; rType = 0; vrLen = 741; vrLoc = 0; }; 223429A114AF70B100D0B406 /* keyVar.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {755, 1071}}"; - sepNavSelRange = "{1398, 0}"; - sepNavVisRange = "{0, 1398}"; + sepNavIntBoundsRect = "{{0, 0}, {755, 715}}"; + sepNavSelRange = "{128, 0}"; + sepNavVisRange = "{533, 932}"; + }; + }; + 223429A214AF70B100D0B406 /* keyVar.h */ = { + uiCtxt = { + sepNavIntBoundsRect = "{{0, 0}, {755, 429}}"; + sepNavSelRange = "{0, 0}"; + sepNavVisRange = "{0, 519}"; }; }; 223429A314AF70B100D0B406 /* viewpoint.cpp */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {755, 1755}}"; - sepNavSelRange = "{877, 0}"; - sepNavVisRange = "{0, 835}"; + sepNavIntBoundsRect = "{{0, 0}, {1076, 1235}}"; + sepNavSelRange = "{1598, 0}"; + sepNavVisRange = "{0, 821}"; sepNavWindowFrame = "{{15, 4}, {976, 574}}"; }; }; @@ -217,12 +224,22 @@ vrLen = 1398; vrLoc = 0; }; + 226875A614B5000F006FAF1F /* PBXTextBookmark */ = { + isa = PBXTextBookmark; + fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; + name = "testApp.cpp: 17"; + rLen = 0; + rLoc = 313; + rType = 0; + vrLen = 717; + vrLoc = 0; + }; 22AABA5214B4EBFD00280662 /* PBXTextBookmark */ = { isa = PBXTextBookmark; fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; name = "testApp.cpp: 14"; rLen = 0; - rLoc = 291; + rLoc = 255; rType = 0; vrLen = 740; vrLoc = 0; @@ -280,7 +297,7 @@ fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; name = "testApp.cpp: 14"; rLen = 0; - rLoc = 291; + rLoc = 255; rType = 0; vrLen = 740; vrLoc = 0; @@ -290,7 +307,7 @@ fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; name = "testApp.cpp: 18"; rLen = 0; - rLoc = 403; + rLoc = 345; rType = 0; vrLen = 721; vrLoc = 0; @@ -300,7 +317,7 @@ fRef = E4B69E1E0A3A1BDC003C02F2 /* testApp.cpp */; name = "testApp.cpp: 17"; rLen = 0; - rLoc = 371; + rLoc = 313; rType = 0; vrLen = 697; vrLoc = 0; @@ -309,13 +326,13 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {761, 1248}}"; sepNavSelRange = "{171, 0}"; - sepNavVisRange = "{2715, 1475}"; + sepNavVisRange = "{0, 739}"; sepNavWindowFrame = "{{15, 4}, {976, 574}}"; }; }; 22EF433914AF89EF003C3497 /* mapUtils.h */ = { uiCtxt = { - sepNavIntBoundsRect = "{{0, 0}, {755, 393}}"; + sepNavIntBoundsRect = "{{0, 0}, {755, 397}}"; sepNavSelRange = "{327, 0}"; sepNavVisRange = "{0, 329}"; }; @@ -354,8 +371,8 @@ PBXFileDataSource_Target_ColumnID, ); }; - PBXPerProjectTemplateStateSaveDate = 347401505; - PBXWorkspaceStateSaveDate = 347401505; + PBXPerProjectTemplateStateSaveDate = 347406347; + PBXWorkspaceStateSaveDate = 347406347; }; perUserProjectItems = { 220EA1EF14925D45004424ED = 220EA1EF14925D45004424ED /* PBXTextBookmark */; @@ -371,12 +388,13 @@ 2257104214B1404F009BC2A4 = 2257104214B1404F009BC2A4 /* PBXTextBookmark */; 2257104414B1404F009BC2A4 = 2257104414B1404F009BC2A4 /* PBXTextBookmark */; 22578A0914B34BAC0036E99C = 22578A0914B34BAC0036E99C /* PBXTextBookmark */; + 226875A614B5000F006FAF1F /* PBXTextBookmark */ = 226875A614B5000F006FAF1F /* PBXTextBookmark */; 22AABA5214B4EBFD00280662 = 22AABA5214B4EBFD00280662 /* PBXTextBookmark */; 22AFFECF149798EE0079DDC5 = 22AFFECF149798EE0079DDC5 /* PBXTextBookmark */; 22AFFED1149798EE0079DDC5 = 22AFFED1149798EE0079DDC5 /* PBXTextBookmark */; - 22D4C34114B4ED2D00BC7337 /* PBXTextBookmark */ = 22D4C34114B4ED2D00BC7337 /* PBXTextBookmark */; - 22D4C34B14B4F03D00BC7337 /* PBXTextBookmark */ = 22D4C34B14B4F03D00BC7337 /* PBXTextBookmark */; - 22D4C35D14B4FAF600BC7337 /* PBXTextBookmark */ = 22D4C35D14B4FAF600BC7337 /* PBXTextBookmark */; + 22D4C34114B4ED2D00BC7337 = 22D4C34114B4ED2D00BC7337 /* PBXTextBookmark */; + 22D4C34B14B4F03D00BC7337 = 22D4C34B14B4F03D00BC7337 /* PBXTextBookmark */; + 22D4C35D14B4FAF600BC7337 = 22D4C35D14B4FAF600BC7337 /* PBXTextBookmark */; }; sourceControlManager = 22C080CC1491244000E6B4C0 /* Source Control */; userBuildSettings = { @@ -400,7 +418,7 @@ uiCtxt = { sepNavIntBoundsRect = "{{0, 0}, {755, 1781}}"; sepNavSelRange = "{371, 0}"; - sepNavVisRange = "{0, 697}"; + sepNavVisRange = "{0, 717}"; sepNavWindowFrame = "{{15, 4}, {976, 574}}"; }; }; diff --git a/src/keyVar.cpp b/src/keyVar.cpp index 8a5ce9a..2c92896 100644 --- a/src/keyVar.cpp +++ b/src/keyVar.cpp @@ -2,6 +2,7 @@ * keyvar.cpp generalised cushioned keyboard controller + //todo time based rather than onoff to get around keyrepeat issue */ #include "keyVar.h" diff --git a/src/testApp.cpp b/src/testApp.cpp index 5bd6f0a..42f7055 100644 --- a/src/testApp.cpp +++ b/src/testApp.cpp @@ -10,19 +10,14 @@ void testApp::setup(){ //some model / light stuff glEnable (GL_DEPTH_TEST); glShadeModel (GL_SMOOTH); - - //initialize lighting - //glEnable (GL_LIGHTING); glColorMaterial (GL_FRONT_AND_BACK, GL_DIFFUSE); 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.setRotation(0, 180, 1, 0, 0); bottle.setPosition(0, 112, 0); - //ofDisableArbTex(); texture.loadMovie("gradblend01.mov"); @@ -33,11 +28,8 @@ void testApp::setup(){ views=new viewpoint[1]; //todo: read this from xml - views[0].setup(GL_LIGHT0,ofGetWidth(),ofGetHeight(),0,0); + views[0].setup(ofGetWidth(),ofGetHeight(),0,0); activeView=0; - - - } //-------------------------------------------------------------- diff --git a/src/viewpoint.cpp b/src/viewpoint.cpp index efb6894..daca64f 100644 --- a/src/viewpoint.cpp +++ b/src/viewpoint.cpp @@ -1,8 +1,7 @@ #include "viewpoint.h" #define DEBUG 0 -void viewpoint::setup(int ln,float w, float h, float x, float y) { - lightNum=ln; +void viewpoint::setup(float w, float h, float x, float y) { window=ofRectangle(w,h,x,y); distortFactor=0.0; renderFBO.allocate(window.width,window.height,GL_RGB); @@ -13,10 +12,8 @@ void viewpoint::setup(int ln,float w, float h, float x, float y) { near=1; far=20; - //camera.setParent(target); vars=new keyVar[8]; - //void set(char _keyInc,char _keyDec,float _val,float _speed,float _accel,float accelTime); vars[0].set('w','s',17.25,0.5,1.0,3.0); vars[1].set('g','d',0.0,10,1.0,3.0); vars[2].set('r','v',112,10,1.0,3.0); @@ -26,69 +23,34 @@ void viewpoint::setup(int ln,float w, float h, float x, float y) { vars[6].set('o','l',1000.0,10,1.0,3.0); vars[7].set('q','a',0,1,1.0,3.0); - //camera.setPosition(0,0,vars[6].getVal()); - - getLightPosition=new GLfloat[4]; - light.enable(); light.setDirectional(); } //-------------------------------------------------------------- void viewpoint::setLight(){ - //glLoadIdentity(); - //glPushMatrix(); target.setPosition(vars[1].getVal(),vars[2].getVal(),vars[3].getVal()); - /* - target.rotate(vars[4].getInc(),1,0,0); - target.rotate(vars[5].getInc(),0,1,0); - camera.setPosition(0,0,vars[6].getVal()); - */ - camera.orbit(vars[5].getVal(), vars[4].getVal(), vars[6].getVal(), target); camera.lookAt(target,ofVec3f(0,1,0)); - //glPopMatrix(); - //ofVec3f lp=camera.getGlobalPosition(); light.setPosition(camera.getGlobalPosition()); - /* - GLfloat lightPosition[] = {lp.x, lp.y, lp.z,1}; - GLfloat lightColour[] = {0.99, 0.99, 0.99, 0.5}; - - glLightfv(lightNum, GL_POSITION, lightPosition); - glLightfv(lightNum, GL_DIFFUSE, lightColour); - glEnable(lightNum); - glGetLightfv(lightNum,GL_POSITION, getLightPosition); - */ } //-------------------------------------------------------------- -void viewpoint::begin(){ - +void viewpoint::begin(){ renderFBO.begin(); ofClear(0,0,0); - //ofPushView(); - camera.begin(); camera.setFov(vars[0].getVal()); - - - - } +} //-------------------------------------------------------------- -void viewpoint::end(){ - +void viewpoint::end(){ camera.end(); - //ofPopView(); renderFBO.end(); ofPushMatrix(); bindTexture(renderFBO); - - //draw a grid - //glPolygonMode( GL_FRONT_AND_BACK, GL_LINE ); ofNoFill(); - ofSetLineWidth(1.0); //ofSetColor(I_fade1,I_fade1,I_fade1); int gridX=50; @@ -97,8 +59,8 @@ void viewpoint::end(){ int yStep=ofGetHeight()/2; ofTranslate(ofGetWidth()/2,ofGetHeight()/2); + //todo: distort texcoords instead of vertex coords for (float i = -1; i < 1.001; i+=(2.0f/gridY)){ - glBegin(GL_QUAD_STRIP); ofPoint p0; ofPoint p1; @@ -110,21 +72,16 @@ void viewpoint::end(){ glTexCoord2f((j+1)*0.5,(i+1)*0.5); glVertex3f(p1.x*xStep,p1.y*yStep,-0.1); } - glEnd(); - // } ofFill(); - unbindTexture(renderFBO); - ofPopMatrix(); ofSetHexColor(0xFFFFFF); ofDrawBitmapString("camera: "+ofToString(camera.getX(), 2)+","+ofToString(camera.getY(), 2)+","+ofToString(camera.getZ(), 2), 10, ofGetHeight()-30); ofDrawBitmapString("light: "+ofToString(light.getX(), 2)+","+ofToString(light.getY(), 2)+","+ofToString(light.getZ(), 2), 10, ofGetHeight()-18); - } //-------------------------------------------------------------- void viewpoint::keyPressed(int key){ diff --git a/src/viewpoint.h b/src/viewpoint.h index 20da42d..e66dffa 100644 --- a/src/viewpoint.h +++ b/src/viewpoint.h @@ -15,7 +15,7 @@ class viewpoint { public: - void setup(int ln,float w, float h, float x, float y); + void setup(float w, float h, float x, float y); void begin(); void end(); void keyPressed(int key); |
