Sign in to follow this  
DarkZoulz

Order of data in vertex?

Recommended Posts

DarkZoulz    106
I want to load a mesh into a direct3dx mesh object and then be able to lock it's vertex buffer and get the data in it. For that to work I need to get the FVF that was used when building the vertex buffer, and that's no problem with GetFVF(). I get the total size of the FVF with D3DXGetFVFVertexSize(). But I would like to know in what order the data is in, so I can parse it. Any ideas?

Share this post


Link to post
Share on other sites
IFooBar    906
Vertex data that is compatible with the fixed function pipeline has it's elements arranged in the same order. So if the FVF had D3DFVF_XYZ then that would always be first, and textures would always be last. There used to be a page in the sdk docs about the order in which fvf data must be declared in, but I can't find it anymore. Off the top of my head however it's

xyz or xyzrhw (cant have both)
normal
point size
color
specular
tex coordinates

Share this post


Link to post
Share on other sites
Nik02    4348
While it is possible to calculate the component's offsets manually (like IFooBar said), D3DX already has a function for this purpose - D3DXDeclaratorFromFVF(). It returns an array of D3DVERTEXELEMENT9 structures, which contain comprehensive info about the vertex components, including their offsets.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this