Added support for handling a user define CoordinateFrame in the flight

and trackball manipulators with API access via the MatrixManipulator
base class
This commit is contained in:
Robert Osfield
2004-04-29 22:18:54 +00:00
parent 36cd372847
commit f81447e839
5 changed files with 32 additions and 15 deletions

View File

@@ -64,6 +64,8 @@ public:
// Overrides from MatrixManipulator...
/** set the coordinate frame which tells the manipulator which way is up, east and north.*/
virtual void setCoordinateFrame(const osg::CoordinateFrame& cf) { _coordinateFrame = cf; _current->setCoordinateFrame(cf); }
/** set the position of the matrix manipulator using a 4x4 Matrix.*/
virtual void setByMatrix(const osg::Matrixd& matrix) { _current->setByMatrix(matrix); }

View File

@@ -16,6 +16,7 @@
#include <osg/Node>
#include <osg/Matrixd>
#include <osg/CoordinateSystemNode>
#include <osgUtil/SceneView>
@@ -39,6 +40,16 @@ public:
virtual const char* className() const { return "MatrixManipulator"; }
/** set the coordinate frame which tells the manipulator which way is up, east and north.*/
virtual void setCoordinateFrame(const osg::CoordinateFrame& cf) { _coordinateFrame = cf; }
/** get the coordinate frame.*/
const osg::CoordinateFrame& getCoordinateFrame() const { return _coordinateFrame; }
osg::Vec3 getSideVector() const { return osg::Vec3(_coordinateFrame(0,0),_coordinateFrame(1,0),_coordinateFrame(2,0)); }
osg::Vec3 getFromVector() const { return osg::Vec3(_coordinateFrame(0,1),_coordinateFrame(1,1),_coordinateFrame(2,1)); }
osg::Vec3 getUpVector() const { return osg::Vec3(_coordinateFrame(0,2),_coordinateFrame(1,2),_coordinateFrame(2,2)); }
/** set the position of the matrix manipulator using a 4x4 Matrix.*/
virtual void setByMatrix(const osg::Matrixd& matrix) = 0;
@@ -95,6 +106,7 @@ protected:
MatrixManipulator();
virtual ~MatrixManipulator();
osg::CoordinateFrame _coordinateFrame;
};
}