Game Development Reference
In-Depth Information
void AddAlphaSceneNode(AlphaSceneNode *asn)
{ m_AlphaSceneNodes.push_back(asn); }
};
The Scene class has seven data members:
n m_Root : The root scene node of the entire visible world. It has no parents, and
everything that is drawn is attached either as a child or to a descendant scene
node.
n m_Camera : The active camera. In this simple scene graph, there is only one
camera, but there
t have a list of these objects.
n m_MatrixStack : A nifty DirectX object that manages a stack of transform
matrices, this data structure holds the current world transform matrix as the
scene graph is traversed and drawn.
n m_AlphaSceneNodes : A list of structures that holds the information necessary
to draw transparent scene nodes in a final render pass.
n m_ActorMap : An STL map that lets the scene graph find a scene node matched
to a particular ActorId .
n m_LightManager : A helper class to manage multiple directional lights in the
scene.
'
s nothing that says you can
'
The root node, m_Root , is the top-level scene node in the entire scene graph. There
is some special code associated with the root node, which I
ll show you shortly. For
now, you can consider the root node as the same kind of object that all tree-like data
structures have.
The camera node is a little special. It could be attached anywhere in the scene graph,
especially if it is a first- or third-person camera that targets a particular object. All the
same, the scene graph needs quick access to the camera node, because just before ren-
dering the scene, the scene graph uses the camera location and orientation to set the
view transform you learned about in Chapter 14,
'
3D Graphics Basics.
I
'
ll show you
how that is done when I talk about the CameraNode class, in
A Simple Camera
later on in this chapter.
The interesting bit that you might not have seen before is a Direct3D matrix stack.
You
ve already seen that matrix concatenation is a common task in 3D graphics. Any
number of matrices could be multiplied, or concatenated, to create any bizarre and
twisted set of rotation and translation operations. In the case of a hierarchical
model like a human figure, these matrix concatenations can get tedious unless you
'
 
Search WWH ::




Custom Search