Game Development Reference
In-Depth Information
new SceneNode(INVALID_ACTOR_ID,
, RenderPass_Static, g_White, &Mat4x4::g_Identity));
m_Children.push_back(staticGroup);
StaticGroup
// RenderPass_Static = 0
shared_ptr<SceneNode> actorGroup(
new SceneNode(INVALID_ACTOR_ID,
ActorGroup
, RenderPass_Actor,
g_White, &Mat4x4::g_Identity));
m_Children.push_back(actorGroup);
// RenderPass_Actor = 1
shared_ptr<SceneNode> skyGroup(
new SceneNode(INVALID_ACTOR_ID,
SkyGroup
, RenderPass_Sky,
g_White, &Mat4x4::g_Identity));
m_Children.push_back(skyGroup);
// RenderPass_Sky = 2
shared_ptr<SceneNode> invisibleGroup(
GCC_NEW SceneNode(INVALID_ACTOR_ID,
, RenderPass_NotRendered, g_White,
&Mat4x4::g_Identity));
m_Children.push_back(invisibleGroup);
InvisibleGroup
// RenderPass_NotRendered = 3
}
The root node has child nodes that are added directly as a part of the constructor
one child for each render pass you define. In the previous case, there are three ren-
der passes: one for static actors, one for dynamic actors, and one for the sky. When
other scene nodes are added to the scene graph, the root node actually adds them to
one of these children, based on the new scene node
'
s m_RenderPass member
variable:
bool RootNode::VAddChild(shared_ptr<ISceneNode> kid)
{
// Children that divide the scene graph into render passes.
// Scene nodes will get added to these children based on the value of the
// render pass member variable.
RenderPass pass = kid->VGet()->RenderPass();
if ((unsigned)pass >= m_Children.size() || !m_Children[pass])
{
GCC_ASSERT(0 && _T(
There is no such render pass
));
return false;
}
return m_Children[pass]->VAddChild(kid);
}
Search WWH ::




Custom Search