Microsoft DirectX 8.1 (C++)

D3DXComputeTangent

Computes a per vertex coordinate system based on texture coordinate gradients.

HRESULT D3DXComputeTangent(
  LPD3DXMESH InMesh,
  DWORD      TexStage,
  LPD3DXMESH OutMesh,
  DWORD      TexStageUVec,
  DWORD      TexStageVVec,
  DWORD      Wrap,
  DWORD*     pAdjacency
);

Parameters

InMesh
[in] Pointer to an ID3DXMesh interface, representing the input mesh.
TexStage
[in] Texture coordinate set in input mesh to use for gradients.
OutMesh
[out] Pointer to an ID3DXMesh interface, representing the returned mesh.
TexStageUVec
[in] Texture coordinate set in output mesh to receive U tangent vector. Set this value to D3DX_COMP_TANGENT_NONE if you do not want to generate a U tangent vector.
TexStageVVec
[in] Texture coordinate set in output mesh to receive V tangent vector. Set this value to D3DX_COMP_TANGENT_NONE if you do not want to generate a V tangent vector.
Wrap
[in] Set this value to 0 for no wrapping or 1 to wrap in the U and V directions.
pAdjacency
[out] Pointer to an array of three DWORDs per face that specify the three neighbors for each face in the created mesh.

Return Values

If the function succeeds, the return value is D3D_OK.

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

D3DERR_INVALIDCALL
E_OUTOFMEMORY

Remarks

Setting both TexStageVVec and TexStageWVec to D3DX_COMP_TANGENT_NONE will cause this method to fail, since it has nothing to do.

Requirements

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