Visiting scene graph structures

To create a visitor subclass, we have to re-implement one or several apply() virtual overloaded methods declared in the osg::NodeVisitor base class. These methods are designed for most major OSG node types. The visitor will automatically call the appropriate apply() method for each node it visits during the traversal. User customized visitor classes should override only the apply() methods for required node types.

In the implementation of an apply() method, developers have to call the traverse() method of osg::NodeVisitor at the appropriate time. It will instruct the visitor to traverse to the next node, maybe a child, or a sibling node if the current node has no children to visit. Not calling the traverse() method ...

Get OpenSceneGraph 3.0 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.