From 7d947d79ff2091a38982816e6367b6b91b45cfbd Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 3 Dec 2012 10:10:46 +0000 Subject: [PATCH] From Wang Rui, "I've found a very covert bug in current VDSM implementation. It makes the computation of positional texgen incorrect if the shadow scene is under one or more child cameras with view/proj offsets. Using current stage instead will fix it." --- src/osgShadow/ViewDependentShadowMap.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/osgShadow/ViewDependentShadowMap.cpp b/src/osgShadow/ViewDependentShadowMap.cpp index 82ba278df..1c725f32c 100644 --- a/src/osgShadow/ViewDependentShadowMap.cpp +++ b/src/osgShadow/ViewDependentShadowMap.cpp @@ -2303,9 +2303,8 @@ bool ViewDependentShadowMap::assignTexGenSettings(osgUtil::CullVisitor* cv, osg: osg::ref_ptr refMatrix = new osg::RefMatrix( camera->getInverseViewMatrix() * (*(cv->getModelViewMatrix())) ); - cv->getRenderStage()->getPositionalStateContainer()->addPositionedTextureAttribute( textureUnit, refMatrix.get(), texgen ); - - + osgUtil::RenderStage* currentStage = cv->getCurrentRenderBin()->getStage(); + currentStage->getPositionalStateContainer()->addPositionedTextureAttribute( textureUnit, refMatrix.get(), texgen ); return true; }