Graphics Reference
In-Depth Information
CModel::CModel() {
// Create a Mesh Primitive
Source file.
Model.cpp
file
in
the
Model
folder
of
the
UWBD3D
_
PrimitiveMesh
*
tigerMesh=
new
UWBD3D
_
PrimitiveMesh(L"tiger.x");
UWB
_
SceneNode
*
pTigerMeshNode=
new
UWB
_
SceneNode(L"tiger mesh");
// mesh primitive behaves like a simple UWB
_
Primitive
A:
D3D
_
MeshSupport
project.
B:
pTigerMeshNode->SetPrimitive(tigerMesh);
m
_
root
_
node.InsertChildNode( pTigerMeshNode );
.
Listing 16.7.
Constructor of
CModel
in Tutorial 16.1.
by simply manipulating the corresponding scene node transformation operators.
As anticipated, in Tutorial 16.1, with the
tiger
_
mesh
scene node selected, we
can manipulate the tiger primitive just as any other primitive.
Tutorial 16.2.
Project Name:
D3D
_
CompoundMesh
Library Support:
UWB
_
MFC
_
Lib1
UWB
_
D3D
_
Lib15
Tutorial 16.2. Working with a Composite Mesh Object
•
Goal.
Demonstrate working with the
AxisMesh
class.
•
Approach.
Implement a simple program that works with an
AxisMesh
object.
Figure 16.4 is a screenshot of running Tutorial 16.2. This tutorial is identical to
Tutorial 16.1 except for the 3D-looking orthonormal basis. Listing 16.8 shows
the constructor of the
CModel
class for Tutorial 16.2. In this case, the scene node
that references the orthonormal basis is inserted as a child node of the tiger node.
This is to reaffirm that after the initial instantiation, the new D3D-specific mesh
primitives can be used in exactly the same manner as all other primitives we have
worked with previously, and they behave in exactly the same manner.
Figure 16.4.
Tutorial
16.2.
CModel::CModel() {
.
Source file.
Model.cpp
file
in the
Model
folder of the
D3D
_
CompoundMesh
project.
// scene node
UWB
_
SceneNode
*
pAxisNode =
new
UWB
_
SceneNode( L"axis frame" );
// a primitive
UWBD3D
_
PrimitiveMeshAxis
*
pMeshAxis =
new
UWBD3D
_
PrimitiveMeshAxis();
// set scene node primitive
pAxisNode->SetPrimitive( pMeshAxis );
.
Listing 16.8.
Constructor of
CModel
in Tutorial 16.2.
Search WWH ::
Custom Search