Game Development Reference
In-Depth Information
// is usually a SceneNode with the identity
// matrix
m_Camera->SetViewTransform(this);
m_LightManager->CalcLighting(this);
if (m_Root->VPreRender(this)==S_OK)
{
m_Root->VRender(this);
m_Root->VRenderChildren(this);
m_Root->VPostRender(this);
}
}
RenderAlphaPass();
return S_OK;
}
HRESULT Scene::OnRestore()
{
if (!m_Root)
return S_OK;
return m_Root->VOnRestore(this);
}
HRESULT Scene::OnUpdate(const int deltaMilliseconds)
{
if (!m_Root)
return S_OK;
static DWORD lastTime = timeGetTime();
DWORD elapsedTime = 0;
DWORD now = timeGetTime();
elapsedTime = now - lastTime;
lastTime = now;
return m_Root->VOnUpdate(this, elapsedTime);
}
'
These methods clearly use the root node for all the heavy lifting. (I
ll bet you thought
there was going to be a little more meat to these methods!)
You
ll notice that OnRender() must first check for the existence of a root node and
a camera. Without either of these, there
'
'
s not much more that can be done. If
Search WWH ::




Custom Search