Show
Ignore:
Timestamp:
10/07/08 16:01:14 (6 years ago)
Author:
robert
Message:

Replaced usage of depreacted IntersectVisitor? with IntersectionVisitor?

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgforest/osgforest.cpp

    r7929 r8998  
    3737#include <osgDB/FileUtils> 
    3838 
    39 #include <osgUtil/IntersectVisitor> 
     39#include <osgUtil/LineSegmentIntersector> 
     40#include <osgUtil/IntersectionVisitor> 
    4041#include <osgUtil/SmoothingVisitor> 
    4142 
     
    509510        if (terrain) 
    510511        { 
    511             osgUtil::IntersectVisitor iv; 
    512             osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment; 
    513  
    514             segDown->set(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z())); 
    515             iv.addLineSegment(segDown.get()); 
     512            osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =  
     513                new osgUtil::LineSegmentIntersector(tree->_position,tree->_position+osg::Vec3(0.0f,0.0f,size.z())); 
     514 
     515            osgUtil::IntersectionVisitor iv(intersector.get()); 
    516516             
    517517            terrain->accept(iv); 
    518518 
    519             if (iv.hits()) 
     519            if (intersector->containsIntersections()) 
    520520            { 
    521                 osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get()); 
    522                 if (!hitList.empty()) 
     521                osgUtil::LineSegmentIntersector::Intersections& intersections = intersector->getIntersections(); 
     522                for(osgUtil::LineSegmentIntersector::Intersections::iterator itr = intersections.begin(); 
     523                    itr != intersections.end(); 
     524                    ++itr) 
    523525                { 
    524                     osg::Vec3 ip = hitList.front().getWorldIntersectPoint(); 
    525                     osg::Vec3 np = hitList.front().getWorldIntersectNormal(); 
    526                     tree->_position = ip; 
     526                    const osgUtil::LineSegmentIntersector::Intersection& intersection = *itr; 
     527                    tree->_position = intersection.getWorldIntersectPoint(); 
    527528                } 
    528529            }