osgProducer::Viewer Class Reference

Inheritance diagram for osgProducer::Viewer:

osgProducer::OsgCameraGroup osgGA::GUIActionAdapter List of all members.

Public Types

typedef std::list< osg::ref_ptr<
osgGA::GUIEventHandler > > 
EventHandlerList
 NO_EVENT_HANDLERS = 0
 TRACKBALL_MANIPULATOR = 1
 DRIVE_MANIPULATOR = 2
 FLIGHT_MANIPULATOR = 4
 TERRAIN_MANIPULATOR = 8
 UFO_MANIPULATOR = 0x10
 STATE_MANIPULATOR = 32
 HEAD_LIGHT_SOURCE = 64
 SKY_LIGHT_SOURCE = 128
 STATS_MANIPULATOR = 256
 VIEWER_MANIPULATOR = 512
 ESCAPE_SETS_DONE = 1024
 STANDARD_SETTINGS
enum  ViewerOptions {
  NO_EVENT_HANDLERS = 0, TRACKBALL_MANIPULATOR = 1, DRIVE_MANIPULATOR = 2, FLIGHT_MANIPULATOR = 4,
  TERRAIN_MANIPULATOR = 8, UFO_MANIPULATOR = 0x10, 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)
double getDoneAtElapsedTime () const
void setDoneAtElapsedTimeEnabled (bool enabled)
bool getDoneAtElapsedTimeEnabled () const
void setDoneAtFrameNumber (unsigned int frameNumber)
unsigned int getDoneAtFrameNumber () const
void setDoneAtFrameNumberEnabled (bool enabled)
bool getDoneAtFrameNumberEnabled () const
void setDone (bool done)
bool getDone () const
virtual bool done () const
void setWriteImageWhenDone (bool enabled)
bool getWriteImageWhenDone () const
void setWriteImageFileName (const std::string &filename)
const std::string & getWriteImageFileName () const
virtual void setViewByMatrix (const Producer::Matrix &pm)
virtual bool realize (ThreadingModel thread_model)
virtual bool realize ()
virtual void update ()
void setUpdateVisitor (osg::NodeVisitor *nv)
osg::NodeVisitorgetUpdateVisitor ()
const osg::NodeVisitorgetUpdateVisitor () const
void setEventVisitor (osgGA::EventVisitor *nv)
osgGA::EventVisitorgetEventVisitor ()
const osgGA::EventVisitorgetEventVisitor () const
void computeActiveCoordinateSystemNodePath ()
void setCoordinateSystemNodePath (const osg::NodePath &nodePath)
osg::NodePath getCoordinateSystemNodePath () const
virtual void frame ()
virtual void requestRedraw ()
virtual void requestContinuousUpdate (bool)
virtual void requestWarpPointer (float x, float y)
bool computePixelCoords (float x, float y, unsigned int cameraNum, float &pixel_x, float &pixel_y)
bool computeNearFarPoints (float x, float y, unsigned int cameraNum, osg::Vec3 &near, osg::Vec3 &far)
bool computeIntersections (float x, float y, unsigned int cameraNum, osg::Node *node, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
bool computeIntersections (float x, float y, unsigned int cameraNum, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
bool computeIntersections (float x, float y, osg::Node *node, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
bool computeIntersections (float x, float y, osgUtil::IntersectVisitor::HitList &hits, osg::Node::NodeMask traversalMask=0xffffffff)
void setEventQueue (osgGA::EventQueue *eventQueue)
osgGA::EventQueuegetEventQueue ()
void setKeyboardMouse (Producer::KeyboardMouse *kbm)
Producer::KeyboardMouse * getKeyboardMouse ()
const Producer::KeyboardMouse * getKeyboardMouse () const
void setKeyboardMouseCallback (osgProducer::KeyboardMouseCallback *kbmcb)
osgProducer::KeyboardMouseCallbackgetKeyboardMouseCallback ()
const osgProducer::KeyboardMouseCallbackgetKeyboardMouseCallback () const
EventHandlerListgetEventHandlerList ()
const EventHandlerListgetEventHandlerList () const
osgGA::KeySwitchMatrixManipulatorgetKeySwitchMatrixManipulator ()
const osgGA::KeySwitchMatrixManipulatorgetKeySwitchMatrixManipulator () const
unsigned int addCameraManipulator (osgGA::MatrixManipulator *cm)
void selectCameraManipulator (unsigned int no)
void getCameraManipulatorNameList (std::list< std::string > &nameList)
bool selectCameraManipulatorByName (const std::string &name)
osgGA::MatrixManipulatorgetCameraManipulatorByName (const std::string &name)
void setRecordingAnimationPath (bool on)
bool getRecordingAnimationPath () const
void setAnimationPath (osg::AnimationPath *path)
osg::AnimationPathgetAnimationPath ()
const osg::AnimationPathgetAnimationPath () const
const double * getPosition () const
double getSpeed () const
osg::Quat getOrientation () const
virtual void getUsage (osg::ApplicationUsage &usage) const
virtual void updatedSceneData ()

Static Public Member Functions

static const char * getDefaultImageFileName ()

Protected Types

typedef std::vector< osg::observer_ptr<
osg::Node > > 
ObserveredNodePath

Protected Attributes

bool _setDoneAtElapsedTimeEnabled
double _setDoneAtElapsedTime
bool _setDoneAtFrameNumberEnabled
unsigned int _setDoneAtFrameNumber
bool _done
bool _writeImageWhenDone
std::string _writeImageFileName
osg::ref_ptr< osgGA::EventQueue_eventQueue
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::ref_ptr< osgGA::EventVisitor_eventVisitor
ObserveredNodePath _coordinateSystemNodePath
bool _recordingAnimationPath
double _recordingStartTime
osg::ref_ptr< osg::AnimationPath_animationPath
double _position [3]
osg::Quat _orientation
double _speed

Detailed Description

A Producer-based viewer. Just like OpenGL, the core of OSG is independent of windowing system. The integration between OSG and some windowing system is delegated to other, non-core parts of OSG (users are also allowed to integrate OSG with any exotic windowing system they happen to use). Viewer implements the integration between OSG and Producer, AKA Open Producer (http://www.andesengineering.com/Producer), thus offering an out-of-the-box, scalable and multi-platform abstraction of the windowing system.


Member Typedef Documentation

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

typedef std::vector< osg::observer_ptr<osg::Node> > osgProducer::Viewer::ObserveredNodePath [protected]


Member Enumeration Documentation

enum osgProducer::Viewer::ViewerOptions

Specifies options to control some aspects of the Viewer behavior (using the setUpViewer() member function).

Enumerator:
NO_EVENT_HANDLERS  Do not activate any standard event handlers. If no event handlers are selected then the users would typically register their own custom event handlers to add user interaction via getEventHandlerList().push_back(myEventHandler) or addCameraManipulator(myCameraManipualtor).
TRACKBALL_MANIPULATOR  Add an osgGA::TrackballManipulator to manipulate the camera interactively.
DRIVE_MANIPULATOR  Add an osgGA::DriveManipulator to manipulate the camera interactively.
FLIGHT_MANIPULATOR  Add an osgGA::FlightManipulator to manipulate the camera interactively.
TERRAIN_MANIPULATOR  Add an osgGA::TerrainManipulator to manipulate the camera interactively.
UFO_MANIPULATOR  Add an osgGA::UFOManipulator to manipulate the camera interactively.
STATE_MANIPULATOR  Add an osgGA::StateSetManipulator to interactively toggle some bits of the renderer state (texturing, lightning...)
HEAD_LIGHT_SOURCE  Add a light source some point near the camera.
SKY_LIGHT_SOURCE  Add a light source above the scene; does nothing if HEAD_LIGHT_SOURCE is also used.
STATS_MANIPULATOR  Add peformance statistics reporting, currently implemented via VIEWER_MANPULATOR.
VIEWER_MANIPULATOR  Add an osgProducer::ViewerEventHandler that enables lots of tricks like performance statistics and writing the scene to a file.
ESCAPE_SETS_DONE  Finish the viewer execution when the ESC key is pressed.
STANDARD_SETTINGS  Enable a set of standard settings (TRACKBALL_MANIPULATOR, DRIVE_MANIPULATOR, FLIGHT_MANIPULATOR, TERRAIN_MANIPULATOR, STATE_MANIPULATOR, HEAD_LIGHT_SOURCE, STATS_MANIPULATOR, VIEWER_MANIPULATOR, ESCAPE_SETS_DONE).


Constructor & Destructor Documentation

osgProducer::Viewer::Viewer (  ) 

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

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

osgProducer::Viewer::Viewer ( osg::ArgumentParser arguments  ) 

virtual osgProducer::Viewer::~Viewer (  )  [virtual]


Member Function Documentation

unsigned int osgProducer::Viewer::addCameraManipulator ( osgGA::MatrixManipulator cm  ) 

void osgProducer::Viewer::computeActiveCoordinateSystemNodePath (  ) 

bool osgProducer::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 osgProducer::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 osgProducer::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 osgProducer::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 osgProducer::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 osgProducer::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.

virtual bool osgProducer::Viewer::done (  )  const [virtual]

Return true if the application is done and should exit.

virtual void osgProducer::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]

osgGA::MatrixManipulator* osgProducer::Viewer::getCameraManipulatorByName ( const std::string &  name  ) 

void osgProducer::Viewer::getCameraManipulatorNameList ( std::list< std::string > &  nameList  ) 

osg::NodePath osgProducer::Viewer::getCoordinateSystemNodePath (  )  const

static const char* osgProducer::Viewer::getDefaultImageFileName (  )  [static]

Get the default filename for writing an image snapshot

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]

osgGA::EventQueue* osgProducer::Viewer::getEventQueue (  )  [inline]

Get the EventQueue.

const osgGA::EventVisitor* osgProducer::Viewer::getEventVisitor (  )  const [inline]

Get the const update visitor.

osgGA::EventVisitor* osgProducer::Viewer::getEventVisitor (  )  [inline]

Get the update visitor.

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.

virtual void osgProducer::Viewer::getUsage ( osg::ApplicationUsage usage  )  const [virtual]

Get the keyboard and mouse usage of this viewer.

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

Get 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.

virtual bool osgProducer::Viewer::realize (  )  [virtual]

Realize the render surfaces (OpenGL graphics) and various threads, and call any realize callbacks.

Reimplemented from osgProducer::OsgCameraGroup.

virtual bool osgProducer::Viewer::realize ( ThreadingModel  thread_model  )  [virtual]

Set the threading model and then call realize().

virtual void osgProducer::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.

virtual void osgProducer::Viewer::requestRedraw (  )  [virtual]

requestRedraw() requests a single redraw.

Implements osgGA::GUIActionAdapter.

virtual void osgProducer::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 osgProducer::Viewer::selectCameraManipulator ( unsigned int  no  ) 

bool osgProducer::Viewer::selectCameraManipulatorByName ( const std::string &  name  ) 

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

void osgProducer::Viewer::setCoordinateSystemNodePath ( const osg::NodePath nodePath  ) 

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 osgProducer::Viewer::setEventQueue ( osgGA::EventQueue eventQueue  )  [inline]

Set the EventQueue - a thread safe queue for registering events.

void osgProducer::Viewer::setEventVisitor ( osgGA::EventVisitor nv  )  [inline]

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

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

void osgProducer::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 osgProducer::Viewer::setUpViewer ( unsigned int  options = STANDARD_SETTINGS  ) 

Set up the viewer, allowing to control some aspects of its behavior.

Parameters:
options One or more of the options defined by the ViewerOptions enumeration, combined using the bitwise OR operator (``|'').

virtual void osgProducer::Viewer::setViewByMatrix ( const Producer::Matrix pm  )  [virtual]

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

void osgProducer::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.

virtual void osgProducer::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.

virtual void osgProducer::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]

ObserveredNodePath osgProducer::Viewer::_coordinateSystemNodePath [protected]

bool osgProducer::Viewer::_done [protected]

EventHandlerList osgProducer::Viewer::_eventHandlerList [protected]

osg::ref_ptr<osgGA::EventQueue> osgProducer::Viewer::_eventQueue [protected]

osg::ref_ptr<osgGA::EventVisitor> osgProducer::Viewer::_eventVisitor [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 file:
Generated on Sun Oct 1 13:17:12 2006 for openscenegraph by  doxygen 1.4.7