OpenSceneGraph  3.0.1
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
osgGA::UFOManipulator Class Reference

A UFO manipulator driven with keybindings. More...

Inheritance diagram for osgGA::UFOManipulator:
Inheritance graph
[legend]

Public Member Functions

 UFOManipulator ()
 Default constructor.
virtual const char * className () const
 return className
virtual void setByMatrix (const osg::Matrixd &matrix)
 Set the current position with a matrix.
virtual void setByInverseMatrix (const osg::Matrixd &invmat)
 Set the current position with the inverse matrix.
virtual osg::Matrixd getMatrix () const
 Get the current viewmatrix.
virtual osg::Matrixd getInverseMatrix () const
 Get the current inverse view matrix.
virtual void setNode (osg::Node *node)
 Set the subgraph this manipulator is driving the eye through.
virtual const osg::NodegetNode () const
 Get the root node of the subgraph this manipulator is driving the eye through (const)
virtual osg::NodegetNode ()
 Get the root node of the subgraph this manipulator is driving the eye through.
virtual void computeHomePosition ()
 Computes the home position based on the extents and scale of the scene graph rooted at node.
virtual void home (const osgGA::GUIEventAdapter &, osgGA::GUIActionAdapter &)
 Sets the viewpoint matrix to the home position.
void home (double)
 Move the camera to the default position.
virtual void init (const GUIEventAdapter &, GUIActionAdapter &)
 Start/restart the manipulator.
bool handle (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &aa)
 Handles incoming osgGA events.
void getUsage (osg::ApplicationUsage &usage) const
 Reports Usage parameters to the application.
void getCurrentPositionAsLookAt (osg::Vec3d &eye, osg::Vec3d &center, osg::Vec3d &up)
 Report the current position as LookAt vectors.
void setMinHeight (double in_min_height)
double getMinHeight () const
void setMinDistance (double in_min_dist)
double getMinDistance () const
void setForwardSpeed (double in_fs)
double getForwardSpeed () const
void setSideSpeed (double in_ss)
double getSideSpeed () const
void setRotationSpeed (double in_rot_speed)
double getRotationSpeed () const
- Public Member Functions inherited from osgGA::CameraManipulator
virtual void setCoordinateFrameCallback (CoordinateFrameCallback *cb)
 set the coordinate frame which callback tells the manipulator which way is up, east and north.
CoordinateFrameCallbackgetCoordinateFrameCallback ()
 get the coordinate frame callback which tells the manipulator which way is up, east and north.
const CoordinateFrameCallbackgetCoordinateFrameCallback () const
 get the coordinate frame callback which tells the manipulator which way is up, east and north.
osg::CoordinateFrame getCoordinateFrame (const osg::Vec3d &position) const
 get the coordinate frame.
osg::Vec3d getSideVector (const osg::CoordinateFrame &cf) const
osg::Vec3d getFrontVector (const osg::CoordinateFrame &cf) const
osg::Vec3d getUpVector (const osg::CoordinateFrame &cf) const
virtual
osgUtil::SceneView::FusionDistanceMode 
getFusionDistanceMode () const
 Get the FusionDistanceMode.
virtual float getFusionDistanceValue () const
 Get the FusionDistanceValue.
void setIntersectTraversalMask (unsigned int mask)
 Set the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection.
unsigned int getIntersectTraversalMask () const
 Get the mask to use when set up intersection traversal such as used in manipulators that follow terrain or have collision detection.
virtual void setHomePosition (const osg::Vec3d &eye, const osg::Vec3d &center, const osg::Vec3d &up, bool autoComputeHomePosition=false)
 Manually set the home position, and set the automatic compute of home position.
virtual void getHomePosition (osg::Vec3d &eye, osg::Vec3d &center, osg::Vec3d &up) const
 Get the manually set home position.
virtual void setAutoComputeHomePosition (bool flag)
 Set whether the automatic compute of the home position is enabled.
bool getAutoComputeHomePosition () const
 Get whether the automatic compute of the home position is enabled.
virtual void computeHomePosition (const osg::Camera *camera=NULL, bool useBoundingBox=false)
 Compute the home position.
- Public Member Functions inherited from osgGA::GUIEventHandler
 GUIEventHandler ()
 GUIEventHandler (const GUIEventHandler &eh, const osg::CopyOp &copyop)
 META_Object (osgGA, GUIEventHandler)
