Jump to content
  • Advertisement
Sign in to follow this  
jujumbura

Simple question about custom FVF's

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

Hullo hullo, So I've been pouring through all the DirectX tutorials I can find, and one thing that still boggles me about the basics is the way DirectX takes custom FVF's for custom-defined vertices. What seems to happen is that there is a definition of a struct somewhere which includes position, normals, colors, texture coordinates, etc. Then there is an FVF flag #defined to be all of the D3D flags which represent that data OR'd together. So what I'm wondering is this: how does DirectX know in what order the different vertex data is going to come? There's no difference between A | B | C and C | B | A, so how does it work? Are you required to always specifiy the data in a particular order if you're going to use it? I've been scratching my head over this for a while. Thanks much for any help clearing this up. Mike

Share this post


Link to post
Share on other sites
Advertisement
I think the standard is the following order for the vertex data:

VERTICES
NORMALS
TEXTURE COORDINATES

This is assuming each of these is included in the FVF Definition.
You can get the info by doing this


unsigned short fvf = mesh->GetFVF();
int fvfSize = D3DXGetFVFVertexSize(fvf) / sizeof(float);

if(fvf & D3DFVF_NORMAL)
// do something

if(fvf & D3DFVF_TEX1)
// do something





Share this post


Link to post
Share on other sites
The DX8 docs had a wonderful diagram showing the layout, but they seem to have removed it in DX9 (guess they want us to use decls instead. bah..). Let me see..

Here it is.



Note that most of the elements are optional; you just have to follow this order.

[smile]

edit: are there image tags for this forum? [img] doesn't work, and I can't find anything in the FAQ about it.

[Edited by - Coder on August 10, 2005 8:29:12 AM]

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!