Graphics Reference
In-Depth Information
class UWBD3D _ PrimitiveMeshAxis : public UWB _ Primitive {
.
Source file.
uwbgl _ D3DPrimitiveAxis1.h
file in the D3D Files/
D3D_Primitives
// physical representations of each arrow
subfolder
UWBD3D _ PrimitiveMeshArrow m _ xaxis;
UWBD3D _ PrimitiveMeshArrow m _ yaxis;
UWBD3D _ PrimitiveMeshArrow m _ zaxis;
A:
UWBGL _ D3D _ Lib15
of
the
project.
};
Listing 16.6. Representing the orthonormal basis with three arrows.
orient the drawing of the cylinder and cone mesh objects such that the resulting
image resembles an arrow. Here we see that there is actually no internal physical
data representing the MeshArrow object. The appearance of the arrow depends
entirely on the cylinder.x and mesh.x files. Listing 16.6 shows the definition
of three MeshArrow objects representing the three major axes in an orthonormal
basis. This example shows an alternative approach to representing mesh objects.
Instead of accessing and transforming each individual mesh resources at drawing
time, in this case, physical data is defined.
The MeshArrow and MeshAxis classes reaffirm that physical representation
of data internal to our program is independent of the graphical rendition of the
objects for the user. Representations internal to our program should be based
on design guidelines for our system. For example, with no physical memory re-
quirement, the MeshArrow approach of accessing data at drawing time optimizes
the program's memory footprint. However, the associated cost is the processing
requirements of computing transformation during drawing time.
Tutorial 16.1.
Project Name:
D3D _ MeshSupport
Library Support:
UWB _ MFC _ Lib1
UWB _ D3D _ Lib15
Tutorial 16.1. Working with Simple Meshes
Goal. Demonstrate working with the new PrimitiveMesh class.
Approach. Implement a simple program with a PrimitiveMesh object.
Figure 16.3 is a screenshot of running Tutorial 16.1. This tutorial is almost ex-
actly the same as the ones from the previous chapter. The only difference here is
the tiger.x mesh object. Listing 16.7 shows the constructor for the CModel class
for this tutorial. At label A, a tigerMesh primitive object is created based on the
corresponding mesh file name (the tiger.x file name). After the instantiation,
the resulting primitive reference can be used just like any other UWB_Primitive
references. At label B, the tigerMesh primitive is referenced by a SceneNode
object. This means that we should be able to control the transformation of the tiger
Figure 16.3.
Tutorial
16.1.
 
Search WWH ::




Custom Search