-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
OpenSceneGraph 3.0: Beginner's Guide
The osg::Switch node is able to render or skip specific children conditionally. It inherits the methods of osg::Group super class and attaches a Boolean value to each child node. It has a few useful public methods:
The overloaded addChild() method is able to have a Boolean parameter in addition to the osg::Node pointer. When the Boolean parameter is set to false, the added node will be invisible to the viewer.
The setValue() method will set the visibility value of the child node at the specified index. It has two parameters: the zero-based index and the Boolean value. And getValue() can get the value of child node at the input index.
The setNewChildDefaultValue() method sets the default visibility for new children. If a child is simply added without specifying a value, its value will be decided by setNewChildDefaultValue(), for instance:
switchNode->setNewChildDefaultValue( false ); switchNode->addChild( childNode ); // Turned off by default now!
Change the font size
Change margin width
Change background colour