diff --git a/include/osgProducer/Viewer b/include/osgProducer/Viewer index 53278813f..72f8519f7 100644 --- a/include/osgProducer/Viewer +++ b/include/osgProducer/Viewer @@ -114,13 +114,18 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction /** compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.*/ 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); + /** 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); + /** 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); + /** compute, from normalized mouse coords, for all Cameras, intersections with the scene.*/ bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits); - void setKeyboardMouse(Producer::KeyboardMouse* kbm); Producer::KeyboardMouse* getKeyboardMouse() { return _kbm.get(); } const Producer::KeyboardMouse* getKeyboardMouse() const { return _kbm.get(); } diff --git a/src/osgProducer/Viewer.cpp b/src/osgProducer/Viewer.cpp index 00080561d..78255aa9b 100644 --- a/src/osgProducer/Viewer.cpp +++ b/src/osgProducer/Viewer.cpp @@ -588,7 +588,7 @@ bool Viewer::computeNearFarPoints(float x,float y,unsigned int cameraNum,osg::Ve } -bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits) +bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits) { float pixel_x,pixel_y; if (computePixelCoords(x,y,cameraNum,pixel_x,pixel_y)) @@ -623,7 +623,7 @@ bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil PickVisitor iv; osgUtil::IntersectVisitor::HitList localHits; - localHits = iv.getHits(getSceneData(), vum, rx,ry); + localHits = iv.getHits(node, vum, rx,ry); if (localHits.empty()) return false; @@ -634,17 +634,28 @@ bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil return false; } -bool Viewer::computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits) +bool Viewer::computeIntersections(float x,float y,unsigned int cameraNum,osgUtil::IntersectVisitor::HitList& hits) +{ + return computeIntersections(x,y,cameraNum,getSceneData(),hits); +} + +bool Viewer::computeIntersections(float x,float y,osg::Node *node,osgUtil::IntersectVisitor::HitList& hits) { bool hitFound = false; osgUtil::IntersectVisitor::HitList hlist; for(unsigned int i=0;iselectMatrixManipulator(no);