-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenSceneGraph 3.0: Beginner's Guide
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 means to stop the traversal at once, and the rest of the scene graph is ignored without performing any operations.
The apply() methods have the unified formats of:
virtual void apply( osg::Node& ); virtual void apply( osg::Geode& ); virtual...
Change the font size
Change margin width
Change background colour