Changeset 8998
- Timestamp:
- 10/07/08 16:01:14 (5 years ago)
- Location:
- OpenSceneGraph/trunk/examples
- Files:
-
- 5 modified
-
osgforest/osgforest.cpp (modified) (2 diffs)
-
osgoccluder/osgoccluder.cpp (modified) (2 diffs)
-
osgparticleeffects/osgparticleeffects.cpp (modified) (2 diffs)
-
osgshaderterrain/osgshaderterrain.cpp (modified) (1 diff)
-
osgspheresegment/osgspheresegment.cpp (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
OpenSceneGraph/trunk/examples/osgforest/osgforest.cpp
r7929 r8998 37 37 #include <osgDB/FileUtils> 38 38 39 #include <osgUtil/IntersectVisitor> 39 #include <osgUtil/LineSegmentIntersector> 40 #include <osgUtil/IntersectionVisitor> 40 41 #include <osgUtil/SmoothingVisitor> 41 42 … … 509 510 if (terrain) 510 511 { 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()); 516 516 517 517 terrain->accept(iv); 518 518 519 if (i v.hits())519 if (intersector->containsIntersections()) 520 520 { 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) 523 525 { 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(); 527 528 } 528 529 } -
OpenSceneGraph/trunk/examples/osgoccluder/osgoccluder.cpp
r6941 r8998 24 24 #include <osg/Group> 25 25 #include <osg/Notify> 26 #include <osg/LineSegment>27 26 #include <osg/io_utils> 28 27 … … 36 35 37 36 #include <osgUtil/Optimizer> 38 #include <osgUtil/IntersectVisitor>39 37 40 38 #include <osg/OccluderNode> -
OpenSceneGraph/trunk/examples/osgparticleeffects/osgparticleeffects.cpp
r7964 r8998 29 29 30 30 #include <osgUtil/Optimizer> 31 #include <osgUtil/IntersectVisitor>32 31 33 32 #include <osgDB/ReadFile> … … 134 133 osg::Vec3 computeTerrainIntersection(osg::Node* subgraph,float x,float y) 135 134 { 136 osgUtil::IntersectVisitor iv;137 osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment;138 139 135 const osg::BoundingSphere& bs = subgraph->getBound(); 140 136 float zMax = bs.center().z()+bs.radius(); 141 137 float zMin = bs.center().z()-bs.radius(); 142 138 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()); 145 143 146 144 subgraph->accept(iv); 147 145 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(); 156 149 } 157 150 -
OpenSceneGraph/trunk/examples/osgshaderterrain/osgshaderterrain.cpp
r7498 r8998 40 40 #include <osgDB/FileUtils> 41 41 42 #include <osgUtil/IntersectVisitor>43 42 #include <osgUtil/SmoothingVisitor> 44 43 -
OpenSceneGraph/trunk/examples/osgspheresegment/osgspheresegment.cpp
r7648 r8998 28 28 29 29 #include <osgUtil/SmoothingVisitor> 30 #include <osgUtil/IntersectVisitor>31 30 32 31 #include <osgDB/ReadFile> … … 318 317 osg::Vec3 computeTerrainIntersection(osg::Node* subgraph,float x,float y) 319 318 { 320 osgUtil::IntersectVisitor iv;321 osg::ref_ptr<osg::LineSegment> segDown = new osg::LineSegment;322 323 319 const osg::BoundingSphere& bs = subgraph->getBound(); 324 320 float zMax = bs.center().z()+bs.radius(); 325 321 float zMin = bs.center().z()-bs.radius(); 326 322 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()); 329 327 330 328 subgraph->accept(iv); 331 329 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(); 340 333 } 341 334
