_populateLightList with sceneNode

What it says on the tin: a place to discuss proposed new features.
Post Reply
User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
Contact:

_populateLightList with sceneNode

Post by volca » Wed Nov 12, 2008 2:05 pm

I think this would be a minor but possibly useful improvement:
SceneManager::_populateLightList accepts position and radius now, which means if there is a complex structure to traverse each time this method is called, one gets a performance penalty.

I, for now, solved this by providing a listener for all the entities that provides the light list, but that means the usage of the listener concept is blocked for the outside of the SceneManager class.

Would it be acceptible to move the position and radius determination to the insides of this method and expect a SceneNode instead?:

Code: Select all

// in OgreSceneNode.cpp
mCreator->_populateLightList(this, radius, mLightList);
// in SceneManager - new virtual method
void SceneManager::_populateLightList(const SceneNode* node, Real radius, LightList& destList) {
   _populateLightList(node->_getDerivedPosition(), radius, destList);
}
This would enable one to cache derived info in SceneNode* descendant an use it in the population.

I hope I wrote it readable :)
0 x
Image

User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
Contact:

Post by volca » Fri Nov 14, 2008 8:36 am

Ok, is there something more I could do? I can provide a patch against the SVN head, if you give me the time to setup the ogre dev environment.

Another such problem I had was with getLightsAffectingFrustum, but this was solved by moving the visibility determination into the Camera class descendant, so the visible parts of the scene were always available when camera was given as a parameter.

With SceneNode* I don't have such possibility because it calls the method using it's position only, when the SceneNode* parameter would do a better job as it would allow more customizations.

For N visible objects, I got N calls to the method _populateLightList, each of this calls had to traverse the BSP to find the leaf the given position is in, that is not effective way of doing things - the SceneNode class descendant I use already knows the current BSP leaf it is in. I hope this makes it more clear...
0 x
Image

User avatar
sinbad
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 19265
Joined: Sun Oct 06, 2002 11:19 pm
Location: Guernsey, Channel Islands
x 2
Contact:

Post by sinbad » Fri Nov 14, 2008 5:26 pm

Yes, this is a good idea, thanks.

Please do submit a patch, this will go into 1.8.
0 x

User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
Contact:

Post by volca » Sat Nov 15, 2008 4:51 pm

Okay, thanks! I'll setup a ogre dev environment for 1.8 and submit in a few days.
0 x
Image

User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
Contact:

Post by volca » Wed Dec 03, 2008 2:12 pm

Just to inform anyone interested, the bug report with patch attached is to be found here:
http://sourceforge.net/tracker/?func=de ... up_id=2997
0 x
Image

User avatar
Praetor
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 3335
Joined: Tue Jun 21, 2005 8:26 pm
Location: Rochester, New York, US
Contact:

Post by Praetor » Wed Dec 03, 2008 3:06 pm

Thank you, one of us will put this into 1.8.
0 x

User avatar
volca
Gnome
Posts: 393
Joined: Thu Dec 08, 2005 9:57 pm
Contact:

Post by volca » Wed Dec 03, 2008 3:07 pm

No, I thank You, sir :)

Thanks!
0 x
Image

Post Reply