Hello,
Sorry to bother again. I think this is somwhat a different topic from my
previous post.
I am using a LOD based node, with several gourps/LODs.
At some point I want to completely wipe out my scene. How can I delete all
nodes?
This is my code. I think it still leaves some nodes floating.
void rRemoveChildren(osg::Node* currNode) {
osg::Group* currGroup;
osg::Node* foundNode;
// check to see if we have a valid (non-NULL) node.
// if we do have a null node, return NULL.
if (!currNode) {
return;
}
currGroup = currNode->asGroup(); // returns NULL if not a group.
if (currGroup) {
auto nChildren = currGroup->getNumChildren();
for (int i = nChildren-1; i >=0; i--) {
osg::Group* asGroup = currGroup->getChild(i)->asGroup();
if (!asGroup || asGroup->getNumChildren() < 1) {
osg::Node* shild = currGroup->getChild(i);
shild->releaseGLObjects();
currGroup->removeChild(shild);
}
else rRemoveChildren(asGroup);
}
} else {
auto parents = currNode->getParents();
for (auto p : parents)
p->removeChild(currNode);
}
}
_______________________________________________
osg-users mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org