[osg-users] KdTree support now checked in

Jean-Sébastien Guay jean-sebastien.guay at cm-labs.com
Sun Jul 13 12:21:36 PDT 2008


Hi Robert,

> To enable automatic generation of KdTree's I have extended osgDB so
> that the Registry and DatabasePager are both KdTree aware, and if
> KdTree build option is enabled it'll use the Registry's new
> KdTreeBuilder object to build KdTree's on loaded models.  To enable
> this building you simple set the env var OSG_BUILD_KDTREES to on, i.e.
> 
>   set OSG_BUILD_KDTREES=on
>   osgpick cow.osg
> 
> Or programatically you can enable building of KdTrees via:
> 
>     osgDB::Registry::instance()->setBuildKdTreesHint(osgDB::ReaderWriter::Options::BUILD_KDTREES);
> 
> You'll need to call this before you load any models that you wish to
> have BUILD_KDTREES set.

This is all good, but do we need to do anything to get the kd-tree 
rebuilt if some geometry changes? Or is this all transparently handled 
by osg::Geometry::dirty() / dirtyDisplayList()?

In my Masters project one of the goals was to support totally dynamic 
geometry, so any object could both be moved (dynamic with respect to 
transform nodes) or deformed (dynamic with respect to actual geometry). 
So it was possible to modify vertices in the osg::Geometry's vertex 
array. But then, if there is a kd-tree for that geometry, it needs to be 
rebuilt...

Thanks,

J-S
-- 
______________________________________________________
Jean-Sebastien Guay    jean-sebastien.guay at cm-labs.com
                                http://www.cm-labs.com/
                         http://whitestar02.webhop.org/



More information about the osg-users mailing list