Show
Ignore:
Timestamp:
01/09/07 18:35:46 (8 years ago)
Author:
robert
Message:

Added View::computeIntersections methods

Files:
1 modified

Legend:

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

    r5928 r5951  
    9393std::string PickHandler::pick(float x, float y) 
    9494{ 
    95 #if 0 
    96     osgUtil::IntersectVisitor::HitList hlist; 
    97     if (_viewer->computeIntersections(x, y, hlist)) 
    98     { 
    99         for(osgUtil::IntersectVisitor::HitList::iterator hitr=hlist.begin(); 
    100             hitr!=hlist.end(); 
     95    osgUtil::LineSegmentIntersector::Intersections intersections; 
     96    if (_viewer->computeIntersections(x, y, intersections)) 
     97    { 
     98        for(osgUtil::LineSegmentIntersector::Intersections::iterator hitr = intersections.begin(); 
     99            hitr != intersections.end(); 
    101100            ++hitr) 
    102101        { 
    103             if (hitr->_geode.valid() && !hitr->_geode->getName().empty()) return hitr->_geode->getName(); 
    104         } 
    105     } 
    106 #else 
    107     osg::notify(osg::NOTICE)<<"Picking not implemented yet "<<x<<", "<<y<<std::endl; 
    108 #endif     
     102            osg::Node* node = hitr->nodePath.empty() ? 0 : hitr->nodePath.back(); 
     103            if (node && !node->getName().empty()) return node->getName(); 
     104        } 
     105    } 
     106 
    109107    return ""; 
    110108} 
     
    417415    viewer.setSceneData( root ); 
    418416 
    419     // create the windows and run the threads. 
    420     viewer.realize(); 
    421      
    422417    osg::Matrix lookAt; 
    423418    lookAt.makeLookAt(osg::Vec3(0.0f, -4.0f, 0.0f), centerScope, osg::Vec3(0.0f, 0.0f, 1.0f));