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/osgparticleeffects/osgparticleeffects.cpp

    r7964 r8998  
    2929 
    3030#include <osgUtil/Optimizer> 
    31 #include <osgUtil/IntersectVisitor> 
    3231 
    3332#include <osgDB/ReadFile> 
     
    134133osg::Vec3 computeTerrainIntersection(osg::Node* subgraph,float x,float y) 
    135134{ 
    136     osgUtil::IntersectVisitor iv; 
    137     osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment; 
    138  
    139135    const osg::BoundingSphere& bs = subgraph->getBound(); 
    140136    float zMax = bs.center().z()+bs.radius(); 
    141137    float zMin = bs.center().z()-bs.radius(); 
    142138     
    143     segDown->set(osg::Vec3(x,y,zMin),osg::Vec3(x,y,zMax)); 
    144     iv.addLineSegment(segDown.get()); 
     139    osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =  
     140        new osgUtil::LineSegmentIntersector(osg::Vec3(x,y,zMin),osg::Vec3(x,y,zMax)); 
     141 
     142    osgUtil::IntersectionVisitor iv(intersector.get()); 
    145143 
    146144    subgraph->accept(iv); 
    147145 
    148     if (iv.hits()) 
    149     { 
    150         osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get()); 
    151         if (!hitList.empty()) 
    152         { 
    153             osg::Vec3 ip = hitList.front().getWorldIntersectPoint(); 
    154             return  ip; 
    155         } 
     146    if (intersector->containsIntersections()) 
     147    { 
     148        return intersector->getFirstIntersection().getWorldIntersectPoint(); 
    156149    } 
    157150