D3DXOptimizeVertices function

Generates an optimized vertex remapping for a triangle list. This function is commonly used after applying the face remapping generated by D3DXOptimizeFaces.

Syntax

HRESULT D3DXOptimizeVertices(
  _In_    LPCVOID pIndices,
  _In_    UINT    NumFaces,
  _In_    UINT    NumVertices,
  _In_    BOOL    Indices32Bit,
  _Inout_ DWORD   *pVertexRemap
);

Parameters

pIndices [in]

Type: LPCVOID

Pointer to triangle list indices to use for ordering vertices.

NumFaces [in]

Type: UINT

Number of faces in the triangle list.

NumVertices [in]

Type: UINT

Number of vertices referenced by the triangle list.

Indices32Bit [in]

Type: BOOL

Flag indicating index type: TRUE if indices are 32-bit (more than 65535 vertices), FALSE if indices are 16-bit (65535 or fewer vertices).

pVertexRemap [in, out]

Type: DWORD*

Pointer to a destination buffer that will contain the new index for each vertex. The value stored in pVertexRemap for a given element is the source vertex location in the new vertex ordering.

Return value

Type: HRESULT

If the function succeeds, the return value is D3D_OK. If the function fails, the return value can be one of the following: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

Remarks

By default, a mesh uses 16 bit indices when it is created unless the application specifies otherwise. To check whether an existing mesh uses 16-bit or 32-bit indices, call ID3DXBaseMesh::GetOptions and check for the D3DXMESH_32BIT flag.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

Mesh Functions