Page 1 of 1

ILightSceneNode::doLightRecalc

Posted: Sun Jul 26, 2015 4:50 am
by chronologicaldot
It would be nice to have ILightSceneNode::doLightRecalc() or something like it. doLightRecalc() is in CLightSceneNode (but only ILightSceneNode is returned from the scene manager). Without an ugly hack, the only way to reset the light calculations is by a) doing it manually or b) lightNode->setRadius( lightNode->getRadius() );

I have to do light recalculations whenever I translate the light scene node (because for some reason no one planned for moving lights??).
Did I miss something????

For moving the light, here's what I'd like:

Code: Select all

 
ILightSceneNode* lightNode = sceneManager->addLightSceneNode(0, SColorf( SColor(0xffffffff) ), vector3df(), 100 );
// somewhere later, like in an animator...
lightNode->setTranslation( vector3df(4,0,10) ); // Should change light data too, but doesn't
// but this is required:
lightNode->setRadius( lightNode->getRadius() );
 
It would actually be nice if the light node itself simply called doLightRecalc() inside setTranslation(), and that way, native animators could be used and we wouldn't have doLightRecalc() exposed.

Re: ILightSceneNode::doLightRecalc

Posted: Mon Jul 27, 2015 10:31 am
by CuteAlien
It calls doLightRecalc in OnRegisterSceneNode, but I guess that might be too early for animators.

Usually nothing much is done in setTranslation because the matrices are not updated there yet. That's done in updateAbsolutePosition() which is usually just called once (and that's an important enough speed optimization that it's not easy to remove despite all the troubles it causes). I wondered a few times already if the real solution might be using dirty-flags instead which ensure getAbsoluteTransformation always returns the updated matrix. But have to check what's going on exactly.

At least the light recalc should be done in updateAbsolutePosition() I think.

Re: ILightSceneNode::doLightRecalc

Posted: Wed Jul 29, 2015 12:18 am
by CuteAlien
In svn r5111 do now a doLightRecalc in updateAbsolutePosition. This is already called after animators are run so it should now be possible to use native animators. I didn't know how to write a quick test-case for it which showed me the problems (hard to see if it's just stuff 1 frame wrong and about lights), so this is untested...

Re: ILightSceneNode::doLightRecalc

Posted: Thu Jul 30, 2015 12:27 am
by chronologicaldot
Thanks!

Re: ILightSceneNode::doLightRecalc

Posted: Sun Aug 16, 2015 8:54 am
by feelthat
check keywords

spot light
chronologicaldot wrote:Thanks!

Re: ILightSceneNode::doLightRecalc

Posted: Sun Aug 16, 2015 10:04 am
by CuteAlien
@feelthat: It doesn't help if you link it again,I've seen it back then. But I can't do anything with posts like that until you start explaining what your code is about. You have to describe the problem. You have to explain the solution. If you have a test even better. But describing and explaining is essential.

And in this case there seems also the problem that you copied code which was under GPL. That is incompatible with the zlib license of Irrlicht. Sorry, we can't use GPL code, please be careful with licenses.

Re: ILightSceneNode::doLightRecalc

Posted: Mon Aug 17, 2015 4:17 pm
by feelthat
ok i will take care~~~

thanks
CuteAlien wrote:@feelthat: It doesn't help if you link it again,I've seen it back then. But I can't do anything with posts like that until you start explaining what your code is about. You have to describe the problem. You have to explain the solution. If you have a test even better. But describing and explaining is essential.

And in this case there seems also the problem that you copied code which was under GPL. That is incompatible with the zlib license of Irrlicht. Sorry, we can't use GPL code, please be careful with licenses.