• Create Account

## D3DXComputeTangentFrameEx help to decipher documentation

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

2 replies to this topic

### #1belfegor  Members

Posted 22 June 2012 - 12:38 PM

I just need someone to help me decipher one parameter for D3DXComputeTangentFrameEx function from documentation

Combination of one or more D3DXTANGENT flags that specify tangent frame computation options. If NULL, the following options will be specified:
... bla, bla & !( D3DXTANGENT_WEIGHT_BY_AREA | D3DXTANGENT_WEIGHT_EQUAL )
...
...

1. It says if NULL below flags will be specified, then whats the meaning of '&' (and) and '!' (not) infront of flags? Will it be or not i am confused?

2. I dont want it to compute normals as i did myself, so should i specify all flags except D3DXTANGENT_CALCULATE_NORMALS?

### #2SHilbert  Members

Posted 23 June 2012 - 02:07 AM

Geez, that is some poorly worded documentation.

I think what it is saying is that if you pass NULL, then you get the situation described in the description column. As for the second column, I think the & !( ... ) is a horribly poor way of saying "bitwise anded with the bitwise inverse of ...." -- kind of weird they used ! instead of ~. That explains why "Vertices are ordered in a counterclockwise direction around each triangle." is next to "& !( D3DXTANGENT_WIND_CW )" -- D3DXTANGENT_WIND_CW is not set, so the ordering must be counterclockwise.

So basically none of the flags mentioned in that column are set by default. All of the flags have a nonzero value, so if you pass NULL for the flags value you will of course have provided none of the flags.

I don't think you want to specify all the flags since some of them are mutually exclusive, but I don't know what to recommend specifically. It does sound like you want to avoid passing D3DXTANGENT_CALCULATE_NORMALS though.

### #3MJP  Moderators

Posted 23 June 2012 - 04:46 PM

I dug up this code that I used to use to generate tangents for a mesh that already has normals and texture coordinates:
D3DXComputeTangentFrameEx(clonedMesh, D3DDECLUSAGE_TEXCOORD, 0,
D3DDECLUSAGE_TANGENT, 0, D3DDECLUSAGE_BINORMAL, 0,