Added a traverseGeode method to the UpdateVisitor which contains the
traversal code for both the nodes traversal and the drawables the geode contains.
This commit is contained in:
@@ -79,17 +79,20 @@ class OSGUTIL_EXPORT UpdateVisitor : public osg::NodeVisitor
|
|||||||
{
|
{
|
||||||
osg::NodeCallback* callback = node.getUpdateCallback();
|
osg::NodeCallback* callback = node.getUpdateCallback();
|
||||||
if (callback) (*callback)(&node,this);
|
if (callback) (*callback)(&node,this);
|
||||||
else if (node.getNumChildrenRequiringUpdateTraversal()>0) traverse(node);
|
else if (node.getNumChildrenRequiringUpdateTraversal()>0) traverseGeode(node);
|
||||||
|
|
||||||
// call the app callbacks on the drawables.
|
|
||||||
for(unsigned int i=0;i<node.getNumDrawables();++i)
|
|
||||||
{
|
|
||||||
osg::Drawable::UpdateCallback* callback = node.getDrawable(i)->getUpdateCallback();
|
|
||||||
if (callback) callback->update(this,node.getDrawable(i));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void traverseGeode(osg::Geode& geode)
|
||||||
|
{
|
||||||
|
traverse((osg::Node&)geode);
|
||||||
|
|
||||||
|
// call the app callbacks on the drawables.
|
||||||
|
for(unsigned int i=0;i<geode.getNumDrawables();++i)
|
||||||
|
{
|
||||||
|
osg::Drawable::UpdateCallback* callback = geode.getDrawable(i)->getUpdateCallback();
|
||||||
|
if (callback) callback->update(this,geode.getDrawable(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user