Fix handling of in-scenegraph Drawables in ShaderGenVisitor

This commit is contained in:
scrawl
2017-02-03 17:51:03 +01:00
parent e48aa118b6
commit 4e1a2d3246
2 changed files with 4 additions and 15 deletions

View File

@@ -67,7 +67,7 @@ public:
osg::StateSet *getRootStateSet() const { return _rootStateSet.get(); }
void apply(osg::Node &node);
void apply(osg::Geode &geode);
void apply(osg::Drawable &drawable);
void reset();

View File

@@ -322,24 +322,13 @@ void ShaderGenVisitor::apply(osg::Node &node)
_state->popStateSet();
}
void ShaderGenVisitor::apply(osg::Geode &geode)
void ShaderGenVisitor::apply(osg::Drawable &drawable)
{
osg::StateSet *stateSet = geode.getStateSet();
osg::StateSet *stateSet = drawable.getStateSet();
if (stateSet)
_state->pushStateSet(stateSet);
for (unsigned int i=0; i<geode.getNumDrawables(); ++i)
{
osg::Drawable *drawable = geode.getDrawable(i);
osg::StateSet *ss = drawable->getStateSet();
if (ss)
_state->pushStateSet(ss);
update(drawable);
if (ss)
_state->popStateSet();
}
update(&drawable);
if (stateSet)
_state->popStateSet();