Changing all materials in the 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
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Changing all materials in the scene.

Post by 3DModelerMan »

Is there an automatic way to change all the materials in the scene to a specific type, then change them all back? Or do I have to use the brute force method, and search the scene graph?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

You have to brute force it, but you can get an array of scene nodes from getSceneNodesFromType. Then you'll just need another array of the same size to store all the material types until you change them back.

What are you doing this for? A normal or depth map?
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post by vitek »

You could do something with this.

Travis
DtD
Posts: 264
Joined: Mon Aug 11, 2008 7:05 am
Location: Kansas
Contact:

Post by DtD »

BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post by BlindSide »

DtD wrote:What about the OverrideMaterial?
http://irrlicht.sourceforge.net/docu/cl ... 7277abf14a
this.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post by hybrid »

IIRC, you cannot change the material type currently. Only the other attributes of the material.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Does the override material get switched back after I've changed it though? What if I just looped through all the nodes, then stored the're materials in memory, and switched to the material I wanted, then when I was done, switched back to the ones I stored in memory? Would that take up too much memory?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
slavik262
Posts: 753
Joined: Sun Nov 22, 2009 9:25 pm
Location: Wisconsin, USA

Post by slavik262 »

It shouldn't take too much memory, and that's what I'd do.
3DModelerMan
Posts: 1691
Joined: Sun May 18, 2008 9:42 pm

Post by 3DModelerMan »

Oh okay, is there a good way to seperate the logic of my nodes, from the rendering? I'm going to be calling smgr->drawAll() multiple times for multipass rendering, so I don't want the animators to execute every single draw call. Maybe disable and then reenable them all?
That would be illogical captain...

My first full game:
http://www.kongregate.com/games/3DModel ... tor#tipjar
Post Reply