Graphics Reference
In-Depth Information
This tutorial demonstrates how to subclass from the
SceneNode
class to create
general
graphical objects that can be reused. As will be demonstrated in later
tutorials, we can instantiate multiple
CArm
objects in more complex graphical
models.
Tutorial 11.5. The
SceneTreeControl
GUI Object
Tutorial 11.5.
Project Name:
D3D
_
SceneNodeMultiPrim
Library Support:
UWB_MFC_Lib1
UWB_D3D_Lib11
•
Goal.
Demonstrate that it is possible to include multiple primitives in a
SceneNode
and examine the effects of changing transformation parameters
in a scene node hierarchy.
•
Approach.
Increase the primitive complexity of the arm's model and in-
troduce the
CSceneTreeControl
class to support general user interaction
with scene nodes.
Figure 11.7 is a screenshot of running Tutorial 11.5. Compared to the previous
tutorial, the two main differences are: (1) the more complex arm/palm design, and
(2) the more elaborate user interface.
Figure 11.7.
Tutorial
Figure 11.8 shows the detailed design of the arm/palm objects of this tutorial.
In this case, the palm object consists of two primitives (
C
p
0
,
R
p
1
), and the arm
object has three primitives (
R
a
0
,
R
a
1
,
R
a
2
).
11.5.
R
a2
R
a1
Figure 11.9 shows the
SceneNode
R
p1
P
a
implementation of the design.
With the scene node hierarchy from Figure 11.9, this tutorial implements the
SceneTreeControl
GUI container to support user interaction with the different
scene nodes and primitives. As illustrated in Figure 11.10, the
SceneTreeControl
itself contains two GUI containers, the
PrimitiveControl
and
XformInfo
Control
. Together, these GUI containers support the following
R
a0
C
p0
Figure 11.8.
Design of
the arm of Tutorial 11.5.
•
Selection of
SceneNode
.
Displays the tree structure of a
SceneNode
.A
user can click on any of the nodes in the displayed tree structure to select a
current
SceneNode
.
Arm
M
a
Xform
V
PrimList
Child SN
R
a0
R
a1
R
a2
•
Selection of primitive.
Allows a user to select a current primitive from the
primitive list of the currently selected
SceneNode
by scrolling the slider bar
at the bottom of the
SceneTreeControl
.
M
p
Palm
Xform
V
PrimList
Child SN
R
p1
C
p0
C
•
Control of transformation.
Through the
XformInfoControl
GUI con-
tainer, controls the
XformInfo
transformation operator of the selected
Scene
Node
.
Figure 11.9.
SceneNode
structure for Tutorial 11.5.
•
Control of primitive attributes.
Through the
PrimitiveControl
GUI
container, controls the attributes of the selected primitive.
Search WWH ::
Custom Search