- Main Page
- Modules
- Namespaces
- Classes
- Files
- Related Pages

- Alphabetical List
- Class List
- Class Hierarchy
- Class Members

# osgProducer::Viewer Class Reference

Inheritance diagram for osgProducer::Viewer:

[legend]
List of all members.

## Public Types
typedef std::list< osg::ref_ptr< osgGA::GUIEventHandler > > | EventHandlerList
enum | ViewerOptions { NO_EVENT_HANDLERS = 0, TRACKBALL_MANIPULATOR = 1, DRIVE_MANIPULATOR = 2, FLIGHT_MANIPULATOR = 4, TERRAIN_MANIPULATOR = 8, STATE_MANIPULATOR = 32, HEAD_LIGHT_SOURCE = 64, SKY_LIGHT_SOURCE = 128, STATS_MANIPULATOR = 256, VIEWER_MANIPULATOR = 512, ESCAPE_SETS_DONE = 1024, STANDARD_SETTINGS }
## Public Member Functions
| Viewer ()
| Viewer (Producer::CameraConfig *cfg)
| Viewer (const std::string &configFile)
| Viewer (osg::ArgumentParser &arguments)
virtual | ~Viewer ()
void | setUpViewer (unsigned int options=STANDARD_SETTINGS)
void | setDoneAtElapsedTime (double elapsedTime)
| Set the viewer so it sets done to true once the refrence time equals or exceeds specified elapsed time.
double | getDoneAtElapsedTime () const
| Get the elapsed time that will cause done to be set to be true.
void | setDoneAtElapsedTimeEnabled (bool enabled)
| Set whether to use a elapsed time to limit the run of the viewer.
bool | getDoneAtElapsedTimeEnabled () const
| Get whether to use a elapsed time to limit the run of the viewer.
void | setDoneAtFrameNumber (unsigned int frameNumber)
| Set the viewer so it sets done to true once the frame number equals or exceeds specified frame number.
unsigned int | getDoneAtFrameNumber () const
| Get the frame number that will cause done to be set to be true.
void | setDoneAtFrameNumberEnabled (bool enabled)
| Set whether to use a frame number to limit the run of the viewer.
bool | getDoneAtFrameNumberEnabled () const
| Get whether to use a frame number to limit the run of the viewer.
void | setDone (bool done)
| Set the done flag signalling that the viewer exit.
bool | getDone () const
| Get the done flag which signals that the viewer exit.
virtual bool | done () const
| return true if the application is done and should exit.
void | setWriteImageWhenDone (bool enabled)
| Set the viewer to take an image snapshot on the last frame() when done is enabled.
bool | getWriteImageWhenDone () const
| Set the viewer to take an image snapshot on the last frame() when done is enabled.
void | setWriteImageFileName (const std::string &filename)
| Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.
const std::string & | getWriteImageFileName () const
| Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.
virtual void | setViewByMatrix (const Producer::Matrix &pm)
| Override the Producer::CameraGroup::setViewByMatrix to catch all changes to view.
virtual bool | realize (ThreadingModel thread_model)
| Set the threading model and then call realize().
virtual bool | realize ()
| Realize the render surfaces (OpenGL graphics) and various threads, and call any realize callbacks.
virtual void | update ()
| Updated the scene.
void | setUpdateVisitor (osg::NodeVisitor *nv)
| set the update visitor which does the update traversal of the scene graph.
osg::NodeVisitor * | getUpdateVisitor ()
| get the update visitor.
const osg::NodeVisitor * | getUpdateVisitor () const
| get the const update visitor.
void | computeActiveCoordindateSystemNodePath ()
void | setCoordindateSystemNodePath (const osg::RefNodePath &nodePath)
void | setCoordindateSystemNodePath (const osg::NodePath &nodePath)
const osg::RefNodePath & | getCoordindateSystemNodePath () const
virtual void | frame ()
| Dispatch the cull and draw for each of the Camera's for this frame.
virtual void | requestRedraw ()
| requestRedraw() requests a single redraw.
virtual void | requestContinuousUpdate (bool)
| requestContinousUpdate(bool) is for en/disabling a throw or idle callback to be requested by a GUIEventHandler (typically a MatrixManipulator, though other GUIEventHandler's may also provide functionality).
virtual void | requestWarpPointer (float x, float y)
| requestWarpPointer(int,int) is requesting a repositioning of the mouse pointer to a specified x,y location on the window.
bool | computePixelCoords (float x, float y, unsigned int cameraNum, float &pixel_x, float &pixel_y)
| compute, from normalized mouse coords, for sepecified Camera, the pixel coords relative to that Camera's RenderSurface.
bool | computeNearFarPoints (float x, float y, unsigned int cameraNum, osg::Vec3 &near, osg::Vec3 &far)
| compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.
bool | computeIntersections (float x, float y, unsigned int cameraNum, osg::Node *node, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
| compute, from normalized mouse coords, for all Cameras, intersections with the specified subgraph.
bool | computeIntersections (float x, float y, unsigned int cameraNum, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
| compute, from normalized mouse coords, for sepecified Camera, intersections with the scene.
bool | computeIntersections (float x, float y, osg::Node *node, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
| compute, from normalized mouse coords, for all Cameras, intersections with specified subgraph.
bool | computeIntersections (float x, float y, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
| compute, from normalized mouse coords, for all Cameras, intersections with the scene.
void | setKeyboardMouse (Producer::KeyboardMouse *kbm)
Producer::KeyboardMouse * | getKeyboardMouse ()
const Producer::KeyboardMouse * | getKeyboardMouse () const
void | setKeyboardMouseCallback (osgProducer::KeyboardMouseCallback *kbmcb)
osgProducer::KeyboardMouseCallback * | getKeyboardMouseCallback ()
const osgProducer::KeyboardMouseCallback * | getKeyboardMouseCallback () const
EventHandlerList & | getEventHandlerList ()
const EventHandlerList & | getEventHandlerList () const
osgGA::KeySwitchMatrixManipulator * | getKeySwitchMatrixManipulator ()
const osgGA::KeySwitchMatrixManipulator * | getKeySwitchMatrixManipulator () const
unsigned int | addCameraManipulator (osgGA::MatrixManipulator *cm)
void | selectCameraManipulator (unsigned int no)
void | setRecordingAnimationPath (bool on)
bool | getRecordingAnimationPath () const
void | setAnimationPath (osg::AnimationPath *path)
osg::AnimationPath * | getAnimationPath ()
const osg::AnimationPath * | getAnimationPath () const
const double * | getPosition () const
double | getSpeed () const
osg::Quat | getOrientation () const
virtual void | getUsage (osg::ApplicationUsage &usage) const
| Get the keyboard and mouse usage of this viewer.
virtual void | updatedSceneData ()
| update internal structures w.r.t updated scene data.
## Protected Attributes
bool | _setDoneAtElapsedTimeEnabled
double | _setDoneAtElapsedTime
bool | _setDoneAtFrameNumberEnabled
unsigned int | _setDoneAtFrameNumber
bool | _done
bool | _writeImageWhenDone
std::string | _writeImageFileName
osg::ref_ptr< Producer::KeyboardMouse > | _kbm
osg::ref_ptr< osgProducer::KeyboardMouseCallback > | _kbmcb
EventHandlerList | _eventHandlerList
osg::ref_ptr< osgGA::KeySwitchMatrixManipulator > | _keyswitchManipulator
osg::ref_ptr< osg::NodeVisitor > | _updateVisitor
osg::RefNodePath | _coordinateSystemNodePath
bool | _recordingAnimationPath
double | _recordingStartTime
osg::ref_ptr< osg::AnimationPath > | _animationPath
double | _position [3]
osg::Quat | _orientation
double | _speed

## Member Typedef Documentation

typedef std::list< osg::ref_ptr<osgGA::GUIEventHandler> > osgProducer::Viewer::EventHandlerList

## Member Enumeration Documentation

enum osgProducer::Viewer::ViewerOptions

  | Enumerator:
  NO_EVENT_HANDLERS |
  TRACKBALL_MANIPULATOR |
  DRIVE_MANIPULATOR |
  FLIGHT_MANIPULATOR |
  TERRAIN_MANIPULATOR |
  STATE_MANIPULATOR |
  HEAD_LIGHT_SOURCE |
  SKY_LIGHT_SOURCE |
  STATS_MANIPULATOR |
  VIEWER_MANIPULATOR |
  ESCAPE_SETS_DONE |
  STANDARD_SETTINGS |

## Constructor & Destructor Documentation

Viewer::Viewer | ( |  | ) |

Viewer::Viewer | ( | Producer::CameraConfig * | cfg | ) |

Viewer::Viewer | ( | const std::string & | configFile | ) |

Viewer::Viewer | ( | osg::ArgumentParser & | arguments | ) |

Viewer::~Viewer | ( |  | ) | `[virtual]`

## Member Function Documentation

unsigned int Viewer::addCameraManipulator | ( | osgGA::MatrixManipulator * | cm | ) |

void Viewer::computeActiveCoordindateSystemNodePath | ( |  | ) |

bool Viewer::computeIntersections | ( | float | x,
|  | float | y,
|  | osgUtil::IntersectVisitor::HitList & | hits,
|  | osg::Node::NodeMask | traversalMask = `0xffffffff`
| ) |

| compute, from normalized mouse coords, for all Cameras, intersections with the scene.

bool Viewer::computeIntersections | ( | float | x,
|  | float | y,
|  | osg::Node * | node,
|  | osgUtil::IntersectVisitor::HitList & | hits,
|  | osg::Node::NodeMask | traversalMask = `0xffffffff`
| ) |

| compute, from normalized mouse coords, for all Cameras, intersections with specified subgraph.

bool Viewer::computeIntersections | ( | float | x,
|  | float | y,
|  | unsigned int | cameraNum,
|  | osgUtil::IntersectVisitor::HitList & | hits,
|  | osg::Node::NodeMask | traversalMask = `0xffffffff`
| ) |

| compute, from normalized mouse coords, for sepecified Camera, intersections with the scene.

bool Viewer::computeIntersections | ( | float | x,
|  | float | y,
|  | unsigned int | cameraNum,
|  | osg::Node * | node,
|  | osgUtil::IntersectVisitor::HitList & | hits,
|  | osg::Node::NodeMask | traversalMask = `0xffffffff`
| ) |

| compute, from normalized mouse coords, for all Cameras, intersections with the specified subgraph.

bool Viewer::computeNearFarPoints | ( | float | x,
|  | float | y,
|  | unsigned int | cameraNum,
|  | osg::Vec3 & | near,
|  | osg::Vec3 & | far
| ) |

| compute, from normalized mouse coords, for sepecified Camera, the near and far points in worlds coords.

bool Viewer::computePixelCoords | ( | float | x,
|  | float | y,
|  | unsigned int | cameraNum,
|  | float & | pixel_x,
|  | float & | pixel_y
| ) |

| compute, from normalized mouse coords, for sepecified Camera, the pixel coords relative to that Camera's RenderSurface.

bool Viewer::done | ( |  | ) | const`[virtual]`

| return true if the application is done and should exit.

void Viewer::frame | ( |  | ) | `[virtual]`

| Dispatch the cull and draw for each of the Camera's for this frame. Reimplemented from osgProducer::OsgCameraGroup.

const osg::AnimationPath* osgProducer::Viewer::getAnimationPath | ( |  | ) | const`[inline]`

osg::AnimationPath* osgProducer::Viewer::getAnimationPath | ( |  | ) | `[inline]`

const osg::RefNodePath& osgProducer::Viewer::getCoordindateSystemNodePath | ( |  | ) | const`[inline]`

bool osgProducer::Viewer::getDone | ( |  | ) | const`[inline]`

| Get the done flag which signals that the viewer exit.

double osgProducer::Viewer::getDoneAtElapsedTime | ( |  | ) | const`[inline]`

| Get the elapsed time that will cause done to be set to be true.

bool osgProducer::Viewer::getDoneAtElapsedTimeEnabled | ( |  | ) | const`[inline]`

| Get whether to use a elapsed time to limit the run of the viewer.

unsigned int osgProducer::Viewer::getDoneAtFrameNumber | ( |  | ) | const`[inline]`

| Get the frame number that will cause done to be set to be true.

bool osgProducer::Viewer::getDoneAtFrameNumberEnabled | ( |  | ) | const`[inline]`

| Get whether to use a frame number to limit the run of the viewer.

const EventHandlerList& osgProducer::Viewer::getEventHandlerList | ( |  | ) | const`[inline]`

EventHandlerList& osgProducer::Viewer::getEventHandlerList | ( |  | ) | `[inline]`

const Producer::KeyboardMouse* osgProducer::Viewer::getKeyboardMouse | ( |  | ) | const`[inline]`

Producer::KeyboardMouse* osgProducer::Viewer::getKeyboardMouse | ( |  | ) | `[inline]`

const osgProducer::KeyboardMouseCallback* osgProducer::Viewer::getKeyboardMouseCallback | ( |  | ) | const`[inline]`

osgProducer::KeyboardMouseCallback* osgProducer::Viewer::getKeyboardMouseCallback | ( |  | ) | `[inline]`

const osgGA::KeySwitchMatrixManipulator* osgProducer::Viewer::getKeySwitchMatrixManipulator | ( |  | ) | const`[inline]`

osgGA::KeySwitchMatrixManipulator* osgProducer::Viewer::getKeySwitchMatrixManipulator | ( |  | ) | `[inline]`

osg::Quat osgProducer::Viewer::getOrientation | ( |  | ) | const`[inline]`

const double* osgProducer::Viewer::getPosition | ( |  | ) | const`[inline]`

bool osgProducer::Viewer::getRecordingAnimationPath | ( |  | ) | const`[inline]`

double osgProducer::Viewer::getSpeed | ( |  | ) | const`[inline]`

const osg::NodeVisitor* osgProducer::Viewer::getUpdateVisitor | ( |  | ) | const`[inline]`

| get the const update visitor.

osg::NodeVisitor* osgProducer::Viewer::getUpdateVisitor | ( |  | ) | `[inline]`

| get the update visitor.

void Viewer::getUsage | ( | osg::ApplicationUsage & | usage | ) | const`[virtual]`

| Get the keyboard and mouse usage of this viewer.

const std::string & Viewer::getWriteImageFileName | ( |  | ) | const

| Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.

bool osgProducer::Viewer::getWriteImageWhenDone | ( |  | ) | const`[inline]`

| Set the viewer to take an image snapshot on the last frame() when done is enabled.

bool Viewer::realize | ( |  | ) | `[virtual]`

| Realize the render surfaces (OpenGL graphics) and various threads, and call any realize callbacks. Reimplemented from osgProducer::OsgCameraGroup.

bool Viewer::realize | ( | ThreadingModel | thread_model | ) | `[virtual]`

| Set the threading model and then call realize(). Reimplemented from osgProducer::OsgCameraGroup.

void Viewer::requestContinuousUpdate | ( | bool |  | ) | `[virtual]`

| requestContinousUpdate(bool) is for en/disabling a throw or idle callback to be requested by a GUIEventHandler (typically a MatrixManipulator, though other GUIEventHandler's may also provide functionality). GUI toolkits can respond to this immediately by registering an idle/timed callback, or can delay setting the callback and update at their own leisure. Implements osgGA::GUIActionAdapter.

void Viewer::requestRedraw | ( |  | ) | `[virtual]`

| requestRedraw() requests a single redraw. Implements osgGA::GUIActionAdapter.

void Viewer::requestWarpPointer | ( | float | x,
|  | float | y
| ) | `[virtual]`

| requestWarpPointer(int,int) is requesting a repositioning of the mouse pointer to a specified x,y location on the window. This is used by some camera manipulators to initialise the mouse pointer when mouse position relative to a controls neutral mouse position is required, i.e when mimicking a aircrafts joystick. Implements osgGA::GUIActionAdapter.

void Viewer::selectCameraManipulator | ( | unsigned int | no | ) |

void osgProducer::Viewer::setAnimationPath | ( | osg::AnimationPath * | path | ) | `[inline]`

void Viewer::setCoordindateSystemNodePath | ( | const osg::NodePath & | nodePath | ) |

void osgProducer::Viewer::setCoordindateSystemNodePath | ( | const osg::RefNodePath & | nodePath | ) | `[inline]`

void osgProducer::Viewer::setDone | ( | bool | done | ) | `[inline]`

| Set the done flag signalling that the viewer exit.

void osgProducer::Viewer::setDoneAtElapsedTime | ( | double | elapsedTime | ) | `[inline]`

| Set the viewer so it sets done to true once the refrence time equals or exceeds specified elapsed time. Automatically does a setDoneAtElapsedTimeEnabled(true).

void osgProducer::Viewer::setDoneAtElapsedTimeEnabled | ( | bool | enabled | ) | `[inline]`

| Set whether to use a elapsed time to limit the run of the viewer.

void osgProducer::Viewer::setDoneAtFrameNumber | ( | unsigned int | frameNumber | ) | `[inline]`

| Set the viewer so it sets done to true once the frame number equals or exceeds specified frame number. Automatically does a setDoneAtFrameNumberEnabled(true).

void osgProducer::Viewer::setDoneAtFrameNumberEnabled | ( | bool | enabled | ) | `[inline]`

| Set whether to use a frame number to limit the run of the viewer.

void Viewer::setKeyboardMouse | ( | Producer::KeyboardMouse * | kbm | ) |

void Viewer::setKeyboardMouseCallback | ( | osgProducer::KeyboardMouseCallback * | kbmcb | ) |

void osgProducer::Viewer::setRecordingAnimationPath | ( | bool | on | ) | `[inline]`

void osgProducer::Viewer::setUpdateVisitor | ( | osg::NodeVisitor * | nv | ) | `[inline]`

| set the update visitor which does the update traversal of the scene graph. Automatically called by the update() method.

void Viewer::setUpViewer | ( | unsigned int | options = `STANDARD_SETTINGS` | ) |

void Viewer::setViewByMatrix | ( | const Producer::Matrix & | pm | ) | `[virtual]`

| Override the Producer::CameraGroup::setViewByMatrix to catch all changes to view.

void Viewer::setWriteImageFileName | ( | const std::string & | filename | ) |

| Set the filename to write to when the viewer takes an image snapshot on the last frame() when done is enabled.

void osgProducer::Viewer::setWriteImageWhenDone | ( | bool | enabled | ) | `[inline]`

| Set the viewer to take an image snapshot on the last frame() when done is enabled.

void Viewer::update | ( |  | ) | `[virtual]`

| Updated the scene. Handle any queued up events, do an update traversal and set the CameraGroup's setViewByMatrix if any camera manipulators are active.

void Viewer::updatedSceneData | ( |  | ) | `[virtual]`

| update internal structures w.r.t updated scene data. Reimplemented from osgProducer::OsgCameraGroup.

## Member Data Documentation

osg::ref_ptr<osg::AnimationPath> osgProducer::Viewer::_animationPath`[protected]`

osg::RefNodePath osgProducer::Viewer::_coordinateSystemNodePath`[protected]`

bool osgProducer::Viewer::_done`[protected]`

EventHandlerList osgProducer::Viewer::_eventHandlerList`[protected]`

osg::ref_ptr<Producer::KeyboardMouse> osgProducer::Viewer::_kbm`[protected]`

osg::ref_ptr<osgProducer::KeyboardMouseCallback> osgProducer::Viewer::_kbmcb`[protected]`

osg::ref_ptr<osgGA::KeySwitchMatrixManipulator> osgProducer::Viewer::_keyswitchManipulator`[protected]`

osg::Quat osgProducer::Viewer::_orientation`[protected]`

double osgProducer::Viewer::_position[3]`[protected]`

bool osgProducer::Viewer::_recordingAnimationPath`[protected]`

double osgProducer::Viewer::_recordingStartTime`[protected]`

double osgProducer::Viewer::_setDoneAtElapsedTime`[protected]`

bool osgProducer::Viewer::_setDoneAtElapsedTimeEnabled`[protected]`

unsigned int osgProducer::Viewer::_setDoneAtFrameNumber`[protected]`

bool osgProducer::Viewer::_setDoneAtFrameNumberEnabled`[protected]`

double osgProducer::Viewer::_speed`[protected]`

osg::ref_ptr<osg::NodeVisitor> osgProducer::Viewer::_updateVisitor`[protected]`

std::string osgProducer::Viewer::_writeImageFileName`[protected]`

bool osgProducer::Viewer::_writeImageWhenDone`[protected]`

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

- Viewer
- Viewer.cpp