Microsoft DirectX 8.1 (C++)

ID3DXPMesh::Optimize

Controls the reordering of mesh faces and vertices to optimize performance, generating an output mesh.

HRESULT Optimize(
  DWORD Flags,
  DWORD* pAdjacencyOut,
  DWORD* pFaceRemap,
  LPD3DXBUFFER* ppVertexRemap,
  LPD3DXMESH* ppOptMesh
);

Parameters

Flags
[in] A combination of one or more flags from the D3DXMESHOPT enumeration, specifying the type of optimization to perform.
pAdjacencyOut
[out] Pointer to a destination buffer for the face adjacency array of the optimized mesh. The face adjacency is stored as an array of arrays. The innermost array is three indices of adjacent triangles, and the outer array is one set of face adjacency per triangle in the mesh. The size of this array is the maximum number of faces multiplied by 3.
pFaceRemap
[out] Pointer to a destination buffer containing the new index for each face.
ppVertexRemap
[out] Address of a pointer to an ID3DXBuffer interface; containing the new index for each vertex.
ppOptMesh
[out] Address of a pointer to an ID3DXMesh interface, representing the optimized mesh.

Return Values

If the method succeeds, the return value is D3D_OK.

If the method fails, the return value can be one of the following values.

D3DERR_INVALIDCALL
E_OUTOFMEMORY

Requirements

  Header: Declared in D3dx8mesh.h.
  Import Library: Use D3dx8.lib.