From Farshid Lashkari, "As discussed, I've added the ability to handle Drawable objects within the NodeVisitor class. Here is an overview of the changes:

- Added apply(Drawable) and apply(Geometry) to NodeVisitor

- Added accept(NodeVisitor) method to Drawable/Geometry

- Added traverse(NodeVisitor) to Geode which calls accept(NodeVisitor) on all Drawables

- Updated CullVisitor to use new apply(Drawable) to handle drawables. The apply(Billboard) method still manually handles the drawables since it is depends on the billboard settings. I needed to disable the traverse within billboard to prevent duplicate traversal of drawables.

- Update other osgUtil node visitors (GLObjectsVisitor, IncrementalCompileOperation, ..) to use new apply(Drawable) method.
"
This commit is contained in:
Robert Osfield
2014-05-12 12:10:35 +00:00
parent ead92353fe
commit b2c7bacfe9
13 changed files with 130 additions and 118 deletions

View File

@@ -61,18 +61,7 @@ void GLObjectsVisitor::apply(osg::Geode& node)
apply(*(node.getStateSet()));
}
for(unsigned int i=0;i<node.getNumDrawables();++i)
{
osg::Drawable* drawable = node.getDrawable(i);
if (drawable)
{
apply(*drawable);
if (drawable->getStateSet())
{
apply(*(drawable->getStateSet()));
}
}
}
traverse(node);
bool programSetAfter = _lastCompiledProgram.valid();
if (!programSetBefore && programSetAfter)
@@ -120,6 +109,11 @@ void GLObjectsVisitor::apply(osg::Drawable& drawable)
{
drawable.releaseGLObjects(_renderInfo.getState());
}
if (drawable.getStateSet())
{
apply(*(drawable.getStateSet()));
}
}
void GLObjectsVisitor::apply(osg::StateSet& stateset)