• Advertisement
Sign in to follow this  

D3DXComputeTangentFrameEx help to decipher documentation

This topic is 2037 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I just need someone to help me decipher one parameter for D3DXComputeTangentFrameEx function from [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb172745%28v=vs.85%29.aspx"]documentation [/url]

[quote]
Combination of one or more [url="http://msdn.microsoft.com/en-us/library/windows/desktop/bb205467%28v=vs.85%29.aspx"][b]D3DXTANGENT[/b][/url] flags that specify tangent frame computation options. If [b]NULL[/b], the following options will be specified:
... bla, bla & !( D3DXTANGENT_WEIGHT_BY_AREA | D3DXTANGENT_WEIGHT_EQUAL )
...
...
[/quote]

1. It says if NULL below flags will be specified, then whats the meaning of '[b]&[/b]' (and) and '[b]![/b]' (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?

Thanks for your time.

Share this post


Link to post
Share on other sites
Advertisement
Geez, that is some poorly worded documentation.

I [i]think[/i] 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 [i]not[/i] set, so the ordering must be counterclockwise.

So basically [i]none [/i]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.

Share this post


Link to post
Share on other sites
I dug up this code that I used to use to generate tangents for a mesh that already has normals and texture coordinates:
[code]
D3DXComputeTangentFrameEx(clonedMesh, D3DDECLUSAGE_TEXCOORD, 0,
D3DDECLUSAGE_TANGENT, 0, D3DDECLUSAGE_BINORMAL, 0,
D3DX_DEFAULT, 0, D3DXTANGENT_GENERATE_IN_PLACE, &adjacency[0],
-1.01f, -0.01f, -1.01f, NULL, NULL);
[/code] Edited by MJP

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement