diff --git a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp index 57d53b39a..ae3824c67 100644 --- a/examples/osgkeyboardmouse/osgkeyboardmouse.cpp +++ b/examples/osgkeyboardmouse/osgkeyboardmouse.cpp @@ -165,6 +165,10 @@ public: osg::notify(osg::NOTICE)<<"Using projection coordiates for picking"< intersectors = new osgUtil::IntersectorGroup; + + osg::Viewport* viewport = viewer->getCamera()->getViewport(); + unsigned int numX = 100; + unsigned int numY = 100; + double dx = viewport->width()/double(numX-1); + double dy = viewport->width()/double(numX-1); + + + double y = viewport->x(); + for(unsigned int r=0; rx(); + for(unsigned int c=0; cgetIntersectors().push_back( new osgUtil::PolytopeIntersector( osgUtil::Intersector::WINDOW, x-dx*0.5, y-dy*0.5, x+dx*0.5, y+dy*0.5 ) ); + } + else + { + intersectors->getIntersectors().push_back( new osgUtil::LineSegmentIntersector( osgUtil::Intersector::WINDOW, x, y ) ); + } + + x += dx; + } + y += dy; + } + + + osgUtil::IntersectionVisitor iv(intersectors.get()); + + osg::ElapsedTime elapsedTime; + viewer->getCamera()->accept(iv); + + OSG_NOTICE<<"Intersection traversal took "<getIntersectors().size()<<" intersectors"<getSceneData();