I'm working on a custom lighting solution and want to display it.
Rather than go through the complexity of setting up textures and lightmaps,
I decided that for now, simply changing the vertex colours would be enough.
But I'm having no luck changing the vertex colours.
I've gone down to the meshBuffer nitty gritty and have changed the vertex colours, then setDirty( EBT_VERTEX );
It has no effect. Still no effect with lighting turned off.
It's frustrating changing things but seeing absolutely no effect.
How do I do this?
Thanks.
[SOLVED] Problem Changing Vertex Colours
[SOLVED] Problem Changing Vertex Colours
Last edited by EvilDavo on Fri Oct 22, 2010 6:32 pm, edited 1 time in total.
any code can help to help you.
you have also to set the correct lighting for the material of your mesh since there are some lighting systems that ignore vertex colors (and it is done by default?)
you have also to set the correct lighting for the material of your mesh since there are some lighting systems that ignore vertex colors (and it is done by default?)
Junior Irrlicht Developer.
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
Real value in social networks is not about "increasing" number of followers, but about getting in touch with Amazing people.
- by Me
I figured it out. Have to call setMesh afterwards for it to take effect.
Thanks for the advice. It doesn't work without using ECM_EMISSIVE, so that was very useful to know.
If anyone's interested this is how I changed the colours per vertex.
Thanks for the advice. It doesn't work without using ECM_EMISSIVE, so that was very useful to know.
If anyone's interested this is how I changed the colours per vertex.
Code: Select all
scene::IMesh* mesh = meshNode->getMesh();
for (unsigned i=0; i<mesh->getMeshBufferCount(); ++i)
{
video::SMaterial &mat = mesh->getMeshBuffer(i)->getMaterial();
mat.AmbientColor = video::SColor(0,0,0,0);
mat.DiffuseColor = video::SColor(0,0,0,0);
mat.SpecularColor = video::SColor(0,0,0,0);
mat.EmissiveColor = video::SColor(0,0,0,0);
mat.ColorMaterial = video::ECM_EMISSIVE;
video::S3DVertex *vertex = (video::S3DVertex*)(mesh->getMeshBuffer(i)->getVertices());
for (unsigned j=0; j<mesh->getMeshBuffer(i)->getVertexCount(); ++j)
{
vertex[j].Color = video::SColor(255,255,0,0); // set the colour per-vertex. Obviously, I'll have different colours for each vertex, but for simplicity, the colour red will do here
}
}
meshNode->setMesh( mesh );