diff --git a/src/osgViewer/View.cpp b/src/osgViewer/View.cpp index 165a6e1ab..836894810 100644 --- a/src/osgViewer/View.cpp +++ b/src/osgViewer/View.cpp @@ -1820,7 +1820,45 @@ bool View::computeIntersections(float x,float y, osgUtil::LineSegmentIntersector osgUtil::IntersectionVisitor iv(picker.get()); iv.setTraversalMask(traversalMask); + + +#if 1 const_cast(camera)->accept(iv); +#else + + // timing test code paths + + iv.setUseKdTreeWhenAvailable(true); + iv.setDoDummyTraversal(true); + + const_cast(camera)->accept(iv); + + osg::Timer_t before = osg::Timer::instance()->tick(); + const_cast(camera)->accept(iv); + + osg::Timer_t after_dummy = osg::Timer::instance()->tick(); + + iv.setDoDummyTraversal(false); + const_cast(camera)->accept(iv); + osg::Timer_t after_kdTree_2 = osg::Timer::instance()->tick(); + + iv.setUseKdTreeWhenAvailable(false); + const_cast(camera)->accept(iv); + osg::Timer_t after = osg::Timer::instance()->tick(); + + double timeDummy = osg::Timer::instance()->delta_m(before, after_dummy); + double timeKdTree = osg::Timer::instance()->delta_m(after_dummy, after_kdTree_2); + double timeConventional = osg::Timer::instance()->delta_m(after_kdTree_2, after); + + osg::notify(osg::NOTICE)<<"Using Dummy "<containsIntersections()) {