
282 Chapter 4 Scene Graphs
N
0
S
0
N
2
S
2
N
1
S
1
G
3
S
3
N
4
S
4
G
5
S
5
G
6
S
6
Figure 4.8 A common situation for updating render state.
The protected member functions are helper functions for the depth-first traversal.
The function
PushState pushes any global state and lights that the Spatial object
has attached to it onto stacks. The function
PopState pops those stacks. The intent
is that the stacks are used by all the nodes in the scene hierarchy as they are visited.
Function
Node::UpdateState has the responsibility for propagating the update in a
recursive traversal of the scene hierarchy. Function
Geometry::UpdateState is called
at leaf nodes of the hierarchy. It has the