D3DXCreateMeshFVF call
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.
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:
Something like that ^^
Hope that helps.
ace
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 structstruct 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
//vertex structstruct 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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement