Game Development Reference
In-Depth Information
Chapter 11
Meshes Part II
In this chapter we continue our study of the mesh-related interfaces,
structures, and functions provided by the D3DX library. With the foun-
dation built in the last chapter, we can move on to more interesting
techniques, such as loading and rendering complex 3D models stored
on disk and controlling the level of detail of our meshes through the
progressive mesh interface.
Objectives
To learn how to load the data of an XFile into an ID3DXMesh object
To gain an understanding of the benefits of using progressive
meshes and how to use the progressive mesh interface—
ID3DXPMesh
To learn about bounding volumes, why they are useful, and how to
create them using the D3DX functions
11.1 ID3DXBuffer
A small reference to the ID3DXBuffer interface was made in the last
chapter, but we didn't elaborate on it. We see this interface throughout
our utilization of the D3DX library, and therefore a brief overview of
this interface is called for.
The ID3DXBuffer interface is a generic data structure that D3DX
uses to store data in a contiguous block of memory. It has only two
methods:
LPVOID GetBufferPointer(); —Returns a pointer to the start
of the data
DWORD GetBufferSize(); —Returns the size of the buffer in
bytes
To keep the structure generic, it uses a void pointer. This means that it
is up to us to realize the type of data being stored. For example,
D3DXLoadMeshFromX uses an ID3DXBuffer to return the adjacency
178
Search WWH ::




Custom Search