virtual void operator() (osg::Node *node, osg::NodeVisitor *nv)
 Event traversal node callback method.
virtual void event (osg::NodeVisitor *nv, osg::Drawable *drawable)
 Event traversal drawable callback method.
virtual bool handle (const GUIEventAdapter &ea, GUIActionAdapter &aa, osg::Object *, osg::NodeVisitor *)
 Handle events, return true if handled, false otherwise.
bool handleWithCheckAgainstIgnoreHandledEventsMask (const GUIEventAdapter &ea, GUIActionAdapter &aa, osg::Object *object, osg::NodeVisitor *nv)
 Convenience method that only passes on to the handle(,,,) method events that either haven't been handled yet, or have been handled but haven't be set to be ignored by the IgnoreHandledEventsMask.
bool handleWithCheckAgainstIgnoreHandledEventsMask (const GUIEventAdapter &ea, GUIActionAdapter &aa)
 Convenience method that only passes on to the handle(,) method events that either haven't been handled yet, or have been handled but haven't be set to be ignored by the IgnoreHandledEventsMask.
void setIgnoreHandledEventsMask (unsigned int mask)
 Set a mask of osgGA::GUIEeventAdapter::Event to be ignored if marked as handled.
unsigned int getIgnoreHandledEventsMask () const
 Get the event mask of the osgGA::GUIEeventAdapter::Event to be ignored if marked as handled.
- Public Member Functions inherited from osg::NodeCallback
 NodeCallback ()
 NodeCallback (const NodeCallback &nc, const CopyOp &)
 META_Object (osg, NodeCallback)
void traverse (Node *node, NodeVisitor *nv)
 Call any nested callbacks and then traverse the scene graph.
void setNestedCallback (NodeCallback *nc)
NodeCallbackgetNestedCallback ()
const NodeCallbackgetNestedCallback () const
void addNestedCallback (NodeCallback *nc)
void removeNestedCallback (NodeCallback *nc)
- Public Member Functions inherited from osg::Object
 Object ()
 Construct an object.
 Object (bool threadSafeRefUnref)
 Object (const Object &, const CopyOp &copyop=CopyOp::SHALLOW_COPY)
 Copy constructor, optional CopyOp object can be used to control shallow vs deep copying of dynamic data.
virtual ObjectcloneType () const =0
 Clone the type of an object, with Object* return type.
virtual Objectclone (const CopyOp &) const =0
 Clone an object, with Object* return type.
virtual bool isSameKindAs (const Object *) const
virtual const char * libraryName () const =0
 return the name of the object's library.
virtual void setThreadSafeRefUnref (bool threadSafe)
 Set whether to use a mutex to ensure ref() and unref() are thread safe.
virtual void setName (const std::string &name)
 Set the name of object using C++ style string.
void setName (const char *name)
 Set the name of object using a C style string.
const std::string & getName () const
 Get the name of object.
void setDataVariance (DataVariance dv)
 Set the data variance of this object.
DataVariance getDataVariance () const
 Get the data variance of this object.
virtual void computeDataVariance ()
 Compute the DataVariance based on an assessment of callback etc.
void setUserDataContainer (osg::UserDataContainer *udc)
 set the UserDataContainer object.
osg::UserDataContainergetUserDataContainer ()
 get the UserDataContainer attached to this object.
const osg::UserDataContainergetUserDataContainer () const
 get the const UserDataContainer attached to this object.
osg::UserDataContainergetOrCreateUserDataContainer ()
 Convinience method that returns the UserDataContainer, and if one doesn't already exist creates and assigns a DefaultUserDataContainer to the Object and then return this new UserDataContainer.
virtual void setUserData (Referenced *obj)
 Set user data, data must be subclassed from Referenced to allow automatic memory handling.
virtual ReferencedgetUserData ()
 Get user data.
virtual const ReferencedgetUserData () const
 Get const user data.
template<typename T >
bool getUserValue (const std::string &name, T &value) const
 Convinience method that casts the named UserObject to osg::TemplateValueObject<T> and gets the value.
template<typename T >
void setUserValue (const std::string &name, const T &value)
 Convinience method that creates the osg::TemplateValueObject<T> to store the specified value and adds it as a named UserObject.
