4.4 The Update Pass 287
This is a recursive call that traverses a linear list of nodes. The traversal takes you up
the tree to the root, and then you push the states of the nodes as you return to the
initiator.
The pushing and popping of state is straightforward:
void Spatial::PushState (
std::vector<GlobalState*>* akGStack,
std::vector<Light*>* pkLStack)
{
int i;
for (i = 0; i < (int)m_kGlobalStates.size(); i++)
{
int eType = m_kGlobalStates[i]->GetStateType();
akGStack[eType].push_back(m_kGlobalStates[i]);
}
for (i = 0; i < (int)m_kLights.size(); i++)
{
Light* pkLight = StaticCast<Light>(m_kLights[i]);
pkLStack->push_back(pkLight);
}
}
void Spatial::PopState (
std::vector<GlobalState*>* akGStack,
std::vector<Light*>* pkLStack)
{
int i;
for (i = 0; i < (int)m_kGlobalStates.size(); ...