From 54d36299746dac3fda904c7c8697d2f5f292e67a Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 19 Oct 2004 13:52:46 +0000 Subject: [PATCH] Move the setting of the camera horizontal field of view to after the realize() to avoid the CameraGroup's Lens be set when its NULL. --- examples/osgcluster/osgcluster.cpp | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/examples/osgcluster/osgcluster.cpp b/examples/osgcluster/osgcluster.cpp index 7942202d2..cb40983b7 100644 --- a/examples/osgcluster/osgcluster.cpp +++ b/examples/osgcluster/osgcluster.cpp @@ -126,12 +126,9 @@ int main( int argc, char **argv ) float socketNumber=8100.0f; while (arguments.read("-n",socketNumber)) ; - float camera_fov=45.0f; + float camera_fov=-1.0f; while (arguments.read("-f",camera_fov)) { - std::cout << "setting lens perspective : original "<0.0f) + { + float aspectRatio = tan( osg::DegreesToRadians(viewer.getLensVerticalFov()*0.5)) / tan(osg::DegreesToRadians(viewer.getLensHorizontalFov()*0.5)); + float new_fovy = osg::RadiansToDegrees(atan( aspectRatio * tan( osg::DegreesToRadians(camera_fov*0.5))))*2.0f; + std::cout << "setting lens perspective : original "<