diff --git a/include/osgUtil/CullVisitor b/include/osgUtil/CullVisitor index a5d4173a6..7cc25e5ec 100644 --- a/include/osgUtil/CullVisitor +++ b/include/osgUtil/CullVisitor @@ -92,9 +92,6 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac virtual void apply(osg::Camera& node); virtual void apply(osg::OccluderNode& node); - void setClearNode(const osg::ClearNode* earthSky) { _clearNode = earthSky; } - const osg::ClearNode* getClearNode() const { return _clearNode.get(); } - /** Push state set on the current state group. * If the state exists in a child state group of the current * state group then move the current state group to that child. @@ -286,8 +283,6 @@ class OSGUTIL_EXPORT CullVisitor : public osg::NodeVisitor, public osg::CullStac else acceptNode->accept(*this); } - osg::ref_ptr _clearNode; - osg::ref_ptr _rootStateGraph; StateGraph* _currentStateGraph; diff --git a/src/osgUtil/CullVisitor.cpp b/src/osgUtil/CullVisitor.cpp index b62458ee7..73655cbaa 100644 --- a/src/osgUtil/CullVisitor.cpp +++ b/src/osgUtil/CullVisitor.cpp @@ -1090,7 +1090,17 @@ void CullVisitor::apply(LOD& node) void CullVisitor::apply(osg::ClearNode& node) { // simply override the current earth sky. - setClearNode(&node); + if (node.getRequiresClear()) + { + getCurrentRenderBin()->getStage()->setClearColor(node.getClearColor()); + getCurrentRenderBin()->getStage()->setClearMask(node.getClearMask()); + } + else + { + // we have an earth sky implementation to do the work for use + // so we don't need to clear. + getCurrentRenderBin()->getStage()->setClearMask(0); + } // push the node's state. StateSet* node_state = node.getStateSet(); diff --git a/src/osgUtil/SceneView.cpp b/src/osgUtil/SceneView.cpp index 730641769..1aedf8916 100644 --- a/src/osgUtil/SceneView.cpp +++ b/src/osgUtil/SceneView.cpp @@ -764,9 +764,6 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod cullVisitor->inheritCullSettings(*this); - - cullVisitor->setClearNode(NULL); // reset earth sky on each frame. - cullVisitor->setStateGraph(rendergraph); cullVisitor->setRenderStage(renderStage); @@ -829,22 +826,6 @@ bool SceneView::cullStage(const osg::Matrixd& projection,const osg::Matrixd& mod if (_globalStateSet.valid()) cullVisitor->popStateSet(); - const osg::ClearNode* clearNode = cullVisitor->getClearNode(); - if (clearNode) - { - if (clearNode->getRequiresClear()) - { - renderStage->setClearColor(clearNode->getClearColor()); - renderStage->setClearMask(clearNode->getClearMask()); - } - else - { - // we have an earth sky implementation to do the work for use - // so we don't need to clear. - renderStage->setClearMask(0); - } - } - renderStage->sort(); // prune out any empty StateGraph children.