I'm trying to read 3D models which were created for a DirectX applications, which are defined in the following way :
- In the file header, the Flexible Vertex Format (FVF) of the mesh is given (actually, I have any combinations of D3DFVF_{XYZ,DIFFUSE,NORMAL,TEX1,TEX2} in the meshes I tested)
- Then,
n
vertices are given in a linear pattern, with the fields presents according to the FVF.
However, I do not know the order of these fields. The logic would be that it is defined somewhere in DirectX documentation, but I was unable to find it. For example, which of these two structures is correct with FVF = D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL
(C syntax, but this problem applies to every language) ?
// This one ?
struct vertex1
{
D3DVERTEX pos;
DWORD color;
D3DVERTEX normal;
};
// Or this one ?
struct vertex2
{
D3DVERTEX pos;
D3DVERTEX normal;
DWORD color;
};
I would like a general answer to this question with all the possible fields (for example, XYZ before DIFFUSE before NORMAL before TEX1 before TEX2
). A pointer to the right page of the documentation would be fine too as I was not able to find it :) .