Jump to content
  • Advertisement
Sign in to follow this  
hero79

D3DXCreateMeshFVF call

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

Hi, i`d like to make ASE loader for directx, but i don`t know, how to create mesh to store vertices, faces, normals and texture coords. Because, in CreateMesh call is DWORD FVF parameter, but i don`t know, which compatible directx structures i need to create. Could anybody supply me with structures, which i need to define to load ase model ? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
The FVF is a combination of one or more of the following flags:

D3DFVF_DIFFUSE Vertex format includes a diffuse color component. DWORD in ARGB order. See D3DCOLOR_ARGB.

D3DFVF_NORMAL Vertex format includes a vertex normal vector. This flag cannot be used with the D3DFVF_XYZRHW flag.

D3DFVF_PSIZE Vertex format specified in point size. This size is expressed in camera space units for vertices that are not transformed and lit, and in device-space units for transformed and lit vertices.

D3DFVF_SPECULAR Vertex format includes a specular color component. DWORD in ARGB order. See D3DCOLOR_ARGB.

D3DFVF_XYZ Vertex format includes the position of an untransformed vertex. This flag cannot be used with the D3DFVF_XYZRHW flag.

D3DFVF_XYZRHW Vertex format includes the position of a transformed vertex. This flag cannot be used with the D3DFVF_XYZ or D3DFVF_NORMAL flags.

D3DFVF_XYZB1 through D3DFVF_XYZB5 Vertex format contains position data, and a corresponding number of weighting (beta) values to use for multimatrix vertex blending operations. Currently, Microsoft Direct3D can blend with up to three weighting values and four blending matrices. For more information about using blending matrices, see Indexed Vertex Blending. 1, 2, or 3 floats. When D3DFVF_LASTBETA_UBYTE4 is used, the last blending weight is treated as a DWORD.
D3DFVF_XYZW Vertex format contains transformed and clipped (x, y, z, w) data. ProcessVertices does not invoke the clipper, instead outputting data in clip coordinates. This constant is designed for, and can only be used with, the programmable vertex pipeline.

.. taken from the SDK.

You basically have to provide a combination of this by or'ing them together ( use '|' symbol). If you have a vertex buffer full of vertices that you want to copy into this mesh object then you would provide the same FVF for this object as you did when you made the vertex buffer.

An example:


//vertex struct
struct vertex
{
float x, y, z; //location
float r, g, b; //color
};

#define VERTEX_FVF (D3DFVF_XYZ|D3DFVF_DIFFUSE)

LPD3DXMESH myMesh;
D3DXCreateMeshFVF( 10, 10, D3DXMESH_MANAGED, VERTEX_FVF, device, &myMesh );




Something like that ^^

Hope that helps.

ace

Share this post


Link to post
Share on other sites

//vertex struct
struct vertex
{
D3DXVECTOR3 pos;
D3DXVECTOR3 norm;
};

#define VERTEX_FVF (D3DFVF_XYZ|D3DFVF_NORMAL)

LPD3DXMESH myMesh;
D3DXCreateMeshFVF( 10, 10, D3DXMESH_MANAGED, VERTEX_FVF, device, &myMesh );




You dont include faces in any way. Faces are made up of 3 of these.

ace

Share this post


Link to post
Share on other sites
And if i want to use texture coordinates, then i need to use :

#define D3D_VERTEX_FVF (D3DFVF_XYZ | D3DFVF_DIFFUSE | D3DFVF_NORMAL | D3DFVF_TEX1)

as final and update structure above

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!