From Qing Shen, addition of computeIntsect methods which take a
node pointer to intersect with rather than assume the viewer's scene pointer.
This commit is contained in:
@@ -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(); }
|
||||
|
||||
@@ -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;i<getNumberOfCameras();++i)
|
||||
{
|
||||
if (computeIntersections(x,y,i,hits)) hitFound = true;
|
||||
if (computeIntersections(x,y,i,node,hits)) hitFound = true;
|
||||
}
|
||||
return hitFound;
|
||||
}
|
||||
|
||||
|
||||
bool Viewer::computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits)
|
||||
{
|
||||
return computeIntersections(x,y,getSceneData(),hits);
|
||||
}
|
||||
|
||||
void Viewer::selectCameraManipulator(unsigned int no)
|
||||
{
|
||||
if (_keyswitchManipulator.valid()) _keyswitchManipulator->selectMatrixManipulator(no);
|
||||
|
||||
Reference in New Issue
Block a user