Computes the tangent vectors for the texture coordinates given in the texture stage. Provided to support legacy applications. Use D3DXComputeTangentFrameEx for better results.
HRESULT D3DXComputeTangent( LPD3DXMESH Mesh, DWORD TexStageIndex, DWORD TangentIndex, DWORD BinormIndex, DWORD Wrap, CONST DWORD * pAdjacency );
If the function succeeds, the return value is S_OK. If the function fails, the return value can be one of the following: D3DERR_INVALIDCALL, D3DXERR_INVALIDDATA, E_OUTOFMEMORY.
If the mesh vertex declaration specifies tangent or binormal fields, D3DXComputeTangent will update any user-supplied tangent or binormal data. Alternatively, set TangentIndex to D3DX_DEFAULT to not update the user-supplied tangent data, or set BinormIndex to D3DX_DEFAULT to not update the user-supplied binormal data. TexStageIndex cannot be set to D3DX_DEFAULT.
D3DXComputeTangent depends on the mesh vertex declaration containing either the binormal field (BinormIndex), the tangent field (TangentIndex), or both. If both are missing, this function will fail.
This function simply calls D3DXComputeTangentFrameEx with the following input parameters:
D3DXComputeTangentFrameEx( Mesh, D3DDECLUSAGE_TEXCOORD, TexStageIndex, ( BinormIndex == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_BINORMAL, // provides backward function compatibility BinormIndex, ( TangentIndex == D3DX_DEFAULT ) ? D3DX_DEFAULT : D3DDECLUSAGE_TANGENT, TangentIndex, D3DX_DEFAULT, // do not store normals 0, ( Wrap ? D3DXTANGENT_WRAP_UV : 0 ) | D3DXTANGENT_GENERATE_IN_PLACE | D3DXTANGENT_ORTHOGONALIZE_FROM_U, pAdjacency, -1.01f, -0.01f, -1.01f, NULL, NULL);
Header: Declared in D3dx9mesh.h.