dave perry wrote: > Tim Moore wrote: > >> -----BEGIN PGP SIGNED MESSAGE----- >> Hash: SHA1 >> >> dave perry wrote: >> | Patch adds a member function to FGRenderer class that returns the >> | current aspect ratio. Uses this in place of 4.0/3.0 in setFOV and >> | setNearFar. >> | >> | The diff follows: >> | >> This seems a little confusing / confused. In setFOV, why would you ignore >> the w argument? >> Now, I happen to know that /sim/startup/xsize is set to the value of w >> somewhere in >> one of the callers, but this is not clear at all. Can we untangle this a bit? >> >> > In setFOV, you can use w/h for the aspect ratio. But in setNearFar just > below this, w and h are not defined in that context, so you need to get > the real current aspect ratio from some where. Hi Tim, The following patch uses w/h for the aspect ratio in setFOV and then uses xsize/ysize (from /sim/startup) for the aspect ratio in setNearFar. This accomplishes using the actual aspect ratio in place of 4.0/3.0 without having to add a new member function to the FGRenderer class.
Please commit this patch. It fixes the same issue as the last patch and the behavior is the same as described on my last note. renderer.cxx patch follows: Index: renderer.cxx =================================================================== RCS file: /var/cvs/FlightGear-0.9/source/src/Main/renderer.cxx,v retrieving revision 1.100 diff -p -u -r1.100 renderer.cxx --- renderer.cxx 6 Jan 2008 23:03:20 -0000 1.100 +++ renderer.cxx 21 Jan 2008 15:48:33 -0000 @@ -872,7 +872,7 @@ void FGRenderer::setFOV( float w, float fov_width = w; fov_height = h; osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); - viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, 4.0/3.0, + viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, w/h, fov_near, fov_far); } @@ -885,8 +885,10 @@ void FGRenderer::setNearFar( float n, fl n = 0.1; fov_near = n; fov_far = f; + float xsize = fgGetInt("/sim/startup/xsize"); + float ysize = fgGetInt("/sim/startup/ysize"); osgViewer::Viewer* viewer = globals->get_renderer()->getViewer(); - viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, 4.0/3.0, + viewer->getCamera()->setProjectionMatrixAsPerspective(fov_height, xsize/ysize, fov_near, fov_far); } Thanks, Dave ------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2008. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/ _______________________________________________ Flightgear-devel mailing list Flightgear-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/flightgear-devel