From 4a28b2ed4bbd7ccc342d766bb3daa764ba2ccaae Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 7 May 2009 14:53:21 +0000 Subject: [PATCH] Fixed handling of resize of ABSOLUTE_RF slave cameras --- 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 4c4dacd0c..9cb3cd408 100644 --- a/src/osg/GraphicsContext.cpp +++ b/src/osg/GraphicsContext.cpp @@ -822,14 +822,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 @@ -843,10 +855,10 @@ void GraphicsContext::resizedImplementation(int x, int y, int width, int height) } } - } + } } - + _traits->x = x; _traits->y = y; _traits->width = width;