#### Archived

This topic is now archived and is closed to further replies.

# FVF question

## Recommended Posts

Being new to DirectX programming, I have a couple questions In the help files referencing defining a custom vertex type there is the following code followed by my tentative version:
    struct CUSTOMVERTEX
{
FLOAT x, y, z, rhw; // The transformed position for the vertex.

DWORD color;        // The vertex color.

};

#define D3DFVF_CUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)

//Or can it be like this?

struct MYCUSTOMVERTEX
{
FLOAT myx, myy, myz, myrhw; // The transformed position for the vertex.

DWORD mycolor;        // The vertex color.

};
//Do I need to change the #define statement too?

#define D3DFVF_MYCUSTOMVERTEX (D3DFVF_XYZRHW|D3DFVF_DIFFUSE)


Is what I did in the bottom half of that code legal or neccessary? The second part to my question is: My "source" for the vertices is going to be read out of a running 3D modelling application. As far as the DirectX end of the operation is concerned, I could be reading them out of a file. What functions should I look at in the DX8 SDK helpfiles that would help me group the vertices into the different models I would be importing, and then getting them ready to render in my DX interface? Thanks, [edited by - matthewb on December 24, 2002 2:58:26 PM]

##### Share on other sites
So ... what''s the question?

##### Share on other sites
First of all, if I understood your first question right, the lower part of that code is legal but unnecessary (since the two are the same). The reason why you want to have multiple FVFs is when they differ, i.e some only have position, some have position and color etc, so you could define all possible FVFs and then use them wherever you like (instead of having something like D3DFVF_PLAYER and D3DFVF_ENEMY when they are the same). Also, dunno if you asked this, your FVF doesn''t need to have the same name as the struct. As for the second question, I''m not sure on that either. I think you should look up "D3DXLoadMeshFromX" for loading .x files (model files).

Merry christmas!

• ### Forum Statistics

• Total Topics
628312
• Total Posts
2981998

• 9
• 9
• 13
• 11
• 13