Graphics Reference
In-Depth Information
class CModel {
// ... similar to Tutorial 11.2
Source file. Model.h/cpp
files in the Model folder of the
D3D _ SceneNode project.
...
.
UWB _ SceneNode m _ scene; // This is the arm
// Draw all of the geometry that is part of this model.
void DrawModel();
A:
};
CModel::CModel() ... // Constructor
// Allocate memory for R a 0
UWB _ PrimitiveRectangle * pRectangle = new UWB _ PrimitiveRectangle();
.
// Set the geometric information of R a 0 (pRectangle)
// m _ scene->m _ pPrimitive = R a 0
m _ scene.SetPrimitive(pRectangle);
// SceneNode for the palm
B:
UWB _ SceneNode * pChildNode = new UWB _ SceneNode();
// Allocate memory for C p 0
UWB _ PrimitiveCircle * pCircle = new UWB _ PrimitiveCircle();
.
// Set the geometric information of C p 0 (pCircle)
// pChildNode->m _ pPrimitive = pCircle
pChildNode->SetPrimitive( pCircle );
// Set pChildeNode into m _ scene->m _ child _ node array
C:
m _ scene.InsertChildNode( pChildNode );
.
D:
void CModel::DrawModel()
// Draws the SceneNode hierarchy
m _ scene.Draw(lod, m _ DrawHelper);
.
E:
Listing 11.5. The CModel class of Tutorial 11.3.
of m _ scene . At label C, the child scene node pChildNode and circle C p 0 are
allocated and appropriately initialized. At label D, pChildNode is set to become
a child node of m _ scene . In this way, as illustrated in Figure 11.6, m _ scene
references the arm geometry ( R a 0 ) and has the transformation operator ( M a )that
controls the entire arm. The child of m _ scene references the palm geometry ( C p 0 )
and has the transformation operator that controls only the palm object.
Search WWH ::




Custom Search