ID3DXPMesh::Optimize

Bb174108.XDK_CHM_BANNER_left(en-us,VS.85).jpgBb174108.XDK_CHM_BANNER_right(en-us,VS.85).jpg

NOTE: The ID3DXPMesh and ID3DXSPMesh interfaces are now obsolete and will be removed in a future release.

ID3DXPMesh::Optimize

Generates an output mesh with reordered faces and vertices to optimize performance.

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

Parameters

Flags
[in] 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 D3DXMESH32_BIT, D3DXMESH_IB_WRITEONLY, and D3DXMESH_WRITEONLY).
pAdjacencyOut
[out] Pointer to an array of three DWORDs per face that specifies the three neighbors for each face in the optimized mesh. If the edge has no adjacent faces, the value is 0xffffffff.
pFaceRemap
[out] An array of DWORDs, 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] Address of a pointer to an ID3DXBuffer 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.
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: D3DERR_INVALIDCALL, E_OUTOFMEMORY.

Remarks

After an application generates adjacency information for a mesh, the mesh data can be optimized (reordered) for better drawing performance. This method determines which patches are adjacent (within the provided tolerance).

Requirements

Header: Declared in D3DX9Mesh.h.

Library: Use D3dx9.lib.

See Also

ID3DXBaseMesh::GenerateAdjacency, ID3DXPMesh::OptimizeBaseLOD

Show: