From e66372a13770905c4095a0659ceb5f4ddee0d2a2 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 15 May 2002 19:58:04 +0000 Subject: [PATCH] Fixed problem with orhographic projections due to a bug in CullVisitor where it automatically resets the near and far to the values calculated during cull traversal. The maths for converting the computed far and near into clip coordinates was wrong, fixed this and the problem goes away. --- src/osgUtil/CullVisitor.cpp | 10 +++++----- src/osgUtil/TrackballManipulator.cpp | 7 +++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index 86d3a8993..70c6722c3 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -218,16 +218,16 @@ void CullVisitor::popProjectionMatrix() // so it doesn't cull them out. osg::Matrix& projection = *_projectionStack.back(); - double desired_znear = _computed_znear*0.95; - double desired_zfar = _computed_zfar*1.05; + double desired_znear = _computed_znear; + double desired_zfar = _computed_zfar; double min_near_plane = _computed_zfar*0.0005f; if (desired_znearsetFusionDistanceRatio(_camera->getFusionDistanceRatio()/1.25f); return true; } +// this is quick hack to test out othographic projection. +// else if (ea.getKey()=='O') +// { +// float dist = _camera->getLookDistance(); +// _camera->setOrtho(-dist,dist,-dist,dist,-dist,dist); +// return true; +// } return false; case(GUIEventAdapter::FRAME): _camera->setFusionDistanceMode(osg::Camera::PROPORTIONAL_TO_LOOK_DISTANCE);