diff --git a/include/osgShadow/ViewDependentShadowMap b/include/osgShadow/ViewDependentShadowMap index 3d18e68c7..3b78f51c2 100644 --- a/include/osgShadow/ViewDependentShadowMap +++ b/include/osgShadow/ViewDependentShadowMap @@ -162,7 +162,7 @@ class OSGSHADOW_EXPORT ViewDependentShadowMap : public ShadowTechnique virtual bool perspectiveShadowMapCameraSettings(Frustum& frustum, LightData& positionedLight, osg::Camera* camera); virtual bool lightSpacePerspectiveShadowMapCameraSettings(Frustum& frustum, LightData& positionedLight, osg::Camera* camera); - virtual bool adjustPerspectiveShadowMapCameraSettings(Frustum& frustum, LightData& positionedLight, osg::Camera* camera); + virtual bool adjustPerspectiveShadowMapCameraSettings(osgUtil::RenderStage* renderStage, Frustum& frustum, LightData& positionedLight, osg::Camera* camera); virtual bool assignTexGenSettings(osgUtil::CullVisitor* cv, osg::Camera* camera, unsigned int textureUnit, osg::TexGen* texgen); diff --git a/src/osgShadow/ViewDependentShadowMap.cpp b/src/osgShadow/ViewDependentShadowMap.cpp index 876ec6f83..531841ce7 100644 --- a/src/osgShadow/ViewDependentShadowMap.cpp +++ b/src/osgShadow/ViewDependentShadowMap.cpp @@ -47,12 +47,14 @@ class VDSMCameraCullCallback : public osg::NodeCallback virtual void operator()(osg::Node*, osg::NodeVisitor* nv); osg::RefMatrix* getProjectionMatrix() { return _projectionMatrix.get(); } + osgUtil::RenderStage* getRenderStage() { return _renderStage.get(); } protected: - osg::ref_ptr _projectionMatrix; - ViewDependentShadowMap* _vdsm; - osg::Polytope _polytope; + ViewDependentShadowMap* _vdsm; + osg::ref_ptr _projectionMatrix; + osg::ref_ptr _renderStage; + osg::Polytope _polytope; }; VDSMCameraCullCallback::VDSMCameraCullCallback(ViewDependentShadowMap* vdsm, osg::Polytope& polytope): @@ -89,6 +91,8 @@ void VDSMCameraCullCallback::operator()(osg::Node* node, osg::NodeVisitor* nv) cv->popCullingSet(); } + _renderStage = cv->getRenderStage(); + if (cv->getComputeNearFarMode() != osg::CullSettings::DO_NOT_COMPUTE_NEAR_FAR) { // make sure that the near plane is computed correctly. @@ -472,7 +476,7 @@ void ViewDependentShadowMap::update(osg::NodeVisitor& nv) void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) { - OSG_NOTICE<getViewMatrix()); @@ -597,23 +592,20 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) cv.popStateSet(); -#ifdef NEW_ADJUST switch(_shadowMapProjectionHint) { + case(LIGHT_SPACE_PERSPECTIVE_SHADOW_MAP): case(PERSPECTIVE_SHADOW_MAP): { - OSG_NOTICE<<"******************New adjustment of shadow"<getRenderStage(), frustum, pl, camera.get()); if (vdsmCallback->getProjectionMatrix()) { vdsmCallback->getProjectionMatrix()->set(camera->getProjectionMatrix()); } break; } - case(LIGHT_SPACE_PERSPECTIVE_SHADOW_MAP): break; default: break; } -#endif // 4.4 compute main scene graph TexGen + uniform settings + setup state // @@ -637,12 +629,10 @@ void ViewDependentShadowMap::cull(osgUtil::CullVisitor& cv) if (numValidShadows>0) { - OSG_INFO<<"Need to assign "<setStateSet(selectStateSetForRenderingShadow(*vdd)); } - OSG_NOTICE<<"End of shadow setup Projection matrix "<<*cv.getProjectionMatrix()<(rs)); + } + + void traverse(osgUtil::RenderBin* renderBin) + { + OSG_NOTICE<<"traverse(RenderBin="<setMode(osg::TexGen::EYE_LINEAR);