OpenSceneGraph/src/osgUtil/RenderGraph.cpp

63 lines
1.2 KiB
C++
Raw Normal View History

#include <osgUtil/RenderGraph>
2001-09-20 05:19:47 +08:00
#include <osg/Notify>
2001-09-20 05:19:47 +08:00
using namespace osg;
using namespace osgUtil;
void RenderGraph::reset()
{
_parent = NULL;
_stateset = NULL;
_depth = 0;
_children.clear();
_leaves.clear();
}
/** recursively clean the RenderGraph of all its drawables, lights and depths.
* Leaves children intact, and ready to be populated again.*/
void RenderGraph::clean()
{
// clean local drawables etc.
_leaves.clear();
// call clean on all children.
for(ChildList::iterator itr=_children.begin();
itr!=_children.end();
++itr)
{
itr->second->clean();
}
}
/** recursively prune the RenderGraph of empty children.*/
void RenderGraph::prune()
{
std::vector<const osg::StateSet*> toEraseList;
// call prune on all children.
for(ChildList::iterator citr=_children.begin();
citr!=_children.end();
++citr)
{
citr->second->prune();
if (citr->second->empty())
{
toEraseList.push_back(citr->first);
}
}
for(std::vector<const osg::StateSet*>::iterator eitr=toEraseList.begin();
eitr!=toEraseList.end();
++eitr)
{
_children.erase(*eitr);
}
}