Group Nodes
59
• csLOD—(level-of-detail) is a switch that selects one of its children based on the
distance between the camera and the shape encapsulated by the csLOD; the closer
the shape, the greater the detail used when rendering the shape, the farther away
the shape, the less detailed the shape. For more information, see Chapter 14,
“Optimizing Rendering.”
• csTransform—positions and orients a shape in the coordinate system of the parent
node to csTransform. For more information, see Chapter 6, “Placing Shapes in a
Scene.”
• csEnvironment—is a grouping node which defines the scope of influence for the
effects provided by csLight. For more information, see Chapter 8, “Lighting and
Fog.”
Using csSwitch to Switch Between Nodes
The csSwitch node selects none, one, or all of its children. The constructor has the
following prototype:
csSwitch();
To specify whether none, one, or all of a csSwitch node’s children are selected, use the
following member function:
void setWhichChild(int which);
The possible values of which are
• NO_CHILDREN—to select no nodes
• an integer—to specify a child node
• ALL_CHILDREN—to select all of the children of the csSwitch node
Each child of a switch node is assigned an index number when added to the group node:
the first child added is index 0, the second child added is index 1, and so on.
You might use a csSwitch node to create an animation sequence. For example, if each of
the five child nodes of a csSwitch node contained the image of a character in different
stages of walking, your application could switch sequentially between the child nodes to
create a simple animation sequence.