diff --git a/VisualStudio/osgGA/osgGA.dsp b/VisualStudio/osgGA/osgGA.dsp index 7ee706649..8a99afc38 100755 --- a/VisualStudio/osgGA/osgGA.dsp +++ b/VisualStudio/osgGA/osgGA.dsp @@ -143,7 +143,7 @@ SOURCE=..\..\src\osgGA\TrackballManipulator.cpp # End Source File # Begin Source File -SOURCE=..\..\src\osgGA\TrackerManipulator.cpp +SOURCE=..\..\src\osgGA\NodeTrackerManipulator.cpp # End Source File # Begin Source File @@ -211,7 +211,7 @@ SOURCE=..\..\Include\osgGA\TrackballManipulator # End Source File # Begin Source File -SOURCE=..\..\Include\osgGA\TrackerManipulator +SOURCE=..\..\Include\osgGA\NodeTrackerManipulator # End Source File # Begin Source File diff --git a/examples/osgsimulation/osgsimulation.cpp b/examples/osgsimulation/osgsimulation.cpp index cc993adc3..93f787da9 100644 --- a/examples/osgsimulation/osgsimulation.cpp +++ b/examples/osgsimulation/osgsimulation.cpp @@ -18,7 +18,7 @@ #include #include -#include +#include // for the grid data.. #include "../osghangglide/terrain_coords.h" @@ -331,7 +331,7 @@ int main(int argc, char **argv) if (!fnnv._foundNodes.empty()) { - osgGA::TrackerManipulator* tm = new osgGA::TrackerManipulator; + osgGA::NodeTrackerManipulator* tm = new osgGA::NodeTrackerManipulator; tm->setTrackNode(fnnv._foundNodes[0].get()); std::cout<<"Found "< #include namespace osgGA{ -class OSGGA_EXPORT TrackerManipulator : public MatrixManipulator +class OSGGA_EXPORT NodeTrackerManipulator : public MatrixManipulator { public: - TrackerManipulator(); + NodeTrackerManipulator(); - virtual const char* className() const { return "Tracker"; } + virtual const char* className() const { return "NodeTrackerManipulator"; } void setTrackNode(osg::Node* node) { _trackNode = node; } osg::Node* getTrackNode() { return _trackNode.get(); } @@ -87,7 +87,7 @@ class OSGGA_EXPORT TrackerManipulator : public MatrixManipulator protected: - virtual ~TrackerManipulator(); + virtual ~NodeTrackerManipulator(); /** Reset the internal GUIEvent stack.*/ void flushMouseEventStack(); diff --git a/src/osgGA/GNUmakefile b/src/osgGA/GNUmakefile index 08d29e302..5e29a5787 100644 --- a/src/osgGA/GNUmakefile +++ b/src/osgGA/GNUmakefile @@ -14,7 +14,7 @@ CXXFILES = \ SetSceneViewVisitor.cpp\ StateSetManipulator.cpp\ TerrainManipulator.cpp\ - TrackerManipulator.cpp\ + NodeTrackerManipulator.cpp\ TrackballManipulator.cpp\ Version.cpp\ diff --git a/src/osgGA/TrackerManipulator.cpp b/src/osgGA/NodeTrackerManipulator.cpp similarity index 92% rename from src/osgGA/TrackerManipulator.cpp rename to src/osgGA/NodeTrackerManipulator.cpp index e1379235d..79da29d5d 100644 --- a/src/osgGA/TrackerManipulator.cpp +++ b/src/osgGA/NodeTrackerManipulator.cpp @@ -1,4 +1,4 @@ -#include +#include #include #include #include @@ -28,7 +28,7 @@ public: NodePathList _nodePaths; }; -TrackerManipulator::TrackerManipulator() +NodeTrackerManipulator::NodeTrackerManipulator() { _rotationMode =ELEVATION_AZIM; _distance = 1.0; @@ -38,19 +38,19 @@ TrackerManipulator::TrackerManipulator() } -TrackerManipulator::~TrackerManipulator() +NodeTrackerManipulator::~NodeTrackerManipulator() { } -void TrackerManipulator::setRotationMode(RotationMode mode) +void NodeTrackerManipulator::setRotationMode(RotationMode mode) { _rotationMode = mode; // need to correct rotation. } -void TrackerManipulator::setNode(osg::Node* node) +void NodeTrackerManipulator::setNode(osg::Node* node) { _node = node; @@ -68,19 +68,19 @@ void TrackerManipulator::setNode(osg::Node* node) } -const osg::Node* TrackerManipulator::getNode() const +const osg::Node* NodeTrackerManipulator::getNode() const { return _node.get(); } -osg::Node* TrackerManipulator::getNode() +osg::Node* NodeTrackerManipulator::getNode() { return _node.get(); } -void TrackerManipulator::home(const GUIEventAdapter& ,GUIActionAdapter& us) +void NodeTrackerManipulator::home(const GUIEventAdapter& ,GUIActionAdapter& us) { if (getAutoComputeHomePosition()) computeHomePosition(); @@ -89,20 +89,20 @@ void TrackerManipulator::home(const GUIEventAdapter& ,GUIActionAdapter& us) } -void TrackerManipulator::init(const GUIEventAdapter& ,GUIActionAdapter& ) +void NodeTrackerManipulator::init(const GUIEventAdapter& ,GUIActionAdapter& ) { flushMouseEventStack(); } -void TrackerManipulator::getUsage(osg::ApplicationUsage& usage) const +void NodeTrackerManipulator::getUsage(osg::ApplicationUsage& usage) const { usage.addKeyboardMouseBinding("Trackball: Space","Reset the viewing position to home"); usage.addKeyboardMouseBinding("Trackball: +","When in stereo, increase the fusion distance"); usage.addKeyboardMouseBinding("Trackball: -","When in stereo, reduse the fusion distance"); } -bool TrackerManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) +bool NodeTrackerManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) { switch(ea.getEventType()) { @@ -188,7 +188,7 @@ bool TrackerManipulator::handle(const GUIEventAdapter& ea,GUIActionAdapter& us) } -bool TrackerManipulator::isMouseMoving() +bool NodeTrackerManipulator::isMouseMoving() { if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; @@ -203,20 +203,20 @@ bool TrackerManipulator::isMouseMoving() } -void TrackerManipulator::flushMouseEventStack() +void NodeTrackerManipulator::flushMouseEventStack() { _ga_t1 = NULL; _ga_t0 = NULL; } -void TrackerManipulator::addMouseEvent(const GUIEventAdapter& ea) +void NodeTrackerManipulator::addMouseEvent(const GUIEventAdapter& ea) { _ga_t1 = _ga_t0; _ga_t0 = &ea; } -void TrackerManipulator::setByMatrix(const osg::Matrixd& matrix) +void NodeTrackerManipulator::setByMatrix(const osg::Matrixd& matrix) { osg::Vec3 lookVector(- matrix(2,0),-matrix(2,1),-matrix(2,2)); @@ -314,13 +314,13 @@ void TrackerManipulator::setByMatrix(const osg::Matrixd& matrix) clampOrientation(); } -osg::Vec3d TrackerManipulator::computeCenter() const +osg::Vec3d NodeTrackerManipulator::computeCenter() const { if (_trackNode.valid()) { CollectParentPaths cpp; - TrackerManipulator* non_const_this = const_cast(this); + NodeTrackerManipulator* non_const_this = const_cast(this); non_const_this->_trackNode->accept(cpp); @@ -336,17 +336,17 @@ osg::Vec3d TrackerManipulator::computeCenter() const return osg::Vec3d(0.0,0.0,0.0); } -osg::Matrixd TrackerManipulator::getMatrix() const +osg::Matrixd NodeTrackerManipulator::getMatrix() const { return osg::Matrixd::translate(0.0,0.0,_distance)*osg::Matrixd::rotate(_rotation)*osg::Matrix::translate(computeCenter()); } -osg::Matrixd TrackerManipulator::getInverseMatrix() const +osg::Matrixd NodeTrackerManipulator::getInverseMatrix() const { return osg::Matrix::translate(-computeCenter())*osg::Matrixd::rotate(_rotation.inverse())*osg::Matrixd::translate(0.0,0.0,-_distance); } -void TrackerManipulator::computePosition(const osg::Vec3d& eye,const osg::Vec3d& center,const osg::Vec3d& up) +void NodeTrackerManipulator::computePosition(const osg::Vec3d& eye,const osg::Vec3d& center,const osg::Vec3d& up) { if (!_node) return; @@ -409,7 +409,7 @@ void TrackerManipulator::computePosition(const osg::Vec3d& eye,const osg::Vec3d& clampOrientation(); } -bool TrackerManipulator::calcMovement() +bool NodeTrackerManipulator::calcMovement() { // return if less then two events have been added. if (_ga_t0.get()==NULL || _ga_t1.get()==NULL) return false; @@ -569,7 +569,7 @@ bool TrackerManipulator::calcMovement() if (!hitFound) { // ?? - osg::notify(INFO)<<"TrackerManipulator unable to intersect with Tracker."<