Hi Paul, ok, I think I have to reject my previous post and will have to say that BFS with osg is not that easy as it sounds first.
The problem is, that whenever I do iterate over the child list and let accept() a child the node visitor, I will end up in DFS. Because accept() means to call apply() again on the visitor. If then visitor will again iterate over the children and call again accept(), I will end up in DFS. In deed, current osg implementation uses recursion to traverse over the graph. Which is very suitable for DFS. Implementing BFS with recursion is not that easy, then DFS. The way, how I can solve that problem would be to write a method which just iteratively collects nodes in a queue and then apply the new visitor on each node. Does anybody has other ideas? Or maybe somebody can correct me if I am doing mistakes here. cheers, art Paul Martz wrote: > > Rather than calling NodeVisitor::traverse() from your overridden apply() > methods, iterate over the child list yourself in apply() and have them > accept() the NodeVisitor. You can call (or not call) the children in any > order you wish. > ------------------ Read this topic online here: http://forum.openscenegraph.org/viewtopic.php?p=18486#18486 _______________________________________________ osg-users mailing list osg-users@lists.openscenegraph.org http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org