?/TD>
Microsoft DirectX 9.0

D3DXComputeTangent Function


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

Syntax

HRESULT D3DXComputeTangent(      

    LPD3DXMESH InMesh,     DWORD TexStageIndex,     DWORD TangentIndex,     DWORD BinormIndex,     DWORD Wrap,     DWORD* pAdjacency );

Parameters

InMesh
[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 usage indexes, see Decoupling Vertex Shaders and Vertex Declarations.
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 usage indexes, see Decoupling Vertex Shaders and Vertex Declarations.
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 values.

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 = D3DXDefault to not update the user-supplied tangent data, and set BinormIndex = D3DXDefault to not update the user-supplied binormal data. TexStageIndex cannot be set to D3DXDefault.

D3DXComputeTangent depends on the mesh vertex declaration containing either the binormal field, the tangent field, or both. If both are missing, this function will fail.

Function Information

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


© 2002 Microsoft Corporation. All rights reserved.