I want to add a material to a existing node and change it's color ( ambient, diffuse, emissive, backface.. )
but didn't found how to make it ( no glsl ) ?
Any one can help ?
howto add a simple material to a node ?
-
- Posts: 1186
- Joined: Fri Dec 29, 2006 12:04 am
Re: howto add a simple material to a node ?
Code: Select all
for (irr::u32 i = 0; i < node->getMaterialCount(); ++i)
{
irr::video::SMaterial& material = node->getMaterial(i);
material.DiffuseColor = irr::video::SColor(255, 255, 0, 0);
}
"Whoops..."
Add ind a material
node->getMaterial(i) return an existing material.
I need to create one and adding it to the node :
something like this :
irr::video::SMaterial newMaterial ;
// change the material
material.DiffuseColor = irr::video::SColor(255, 255, 0, 0);
maretial.SpecularColor...
node->addMaterial ( newMaterial ) ;
I need to create one and adding it to the node :
something like this :
irr::video::SMaterial newMaterial ;
// change the material
material.DiffuseColor = irr::video::SColor(255, 255, 0, 0);
maretial.SpecularColor...
node->addMaterial ( newMaterial ) ;
getMaterial returns a reference so if you assign it to that it will get changed. So you do like randomMesh proposed and just assign material = newMaterial; instead of just setting the DiffuseColor.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Materials are copied from meshbuffers - one material per meshbuffer. So that is what you can set/change.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm