Changeset 8547
- Timestamp:
- 07/08/08 19:35:10
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
OpenSceneGraph/trunk/include/osgUtil/IntersectionVisitor
r7648 r8547 47 47 _disabledCount(0) {} 48 48 49 49 50 void setCoordinateFrame(CoordinateFrame cf) { _coordinateFrame = cf; } 50 51 51 52 CoordinateFrame getCoordinateFrame() const { return _coordinateFrame; } 52 53 53 54 54 55 virtual Intersector* clone(osgUtil::IntersectionVisitor& iv) = 0; 55 56 … … 73 74 74 75 CoordinateFrame _coordinateFrame; 75 unsigned int _disabledCount;76 unsigned int _disabledCount; 76 77 77 78 }; … … 139 140 virtual void reset(); 140 141 142 141 143 /** Set the intersector that will be used to intersect with the scene, and to store any hits that occur.*/ 142 144 void setIntersector(Intersector* intersector); … … 147 149 /** Get the const intersector that will be used to intersect with the scene, and to store any hits that occur.*/ 148 150 const Intersector* getIntersector() const { return _intersectorStack.empty() ? 0 : _intersectorStack.front().get(); } 151 152 153 /** Set whether the intersectors should use KdTrees when they are found on the scene graph.*/ 154 void setUseKdTreeWhenAvailable(bool useKdTrees) { _useKdTreesWhenAvailable; } 155 156 /** Set whether the intersectors should use KdTrees.*/ 157 bool getUseKdTreeWhenAvailable() const { return _useKdTreesWhenAvailable; } 149 158 150 159 … … 202 211 typedef std::list< osg::ref_ptr<Intersector> > IntersectorStack; 203 212 IntersectorStack _intersectorStack; 213 214 bool _useKdTreesWhenAvailable; 204 215 205 216 osg::ref_ptr<ReadCallback> _readCallback; OpenSceneGraph/trunk/src/osgUtil/IntersectionVisitor.cpp
r8501 r8547 156 156 setTraversalMode(osg::NodeVisitor::TRAVERSE_ACTIVE_CHILDREN); 157 157 158 _useKdTreesWhenAvailable = true; 159 158 160 setIntersector(intersector); 159 161 OpenSceneGraph/trunk/src/osgUtil/LineSegmentIntersector.cpp
r8546 r8547 300 300 unsigned int numConventionalHits = 0; 301 301 302 osg::KdTree* kdTree = dynamic_cast<osg::KdTree*>(drawable->getShape());303 302 osg::Vec3d kdTreeHit; 303 osg::KdTree* kdTree = iv.getUseKdTreeWhenAvailable() ? dynamic_cast<osg::KdTree*>(drawable->getShape()) : 0; 304 304 if (kdTree) 305 305 { … … 344 344 } 345 345 346 // return; 347 } 348 else 349 { 350 // osg::notify(osg::NOTICE)<<"Not KdTree available"<<std::endl; 346 return; 351 347 } 352 348 … … 424 420 double timeConventional = osg::Timer::instance()->delta_m(after_kdTree, after_conventional); 425 421 426 #if 1422 #if 0 427 423 if (kdTree) 428 424 {
