From d73f37e841e366880cdeb3c7e0ebb7bcf13c64c1 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Tue, 22 Feb 2011 14:21:34 +0000 Subject: [PATCH] Added test code to explore problems with LightSpacePerspectiveShadowMap implementation handling of different datasets and camera settings. --- .../LightSpacePerspectiveShadowMap.cpp | 47 +++++++++++++++++-- 1 file changed, 43 insertions(+), 4 deletions(-) diff --git a/src/osgShadow/LightSpacePerspectiveShadowMap.cpp b/src/osgShadow/LightSpacePerspectiveShadowMap.cpp index 89216fee7..99224f3bc 100644 --- a/src/osgShadow/LightSpacePerspectiveShadowMap.cpp +++ b/src/osgShadow/LightSpacePerspectiveShadowMap.cpp @@ -16,6 +16,7 @@ #include +#include #include #include @@ -27,6 +28,8 @@ #define LISPSM_ALGO DIRECTIONAL_ADAPTED //#define LISPSM_ALGO DIRECTIONAL_AND_SPOT +#define ROBERTS_TEST_CHANGES 1 + #define PRINT_COMPUTED_N_OPT 0 using namespace osgShadow; @@ -279,8 +282,13 @@ void LightSpacePerspectiveShadowMapAlgorithm::operator() m.makeLookAt( eye, center, up ); osg::BoundingBox bb = hullShadowedView->computeBoundingBox( mvpLight * m ); - if( !bb.valid() ) + if( !bb.valid() ) + { +#if ROBERTS_TEST_CHANGES + OSG_NOTICE<<"LightSpacePerspectiveShadowMapAlgorithm::operator() invalid bb A"<computeBoundingBox( mvpLight * lightView ); - if( !bb.valid() ) + if( !bb.valid() ) + { +#if ROBERTS_TEST_CHANGES + OSG_NOTICE<<"LightSpacePerspectiveShadowMapAlgorithm::operator() invalid bb B"<setProjectionMatrix ( cameraShadow->getProjectionMatrix() * lightView * lispProjection ); + + //OSG_NOTICE<<"LightSpacePerspectiveShadowMapAlgorithm::operator() normal case dotProd="<