[osg-users] Is this a too dirty hack?

Viggo Løvli vigigio at hotmail.com
Wed Jul 23 04:29:22 PDT 2008

I am doing it because I want to be able to set node-masks on nodes that is added to the scene-graph after I have initialized my scene. I am trying to avoid having to specialize the code where we add to the tree. I want the code module that set node-masks to be completely standalone.
The hack seems to fail however, any movement update on objects in the tree will also set the bound dirty, so I am currently getting a dirty flag every frame because of Ephemeris moon's movement :-)
I am not using VPB, but the idea is to somehow know when anything is added to the tree so that I can process them.

From: gordon.tomlinson at sensor.comTo: osg-users at lists.openscenegraph.orgDate: Wed, 23 Jul 2008 07:15:48 -0400Subject: Re: [osg-users] Is this a too dirty hack?

who care's if it dirty, if it works it works ;)
I'm still not sure why your doing this, this way, as you have to add all your nodes to your scene, and if you add a simple addNodestoScene type function that say does somehting like addNodestoScene ( osgDb::LoadNode("myfile.flt")) or similar the you catch all the additions as you have to Load the node , this falls down a little if your using VPB

From: osg-users-bounces at lists.openscenegraph.org [mailto:osg-users-bounces at lists.openscenegraph.org] On Behalf Of Viggo LøvliSent: Wednesday, July 23, 2008 6:35 AMTo: OSG Mailing ListSubject: [osg-users] Is this a too dirty hack?
Hi, I am on the quest to figure out when the node-tree is dirty. I have found a way... But I do not know if this way is a too dirty hack to actually use. I have a class that inherit osg::Group.I use this as the root of my scene-graph. Each time someone add a node to the world, then the dirtyBound function will be called for all parents. This function is not virtual so I can not override it in my specialization of the osg::Group class.I can however set up a callback that is called when we calculate the bounding sphere.This callback is only executed if someone call getBound when the bounding-sphere is set to dirty. So, if the callback to calculate a bounding sphere is called on my root-node then I know that the node tree has been changed.I can thus check if the node-tree is 'dirty' by calling getBound() on my own class. If that results in a callback then it was dirty. So the question is: Is this a too dirty hack to use, or is it okish? Regards,Viggo   

Windows Live Hotmail på mobilen. Ha alltid e-posten din tilgjengelig. 
Hold kontakten med Windows Live Messenger.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20080723/79832901/attachment-0003.htm>

More information about the osg-users mailing list