I would like to show several nodes based on the same mesh with a certain transparency.
The following code works, but affects all nodes at once, because I change the mesh to create the transparency:
Code: Select all
node->setMaterialType(video::EMT_TRANSPARENT_VERTEX_ALPHA);
IMesh* mesh = node->getMesh();
for(u32 i=0; i<mesh->getMeshBufferCount(); i++)
{
scene::IMeshBuffer* buffer = mesh->getMeshBuffer(i);
video::S3DVertex* vertex = (video::S3DVertex*)buffer->getVertices();
for(u32 j=0; j<buffer->getVertexCount(); j++)
{
vertex[j].Color = video::SColor(transparencyValue,vertex[j].Color.getRed(),vertex[j].Color.getGreen(),vertex[j].Color.getBlue());
}
}