Graphics Reference
In-Depth Information
the entire object to be transformed with respect to the origin, and thus the
pivot of M 1 is located at
. Cylinder node is a child of the Base
node and thus is only affected by the M 1 transform.
(
0
,
0
,
0
)
2. The Top node is a child of the Base node. The M 2 transform of the Top
node only controls the descendent of this node. In this case, the pivot of
M 2 is set to be the tip of the cylinder base because we want the top of the
object to be transformed with respect to this position. All descendants of
the Top node ( Cone node) will inherit the concatenated M 2 M 1 transform.
The left of Figure 16.13 shows that the M xf 1 transform of the Cylinder node
transforms the cylinder mesh from its original position along the z -axis to the
standing position along the y -axis. In a similar fashion, the M xf 2 transform of
the Cone node transforms the cone mesh to the top of the standing cylinder. In
this case, despite all the scene node transforms being visible (and manipulatable)
via the GUI SceneTreeControl , only the transforms associated with the Base
( M 1 )and Top nodes ( M 2 ) are designed for the user to manipulate the hierarchy.
The transforms associated with the Cylinder ( M xf 1 )andthe Cone ( M xf 2 ) nodes
are required to place the corresponding meshes in their initial positions and are
not meant to be manipulated by the user. We can verify the effects of M 1 and
M 2 by selecting the Base and Top nodes and manipulating transformation sliders.
Listing 16.21 shows the implementation that builds the hierarchy of Figure 16.13.
The memory of the four scene nodes is allocated at label A. The parent-child
relationships of these nodes are organized at label B. At label C and label D, the
M xf 1 and M xf 2 transforms are computed and loaded into the Cylinder and Cone
nodes, respectively. Finally, at label E, the M 2 pivot is set to be the top of the
cylinder.
16.5
Scene Graph and Orientation
As in the case of a 2D scene hierarchy, when computing a scene node position in
the WC, we must consider all of its ancestors' transforms. In addition, for a 3D
hierarchy, it is often convenient to compute the orthonormal basis of a node when
we need to resolve orientation.
Tutorial 16.7.
Project Name:
D3D _ SceneGraphIn3D
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib17
Tutorial 16.7. Scene Graph and Orientation in 3D
Goal. Demonstrate a simple approach to compute the orthonormal basis
for a scene node in a scene hierarchy.
Search WWH ::




Custom Search