Seperate MeshBuffers for Animated Mesh
Posted: Tue Feb 27, 2018 2:00 pm
Hi all,
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
recoloring legs, this is called with two different colors for each instance
Even though one of the legs is set to red, and one is set to green they both show as green:
[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?
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?