Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

osgViewer::Viewer Class Reference

Viewer holds a single view on to a single scene. More...

Inheritance diagram for osgViewer::Viewer:

Inheritance graph
[legend]
List of all members.

Public Types

typedef std::vector< osg::GraphicsContext * > Contexts
typedef std::vector< osgViewer::GraphicsWindow * > Windows
typedef std::vector< osg::Camera * > Cameras
typedef std::vector< OpenThreads::Thread * > Threads
typedef std::vector< osg::OperationsThread * > OperationsThreads
enum  ThreadingModel {
  SingleThreaded, CullDrawThreadPerContext, DrawThreadPerContext, CullThreadPerCameraDrawThreadPerContext,
  AutomaticSelection
}
enum  BarrierPosition { BeforeSwapBuffers, AfterSwapBuffers }

Public Member Functions

 Viewer ()
 Viewer (osg::ArgumentParser &arguments)
virtual ~Viewer ()
bool isRealized () const
 Get whether at least of one of this viewers windows are realized.
void realize ()
 set up windows and associated threads.
void setDone (bool done)
bool done () const
void setStartTick (osg::Timer_t tick)
osg::Timer_t getStartTick () const
void setReferenceTime (double time=0.0)
osg::FrameStampgetFrameStamp ()
const osg::FrameStampgetFrameStamp () const
virtual void setSceneData (osg::Node *node)
 Set the sene graph data that viewer with view.
virtual GraphicsWindowEmbeddedsetUpViewerAsEmbeddedInWindow (int x, int y, int width, int height)
 Convenience method for setting up the viewer so it can be used embedded in an external managed window.
void setThreadingModel (ThreadingModel threadingModel)
 Set the threading model the rendering traversals will use.
ThreadingModel getThreadingModel () const
 Get the threading model the rendering traversals will use.
void setUseMainThreadForRenderingTraversals (bool flag)
 Set whether the main thread, calling frame(), should be used for the rendering traversals.
bool getUseMainThreadForRenderingTraversals () const
 Get whether the main thread, calling frame(), should be used for the rendering traversals.
ThreadingModel suggestBestThreadingModel ()
 Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available.
void setEndBarrierPosition (BarrierPosition bp)
 Set the position of the end barrier.
BarrierPosition getEndBarrierPosition () const
 Get the end barrier position.
void setKeyEventSetsDone (int key)
 Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to signal end of viewers main loop.
int getKeyEventSetsDone () const
 get the key event that the viewer checks on each frame to see if the viewer's done flag.
void setQuitEventSetsDone (bool flag)
 if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature
bool getQuitEventSetsDone () const
virtual int run ()
 Execute a main frame loop.
virtual void frame (double simulationTime=USE_REFERENCE_TIME)
 Render a complete new frame.
virtual void advance (double simulationTime=USE_REFERENCE_TIME)
virtual void eventTraversal ()
virtual void updateTraversal ()
virtual void renderingTraversals ()
void setCameraWithFocus (osg::Camera *camera)
osg::CameragetCameraWithFocus ()
const osg::CameragetCameraWithFocus () const
void getContexts (Contexts &contexts, bool onlyValid=true)
void getWindows (Windows &windows, bool onlyValid=true)
void getCameras (Cameras &cameras, bool onlyActive=true)
void getAllThreads (Threads &threads, bool onlyActive=true)
void getOperationsThreads (OperationsThreads &threads, bool onlyActive=true)
void setRealizeOperation (osg::Operation *op)
 Set the graphics operation to call on realization of the viewers graphics windows.
osg::OperationgetRealizeOperation ()
 Get the graphics operation to call on realization of the viewers graphics windows.
void setUpThreading ()
 Set up the threading and processor affinity as per the viewers threading model.
bool areThreadsRunning () const
 Return true if viewer threads are running.
void stopThreading ()
 Stop any threads begin run by viewer.
void startThreading ()
 Start any threads required by the viewer.
void setUpRenderingSupport ()
 Set up the Operations to render the various viewer cameras on the viewers graphics windows.
virtual void getUsage (osg::ApplicationUsage &usage) const
 Get the keyboard and mouse usage of this viewer.

Protected Types

typedef std::list< osg::ref_ptr<
osgUtil::SceneView > > 
SceneViews

Protected Member Functions

void constructorInit ()
void checkWindowStatus ()
void makeCurrent (osg::GraphicsContext *gc)
void releaseContext ()

Protected Attributes

bool _firstFrame
bool _done
int _keyEventSetsDone
bool _quitEventSetsDone
ThreadingModel _threadingModel
bool _threadsRunning
bool _useMainThreadForRenderingTraversal
BarrierPosition _endBarrierPosition
osg::ref_ptr< osg::BarrierOperation_startRenderingBarrier
osg::ref_ptr< osg::BarrierOperation_endRenderingDispatchBarrier
osg::ref_ptr< EndOfDynamicDrawBlock_endDynamicDrawBlock
unsigned int _numWindowsOpenAtLastSetUpThreading
SceneViews _sceneViews
osg::Timer_t _startTick
osg::ref_ptr< osg::FrameStamp_frameStamp
osg::observer_ptr< osg::Camera_cameraWithFocus
osg::ref_ptr< osgGA::EventVisitor_eventVisitor
osg::ref_ptr< osg::Operation_realizeOperation
osg::observer_ptr< osg::GraphicsContext_currentContext

