From d5c68cfa02634278f7c002aadf7d971531ac484c Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 19 Feb 2007 12:13:30 +0000 Subject: [PATCH] Moved CameraCullCallback into ShadowTechnique scope to make it more resusable between various Techniques --- include/osgShadow/ShadowTechnique | 14 ++++++++++++++ src/osgShadow/ShadowTechnique.cpp | 13 +++++++++++++ src/osgShadow/ShadowTexture.cpp | 19 ------------------- 3 files changed, 27 insertions(+), 19 deletions(-) diff --git a/include/osgShadow/ShadowTechnique b/include/osgShadow/ShadowTechnique index b37012555..d7d8b8d45 100644 --- a/include/osgShadow/ShadowTechnique +++ b/include/osgShadow/ShadowTechnique @@ -58,6 +58,20 @@ class OSGSHADOW_EXPORT ShadowTechnique : public osg::Object protected : + class OSGSHADOW_EXPORT CameraCullCallback : public osg::NodeCallback + { + public: + + CameraCullCallback(ShadowTechnique* st); + + virtual void operator()(osg::Node*, osg::NodeVisitor* nv); + + protected: + + ShadowTechnique* _shadowTechnique; + }; + + virtual ~ShadowTechnique(); friend class ShadowedScene; diff --git a/src/osgShadow/ShadowTechnique.cpp b/src/osgShadow/ShadowTechnique.cpp index 4beb82509..245edc5f9 100644 --- a/src/osgShadow/ShadowTechnique.cpp +++ b/src/osgShadow/ShadowTechnique.cpp @@ -17,6 +17,19 @@ using namespace osgShadow; +ShadowTechnique::CameraCullCallback::CameraCullCallback(ShadowTechnique* st): + _shadowTechnique(st) +{ +} + +void ShadowTechnique::CameraCullCallback::operator()(osg::Node*, osg::NodeVisitor* nv) +{ + if (_shadowTechnique->getShadowedScene()) + { + _shadowTechnique->getShadowedScene()->osg::Group::traverse(*nv); + } +} + ShadowTechnique::ShadowTechnique(): _shadowedScene(0), _dirty(true) diff --git a/src/osgShadow/ShadowTexture.cpp b/src/osgShadow/ShadowTexture.cpp index a03a28ff0..ff5705e0f 100644 --- a/src/osgShadow/ShadowTexture.cpp +++ b/src/osgShadow/ShadowTexture.cpp @@ -19,25 +19,6 @@ using namespace osgShadow; -class CameraCullCallback : public osg::NodeCallback -{ - public: - - CameraCullCallback(ShadowTexture* st): - _shadowTexture(st) - { - } - - virtual void operator()(osg::Node*, osg::NodeVisitor* nv) - { - _shadowTexture->getShadowedScene()->osg::Group::traverse(*nv); - } - - protected: - - ShadowTexture* _shadowTexture; -}; - ShadowTexture::ShadowTexture(): _textureUnit(1) {