From 67ef3fd2c52ed2ade7ba0e088fb1c4db11bf0f67 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 7 May 2009 14:58:22 +0000 Subject: [PATCH] Fixed ABSOLUTE_RF slave camera resize policy, merged from svn trunk using: http://www.openscenegraph.org/svn/osg/OpenSceneGraph/trunk/src/ --- src/osg/GraphicsContext.cpp | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) diff --git a/src/osg/GraphicsContext.cpp b/src/osg/GraphicsContext.cpp index 4a9b73c6a..4a5098403 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -818,14 +818,26 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height) { osg::View* view = camera->getView(); osg::View::Slave* slave = view ? view->findSlaveForCamera(camera) : 0; - - if (slave && camera->getReferenceFrame()==osg::Transform::RELATIVE_RF) + + if (slave) { - switch(view->getCamera()->getProjectionResizePolicy()) + if (camera->getReferenceFrame()==osg::Transform::RELATIVE_RF) { - case(osg::Camera::HORIZONTAL): slave->_projectionOffset *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; - case(osg::Camera::VERTICAL): slave->_projectionOffset *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; - default: break; + switch(view->getCamera()->getProjectionResizePolicy()) + { + case(osg::Camera::HORIZONTAL): slave->_projectionOffset *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; + case(osg::Camera::VERTICAL): slave->_projectionOffset *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; + default: break; + } + } + else + { + switch(camera->getProjectionResizePolicy()) + { + case(osg::Camera::HORIZONTAL): camera->getProjectionMatrix() *= osg::Matrix::scale(1.0/aspectRatioChange,1.0,1.0); break; + case(osg::Camera::VERTICAL): camera->getProjectionMatrix() *= osg::Matrix::scale(1.0, aspectRatioChange,1.0); break; + default: break; + } } } else @@ -839,10 +851,10 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height) } } - } + } } - + _traits->x = x; _traits->y = y; _traits->width = width;