Compute tangent, binormal, and normal vectors for a mesh.
HRESULT D3DXComputeTangentFrame( ID3DXMesh * pMesh, DWORD dwOptions );
Combination of one or more D3DXTANGENT flags.
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.
This function simply calls D3DXComputeTangentFrameEx with the following input parameters:
D3DXComputeTangentFrameEx(pMesh, D3DDECLUSAGE_TEXCOORD, 0, D3DDECLUSAGE_BINORMAL, 0, D3DDECLUSAGE_TANGENT, 0, D3DDECLUSAGE_NORMAL, 0, dwOptions | D3DXTANGENT_GENERATE_IN_PLACE, NULL, 0.01f, 0.25f, 0.01f, NULL, NULL);
Singularities are handled as required by grouping edges and splitting vertices. If any vertices need to be split, the function will fail. The computed normal vector at each vertex is always normalized to have unit length.
The most robust solution for computing orthogonal Cartesian coordinates is to not set flags D3DXTANGENT_ORTHOGONALIZE_FROM_U and D3DXTANGENT_ORTHOGONALIZE_FROM_V, so that orthogonal coordinates are computed from both UV texture coordinates. However, in this case, if either U or V is zero, then the function will compute orthogonal coordinates using D3DXTANGENT_ORTHOGONALIZE_FROM_V or D3DXTANGENT_ORTHOGONALIZE_FROM_U respectively.
Header: Declared in D3dx9mesh.h.