HI Jeroen, It sounds like a bug to me, although invalidating a KdTree is something far more general a problem than just IndexMeshVisitor - effect any operation that modifies an osg::Geometry could invalidate a KdTree.
The workround would be to make sure that KdTree's are generated after optimization or similar operations. I will need to think further about how one might catch places where geometries are modified by KdTree's not updated. Robert. On 19 June 2014 12:07, Jeroen Wagenaar <[email protected]> wrote: > Hi, > > I got a crash when doing intersections on my level. > The problem turned out to be, that the optimizer > was run on a geometry node, after a KdTree had been build for it. > > The IndexMeshVisitor may change the number of vertices in the geometry, > invalidating the TriangleList in the KdNode. > > I fixed this in my code by just setting the kdtree to NULL in the end of > IndexMeshVisitor::makeMesh, and then rebuilding the kdtree after finishing > the call to optimize. > > I'm not sure if this is a bug, or if the optimizer should just always be run > before building the kdtree ? > > I'm using osgEarth, which calls the optimizer after calling ReadNode. > This may of course be the reason why KdTrees are not on by default in > osgEarth ;) > > Thank you! > > Cheers, > Jeroen ;) > > ------------------ > Read this topic online here: > http://forum.openscenegraph.org/viewtopic.php?p=59814#59814 > > > > > > _______________________________________________ > osg-submissions mailing list > [email protected] > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org _______________________________________________ osg-submissions mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org
