[osg-users] osgUtil::IntersectionVisitor eats all the memory
    Trajce Nikolov NICK 
    trajce.nikolov.nick at gmail.com
       
    Tue Jan  9 04:12:17 PST 2018
    
    
  
hi Robert, Community,
I have the following code in a loop against very large quadtree based
database. And this code is eating all the memory, progressively and then
the system kills it . Any clue?
Thanks a lot
osg::ref_ptr<osgUtil::LineSegmentIntersector> picker;
osg::ref_ptr<osgUtil::IntersectionVisitor> iv;
osg::Vec3d getHOT(const osg::Vec3d& position, osgViewer::CompositeViewer&
viewer, osg::Vec3& normal, bool& valid)
{
    osg::Vec3d result;
osg::EllipsoidModel em;
osg::Vec3d up = em.computeLocalUpVector(position.x(), position.y(),
position.z());
up.normalize();
osg::Vec3d s = position + up * 100;
    osg::Vec3d e = osg::Vec3d(0, 0, 0);
    if (viewer.getView(0)->getSceneData())
    {
#if 1
if (!picker.valid())
{
picker = new osgUtil::LineSegmentIntersector(s,e);
iv = new  MyIntersectionVisitor(RANGE);
}
picker->setStart(s);
picker->setEnd(e);
picker->getIntersections().clear();
iv->setIntersector(picker);
iv->reset();
iv->setUseKdTreeWhenAvailable(false);
//iv->setLODSelectionMode(osgUtil::IntersectionVisitor::USE_EYE_POINT_FOR_LOD_LEVEL_SELECTION);
viewer.getView(0)->getSceneData()->accept(*iv);
if (picker->containsIntersections())
{
osgUtil::LineSegmentIntersector::Intersections           hitList =
picker->getIntersections();
osgUtil::LineSegmentIntersector::Intersections::iterator hit =
hitList.begin();
result = hit->getWorldIntersectPoint();
normal = hit->getWorldIntersectNormal();
valid = true;
return result;
}
#endif
    }
valid = false;
    return result;
}
-- 
trajce nikolov nick
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openscenegraph.org/pipermail/osg-users-openscenegraph.org/attachments/20180109/f085dc02/attachment.html>
    
    
More information about the osg-users
mailing list