Jump to content
  • Advertisement
Sign in to follow this  
m4gnus

How to know which fvf codes are in a DWORD

This topic is 4613 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

Hi I've got a very simple problem: I'm trying to write a vertex class that holds vertices of all fvfs so i have a detection routine that checks which fvf codes are containend in the DWORD i pass to the function( that should be something direct3D does all the time) atm i do this with if((fvf & <FVF-CODE-TO-CHECK-FOR>)==<FVF-CODE-TO-CHECK-FOR>) and it works well except that this way the check for D3DFVF_TEX0 always returns true :(. D3DFVF_TEX0 has the value 00000000 and i don't know how to check if that fvf-code is contained in a DWORD!? i mean how can i decide if 0001 is (0000 | 0001) or just 0001 ? how does direct3d check for this fvf-code? regards, m4gnus

Share this post


Link to post
Share on other sites
Advertisement
D3DFVF_TEX0 just means that there is no Texture. If you look at D3DFVF_TEX1 or D3DFVF_TEX2, you will see that they are 0x100 and 0x200 respectively. All you should need to do is this:


DWORD fvf = (D3DFVF_DIFFUSE|D3DFVF_NORMALS|D3DFVF_TEX0);

if( fvf &D3DFVF_TEX0 )
{
//you have no textures
}



This should work no problems.

~guyaton

Share this post


Link to post
Share on other sites
TEX0 means the vertex contains no texture coordinates. The way to check for that is simple: If you can't find TEX1-8, then it's TEX0.

There are 2 very useful resources to use here:
1) D3DXDeclaratorFromFVF will save you the headache and give you a declaration from an FVF.
2) CrackFVF.cpp by InFramez demonstrates just what you want.

Share this post


Link to post
Share on other sites
Quote:
Original post by guyaton
if(fvf & D3DFVF_TEX0)
...
This should work no problems.

The problem, as stated by the OP, is that D3DFVF_TEX0 = 0. Therefore, the if condition will always fail (anything & 0 = 0).

Share this post


Link to post
Share on other sites
yeah...I forgot bout that [grin] ur idea should work, altho it is a pain to have to check for all the conditions just to find out that there aren't any textures.
~guyaton

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!