Graphics Reference
In-Depth Information
Annex A: Sample Applications
A.1 OVERVIEW
The functionalities of the two sample applications used in the experiments described
in this topic are detailed below. They were used as the main rendering processes that
were modified for implementation of a closed-loop feedback control system.
A.2 PROGRESSIVEMESH SAMPLE *
This ProgressiveMesh sample shows how an application can use the D3DX progres-
sive mesh functionality to simplify meshes for faster rendering. It is a specialised mesh
object that can increase or decrease its geometry complexity, thereby providing flex-
ibility when drawing a mesh so that performance can be maintained at a steady level.
This feature is useful when providing LoD support. (Note: The simplification algorithm
used to generate progressive meshes is based on Hugues Hoppe's Siggraph papers.)
A.3 HOW SAMPLE WORKS
The functionalities of progressive meshes are provided by ID3DXPMesh. The mesh
interface is similar to ID3DXMesh with additional methods for managing complex-
ity. To generate a progressive mesh, call D3DXGeneratePMesh. The progressive
mesh can be used just like a regular mesh. To render it, a sample loops through its
materials and calls ID3DXBaseMesh::DrawSubset to send the geometry subset to
the device. To adjust the level of detail (LoD) of the progressive mesh, the sample
calls ID3DXPMesh::SetNumVertices and passes it the desired number of vertices.
A progressive mesh will simplify or enhance its geometry to match the number of
vertices as closely as possible.
The sample also shows an optimisation technique for progressive meshes by
trimming multiple meshes. Trimming limits the maximum and minimum num-
ber of vertices or faces a progressive mesh can have. The sample divides the range
(maximum to minimum) of the progressive mesh vertices into ten sub-ranges. After
the sub-ranges are computed, the sample creates ten progressive meshes by calling
ID3DXPMesh::ClonePMeshFVF on the original mesh. Then the sample calls
ID3DXPMesh::TrimByVertices on each progressive mesh using a different sub-range.
After setting the range of vertices, the sample calls ID3DXPMesh::Optimize-
BaseLOD to optimise the mesh vertex and index buffers. When a user changes the
vertex count, the new vertex count is checked against the range of the optimised
progressive mesh set, and the mesh whose range contains the desired vertex count is
selected by calling ID3DXPMesh::SetNumVertices.
* Documentation reproduced from Microsoft DirectX SDK 2009.
117
 
Search WWH ::




Custom Search