OpenSceneGraph  3.0.1
Public Member Functions | Protected Types | Protected Member Functions | Protected Attributes | List of all members
osgViewer::CompositeViewer Class Reference

CompositeViewer holds one or more views to one or more scenes. More...

Inheritance diagram for osgViewer::CompositeViewer:
Inheritance graph
[legend]

Public Member Functions

 CompositeViewer ()
 CompositeViewer (const CompositeViewer &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
 CompositeViewer (osg::ArgumentParser &arguments)
 META_Object (osgViewer, CompositeViewer)
virtual ~CompositeViewer ()
bool readConfiguration (const std::string &filename)
 Read the viewer configuration from a configuration file.
virtual void setViewerStats (osg::Stats *stats)
 Set the Stats object used for collect various frame related timing and scene graph stats.
virtual osg::StatsgetViewerStats ()
 Get the Viewers Stats object.
virtual const osg::StatsgetViewerStats () const
 Get the Viewers Stats object.
void addView (osgViewer::View *view)
void removeView (osgViewer::View *view)
osgViewer::ViewgetView (unsigned i)
const osgViewer::ViewgetView (unsigned i) const
unsigned int getNumViews () const
virtual bool isRealized () const
 Get whether at least of one of this viewer's windows are realized.
virtual void realize ()
 Set up windows and associated threads.
virtual void setStartTick (osg::Timer_t tick)
void setReferenceTime (double time=0.0)
osg::FrameStampgetFrameStamp ()
const osg::FrameStampgetFrameStamp () const
virtual double elapsedTime ()
virtual osg::FrameStampgetViewerFrameStamp ()
virtual int run ()
 Execute a main frame loop.
virtual bool checkNeedToDoFrame ()
 Check to see if the new frame is required, called by run() when FrameScheme is set to ON_DEMAND.
virtual void advance (double simulationTime=USE_REFERENCE_TIME)
virtual void eventTraversal ()
virtual void updateTraversal ()
void setCameraWithFocus (osg::Camera *camera)
osg::CameragetCameraWithFocus ()
const osg::CameragetCameraWithFocus () const
osgViewer::ViewgetViewWithFocus ()
const osgViewer::ViewgetViewWithFocus () const
virtual void getCameras (Cameras &cameras, bool onlyActive=true)
virtual void getContexts (Contexts &contexts, bool onlyValid=true)
virtual void getAllThreads (Threads &threads, bool onlyActive=true)
virtual void getOperationThreads (OperationThreads &threads, bool onlyActive=true)
virtual void getScenes (Scenes &scenes, bool onlyValid=true)
virtual void getViews (Views &views, bool onlyValid=true)
virtual void getUsage (osg::ApplicationUsage &usage) const
 Get the keyboard and mouse usage of this viewer.
- Public Member Functions inherited from osgViewer::ViewerBase
 ViewerBase ()
 ViewerBase (const ViewerBase &vb)
virtual 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.
virtual ThreadingModel suggestBestThreadingModel ()
 Let the viewer suggest the best threading model for the viewers camera/window setup and the hardware available.
virtual 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.
virtual void stopThreading ()
 Stop any threads begin run by viewer.
virtual void startThreading ()
 Start any threads required by the viewer.
void setEndBarrierPosition (BarrierPosition bp)
 Set the position of the end barrier.
BarrierPosition getEndBarrierPosition () const
 Get the end barrier position.
void setDone (bool done)
 Set the done flag to signal the viewer's work is done and should exit the frame loop.
bool done () const
 Return true if viewer's work is done and should exit the frame loop.
void setEventVisitor (osgGA::EventVisitor *eventVisitor)
 Set the EventVisitor.
osgGA::EventVisitorgetEventVisitor ()
 Get the EventVisitor.
const osgGA::EventVisitorgetEventVisitor () const
 Get the const EventVisitor.
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
void setReleaseContextAtEndOfFrameHint (bool hint)
 Hint to tell the renderingTraversals() method whether to call relaseContext() on the last context that was made current by the thread calling renderingTraverals().
bool getReleaseContextAtEndOfFrameHint () const
 Hint to tell the renderingTraversals() method whether to call relaseContext().
void setUpdateVisitor (osgUtil::UpdateVisitor *updateVisitor)
 Set the UpdateVisitor.
osgUtil::UpdateVisitorgetUpdateVisitor ()
 Get the UpdateVisitor.
const osgUtil::UpdateVisitorgetUpdateVisitor () const
 Get the const UpdateVisitor.
void setUpdateOperations (osg::OperationQueue *operations)
 Set the Update OperationQueue.
osg::OperationQueuegetUpdateOperations ()
 Get the Update OperationQueue.
const osg::OperationQueuegetUpdateOperations () const
 Get the const Update OperationQueue.
void addUpdateOperation (osg::Operation *operation)
 Add an update operation.
void removeUpdateOperation (osg::Operation *operation)
 Remove an update operation.
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 setIncrementalCompileOperation (osgUtil::IncrementalCompileOperation *ico)
 Set the incremental compile operation.
osgUtil::IncrementalCompileOperationgetIncrementalCompileOperation ()
 Get the incremental compile operation.
void setRunFrameScheme (FrameScheme fs)
FrameScheme getRunFrameScheme () const
void setRunMaxFrameRate (double frameRate)
double getRunMaxFrameRate () const
virtual void frame (double simulationTime=USE_REFERENCE_TIME)
 Render a complete new frame.
virtual void renderingTraversals ()
virtual void getWindows (Windows &windows, bool onlyValid=true)
void checkWindowStatus ()
 Check to see if any windows are still open.
void checkWindowStatus (const Contexts &contexts)
 Check to see if windows are still open using the list of contexts given as a parameter.
- 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 const char * className () const =0
 return the name of the object's class type.
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.

Protected Types

typedef std::vector
< osg::ref_ptr
< osgViewer::View > > 
RefViews

Protected Member Functions

void constructorInit ()
virtual void viewerInit ()
- Protected Member Functions inherited from osgViewer::ViewerBase
void viewerBaseInit ()
void makeCurrent (osg::GraphicsContext *gc)
void releaseContext ()
- Protected Member Functions inherited from osg::Object
virtual ~Object ()
 Object destructor.
- Protected Member Functions inherited from osg::Referenced
virtual ~Referenced ()
void signalObserversAndDelete (bool signalDelete, bool doDelete) const
void deleteUsingDeleteHandler () const

Protected Attributes

RefViews _views
bool _firstFrame
osg::ref_ptr< osg::Stats_stats
osg::Timer_t _startTick
osg::ref_ptr< osg::FrameStamp_frameStamp
osg::observer_ptr< osg::Camera_cameraWithFocus
osg::observer_ptr
< osgViewer::View
_viewWithFocus
- Protected Attributes inherited from osgViewer::ViewerBase
bool _firstFrame
bool _done
int _keyEventSetsDone
bool _quitEventSetsDone
bool _releaseContextAtEndOfFrameHint
ThreadingModel _threadingModel
bool _threadsRunning
bool _requestRedraw
bool _requestContinousUpdate
FrameScheme _runFrameScheme
double _runMaxFrameRate
BarrierPosition _endBarrierPosition
osg::ref_ptr
< osg::BarrierOperation
_startRenderingBarrier
osg::ref_ptr
< osg::BarrierOperation
_endRenderingDispatchBarrier
osg::ref_ptr
< osg::EndOfDynamicDrawBlock
_endDynamicDrawBlock
osg::ref_ptr< osgGA::EventVisitor_eventVisitor
osg::ref_ptr< osg::OperationQueue_updateOperations
osg::ref_ptr
< osgUtil::UpdateVisitor
_updateVisitor
osg::ref_ptr< osg::Operation_realizeOperation
osg::ref_ptr
< osgUtil::IncrementalCompileOperation
_incrementalCompileOperation
osg::observer_ptr
< osg::GraphicsContext
_currentContext
- Protected Attributes inherited from osg::Object
std::string _name
DataVariance _dataVariance
osg::UserDataContainer_userDataContainer
- Protected Attributes inherited from osg::Referenced
OpenThreads::AtomicPtr _observerSet
OpenThreads::Atomic _refCount

Additional Inherited Members

- Public Types inherited from osgViewer::ViewerBase
enum  ThreadingModel {
  SingleThreaded, CullDrawThreadPerContext, ThreadPerContext = CullDrawThreadPerContext, DrawThreadPerContext,
  CullThreadPerCameraDrawThreadPerContext, ThreadPerCamera = CullThreadPerCameraDrawThreadPerContext, AutomaticSelection
}
enum  BarrierPosition { BeforeSwapBuffers, AfterSwapBuffers }
enum  FrameScheme { ON_DEMAND, CONTINUOUS }
typedef std::vector
< osg::Camera * > 
Cameras
typedef std::vector
< osg::GraphicsContext * > 
Contexts
typedef std::vector
< osgViewer::GraphicsWindow * > 
Windows
typedef std::vector
< OpenThreads::Thread * > 
Threads
typedef std::vector
< osg::OperationThread * > 
OperationThreads
typedef std::vector
< osgViewer::Scene * > 
Scenes
typedef std::vector
< osgViewer::View * > 
Views
- 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.

Detailed Description

CompositeViewer holds one or more views to one or more scenes.

Member Typedef Documentation

Constructor & Destructor Documentation

osgViewer::CompositeViewer::CompositeViewer ( )
osgViewer::CompositeViewer::CompositeViewer ( const CompositeViewer ,
const osg::CopyOp copyop = osg::CopyOp::SHALLOW_COPY 
)
osgViewer::CompositeViewer::CompositeViewer ( osg::ArgumentParser arguments)
virtual osgViewer::CompositeViewer::~CompositeViewer ( )
virtual

Member Function Documentation

void osgViewer::CompositeViewer::addView ( osgViewer::View view)
virtual void osgViewer::CompositeViewer::advance ( double  simulationTime = USE_REFERENCE_TIME)
virtual

Implements osgViewer::ViewerBase.

virtual bool osgViewer::CompositeViewer::checkNeedToDoFrame ( )
virtual

Check to see if the new frame is required, called by run() when FrameScheme is set to ON_DEMAND.

Implements osgViewer::ViewerBase.

void osgViewer::CompositeViewer::constructorInit ( )
protected
virtual double osgViewer::CompositeViewer::elapsedTime ( )
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::eventTraversal ( )
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::getAllThreads ( Threads threads,
bool  onlyActive = true 
)
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::getCameras ( Cameras cameras,
bool  onlyActive = true 
)
virtual

Implements osgViewer::ViewerBase.

osg::Camera* osgViewer::CompositeViewer::getCameraWithFocus ( )
inline
const osg::Camera* osgViewer::CompositeViewer::getCameraWithFocus ( ) const
inline
virtual void osgViewer::CompositeViewer::getContexts ( Contexts contexts,
bool  onlyValid = true 
)
virtual

Implements osgViewer::ViewerBase.

osg::FrameStamp* osgViewer::CompositeViewer::getFrameStamp ( )
inline
const osg::FrameStamp* osgViewer::CompositeViewer::getFrameStamp ( ) const
inline
unsigned int osgViewer::CompositeViewer::getNumViews ( ) const
inline
virtual void osgViewer::CompositeViewer::getOperationThreads ( OperationThreads threads,
bool  onlyActive = true 
)
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::getScenes ( Scenes scenes,
bool  onlyValid = true 
)
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::getUsage ( osg::ApplicationUsage usage) const
virtual

Get the keyboard and mouse usage of this viewer.

Implements osgViewer::ViewerBase.

osgViewer::View* osgViewer::CompositeViewer::getView ( unsigned  i)
inline
const osgViewer::View* osgViewer::CompositeViewer::getView ( unsigned  i) const
inline
virtual osg::FrameStamp* osgViewer::CompositeViewer::getViewerFrameStamp ( )
inlinevirtual

Implements osgViewer::ViewerBase.

virtual osg::Stats* osgViewer::CompositeViewer::getViewerStats ( )
inlinevirtual

Get the Viewers Stats object.

Implements osgViewer::ViewerBase.

virtual const osg::Stats* osgViewer::CompositeViewer::getViewerStats ( ) const
inlinevirtual

Get the Viewers Stats object.

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::getViews ( Views views,
bool  onlyValid = true 
)
virtual

Implements osgViewer::ViewerBase.

osgViewer::View* osgViewer::CompositeViewer::getViewWithFocus ( )
inline
const osgViewer::View* osgViewer::CompositeViewer::getViewWithFocus ( ) const
inline
virtual bool osgViewer::CompositeViewer::isRealized ( ) const
virtual

Get whether at least of one of this viewer's windows are realized.

Implements osgViewer::ViewerBase.

osgViewer::CompositeViewer::META_Object ( osgViewer  ,
CompositeViewer   
)
bool osgViewer::CompositeViewer::readConfiguration ( const std::string &  filename)
virtual

Read the viewer configuration from a configuration file.

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::realize ( )
virtual

Set up windows and associated threads.

Implements osgViewer::ViewerBase.

void osgViewer::CompositeViewer::removeView ( osgViewer::View view)
virtual int osgViewer::CompositeViewer::run ( )
virtual

Execute a main frame loop.

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

Reimplemented from osgViewer::ViewerBase.

void osgViewer::CompositeViewer::setCameraWithFocus ( osg::Camera camera)
void osgViewer::CompositeViewer::setReferenceTime ( double  time = 0.0)
virtual void osgViewer::CompositeViewer::setStartTick ( osg::Timer_t  tick)
virtual
virtual void osgViewer::CompositeViewer::setViewerStats ( osg::Stats stats)
inlinevirtual

Set the Stats object used for collect various frame related timing and scene graph stats.

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::updateTraversal ( )
virtual

Implements osgViewer::ViewerBase.

virtual void osgViewer::CompositeViewer::viewerInit ( )
protectedvirtual

Implements osgViewer::ViewerBase.

Member Data Documentation

osg::observer_ptr<osg::Camera> osgViewer::CompositeViewer::_cameraWithFocus
protected
bool osgViewer::CompositeViewer::_firstFrame
protected
osg::ref_ptr<osg::FrameStamp> osgViewer::CompositeViewer::_frameStamp
protected
osg::Timer_t osgViewer::CompositeViewer::_startTick
protected
osg::ref_ptr<osg::Stats> osgViewer::CompositeViewer::_stats
protected
RefViews osgViewer::CompositeViewer::_views
protected
osg::observer_ptr<osgViewer::View> osgViewer::CompositeViewer::_viewWithFocus
protected

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

osg logo
Generated at Tue Sep 4 2012 16:19:03 for the OpenSceneGraph by doxygen 1.8.1.2.