SPIN Framework
|
This class provides camera control and picking for viewers that render a SPIN scene. More...
#include <ViewerManipulator.h>
Public Member Functions | |
void | setPicker (bool b) |
void | setMover (bool b) |
void | setRaw (bool b) |
bool | handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa) |
void | handleKeypress (const osgGA::GUIEventAdapter &ea) |
void | handleMouse (osgViewer::View *view, const osgGA::GUIEventAdapter &ea) |
Protected Attributes | |
std::string | userID |
std::vector< GroupNode * > | selectedNodes |
bool | picker |
bool | mover |
bool | raw |
float | lastX |
float | lastY |
float | clickX |
float | clickY |
bool | manipulatorKey |
osg::Vec3 | lastHitPoint |
This class provides camera control and picking for viewers that render a SPIN scene.
We override the osgGA::NodeTrackerManipulator class so that our camera can follow any node (ie, the UserNode for the viewer). However, mouse events are handled differently. Instead of directly affecting the state of the viewer's graph, we send the events to the server, which will update the UserNode and the changes will be updated on ALL machines.
Additionally, picking of interactive nodes is supported, allowing the viewer to manipulate content of a SPIN scene using the mouse.
bool spin::ViewerManipulator::handle | ( | const osgGA::GUIEventAdapter & | ea, |
osgGA::GUIActionAdapter & | aa | ||
) |
if the userNode's nodepath has changed, we must call setTrackNode again to force NodeTrackerManipulator to store the proper nodePath
void spin::ViewerManipulator::handleKeypress | ( | const osgGA::GUIEventAdapter & | ea | ) |
Handles keyboard input.
void spin::ViewerManipulator::handleMouse | ( | osgViewer::View * | view, |
const osgGA::GUIEventAdapter & | ea | ||
) |
Handles mouse interaction with the scene. Includes camera navigation, picking interactive nodes and manipulating nodes with manipulator handles.
void spin::ViewerManipulator::setMover | ( | bool | b | ) |
Enables or disables the use of camera motion controls.
void spin::ViewerManipulator::setPicker | ( | bool | b | ) |
Enables or disables use of the mouse to pick nodes.
void spin::ViewerManipulator::setRaw | ( | bool | b | ) |
Enables or disables raw mouse events. TO_BE_VERIFIED