Game Development Reference
In-Depth Information
Example call :
// Get the adjacency info of the non-optimized mesh.
DWORD adjacencyInfo[Mesh->GetNumFaces() * 3];
Mesh->GenerateAdjacency(0.0f, adjacencyInfo);
// Array to hold optimized adjacency info.
DWORD optimizedAdjacencyInfo[Mesh->GetNumFaces() * 3];
Mesh->OptimizeInplace(
D3DXMESHOPT_ATTRSORT |
D3DXMESHOPT_COMPACT |
D3DXMESHOPT_VERTEXCACHE,
adjacencyInfo,
optimizedAdjacencyInfo,
0,
0);
A similar method is the Optimize method, which outputs an opti-
mized version of the calling mesh object rather than actually optimizing
the calling mesh object.
HRESULT ID3DXMesh::Optimize(
DWORD Flags,
CONST DWORD* pAdjacencyIn,
DWORD* pAdjacencyOut,
DWORD* pFaceRemap,
LPD3DXBUFFER* ppVertexRemap,
LPD3DXMESH* ppOptMesh // the optimized mesh to be output
);
10.5 The Attribute Table
When a mesh is optimized with the D3DXMESHOPT_ATTRSORT flag,
the geometry of the mesh is sorted by its attribute so that the geome-
try of a particular subset exists as a contiguous block in the
vertex/index buffers (see Figure 10.3).
Search WWH ::




Custom Search