- poly->tangentSpaceTransform[ 0 ][ 2 ] = poly->normal[ 0 ];
- poly->tangentSpaceTransform[ 1 ][ 2 ] = poly->normal[ 1 ];
- poly->tangentSpaceTransform[ 2 ][ 2 ] = poly->normal[ 2 ];
- s = ( poly->tc[ 1 ].x - poly->tc[ 0 ].x ) * ( tc.y - poly->tc[ 0 ].y );
- s -= ( tc.x - poly->tc[ 0 ].x ) * ( poly->tc[ 1 ].y - poly->tc[ 0 ].y );
- s = 1.0f / s;
- temp1 = poly->verts[ 1 ] - poly->start;
- temp1 *= tc.y-poly->tc[0].y;
- temp2 = poly->verts[ 2 ] - poly->start;
- temp2 *= poly->tc[ 1 ].y -poly->tc[0].y;
- temp3 = temp1-temp2;
- temp3 *= s;
- temp3 = normalize(temp3)
- poly->tangentSpaceTransform[ 0 ][ 0 ] = temp1[ 0 ];
- poly->tangentSpaceTransform[ 1 ][ 0 ] = temp1[ 1 ];
- poly->tangentSpaceTransform[ 2 ][ 0 ] = temp1[ 2 ];
- temp1 = poly->verts[ 2 ] - poly->start;
- temp1 *= tc.x-poly->tc[0].x;
- temp2 = poly->verts[ 1 ] - poly->start;
- temp2 *= poly->tc[ 1 ].x -poly->tc[0].x;
- temp3 = temp1-temp2;
- temp3 *= s;
- temp3 = normalize(temp3)
- poly->tangentSpaceTransform[ 0 ][ 1 ] = temp1[ 0 ];
- poly->tangentSpaceTransform[ 1 ][ 1 ] = temp1[ 1 ];
- poly->tangentSpaceTransform[ 2 ][ 1 ] = temp1[ 2 ];