Imagine that I have a mesh (pre-loaded or created manually somewhere) and I want
to clone this mesh for tweaking its vertices and add my own data to them. But original mesh has HBU_STATIC_WRITE_ONLY buffer usage. And I need a copy of such mesh but with HBU_DYNAMIC_WRITE_ONLY_DISCARDABLE buffer usage (or any other).
How can I do such clonning?
My first idea was to do:
Code: Select all
newmesh = oldmesh->clone();
for every submesh in newmesh
{
submesh = newmesh->getSubMesh(i);
submesh->vertexData->reorganizeBuffers(submesh->vertexData->vertexDeclaration, MyHBUlist);
}
- Double copy of vertex data - firstly they are copied in Mesh::clone in STATIC hardware buffer and then to my DYNAMIC one.
- reogranizeBuffers(...) doesn't allow to add extra fields into vertexDeclaration
And doing such copy is a wrong way because Mesh declaration could change in future
releases.
Any ideas?