Game Development Reference
In-Depth Information
SceneNodeList::iterator i = m_Children.begin();
SceneNodeList::iterator end = m_Children.end();
while (i != end)
{
(*i)->VOnRestore(pScene);
++i;
}
return S_OK;
}
HRESULT SceneNode::VOnUpdate(Scene *pScene, DWORD const elapsedMs)
{
SceneNodeList::iterator i = m_Children.begin();
SceneNodeList::iterator end = m_Children.end();
while (i != end)
{
(*i)->VOnUpdate(pScene, elapsedMs);
++i;
}
return S_OK;
}
The next two methods, VPreRender() and VPostRender() , call some of the scene
graph
s matrix management methods. They deal with setting the world transform
matrix before the render and then restoring it to its original value afterward. You
'
ll
see how this is done in detail when I talk about the Scene class in the next section.
'
HRESULT SceneNode::VPreRender(Scene *pScene)
{
pScene->PushAndSetMatrix(m_Props.m_ToWorld);
return S_OK;
}
HRESULT SceneNode::VPostRender(Scene *pScene)
{
pScene->PopMatrix();
return S_OK;
}
VIsVisible() is responsible for visibility culling. In real commercial games, this is
usually a very complicated and involved process, much more than you
ll see here.
You have to start somewhere, though, and you can find a staggering amount of mate-
rial on the Internet that will teach you how to test for object visibility in a 3D ren-
dered scene. What
'
'
'
s really important is that you know that you can
t ignore it, no
matter how simple your engine is. Here is VIsVisible() :
Search WWH ::




Custom Search