Added automatic assignment of _markerObject to CompileSet.

This commit is contained in:
Robert Osfield 2016-08-15 11:45:58 +01:00
parent e9d6737ec4
commit 06cb31a3d2
2 changed files with 8 additions and 2 deletions

View File

@ -24,7 +24,7 @@ class OSGUTIL_EXPORT StateToCompile : public osg::NodeVisitor
{ {
public: public:
StateToCompile(GLObjectsVisitor::Mode mode, osg::Object* markerObject=0); StateToCompile(GLObjectsVisitor::Mode mode, osg::Object* markerObject);
typedef std::set<osg::Drawable*> DrawableSet; typedef std::set<osg::Drawable*> DrawableSet;
typedef std::set<osg::StateSet*> StateSetSet; typedef std::set<osg::StateSet*> StateSetSet;
@ -266,6 +266,8 @@ class OSGUTIL_EXPORT IncrementalCompileOperation : public osg::GraphicsOperation
typedef std::map<osg::GraphicsContext*, CompileList > CompileMap; typedef std::map<osg::GraphicsContext*, CompileList > CompileMap;
CompileMap _compileMap; CompileMap _compileMap;
osg::ref_ptr<osg::Object> _markerObject;
protected: protected:
virtual ~CompileSet() {} virtual ~CompileSet() {}

View File

@ -420,7 +420,8 @@ void IncrementalCompileOperation::CompileSet::buildCompileMap(ContextSet& contex
{ {
if (contexts.empty() || !_subgraphToCompile) return; if (contexts.empty() || !_subgraphToCompile) return;
StateToCompile stc(mode); StateToCompile stc(mode, _markerObject.get());
_subgraphToCompile->accept(stc); _subgraphToCompile->accept(stc);
buildCompileMap(contexts, stc); buildCompileMap(contexts, stc);
@ -579,6 +580,9 @@ void IncrementalCompileOperation::add(CompileSet* compileSet, bool callBuildComp
{ {
if (!compileSet) return; if (!compileSet) return;
// pass on the markerObject to the CompileSet
compileSet->_markerObject = _markerObject;
if (compileSet->_subgraphToCompile.valid()) if (compileSet->_subgraphToCompile.valid())
{ {
// force a compute of the bound of the subgraph to avoid the update traversal from having to do this work // force a compute of the bound of the subgraph to avoid the update traversal from having to do this work