Added convinence methods to osgProducer::Viewer:

/** compute, from normalized mouse coords, for sepecified Camera, the pixel coords relative to that Camera's RenderSurface.*/
        bool computePixelCoords(float x,float y,unsigned int cameraNum,float& pixel_x,float& pixel_y);

        /** compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.*/
        bool computeNearFar(float x,float y,unsigned int cameraNum,osg::Vec3& near, osg::Vec3& far);

        /** 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 the scene.*/
        bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits);
This commit is contained in:
Robert Osfield
2003-04-16 14:17:49 +00:00
parent 48cb15015f
commit 904aceec22
6 changed files with 160 additions and 134 deletions

View File

@@ -20,6 +20,8 @@
#include <osg/ApplicationUsage>
#include <osg/AnimationPath>
#include <osgUtil/IntersectVisitor>
#include <osgGA/GUIActionAdapter>
#include <osgGA/GUIEventHandler>
#include <osgGA/KeySwitchCameraManipulator>
@@ -92,14 +94,27 @@ class OSGPRODUCER_EXPORT Viewer : public OsgCameraGroup, public osgGA::GUIAction
virtual void requestContinuousUpdate(bool) {}
virtual void requestWarpPointer(float x,float y);
Producer::KeyboardMouse* getKeyboardMouse() { return _kbmcb==0?0:_kbmcb->getKeyboardMouse(); }
const Producer::KeyboardMouse* getKeyboardMouse() const { return _kbmcb==0?0:_kbmcb->getKeyboardMouse(); }
/** compute, from normalized mouse coords, for sepecified Camera, the pixel coords relative to that Camera's RenderSurface.*/
bool computePixelCoords(float x,float y,unsigned int cameraNum,float& pixel_x,float& pixel_y);
/** compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.*/
bool computeNearFar(float x,float y,unsigned int cameraNum,osg::Vec3& near, osg::Vec3& far);
KeyboardMouseCallback* getKeyboardMouseCallback() { return _kbmcb; }
/** 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 the scene.*/
bool computeIntersections(float x,float y,osgUtil::IntersectVisitor::HitList& hits);
Producer::KeyboardMouse* getKeyboardMouse() { return _kbmcb==0?0:_kbmcb->getKeyboardMouse(); }
const Producer::KeyboardMouse* getKeyboardMouse() const { return _kbmcb==0?0:_kbmcb->getKeyboardMouse(); }
KeyboardMouseCallback* getKeyboardMouseCallback() { return _kbmcb; }
const KeyboardMouseCallback* getKeyboardMouseCallback() const { return _kbmcb; }
typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > EventHandlerList;
EventHandlerList& getEventHandlerList() { return _eventHandlerList; }