virtual void resizeGLObjectBuffers (unsigned int)
 Resize any per context GLObject buffers to specified size.
virtual void releaseGLObjects (osg::State *=0) const
 If State is non-zero, this function releases any associated OpenGL objects for the specified graphics context.
- Public Member Functions inherited from osg::Referenced
 Referenced ()
 Referenced (bool threadSafeRefUnref)
 Referenced (const Referenced &)
Referencedoperator= (const Referenced &)
bool getThreadSafeRefUnref () const
 Get whether a mutex is used to ensure ref() and unref() are thread safe.
OpenThreads::Mutex * getRefMutex () const
 Get the mutex used to ensure thread safety of ref()/unref().
int ref () const
 Increment the reference count by one, indicating that this object has another pointer which is referencing it.
int unref () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
int unref_nodelete () const
 Decrement the reference count by one, indicating that a pointer to this object is referencing it.
int referenceCount () const
 Return the number of pointers currently referencing this object.
ObserverSetgetObserverSet () const
 Get the ObserverSet if one is attached, otherwise return NULL.
ObserverSetgetOrCreateObserverSet () const
 Get the ObserverSet if one is attached, otherwise create an ObserverSet, attach it, then return this newly created ObserverSet.
void addObserver (Observer *observer) const
 Add a Observer that is observing this object, notify the Observer when this object gets deleted.
void removeObserver (Observer *observer) const
 Remove Observer that is observing this object.
- Public Member Functions inherited from osg::Drawable::EventCallback
 EventCallback ()
 EventCallback (const EventCallback &, const CopyOp &)
 META_Object (osg, EventCallback)

Protected Member Functions

virtual ~UFOManipulator ()
bool intersect (const osg::Vec3d &start, const osg::Vec3d &end, osg::Vec3d &intersection) const
void _stop ()
void _keyDown (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)
void _keyUp (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)
void _frame (const osgGA::GUIEventAdapter &ea, osgGA::GUIActionAdapter &)
void _adjustPosition ()
- Protected Member Functions inherited from osgGA::CameraManipulator
 CameraManipulator ()
 CameraManipulator (const CameraManipulator &mm, const osg::CopyOp &copyOp=osg::CopyOp::SHALLOW_COPY)
virtual ~CameraManipulator ()
std::string getManipulatorName () const

Protected Attributes

osg::observer_ptr< osg::Node_node
float _viewAngle
osg::Matrixd _matrix
osg::Matrixd _inverseMatrix
osg::Matrixd _offset
double _minHeightAboveGround
double _minDistanceInFront
double _speedEpsilon
double _forwardSpeed
double _sideSpeed
double _upSpeed
double _speedAccelerationFactor
double _speedDecelerationFactor
bool _decelerateUpSideRate
double _directionRotationEpsilon
double _directionRotationRate
double _directionRotationAcceleration
double _directionRotationDeceleration
double _viewOffsetDelta
double _pitchOffsetRate
double _pitchOffset
double _yawOffsetRate
double _yawOffset
double _t0
double _dt
osg::Vec3d _direction
osg::Vec3d _position
bool _shift
bool _ctrl
bool _decelerateOffsetRate
bool _straightenOffset
- Protected Attributes inherited from osgGA::CameraManipulator
unsigned int _intersectTraversalMask
bool _autoComputeHomePosition
osg::Vec3d _homeEye
osg::Vec3d _homeCenter
osg::Vec3d _homeUp
osg::ref_ptr
< CoordinateFrameCallback
_coordinateFrameCallback
- Protected Attributes inherited from osgGA::GUIEventHandler
unsigned int _ignoreHandledEventsMask

Additional Inherited Members

- Public Types inherited from osg::Object
enum  DataVariance { DYNAMIC, STATIC, UNSPECIFIED }
- Static Public Member Functions inherited from osg::Referenced
static OpenThreads::Mutex * getGlobalReferencedMutex ()
 Get the optional global Referenced mutex, this can be shared between all osg::Referenced.
static void setThreadSafeReferenceCounting (bool enableThreadSafeReferenceCounting)
 Set whether reference counting should use a mutex for thread safe reference counting.
static bool getThreadSafeReferenceCounting ()
 Get whether reference counting is active.
