D3DXComputeTangent
Microsoft DirectX 9.0 SDK Update (October 2004)

D3DXComputeTangent Function


Computes the tangent vectors for the texture coordinates given in the texture stage.

Syntax

HRESULT WINAPI D3DXComputeTangent(      

    LPD3DXMESH Mesh,     DWORD TexStageIndex,     DWORD TangentIndex,     DWORD BinormIndex,     DWORD Wrap,     const DWORD *pAdjacency );

Parameters

Mesh
[in] Pointer to an ID3DXMesh interface that represent the input mesh.
TexStageIndex
[in] Index that represents the texture stage.
TangentIndex
[in] Index that provides the usage index for the tangent data. The vertex declaration implies the usage; this index modifies the usage with the usage index. For more information about a vertex declaration, see Vertex Declaration.
BinormIndex
[in] Index that provides the usage index for the binormal data. The vertex declaration implies the usage; this index modifies the usage with the usage index. For more information about a vertex declaration, see Vertex Declaration.
Wrap
[in] Set this value to 0 for no wrapping, or to 1 for wrapping in the U and V directions.
pAdjacency
[in] Pointer to an array of three DWORDs per face to be filled with adjacent face indices. The number of bytes in this array must be at least ((3 * ID3DXBaseMesh::GetNumFaces) * sizeof(DWORD)).

Return Value

If the function succeeds, the return value is D3D_OK.

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

D3DERR_INVALIDCALLThe method call is invalid. For example, a method's parameter may have an invalid value.
E_OUTOFMEMORYMicrosoft Direct3D could not allocate sufficient memory to complete the call.


Remarks

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.

Function Information

Headerd3dx9mesh.h
Import libraryd3dx9.lib
Minimum operating systems Windows 98


© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.