Page 1 of 1

ISceneNode's and Materials

Posted: Wed Mar 21, 2012 11:05 pm
by kevinsbro
So I'm pretty sure I already know the answer, but when I try and change the material of an empty scene node it stays at its defaults. The basic empty Scene Node isn't meant to care about materials is it?

Re: ISceneNode's and Materials

Posted: Wed Mar 21, 2012 11:12 pm
by REDDemon
if the scene node gets rendered and has "driver->setMaterial()" called from inside the "render" method the material is setted up correctly.
Everything drawn after "setMaterial" will have that material.. unless you are calling "setMaterial" again in some other scene node. In that case the material will be overwrited with the new material.

Usually a parent node is drawn before children, but you are not supposed to make assumpions on order of drawing (unless you manually draw nodes in a certain order). The material used is the one wich has been setted with the last "setMaterial()" call.

The empty scene node is usually used to group other scene nodes. To transform its children. To attach to it some particle emitter or a camera. to organize better the scene. It has many usages. You can also use it to set a Material if you know that all its children will not change material and they are drawn after the "setMaterial" call. Keep in mind that there are also multiple renderpasses (1 pass for solid materials, 1 for alpha and 1 special).