static void setDeleteHandler (DeleteHandler *handler)
 Set a DeleteHandler to which deletion of all referenced counted objects will be delegated.
static DeleteHandlergetDeleteHandler ()
 Get a DeleteHandler.
- Public Attributes inherited from osg::NodeCallback
ref_ptr< NodeCallback_nestedCallback

Detailed Description

A UFO manipulator driven with keybindings.

The UFOManipulator is better suited for applications that employ architectural walk-throughs, or situations where the eyepoint motion model must move slowly, deliberately and well controlled.

The UFO Manipulator allows the following movements with the listed Key combinations:

Parameters
UpArrowAcceleration forward.
DownArrowAcceleration backward (or deceleration forward).
LeftArrowRotate view and direction of travel to the left.
RightArrowRotate view and direction of travel to the right.
SpaceBarBrake. Gradually decelerates linear and rotational movement.
Shift/UpArrowAccelerate up.
Shift/DownArrowAccelerate down.
Shift/LeftArrowAccelerate (linearly) left.
Shift/RightArrowAccelerate (linearly) right.
Shift/SpaceBarInstant brake. Immediately stop all linear and rotational movement.

When the Shift key is released, up, down, linear left and/or linear right movement is decelerated.

\param Ctrl/UpArrow     Rotate view (but not direction of travel) up.
\param Ctrl/DownArrow   Rotate view (but not direction of travel) down.
\param Ctrl/LeftArrow   Rotate view (but not direction of travel) left.
\param Ctrl/RightArrow  Rotate view (but not direction of travel) right.
\param Ctrl/Return      Straightens out the view offset.

Constructor & Destructor Documentation

osgGA::UFOManipulator::UFOManipulator ( )

Default constructor.

virtual osgGA::UFOManipulator::~UFOManipulator ( )
protectedvirtual

Member Function Documentation

void osgGA::UFOManipulator::_adjustPosition ( )
protected
void osgGA::UFOManipulator::_frame ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter  
)
protected
void osgGA::UFOManipulator::_keyDown ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter  
)
protected
void osgGA::UFOManipulator::_keyUp ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter  
)
protected
void osgGA::UFOManipulator::_stop ( )
protected
virtual const char* osgGA::UFOManipulator::className ( ) const
virtual

return className

Returns
returns constant "UFO"

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::UFOManipulator::computeHomePosition ( )
virtual

Computes the home position based on the extents and scale of the scene graph rooted at node.

void osgGA::UFOManipulator::getCurrentPositionAsLookAt ( osg::Vec3d eye,
osg::Vec3d center,
osg::Vec3d up 
)

Report the current position as LookAt vectors.

double osgGA::UFOManipulator::getForwardSpeed ( ) const
inline
virtual osg::Matrixd osgGA::UFOManipulator::getInverseMatrix ( ) const
virtual

Get the current inverse view matrix.

Implements osgGA::CameraManipulator.

virtual osg::Matrixd osgGA::UFOManipulator::getMatrix ( ) const
virtual

Get the current viewmatrix.

Implements osgGA::CameraManipulator.

double osgGA::UFOManipulator::getMinDistance ( ) const
inline
double osgGA::UFOManipulator::getMinHeight ( ) const
inline
virtual const osg::Node* osgGA::UFOManipulator::getNode ( ) const
virtual

Get the root node of the subgraph this manipulator is driving the eye through (const)

Reimplemented from osgGA::CameraManipulator.

virtual osg::Node* osgGA::UFOManipulator::getNode ( )
virtual

Get the root node of the subgraph this manipulator is driving the eye through.

Reimplemented from osgGA::CameraManipulator.

double osgGA::UFOManipulator::getRotationSpeed ( ) const
inline
double osgGA::UFOManipulator::getSideSpeed ( ) const
inline
void osgGA::UFOManipulator::getUsage ( osg::ApplicationUsage usage) const
virtual

Reports Usage parameters to the application.

Reimplemented from osgGA::GUIEventHandler.

bool osgGA::UFOManipulator::handle ( const osgGA::GUIEventAdapter ea,
osgGA::GUIActionAdapter aa 
)
virtual

Handles incoming osgGA events.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::UFOManipulator::home ( const osgGA::GUIEventAdapter ,
osgGA::GUIActionAdapter  
)
virtual

