Graphics Reference
In-Depth Information
class
CModel {
// ... similar to Tutorial
11.5
...
UWB
_
SceneNode m
_
Body;
A:
// This is the body (base of root node of tree)
.
Source file.
Model.h/cpp
files in the
Model
folder of the
D3D
_
SceneNodeSiblings
project.
};
CModel::CModel() : m
_
Body("Body") {
// The
CModel
class constructor
.
// list for geometries of the body
UWB
_
PrimitiveList
*
pList =
new
UWB
_
PrimitiveList();
// Circle
C
b
0
UWB
_
PrimitiveCircle
*
pC =
new
UWB
_
PrimitiveCircle();
// Rectangle
R
b
1
UWB
_
PrimitiveRectangle
*
pR =
new
UWB
_
PrimitiveRectangle();
// initialize the attributes of
C
b
0
and
R
b
1
.
// insert
C
b
0
into the primitive list
B:
C:
pList->Append(pC);
// insert
R
b
1
into the primitive list
pList->Append(pR);
// pList is the primitive of mBody
m
_
Body.SetPrimitive(pLase);
// Instantiate left CArm object
D:
E:
CArm
*
left =
new
CArm(
vec3
(1.0f,4.0f,0.0f), "LeftArm");
// Instantiate the right CArm object
CArm
*
right =
new
CArm(
vec3
(1.0f,-4.0f,0.0f), "RightArm");
// left and right arms are set to be
m
_
Body.InsertChildNode(left);
// children of the m
_
Body
m
_
Body.InsertChildNode(right);
.
F:
}
Listing 11.11.
The
CModel
class of Tutorial 11.6.
the root scene node of the human model. The scene tree is initialized during the
construction of the
CModel
class. At label B, the primitive list, the head (circle
C
b
0
), and the torso (rectangle
R
b
1
) are allocated and initialized. At label C, the
Search WWH ::
Custom Search