Detailed Description

Viewer holds a single view on to a single scene.


Member Typedef Documentation

typedef std::vector<osg::Camera*> osgViewer::Viewer::Cameras
 

typedef std::vector<osg::GraphicsContext*> osgViewer::Viewer::Contexts
 

typedef std::vector<osg::OperationsThread*> osgViewer::Viewer::OperationsThreads
 

typedef std::list< osg::ref_ptr<osgUtil::SceneView> > osgViewer::Viewer::SceneViews [protected]
 

typedef std::vector<OpenThreads::Thread*> osgViewer::Viewer::Threads
 

typedef std::vector<osgViewer::GraphicsWindow*> osgViewer::Viewer::Windows
 


Member Enumeration Documentation

enum osgViewer::Viewer::BarrierPosition
 

Enumerator:
BeforeSwapBuffers 
AfterSwapBuffers 

enum osgViewer::Viewer::ThreadingModel
 

Enumerator:
SingleThreaded 
CullDrawThreadPerContext 
DrawThreadPerContext 
CullThreadPerCameraDrawThreadPerContext 
AutomaticSelection 


Constructor & Destructor Documentation

osgViewer::Viewer::Viewer  ) 
 

osgViewer::Viewer::Viewer osg::ArgumentParser arguments  ) 
 

virtual osgViewer::Viewer::~Viewer  )  [virtual]
 


Member Function Documentation

virtual void osgViewer::Viewer::advance double  simulationTime = USE_REFERENCE_TIME  )  [virtual]
 

bool osgViewer::Viewer::areThreadsRunning  )  const [inline]
 

Return true if viewer threads are running.

void osgViewer::Viewer::checkWindowStatus  )  [protected]
 

void osgViewer::Viewer::constructorInit  )  [protected]
 

bool osgViewer::Viewer::done  )  const [inline]
 

virtual void osgViewer::Viewer::eventTraversal  )  [virtual]
 

virtual void osgViewer::Viewer::frame double  simulationTime = USE_REFERENCE_TIME  )  [virtual]
 

Render a complete new frame.

Calls advance(), eventTraversal(), updateTraversal(), renderingTraversals().

void osgViewer::Viewer::getAllThreads Threads threads,
bool  onlyActive = true
 

void osgViewer::Viewer::getCameras Cameras cameras,
bool  onlyActive = true
 

const osg::Camera* osgViewer::Viewer::getCameraWithFocus  )  const [inline]
 

osg::Camera* osgViewer::Viewer::getCameraWithFocus  )  [inline]
 

void osgViewer::Viewer::getContexts Contexts contexts,
bool  onlyValid = true
 

BarrierPosition osgViewer::Viewer::getEndBarrierPosition  )  const [inline]
 

Get the end barrier position.

const osg::FrameStamp* osgViewer::Viewer::getFrameStamp  )  const [inline]
 

osg::FrameStamp* osgViewer::Viewer::getFrameStamp  )  [inline]
 

int osgViewer::Viewer::getKeyEventSetsDone  )  const [inline]
 

get the key event that the viewer checks on each frame to see if the viewer's done flag.

void osgViewer::Viewer::getOperationsThreads OperationsThreads threads,
bool  onlyActive = true
 

bool osgViewer::Viewer::getQuitEventSetsDone  )  const [inline]
 

Returns:
true if the viewer respond to the QUIT_APPLICATION-event

osg::Operation* osgViewer::Viewer::getRealizeOperation  )  [inline]
 

Get the graphics operation to call on realization of the viewers graphics windows.

osg::Timer_t osgViewer::Viewer::getStartTick  )  const [inline]
 

ThreadingModel osgViewer::Viewer::getThreadingModel  )  const [inline]
 

Get the threading model the rendering traversals will use.

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

Get the keyboard and mouse usage of this viewer.

bool osgViewer::Viewer::getUseMainThreadForRenderingTraversals  )  const [inline]
 

Get whether the main thread, calling frame(), should be used for the rendering traversals.

void osgViewer::Viewer::getWindows Windows windows,
bool  onlyValid = true
 

bool osgViewer::Viewer::isRealized  )  const
 

Get whether at least of one of this viewers windows are realized.

void osgViewer::Viewer::makeCurrent osg::GraphicsContext gc  )  [inline, protected]
 

void osgViewer::Viewer::realize  ) 
 

set up windows and associated threads.

void osgViewer::Viewer::releaseContext  )  [inline, protected]
 

virtual void osgViewer::Viewer::renderingTraversals  )  [virtual]
 

virtual int osgViewer::Viewer::run  )  [virtual]
 

Execute a main frame loop.

