ID3DX10Mesh::Optimize method

Generates a new mesh with reordered faces and vertices to optimize drawing performance.

Syntax

HRESULT Optimize(
  [in]  UINT        Flags,
  [in]  UINT        *pFaceRemap,
  [out] LPD3D10BLOB *ppVertexRemap
);

Parameters

Flags [in]

Type: UINT

Specifies the type of optimization to perform. This parameter can be set to a combination of one or more flags from D3DXMESHOPT and D3DXMESH (except D3DXMESH_32BIT, D3DXMESH_IB_WRITEONLY, and D3DXMESH_WRITEONLY).

pFaceRemap [in]

Type: UINT*

An array of UINTs, one per face, that identifies the original mesh face that corresponds to each face in the optimized mesh. If the value supplied for this argument is NULL, face remap data is not returned.

ppVertexRemap [out]

Type: LPD3D10BLOB*

Address of a pointer to an ID3D10Blob Interface, which contains a DWORD for each vertex that specifies how the new vertices map to the old vertices. This remap is useful if you need to alter external data based on the new vertex mapping.

Return value

Type: HRESULT

The return value is one of the values listed in Direct3D 10 Return Codes.

Remarks

This method generates a new mesh. Before running Optimize, an application must generate an adjacency buffer by calling ID3DX10Mesh::GenerateAdjacencyAndPointReps. The adjacency buffer contains adjacency data, such as a list of edges and the faces that are adjacent to each other.

This method is very similar to the ID3DX10Mesh::CloneMesh method, except that it can perform optimization while generating the new clone of the mesh. The output mesh inherits all of the creation parameters of the input mesh.

Requirements

Requirement Value
Header
D3DX10.h
Library
D3DX10.lib

See also

ID3DX10Mesh

D3DX Interfaces