Removed all KeySwitchCameraManipulator class, replacing it
with the KeySwitchMatrixManipulator
This commit is contained in:
@@ -11,11 +11,11 @@
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#ifndef OSGUTIL_KEYSWITCCAMERAMANIPULATORHER
|
||||
#define OSGUTIL_KEYSWITCHCAMERAMANIPULATORER 1
|
||||
#ifndef OSGUTIL_KEYSWITCMATRIXMANIPULATOR
|
||||
#define OSGUTIL_KEYSWITCMATRIXMANIPULATOR 1
|
||||
|
||||
#include <osgGA/Export>
|
||||
#include <osgGA/CameraManipulator>
|
||||
#include <osgGA/MatrixManipulator>
|
||||
#include <osgGA/GUIEventHandler>
|
||||
#include <osgGA/GUIEventHandlerVisitor>
|
||||
|
||||
@@ -25,51 +25,64 @@ class GUIEventAdapter;
|
||||
class GUIActionAdapter;
|
||||
|
||||
/**
|
||||
KeySwitchCameraManipulator is a decorator which allows the type of camera manipulator
|
||||
KeySwitchMatrixManipulator is a decorator which allows the type of camera manipulator
|
||||
being used to be switched by pressing a key. E.g. '1' for a TrackballManipultor,
|
||||
'2' for a DriveManipulator, '3' for a FlightManipulator. The manipulators available,
|
||||
and the associated switch keys, can be configured.
|
||||
*/
|
||||
class OSGGA_EXPORT KeySwitchCameraManipulator : public CameraManipulator
|
||||
class OSGGA_EXPORT KeySwitchMatrixManipulator : public MatrixManipulator
|
||||
{
|
||||
public:
|
||||
|
||||
virtual const char* className() { return "KeySwitchCamera"; }
|
||||
virtual const char* className() { return "KeySwitchMatrixManipulator"; }
|
||||
|
||||
/**
|
||||
Add a camera manipulator with an associated name, and a key to
|
||||
trigger the switch,
|
||||
*/
|
||||
void addCameraManipulator(int key, std::string name, CameraManipulator *cm);
|
||||
void addMatrixManipulator(int key, std::string name, MatrixManipulator *cm);
|
||||
|
||||
/**
|
||||
Add a camera manipulator with an autogenerated keybinding which is '1' + previous number of camera's registerd.
|
||||
*/
|
||||
void addNumberedCameraManipulator(CameraManipulator *cm);
|
||||
void addNumberedMatrixManipulator(MatrixManipulator *cm);
|
||||
|
||||
unsigned int getNumCameraManipualtors() const { return _manips.size(); }
|
||||
unsigned int getNumMatrixManipualtors() const { return _manips.size(); }
|
||||
|
||||
void selectCameraManipulator(unsigned int num);
|
||||
void selectMatrixManipulator(unsigned int num);
|
||||
|
||||
|
||||
CameraManipulator* getCurrentCameraManipulator() { return _current.get(); }
|
||||
MatrixManipulator* getCurrentMatrixManipulator() { return _current.get(); }
|
||||
|
||||
const CameraManipulator* getCurrentCameraManipulator() const { return _current.get(); }
|
||||
const MatrixManipulator* getCurrentMatrixManipulator() const { return _current.get(); }
|
||||
|
||||
|
||||
CameraManipulator* getCameraManipulator(unsigned int num);
|
||||
MatrixManipulator* getMatrixManipulator(unsigned int num);
|
||||
|
||||
const CameraManipulator* getCameraManipulator(unsigned int num) const;
|
||||
const MatrixManipulator* getMatrixManipulator(unsigned int num) const;
|
||||
|
||||
|
||||
// Overrides from CameraManipulator...
|
||||
// Overrides from MatrixManipulator...
|
||||
|
||||
|
||||
virtual void setCamera(osg::Camera* c) { _current->setCamera(c); }
|
||||
/** set the position of the matrix manipulator using a 4x4 Matrix.*/
|
||||
virtual void setByMatrix(const osg::Matrix& matrix) { _current->setByMatrix(matrix); }
|
||||
|
||||
virtual const osg::Camera * getCamera() const { return _current->getCamera(); }
|
||||
/** set the position of the matrix manipulator using a 4x4 Matrix.*/
|
||||
virtual void setByInverseMatrix(const osg::Matrix& matrix) { _current->setByInverseMatrix(matrix); }
|
||||
|
||||
/** get the position of the manipulator as 4x4 Matrix.*/
|
||||
virtual osg::Matrix getMatrix() const { return _current->getMatrix(); }
|
||||
|
||||
/** get the position of the manipulator as a inverse matrix of the manipulator, typically used as a model view matrix.*/
|
||||
virtual osg::Matrix getInverseMatrix() const { return _current->getInverseMatrix(); }
|
||||
|
||||
/** Get the FusionDistanceMode. Used by SceneView for setting up setereo convergence.*/
|
||||
virtual osgUtil::SceneView::FusionDistanceMode getFusionDistanceMode() const { return _current->getFusionDistanceMode(); }
|
||||
|
||||
/** Get the FusionDistanceValue. Used by SceneView for setting up setereo convergence.*/
|
||||
virtual float getFusionDistanceValue() const { return _current->getFusionDistanceValue(); }
|
||||
|
||||
virtual osg::Camera * getCamera() { return _current->getCamera(); }
|
||||
|
||||
virtual void setNode(osg::Node* n);
|
||||
|
||||
@@ -88,11 +101,11 @@ public:
|
||||
|
||||
private:
|
||||
|
||||
typedef std::pair<std::string, osg::ref_ptr<CameraManipulator> > NamedManipulator;
|
||||
typedef std::pair<std::string, osg::ref_ptr<MatrixManipulator> > NamedManipulator;
|
||||
typedef std::map<int, NamedManipulator> KeyManipMap;
|
||||
KeyManipMap _manips;
|
||||
|
||||
osg::ref_ptr<CameraManipulator> _current;
|
||||
osg::ref_ptr<MatrixManipulator> _current;
|
||||
};
|
||||
|
||||
};
|
||||
Reference in New Issue
Block a user