Equivialant to while (!viewer.done()) viewer.frame(); Also calls realize() if the viewer is not already realized, and installs trackball manipulator if one is not already assigned.

void osgViewer::Viewer::setCameraWithFocus osg::Camera camera  )  [inline]
 

void osgViewer::Viewer::setDone bool  done  )  [inline]
 

void osgViewer::Viewer::setEndBarrierPosition BarrierPosition  bp  ) 
 

Set the position of the end barrier.

AfterSwapBuffers will may result is slightly higher framerates, by may lead to inconcistent swapping between different windows. BeforeSwapBuffers may lead to slightly lower framerate, but improve consistency in timing of swap buffers, especially important if you are likely to consistently break frame.

void osgViewer::Viewer::setKeyEventSetsDone int  key  )  [inline]
 

Set the key event that the viewer checks on each frame to see if the viewer's done flag should be set to signal end of viewers main loop.

Default value is Escape (osgGA::GUIEVentAdapter::KEY_Escape). Setting to 0 switches off the feature.

void osgViewer::Viewer::setQuitEventSetsDone bool  flag  )  [inline]
 

if the flag is true, the viewer set its done flag when a QUIT_APPLICATION is received, false disables this feature

void osgViewer::Viewer::setRealizeOperation osg::Operation op  )  [inline]
 

Set the graphics operation to call on realization of the viewers graphics windows.

void osgViewer::Viewer::setReferenceTime double  time = 0.0  ) 
 

virtual void osgViewer::Viewer::setSceneData osg::Node node  )  [virtual]
 

Set the sene graph data that viewer with view.

Reimplemented from osgViewer::View.

void osgViewer::Viewer::setStartTick osg::Timer_t  tick  ) 
 

void osgViewer::Viewer::setThreadingModel ThreadingModel  threadingModel  ) 
 

Set the threading model the rendering traversals will use.

void osgViewer::Viewer::setUpRenderingSupport  ) 
 

Set up the Operations to render the various viewer cameras on the viewers graphics windows.

void osgViewer::Viewer::setUpThreading  ) 
 

Set up the threading and processor affinity as per the viewers threading model.

virtual GraphicsWindowEmbedded* osgViewer::Viewer::setUpViewerAsEmbeddedInWindow int  x,
int  y,
int  width,
int  height
[virtual]
 

Convenience method for setting up the viewer so it can be used embedded in an external managed window.

Returns the GraphicsWindowEmbedded that can be used by applications to pass in events to the viewer.

void osgViewer::Viewer::setUseMainThreadForRenderingTraversals bool  flag  ) 
 

Set whether the main thread, calling frame(), should be used for the rendering traversals.

void osgViewer::Viewer::startThreading  ) 
 

Start any threads required by the viewer.

void osgViewer::Viewer::stopThreading  ) 
 

Stop any threads begin run by viewer.

ThreadingModel osgViewer::Viewer::suggestBestThreadingModel  ) 
 

Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available.

virtual void osgViewer::Viewer::updateTraversal  )  [virtual]
 


Member Data Documentation

osg::observer_ptr<osg::Camera> osgViewer::Viewer::_cameraWithFocus [protected]
 

osg::observer_ptr<osg::GraphicsContext> osgViewer::Viewer::_currentContext [protected]
 

bool osgViewer::Viewer::_done [protected]
 

BarrierPosition osgViewer::Viewer::_endBarrierPosition [protected]
 

osg::ref_ptr<EndOfDynamicDrawBlock> osgViewer::Viewer::_endDynamicDrawBlock [protected]
 

osg::ref_ptr<osg::BarrierOperation> osgViewer::Viewer::_endRenderingDispatchBarrier [protected]
 

osg::ref_ptr<osgGA::EventVisitor> osgViewer::Viewer::_eventVisitor [protected]
 

bool osgViewer::Viewer::_firstFrame [protected]
 

osg::ref_ptr<osg::FrameStamp> osgViewer::Viewer::_frameStamp [protected]
 

int osgViewer::Viewer::_keyEventSetsDone [protected]
 

unsigned int osgViewer::Viewer::_numWindowsOpenAtLastSetUpThreading [protected]
 

bool osgViewer::Viewer::_quitEventSetsDone [protected]
 

osg::ref_ptr<osg::Operation> osgViewer::Viewer::_realizeOperation [protected]
 

SceneViews osgViewer::Viewer::_sceneViews [protected]
 

osg::ref_ptr<osg::BarrierOperation> osgViewer::Viewer::_startRenderingBarrier [protected]
 

osg::Timer_t osgViewer::Viewer::_startTick [protected]
 

ThreadingModel osgViewer::Viewer::_threadingModel [protected]
 

bool osgViewer::Viewer::_threadsRunning [protected]
 

bool osgViewer::Viewer::_useMainThreadForRenderingTraversal [protected]
 


The documentation for this class was generated from the following file:
Generated at Fri Jun 15 16:37:15 2007 for the OpenSceneGraph by doxygen 1.4.4.