ID3DXBaseMesh::GenerateAdjacency method

Generate a list of mesh edges, as well as a list of faces that share each edge.

Syntax

HRESULT GenerateAdjacency(
  [in] FLOAT Epsilon,
  [in] DWORD *pAdjacency
);

Parameters

Epsilon [in]

Type: FLOAT

Specifies that vertices that differ in position by less than epsilon should be treated as coincident.

pAdjacency [in]

Type: DWORD*

Pointer to an array of three DWORDs per face to be filled with the indices of adjacent faces. The number of bytes in this array must be at least 3 * ID3DXBaseMesh::GetNumFaces * sizeof(DWORD).

Return value

Type: HRESULT

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 for better drawing performance.

The order of the entries in the adjacency buffer is determined by the order of the vertex indices in the index buffer. The adjacent triangle 0 always corresponds to the edge between the indices of the corners 0 and 1. The adjacent triangle 1 always corresponds to the edge between the indices of the corners 1 and 2 while the adjacent triangle 2 corresponds to the edge between the indices of the corners 2 and 0.

Requirements

Requirement Value
Header
D3DX9Mesh.h
Library
D3dx9.lib

See also

ID3DXBaseMesh

ID3DXMesh::Optimize

ID3DXMesh::OptimizeInplace