Changeset 8998

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

Replaced usage of depreacted IntersectVisitor? with IntersectionVisitor?

Location:
OpenSceneGraph/trunk/examples
Files:
5 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            } 
  • OpenSceneGraph/trunk/examples/osgoccluder/osgoccluder.cpp

    r6941 r8998  
    2424#include <osg/Group> 
    2525#include <osg/Notify> 
    26 #include <osg/LineSegment> 
    2726#include <osg/io_utils> 
    2827 
     
    3635 
    3736#include <osgUtil/Optimizer> 
    38 #include <osgUtil/IntersectVisitor> 
    3937 
    4038#include <osg/OccluderNode> 
  • 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 
  • OpenSceneGraph/trunk/examples/osgshaderterrain/osgshaderterrain.cpp

    r7498 r8998  
    4040#include <osgDB/FileUtils> 
    4141 
    42 #include <osgUtil/IntersectVisitor> 
    4342#include <osgUtil/SmoothingVisitor> 
    4443 
  • OpenSceneGraph/trunk/examples/osgspheresegment/osgspheresegment.cpp

    r7648 r8998  
    2828 
    2929#include <osgUtil/SmoothingVisitor> 
    30 #include <osgUtil/IntersectVisitor> 
    3130 
    3231#include <osgDB/ReadFile> 
     
    318317osg::Vec3 computeTerrainIntersection(osg::Node* subgraph,float x,float y) 
    319318{ 
    320     osgUtil::IntersectVisitor iv; 
    321     osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment; 
    322  
    323319    const osg::BoundingSphere& bs = subgraph->getBound(); 
    324320    float zMax = bs.center().z()+bs.radius(); 
    325321    float zMin = bs.center().z()-bs.radius(); 
    326322     
    327     segDown->set(osg::Vec3(x,y,zMin),osg::Vec3(x,y,zMax)); 
    328     iv.addLineSegment(segDown.get()); 
     323    osg::ref_ptr<osgUtil::LineSegmentIntersector> intersector =  
     324        new osgUtil::LineSegmentIntersector(osg::Vec3(x,y,zMin),osg::Vec3(x,y,zMax)); 
     325 
     326    osgUtil::IntersectionVisitor iv(intersector.get()); 
    329327 
    330328    subgraph->accept(iv); 
    331329 
    332     if (iv.hits()) 
    333     { 
    334         osgUtil::IntersectVisitor::HitList& hitList = iv.getHitList(segDown.get()); 
    335         if (!hitList.empty()) 
    336         { 
    337             osg::Vec3 ip = hitList.front().getWorldIntersectPoint(); 
    338             return  ip; 
    339         } 
     330    if (intersector->containsIntersections()) 
     331    { 
     332        return intersector->getFirstIntersection().getWorldIntersectPoint(); 
    340333    } 
    341334