Sets the viewpoint matrix to the home position.

Reimplemented from osgGA::CameraManipulator.

void osgGA::UFOManipulator::home ( double  )
virtual

Move the camera to the default position.

This version does not require GUIEventAdapter and GUIActionAdapter so may be called from somewhere other than a handle() method in GUIEventHandler. Application must be aware of implications.

Reimplemented from osgGA::CameraManipulator.

virtual void osgGA::UFOManipulator::init ( const GUIEventAdapter ,
GUIActionAdapter  
)
virtual

Start/restart the manipulator.

FIXME: what does this actually mean? Provide examples.

Reimplemented from osgGA::CameraManipulator.

bool osgGA::UFOManipulator::intersect ( const osg::Vec3d start,
const osg::Vec3d end,
osg::Vec3d intersection 
) const
protected
virtual void osgGA::UFOManipulator::setByInverseMatrix ( const osg::Matrixd invmat)
virtual

Set the current position with the inverse matrix.

Parameters
invmatThe inverse of a viewpoint matrix

Implements osgGA::CameraManipulator.

virtual void osgGA::UFOManipulator::setByMatrix ( const osg::Matrixd matrix)
virtual

Set the current position with a matrix.

Parameters
matrixA viewpoint matrix.

Implements osgGA::CameraManipulator.

void osgGA::UFOManipulator::setForwardSpeed ( double  in_fs)
inline
void osgGA::UFOManipulator::setMinDistance ( double  in_min_dist)
inline
void osgGA::UFOManipulator::setMinHeight ( double  in_min_height)
inline
virtual void osgGA::UFOManipulator::setNode ( osg::Node node)
virtual

Set the subgraph this manipulator is driving the eye through.

Parameters
noderoot of subgraph

Reimplemented from osgGA::CameraManipulator.

void osgGA::UFOManipulator::setRotationSpeed ( double  in_rot_speed)
inline
void osgGA::UFOManipulator::setSideSpeed ( double  in_ss)
inline

Member Data Documentation

bool osgGA::UFOManipulator::_ctrl
protected
bool osgGA::UFOManipulator::_decelerateOffsetRate
protected
bool osgGA::UFOManipulator::_decelerateUpSideRate
protected
osg::Vec3d osgGA::UFOManipulator::_direction
protected
double osgGA::UFOManipulator::_directionRotationAcceleration
protected
double osgGA::UFOManipulator::_directionRotationDeceleration
protected
double osgGA::UFOManipulator::_directionRotationEpsilon
protected
double osgGA::UFOManipulator::_directionRotationRate
protected
double osgGA::UFOManipulator::_dt
protected
double osgGA::UFOManipulator::_forwardSpeed
protected
osg::Matrixd osgGA::UFOManipulator::_inverseMatrix
protected
osg::Matrixd osgGA::UFOManipulator::_matrix
protected
double osgGA::UFOManipulator::_minDistanceInFront
protected
double osgGA::UFOManipulator::_minHeightAboveGround
protected
osg::observer_ptr<osg::Node> osgGA::UFOManipulator::_node
protected
osg::Matrixd osgGA::UFOManipulator::_offset
protected
double osgGA::UFOManipulator::_pitchOffset
protected
double osgGA::UFOManipulator::_pitchOffsetRate
protected
osg::Vec3d osgGA::UFOManipulator::_position
protected
bool osgGA::UFOManipulator::_shift
protected
double osgGA::UFOManipulator::_sideSpeed
protected
double osgGA::UFOManipulator::_speedAccelerationFactor
protected
double osgGA::UFOManipulator::_speedDecelerationFactor
protected
double osgGA::UFOManipulator::_speedEpsilon
protected
bool osgGA::UFOManipulator::_straightenOffset
protected
double osgGA::UFOManipulator::_t0
protected
double osgGA::UFOManipulator::_upSpeed
protected
float osgGA::UFOManipulator::_viewAngle
protected
double osgGA::UFOManipulator::_viewOffsetDelta
protected
double osgGA::UFOManipulator::_yawOffset
protected
double osgGA::UFOManipulator::_yawOffsetRate
protected

The documentation for this class was generated from the following file:

osg logo
Generated at Fri Sep 7 2012 02:20:43 for the OpenSceneGraph by doxygen 1.8.1.2.