-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

dave perry wrote:
| 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.
|
I can't do that, Dave :)

The FGRenderer code is extremely unclear here, through no fault of your own. 
While w and
h would seem to be window coordinates, they are in fact angles. So it's not 
correct to
pass their ratio as the aspect ratio argument to 
setProjectionMatrixAsPerspective. I've
been screwing around with getting the actual aspect ratio out of the view, but 
that
produces distortions too when you resize the window. A little more work needs to
be done here to figure out if the views are being updated correctly on a resize 
event
or if there's a bug in the viewer code.

I know that people with wide screens are anxious for this to work, but I don't 
want to
commit something that's just incorrect.

Tim

| 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
|

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFHlw3GeDhWHdXrDRURAhRnAJ4msvWwg8rB74UQ7DDFBIFpZUlhLQCg0+pr
clpa/ytp21yAv3gND4ad5iU=
=UDKI
-----END PGP SIGNATURE-----

-------------------------------------------------------------------------
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

Reply via email to