56 lines
1.5 KiB
Plaintext
56 lines
1.5 KiB
Plaintext
|
#ifndef OSGUTIL_CAMERAMANIPULATOR
|
||
|
#define OSGUTIL_CAMERAMANIPULATOR 1
|
||
|
|
||
|
#include <osg/Referenced>
|
||
|
#include <osg/Camera>
|
||
|
#include <osgUtil/Export>
|
||
|
#include <osgUtil/GUIEventAdapter>
|
||
|
#include <osgUtil/GUIActionAdapter>
|
||
|
|
||
|
namespace osgUtil{
|
||
|
|
||
|
class OSGUTIL_EXPORT CameraManipulator : public osg::Referenced
|
||
|
{
|
||
|
public:
|
||
|
|
||
|
CameraManipulator();
|
||
|
virtual ~CameraManipulator();
|
||
|
|
||
|
/** attach a camera to the manipulator to be used for specifying view.*/
|
||
|
virtual void setCamera(osg::Camera*);
|
||
|
|
||
|
/** get the attached a camera.*/
|
||
|
virtual osg::Camera * getCamera() const;
|
||
|
|
||
|
/** Attach a node to the manipulator.
|
||
|
Automatically detaches previously attached node.
|
||
|
setNode(NULL) detaches previously nodes.
|
||
|
Is ignored by manipulators which do not require a reference model.*/
|
||
|
virtual void setNode(osg::Node*) {}
|
||
|
|
||
|
/** Return node if attached.*/
|
||
|
virtual osg::Node* getNode() const { return NULL; }
|
||
|
|
||
|
/** Move the camera to the default position.
|
||
|
May be ignored by manipulators if home functionality is not appropriate.*/
|
||
|
virtual void home(GUIEventAdapter& ,GUIActionAdapter&) {}
|
||
|
|
||
|
/** Start/restart the manipulator.*/
|
||
|
virtual void init(GUIEventAdapter& ,GUIActionAdapter&) {}
|
||
|
|
||
|
/** Handle events, return true if handled, false otherwise.*/
|
||
|
virtual bool update(GUIEventAdapter& ea,GUIActionAdapter& us);
|
||
|
|
||
|
|
||
|
protected:
|
||
|
|
||
|
// Reference pointer to a camera
|
||
|
osg::ref_ptr<osg::Camera> _camera;
|
||
|
|
||
|
};
|
||
|
|
||
|
}
|
||
|
|
||
|
#endif
|
||
|
|