I am attempting to create instances of an AnimatedMesh and then recolor the vertices within the mesh. My problem is that these animatedMeshes use the same meshbuffers, so re-coloring one mesh will change any other instances.
Here is my code for loading the mesh
Code: Select all
for (int i = 0; i < PlayerParts::COUNT; i++) {
mesh = (ISkinnedMesh*)c->assetManager->getMesh(appearance.modelId[i]);
bodyNodes[i] = c->sceneManager->addAnimatedMeshSceneNode(mesh);
bodyNodes[i]->setJointMode(EJUOR_CONTROL);
bodyNodes[i]->setMaterialFlag(EMF_LIGHTING, false);
}
Code: Select all
for (int i = 0; i < bodyNodes[LEGS]->getMesh()->getMeshBufferCount(); i++) {
c->sceneManager->getMeshManipulator()->setVertexColors(bodyNodes[LEGS]->getMesh()->getMeshBuffer(i), legsColor);
}
[img]
https://ibb.co/dcDHHc
[/img]
My question is how can I copy a meshbuffer so it is seperate from the original and then apply it to an IAnimatedMeshSceneNode?