From ad72dc66ce8337c9d8089760032fcafd7e2e8145 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 7 Oct 2008 15:16:37 +0000 Subject: [PATCH] From Roger James, "The light position is incorrectly calculated for shadow casting scenes whose bounding box centre is not the origin. This is a one line fix. " --- src/osgShadow/ShadowTexture.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osgShadow/ShadowTexture.cpp b/src/osgShadow/ShadowTexture.cpp index 11c1a872e..366c4f6ea 100644 --- a/src/osgShadow/ShadowTexture.cpp +++ b/src/osgShadow/ShadowTexture.cpp @@ -207,7 +207,7 @@ void ShadowTexture::cull(osgUtil::CullVisitor& cv) lightDir.normalize(); // set the position far away along the light direction - osg::Vec3 position = lightDir * bb.radius() * 20; + osg::Vec3 position = bb.center() + lightDir * bb.radius() * 10.0; float centerDistance = (position-bb.center()).length();