diff --git a/include/osgUtil/IncrementalCompileOperation b/include/osgUtil/IncrementalCompileOperation index c739cd6d5..76f51dbb8 100644 --- a/include/osgUtil/IncrementalCompileOperation +++ b/include/osgUtil/IncrementalCompileOperation @@ -24,7 +24,7 @@ class OSGUTIL_EXPORT StateToCompile : public osg::NodeVisitor { public: - StateToCompile(GLObjectsVisitor::Mode mode, osg::Object* markerObject=0); + StateToCompile(GLObjectsVisitor::Mode mode, osg::Object* markerObject); typedef std::set DrawableSet; typedef std::set StateSetSet; @@ -266,6 +266,8 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation typedef std::map CompileMap; CompileMap _compileMap; + osg::ref_ptr _markerObject; + protected: virtual ~CompileSet() {} diff --git a/src/osgUtil/IncrementalCompileOperation.cpp b/src/osgUtil/IncrementalCompileOperation.cpp index 8cf2a2c78..c0b0aa3bb 100644 --- a/src/osgUtil/IncrementalCompileOperation.cpp +++ b/src/osgUtil/IncrementalCompileOperation.cpp @@ -420,7 +420,8 @@ void IncrementalCompileOperation::CompileSet::buildCompileMap(ContextSet& contex { if (contexts.empty() || !_subgraphToCompile) return; - StateToCompile stc(mode); + StateToCompile stc(mode, _markerObject.get()); + _subgraphToCompile->accept(stc); buildCompileMap(contexts, stc); @@ -579,6 +580,9 @@ void IncrementalCompileOperation::add(CompileSet* compileSet, bool callBuildComp { if (!compileSet) return; + // pass on the markerObject to the CompileSet + compileSet->_markerObject = _markerObject; + if (compileSet->_subgraphToCompile.valid()) { // force a compute of the bound of the subgraph to avoid the update traversal from having to do this work