Graphics Reference
In-Depth Information
class
CPrimitiveControl :
public
CDialog {
// ... details related to MFC not shown ...
A:
void
SetPrimitive(UWB
_
Primitive
*
p);
// Sets the m
_
Primitive pointer at label
B
protected
:
B:
UWB
_
Primitive
*
m
_
Primitive;
// GUI event service functions would change
// the attributes referenced by this pointer
// ... GUI event service functions not shown ...
Source file.
PrimitiveControl.h
file
in the
Controls
folder of the
D3D
_
SceneTreeControl
project.
};
Listing 11.10.
The
CPrimitiveControl
class of Tutorial 11.5.
Control
. During the
CSceneTreeControl
construction, in the
OnInitDialog()
function at label C, the
BuildSceneTree()
function is called with the root node
of the model (the arm). This function builds the tree structure on the left of
Control()
functions are called to place the
XformInfoControl
and
Primitive
Control
into their respective placeholders in the
SceneTreeControl
.
The implementation of
CXformInfoControl
wasdiscussedinTutorial9.7
(p. 251).
CPrimitiveControl
is similar to
CXFormInfoControl
where an ap-
propriate GUI element is defined for each controllable attribute in a
UWB
_
Primitive
class. As illustrated in Listing 11.10, the user of the
CPrimitive
Control
class calls the
SetPrimitive()
function (label A) to set the
m
_
Primi
tive
pointer (label B). The GUI elements in the
PrimitiveControl
container
set the attributes of the primitive referenced by the
m
_
Primitive
pointer.
The
CSceneTreeControl
class will be reused in tutorials throughout the rest
of this topic.
11.3
Scene Trees and Scene Graphs
In general, a hierarchical model is a geometric model built based on generations of
transformation operators and primitives, where the user has independent control
over components in the model. In our case, with the functionality defined in the
SceneNode
class, a hierarchical model is simply a scene node hierarchy.
In the previous section, we introduced and worked with the
SceneNode
class
to abstract and become familiar with the functionality of a scene node. In this
section, we concentrate on the hierarchy that interconnects scene nodes. We will
see that the scene tree, a straightforward tree hierarchy of scene nodes, can easily
be constructed and maintained to model objects with independently controllable
Search WWH ::
Custom Search