About my Vertex Buffer structure
Hi. I want to change the way I use vertex buffers in my engine. Now, I am creating a lot of VB (one for every objet), and when I go render, I have to change a lot of time between obtects per frame.
Now I want to change this and do it like this:
I will only use 2 VB:
- 1 STATIC VB holding all my MAP vertices, and 1 DYNAMIC index buffer to index the geometry.
- 1 DYNAMIC VB created for 4000 vertices to hold all the other meshes (every thing that is not the map). Before render each frame, I will lock and fill up the VB with the vertices of the mesh I am going to render.
the FVF for each type of VB would be:
// for the static VB (only for the map)
struct D3DCUSTOMVERTEX_map
{
float x,y,z;
float u,v;
float s,t;
};
// without normals and with 2 pairs of texture coordinates for the lightmaps.
// For the DYNAMIC VB (for the other geometry)
struct D3DCUSTOMVERTEX_obj
{
float x,y,z;
float nx,ny,nz;
float u,v;
};
So, I''ll change only between 2 VB and 2 FVF per frame (and not per object per frame)
What do you think about this?? Thanx.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement