
// Calculate and cache the reciprocal value float fScale2 = 1.0f / ((T.x * B.y * N.z  T.z * B.y * N.x) + (B.x * N.y * T.z  B.z * N.y * T.x) + (N.x * T.y * B.z  N.z * T.y * B.x)); //float fScale2 = 1.0f;
// // Use the temporary T (Tangent), (B) Binormal, and N (Normal) vectors // to calculate the inverse of the tangent matrix that they represent. // The inverse of the tangent matrix is what we want since we need that // to transform the light's vector into tangentspace. //
//D3DXVECTOR3 vTemp;
(*vTangent).x = D3DXVec3Cross( &vTemp, &B, &N )>x * fScale2; (*vTangent).y = (D3DXVec3Cross( &vTemp, &N, &T )>x * fScale2); (*vTangent).z = D3DXVec3Cross( &vTempT, &B )>x * fScale2; D3DXVec3Normalize( &(*vTangent), &(*vTangent) );
(*vBiNormal).x = (D3DXVec3Cross( &vTemp, &B, &N )>y * fScale2); (*vBiNormal).y = D3DXVec3Cross( &vTemp, &N, &T )>y * fScale2; (*vBiNormal).z = (D3DXVec3Cross( &vTemp, &T, &B )>y * fScale2); D3DXVec3Normalize( &(*vBiNormal), &(*vBiNormal) );
(*vNormal).x = D3DXVec3Cross( &vTemp, &B, &N )>z * fScale2; (*vNormal).y = (D3DXVec3Cross( &vTemp, &N, &T )>z * fScale2); (*vNormal).z = D3DXVec3Cross( &vTemp, &T, &B )>z * fScale2; D3DXVec3Normalize( &(*vNormal), &(*vNormal) );
Above snip code is from sample: http://www.codesampler.com/dx9src.htm#dx9_dot3_bump_mapping
T, B, N is the Tangent , BiNoraml, Noraml vectors individual. Then what does this snip code means”£ The cross operation liks tranpose(inverse) the tangentworld Matix. Like:  T     B  >  T B N   N    then vTangent is the Marix”®s first col”£ vTangent == T! and vBiNoraml == B, vNormal == N; then , this snip code do nothing!
Is there anybody who has read the sample code can explain? Thanks!
