simple color question !

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
chinanzio
Posts: 25
Joined: Wed Apr 11, 2007 10:56 am

simple color question !

Post by chinanzio »

I want to set a color to a node like Java API 3d does.
Node->setAmbientColor(255,255,255);
How is in irrlicht ?
Luben
Posts: 568
Joined: Sun Oct 09, 2005 10:12 am
Location: #irrlicht @freenode

Post by Luben »

In irrlicht, a node can consist of several different materials, which have individual light/color properties.

You can get the number of materials of a node by calling Node->getMaterialCount().
Then you can retrieve the materials from the node and set the property AmbientColor. I recomend checking trough SMaterial.h in the include-folder.
You also need to set the general ambient world light color. You do so by calling SceneManager->setAmbientLight(...)

Code: Select all

Node->getMaterial(0).AmbientColor=SColor(0,255,0,0); //Set first materials ambient property
SceneManager->setAmbientLight(SColor(128, 128, 128, 128)); //Set ambient light color
If you don't have anything nice to say, don't say anything at all.
Post Reply