Change light sensitivity of the whole scene

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
Donald Duck
Posts: 34
Joined: Sat Jan 21, 2017 6:51 pm
Location: Duckburg
Contact:

Change light sensitivity of the whole scene

Post by Donald Duck »

I have a button in my program which allows the user to choose if the the scene should be light sensitive or not. But I can't find a quick way to change the light sensitivity of the whole scene at once. I tried this:

Code: Select all

sceneManager->getRootSceneNode()->setMaterialFlag(irr::video::EMF_LIGHTING, false);
but it didn't do anything.

How can I do this without having to change the light sensitivity of each element one by one?
CuteAlien
Admin
Posts: 9734
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Re: Change light sensitivity of the whole scene

Post by CuteAlien »

This is a material setting, there is no global flag. So use sceneManager->getSceneNodesFromType with ESNT_ANY to get all nodes and then loop over the array and set the material flag for each node (which will in turn set it for each material).
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
Post Reply