Hello,
I’m using Nvidia’s MeshMender tool to build vertex tangents and binormals.
I’m using a custom mesh format which is as follows:
struct Mesh
{
unsigned int num_verts, num_uvs, num_norms, num_submeshes;float *vertices;
float *uvs;
float *normals;struct SubMesh
{
unsigned int num_faces;
unsigned int *faces;
};
SubMesh *submeshes;
};
My meshes are structured this way to take advantage of vertex arrays. Basically I activate a texcoord, normal, and vertex pointer for the mesh and then DrawElements for each of each submesh. I don’t think this is uncommon.
Now the MeshMender tool inputs data with a single set of indices and spits out possibly duplicated vertices (hence different indices). This means I can’t Munge() with a full index buffer built from the sum of all the submesh index buffers.
My first thought was to simply break the mesh off so that each submesh had a vertex buffer of its own. So simply call Munge() for each submesh with the same sets of verts, norms, coords, and change the index buffer. Vertices may be duplicated if they’re shared by two submeshes (not very common) and I get the extra overhead of resetting the vertex/norm/uv pointers for each submesh when rendering.
MeshMender returns the full set (or more) of vertices not only the ones indexed so I’d need to rebuild the vertex and index buffer after the Munge()ing to not waste vertex buffer space.
This is the technique I’m opting for and implementing right now. Has anyone else had to deal with this before? Did you handle the situation differently?
Any other input is appreciated
Thanks for reading,
Luigi