00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #ifndef INPUT_SPLIT_MANIPULATOR_H
00028 #define INPUT_SPLIT_MANIPULATOR_H
00029
00030 #include <osgGA/MatrixManipulator>
00031 #include <PVLE/Util/Util.h>
00032 #include <PVLE/Input/MatrixGetter.h>
00033
00034
00082
00083
00084
00085
00086
00087
00088
00089 class SplitManipulator : public osgGA::MatrixManipulator {
00090 public:
00094 SplitManipulator(MatrixGetter * pMatrixGetter = NULL, osgGA::GUIEventHandler * pDelegateHandler = NULL) : pMatrixGetter(pMatrixGetter), pDelegateHandler(pDelegateHandler) {}
00095
00097 virtual void init(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) { aa.requestWarpPointer(0,0); }
00098
00100 virtual void setMatrixGetter(MatrixGetter * pMatrixGetter) { ASSERT(pMatrixGetter); this->pMatrixGetter = pMatrixGetter; }
00101
00102 virtual osg::Matrix getMatrix() const { ASSERT(pMatrixGetter); return osg::Matrix::rotate(osg::PI_2, osg::Vec3(1,0,0)) * pMatrixGetter->getMatrix(); }
00103 virtual osg::Matrix getInverseMatrix() const { ASSERT(pMatrixGetter); return pMatrixGetter->getInverseMatrix() * osg::Matrix::rotate(-osg::PI_2, osg::Vec3(1,0,0)); }
00104
00105 virtual void setByMatrix(const osg::Matrix & matrix) { ASSERT(pMatrixGetter); pMatrixGetter->setByMatrix(matrix); }
00106 virtual void setByInverseMatrix(const osg::Matrix & matrix) { ASSERT(pMatrixGetter); pMatrixGetter->setByInverseMatrix(matrix); }
00107
00108 virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa, osg::Object * pObject, osg::NodeVisitor * pNV) { ASSERT(pDelegateHandler); return pDelegateHandler->handle(ea, aa, pObject, pNV); }
00109 virtual bool handle(const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) { ASSERT(pDelegateHandler); return pDelegateHandler->handle(ea, aa); }
00110
00111 protected:
00112 MatrixGetter * pMatrixGetter;
00113 osgGA::GUIEventHandler * pDelegateHandler;
00114 };
00115
00116
00117
00120
00121
00122
00124
00125
00126
00127
00128
00129
00130
00131
00132
00133
00134
00135 #endif // INPUT_SPLIT_MANIPULATOR_H