diff --git a/include/osgProducer/Viewer b/include/osgProducer/Viewer index 72f8519f7..8be3c93f8 100644 --- a/include/osgProducer/Viewer +++ b/include/osgProducer/Viewer @@ -115,16 +115,16 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction bool computeNearFarPoints(float x,float y,unsigned int cameraNum,osg::Vec3& near, osg::Vec3& far); /** compute, from normalized mouse coords, for all Cameras, intersections with the specified subgraph.*/ - bool computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits); + bool computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff); /** compute, from normalized mouse coords, for sepecified Camera, intersections with the scene.*/ - bool computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits); + bool computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff); /** compute, from normalized mouse coords, for all Cameras, intersections with specified subgraph.*/ - bool computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits); + bool computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff); /** compute, from normalized mouse coords, for all Cameras, intersections with the scene.*/ - bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits); + bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask = 0xffffffff); void setKeyboardMouse(Producer::KeyboardMouse* kbm); Producer::KeyboardMouse* getKeyboardMouse() { return _kbm.get(); } diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 78255aa9b..bbf5165f7 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -62,6 +62,12 @@ public: } ~PickVisitor() {} + void setTraversalMask(osg::Node::NodeMask traversalMask) + { + NodeVisitor::setTraversalMask(traversalMask); + _piv.setTraversalMask(traversalMask); + } + // Aug 2003 added to pass the nodemaskOverride to the PickIntersectVisitor // may be used make the visitor override the nodemask to visit invisible actions inline void setNodeMaskOverride(osg::Node::NodeMask mask) { @@ -588,7 +594,7 @@ bool Viewer::computeNearFarPoints(float x,float y,unsigned int cameraNum,osg::Ve } -bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits) +bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask) { float pixel_x,pixel_y; if (computePixelCoords(x,y,cameraNum,pixel_x,pixel_y)) @@ -621,6 +627,7 @@ bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::No } PickVisitor iv; + iv.setTraversalMask(traversalMask); osgUtil::IntersectVisitor::HitList localHits; localHits = iv.getHits(node, vum, rx,ry); @@ -634,26 +641,26 @@ bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::No return false; } -bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits) +bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask) { - return computeIntersections(x,y,cameraNum,getSceneData(),hits); + return computeIntersections(x,y,cameraNum,getSceneData(),hits,traversalMask); } -bool Viewer::computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits) +bool Viewer::computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits,osg::Node::NodeMask traversalMask) { bool hitFound = false; osgUtil::IntersectVisitor::HitList hlist; for(unsigned int i=0;i