Jump to content
  • Advertisement
Sign in to follow this  
tcige

where can i find the D3DFVF format

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

there's only float on msdn, but no variable name and what float means, where can i find the detail of all kinds of D3DFVF format

 

yes, directx books have the info, but how do they get it, did sb reverse the detail format?

Share this post


Link to post
Share on other sites
Advertisement

What float variable name, I am not sure I understand your question actually.

 

Generally you do something like this

 

struct CustomVertex
{
    float x, y, z; //position
    float nx, ny, nz; //normal
    float u, v; //texture coordinates
};

DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0 |
              D3DFVF_TEXCOORDSIZE2(0);
Edited by NightCreature83

Share this post


Link to post
Share on other sites

What float variable name, I am not sure I understand your question actually.

 

Generally you do something like this

 

struct CustomVertex
{
    float x, y, z; //position
    float nx, ny, nz; //normal
    float u, v; //texture coordinates
}

DWORD CustomVertexFVF |= D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0 |
              D3DFVF_TEXCOORDSIZE2(0);

 

the float variable name is x, y, z in this structure

 

where does this structure come from, i can not find it on msdn

 

you know, when i program, i only go msdn

Share this post


Link to post
Share on other sites

You have to define this structure yourself, the DX SDK will not define this for you as it wouldn't know what needs you have for your vertex structure. Mesh data is very specific to the project it is being used in and some projects use position, normal, tangent and a couple of texture coordinate sets and others leave out the tangent data and calculate that in the shader.

 

What goes into the vertex buffer in the end is up to you. I could also have used this as the CustomVertex structure

 

struct CustomVertexColor
{
    float x, y, z; //position
    float nx, ny, nz; //normal
    DWORD diffuse; //Diffuse color
    float u, v; //texture coordinates
};
 
DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);

 

The thing is I remember that you need to be careful with the order in the struct and FVF, I haven't used the Fixed Function pipeline in years so this information is a bit hazy.

 

Using VERTEXELEMENT9 and the D3D11 equivalents of this are far easier to manage as you are literally telling the vertex buffer how it has been laid out and you could potentially put the normal in front of the position if you wanted to.

Edited by NightCreature83

Share this post


Link to post
Share on other sites

You create that structure. And you choose what you put there because you (should) know what data you need for each verticle.

For example in tcige's code, his structure says that he wants position of each vertex (x, y, z), normal vector of each vertex (nx, ny, nz) and one set of texture coordinates of each vertex (u, v).

The FVF value must correspond to this, so it this case it is D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0.

On the msdn page that NightCreature83 linked to, you can see what number and data types of variables does each of the FVF types need, for example "float,float,float" for  D3DFVF_XYZ. So, your structure must contain three float values (names are up to you, something like x, y, z is common).

 

Of course this is just the definition of the structure of your vertices. Next step is to fill them with actual data. But that's another story.

Edited by Tom KQT

Share this post


Link to post
Share on other sites

where can i find the detail of all kinds of D3DFVF format

 

directx 8 docs.

 

i've got a copy of the chart you need, but gamedev.net's editor can't paste it into this post, i'll try uploading it to my gallery or journal.

Edited by Norman Barrows

Share this post


Link to post
Share on other sites

You have to define this structure yourself, the DX SDK will not define this for you as it wouldn't know what needs you have for your vertex structure. Mesh data is very specific to the project it is being used in and some projects use position, normal, tangent and a couple of texture coordinate sets and others leave out the tangent data and calculate that in the shader.

 

What goes into the vertex buffer in the end is up to you. I could also have used this as the CustomVertex structure

 

struct CustomVertexColor
{
    float x, y, z; //position
    float nx, ny, nz; //normal
    DWORD diffuse; //Diffuse color
    float u, v; //texture coordinates
};
 
DWORD CustomVertexFVF = D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_DIFFUSE | D3DFVF_TEX0 |
D3DFVF_TEXCOORDSIZE2(0);

 

The thing is I remember that you need to be careful with the order in the struct and FVF, I haven't used the Fixed Function pipeline in years so this information is a bit hazy.

 

Using VERTEXELEMENT9 and the D3D11 equivalents of this are far easier to manage as you are literally telling the vertex buffer how it has been laid out and you could potentially put the normal in front of the position if you wanted to.

 

 

thanks a lot

 

i do not mean that, for example, the texture

 

how can i known what addictional info needs in the structure except xyz

Share this post


Link to post
Share on other sites

You create that structure. And you choose what you put there because you (should) know what data you need for each verticle.

For example in tcige's code, his structure says that he wants position of each vertex (x, y, z), normal vector of each vertex (nx, ny, nz) and one set of texture coordinates of each vertex (u, v).

The FVF value must correspond to this, so it this case it is D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX0.

On the msdn page that NightCreature83 linked to, you can see what number and data types of variables does each of the FVF types need, for example "float,float,float" for  D3DFVF_XYZ. So, your structure must contain three float values (names are up to you, something like x, y, z is common).

 

Of course this is just the definition of the structure of your vertices. Next step is to fill them with actual data. But that's another story.

 

yeah, why needs u,v for texture, that's what i want to know

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!