Switch nodes

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:

  1. 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.
  2. 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.
  3. The setNewChildDefaultValue() method sets the default visibility for new children. If a child is simply ...

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.