Simple question about custom FVF's
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
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
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 somethingif(fvf & D3DFVF_TEX1) // do something
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]
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]
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement