struct gVertex
{
Vertex() {}
Vertex(float x, float y, float z)
{
x = x;
y = y;
z = z;
}
D3DCOLOR Diffuse;
D3DCOLOR Specular;
float x, y, z;
float nx, ny, nz;
float u, v;
}
#define FVF_GVERTEX (D3DFVF_DIFFUSE | D3DFVF_SPECULAR | D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEX1 )
Universal FVF
I thought this too simple a question to put in the directX section, but is this a "Universal" FVF? By Universal can I pretty much do anything 3d with this? Or does it have conflicting members?
I don't want to have a flexible FVF, I would rather just hard code one FVF that can do anything. Even at the cost of some memory ineffiency.
Anyway, here is my FVF:
It depends on what your planning on doing, graphically. That FVF will not support multi-texturing or binormal and tangent information (for bump-mapping in tangent space), but should be sufficient for a basic 3D game.
Edit: There are also time when you may want to supply x, y, z, and w coords for your objects. You appear to be set on just using one FVF, but I would really recommend having multiple FVFs, since different objects may need very different sets of information.
Edit: There are also time when you may want to supply x, y, z, and w coords for your objects. You appear to be set on just using one FVF, but I would really recommend having multiple FVFs, since different objects may need very different sets of information.
Yes it is basic, but let us say that I plan to add the other number of texture variables (8 right?) Would it be good enough then? What do I need to add?
Edit: Two more things,
a) What would you recomend for Multipul FVF's
b) Can a D3DVECTOR3 be substituted for the three float x, y, z and normals values?
Edit: Two more things,
a) What would you recomend for Multipul FVF's
b) Can a D3DVECTOR3 be substituted for the three float x, y, z and normals values?
Quote:Original post by Plasmarobo
Edit: Two more things,
a) What would you recomend for Multipul FVF's
b) Can a D3DVECTOR3 be substituted for the three float x, y, z and normals values?
a) It's tough to make recommendations without knowing what you're trying to do. As an example, though, in my most recent project, I use 3 FVFs: my GUI objects have x, y, z, and w componants, along with a color and 1 set of texture coords. My models have x, y, and z coords, color, normal, and 1 set of texture coords, and my map has x, y, and z coords, color, normal, and 2 sets of texture coords.
b) Not sure, sorry. I've always done it with separate x, y, z, etc floats.
Thanks, that gives a little direction.
Oh, if I use the D3DX mesh functions, do I really need to work with Vertex/Index buffers? (I will include them just cause they are good to have)
I know they are the particle and effect thingies, but that is different from Meshes.
Oh, if I use the D3DX mesh functions, do I really need to work with Vertex/Index buffers? (I will include them just cause they are good to have)
I know they are the particle and effect thingies, but that is different from Meshes.
I only use vert buffers for my GUI objects. For mesh's, you can just call mesh->DrawSubset(i) for each material contained in it.
If your still interestead, you can most definatly use D3DXVECTOR3 or D3DXVECTOR4 (if your going to be using the w val.), to store position, and normals, you could even use D3DXVECTOR2 for tex coords.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement