I am building index and vertex buffers from OpenMesh structures which I will feed into my rendering engine. Here I iterate my elements (not shown) and create VertexHandles for each of my points and then add the face.
std::vector<Mesh::VertexHandle> vhandles;
for (... 3 triangle points) {
vhandles.push_back(mesh.add_vertex(Mesh::Point(
point->px, point->py, point->pz)));
}
mesh.add_face(face_vhandles);
The vertex buffer for a Point
appears below and I copy the vhandles data into this struct, then build an array of these to feed to the graphics engine.
struct Point
{
float px, py, pz; // positions
float nx, ny, nz; // normals
float cx, cy, cz; // diffuse
}
When I build the vhandles
vector above, I did not add an index/id to the VertexHandle.
I need to somewheres store and have access to the id of the point with the VertexHandle iteself. Where would I store that? I've not yet found a field for this purpose within the source of a VertexHandle, but seems like something that would be needed.