CompositeViewer
Go to the documentation of this file.
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGVIEWER_CompositeViewer
#define OSGVIEWER_CompositeViewer 1
#include <osg/ArgumentParser>
#include <osgUtil/UpdateVisitor>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/View>
namespace osgViewer {
class OSGVIEWER_EXPORT CompositeViewer : public ViewerBase
{
public:
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);
virtual void setViewerStats(osg::Stats* stats) { _stats = stats; }
virtual osg::Stats* getViewerStats() { return _stats.get(); }
virtual const osg::Stats* getViewerStats() const { return _stats.get(); }
void addView(osgViewer::View* view);
template<class T> void addView(const osg::ref_ptr<T>& view) { addView(view.get()); }
void removeView(osgViewer::View* view);
template<class T> void removeView(const osg::ref_ptr<T>& view) { removeView(view.get()); }
osgViewer::View* getView(unsigned i) { return _views[i].get(); }
const osgViewer::View* getView(unsigned i) const { return _views[i].get(); }
unsigned int getNumViews() const { return _views.size(); }
virtual bool isRealized() const;
virtual void realize();
virtual void setStartTick(osg::Timer_t tick);
void setReferenceTime(double time=0.0);
osg::FrameStamp* getFrameStamp() { return _frameStamp.get(); }
const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
virtual double elapsedTime();
virtual osg::FrameStamp* getViewerFrameStamp() { return getFrameStamp(); }
virtual int run();
virtual bool checkNeedToDoFrame();
virtual bool checkEvents();
virtual void advance(double simulationTime=USE_REFERENCE_TIME);
virtual void eventTraversal();
virtual void updateTraversal();
void setCameraWithFocus(osg::Camera* camera);
osg::Camera* getCameraWithFocus() { return _cameraWithFocus.get(); }
const osg::Camera* getCameraWithFocus() const { return _cameraWithFocus.get(); }
osgViewer::View* getViewWithFocus() { return _viewWithFocus.get(); }
const osgViewer::View* getViewWithFocus() const { return _viewWithFocus.get(); }
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;
protected:
void constructorInit();
virtual void viewerInit();
void generateSlavePointerData(osg::Camera* camera, osgGA::GUIEventAdapter& event);
void generatePointerData(osgGA::GUIEventAdapter& event);
void reprojectPointerData(osgGA::GUIEventAdapter& source_event, osgGA::GUIEventAdapter& dest_event);
typedef std::vector< osg::ref_ptr<osgViewer::View> > RefViews;
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;
osg::ref_ptr<osgGA::GUIEventAdapter> _previousEvent;
};
}
#endif
ArgumentParser
GraphicsWindow
UpdateVisitor
USE_REFERENCE_TIME
#define USE_REFERENCE_TIME
Definition ViewerBase:30
osgGA::GUIEventAdapter
Definition GUIEventAdapter:82
osgViewer::CompositeViewer::viewerInit
virtual void viewerInit()
osgViewer::CompositeViewer::getView
osgViewer::View * getView(unsigned i)
Definition CompositeViewer:59
osgViewer::CompositeViewer::getUsage
virtual void getUsage(osg::ApplicationUsage &usage) const
osgViewer::CompositeViewer::reprojectPointerData
void reprojectPointerData(osgGA::GUIEventAdapter &source_event, osgGA::GUIEventAdapter &dest_event)
osgViewer::CompositeViewer::checkEvents
virtual bool checkEvents()
osgViewer::CompositeViewer::_views
RefViews _views
Definition CompositeViewer:137
osgViewer::CompositeViewer::getCameras
virtual void getCameras(Cameras &cameras, bool onlyActive=true)
osgViewer::CompositeViewer::removeView
void removeView(const osg::ref_ptr< T > &view)
Definition CompositeViewer:57
osgViewer::CompositeViewer::_frameStamp
osg::ref_ptr< osg::FrameStamp > _frameStamp
Definition CompositeViewer:144
osgViewer::CompositeViewer::removeView
void removeView(osgViewer::View *view)
osgViewer::CompositeViewer::getAllThreads
virtual void getAllThreads(Threads &threads, bool onlyActive=true)
osgViewer::CompositeViewer::generatePointerData
void generatePointerData(osgGA::GUIEventAdapter &event)
osgViewer::CompositeViewer::getContexts
virtual void getContexts(Contexts &contexts, bool onlyValid=true)
osgViewer::CompositeViewer::setViewerStats
virtual void setViewerStats(osg::Stats *stats)
Definition CompositeViewer:44
osgViewer::CompositeViewer::advance
virtual void advance(double simulationTime=USE_REFERENCE_TIME)
osgViewer::CompositeViewer::_viewWithFocus
osg::observer_ptr< osgViewer::View > _viewWithFocus
Definition CompositeViewer:147
osgViewer::CompositeViewer::constructorInit
void constructorInit()
osgViewer::CompositeViewer::realize
virtual void realize()
osgViewer::CompositeViewer::setReferenceTime
void setReferenceTime(double time=0.0)
osgViewer::CompositeViewer::getViews
virtual void getViews(Views &views, bool onlyValid=true)
osgViewer::CompositeViewer::getCameraWithFocus
osg::Camera * getCameraWithFocus()
Definition CompositeViewer:104
osgViewer::CompositeViewer::getCameraWithFocus
const osg::Camera * getCameraWithFocus() const
Definition CompositeViewer:105
osgViewer::CompositeViewer::CompositeViewer
CompositeViewer(const CompositeViewer &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgViewer::CompositeViewer::isRealized
virtual bool isRealized() const
osgViewer::CompositeViewer::getView
const osgViewer::View * getView(unsigned i) const
Definition CompositeViewer:60
osgViewer::CompositeViewer::_previousEvent
osg::ref_ptr< osgGA::GUIEventAdapter > _previousEvent
Definition CompositeViewer:149
osgViewer::CompositeViewer::getViewerStats
virtual const osg::Stats * getViewerStats() const
Definition CompositeViewer:50
osgViewer::CompositeViewer::eventTraversal
virtual void eventTraversal()
osgViewer::CompositeViewer::setStartTick
virtual void setStartTick(osg::Timer_t tick)
osgViewer::CompositeViewer::checkNeedToDoFrame
virtual bool checkNeedToDoFrame()
osgViewer::CompositeViewer::getFrameStamp
const osg::FrameStamp * getFrameStamp() const
Definition CompositeViewer:76
osgViewer::CompositeViewer::CompositeViewer
CompositeViewer(osg::ArgumentParser &arguments)
osgViewer::CompositeViewer::readConfiguration
bool readConfiguration(const std::string &filename)
osgViewer::CompositeViewer::setCameraWithFocus
void setCameraWithFocus(osg::Camera *camera)
osgViewer::CompositeViewer::~CompositeViewer
virtual ~CompositeViewer()
osgViewer::CompositeViewer::getNumViews
unsigned int getNumViews() const
Definition CompositeViewer:62
osgViewer::CompositeViewer::_startTick
osg::Timer_t _startTick
Definition CompositeViewer:143
osgViewer::CompositeViewer::getFrameStamp
osg::FrameStamp * getFrameStamp()
Definition CompositeViewer:75
osgViewer::CompositeViewer::addView
void addView(osgViewer::View *view)
osgViewer::CompositeViewer::CompositeViewer
CompositeViewer()
osgViewer::CompositeViewer::META_Object
META_Object(osgViewer, CompositeViewer)
osgViewer::CompositeViewer::getViewWithFocus
osgViewer::View * getViewWithFocus()
Definition CompositeViewer:107
osgViewer::CompositeViewer::RefViews
std::vector< osg::ref_ptr< osgViewer::View > > RefViews
Definition CompositeViewer:136
osgViewer::CompositeViewer::getViewerFrameStamp
virtual osg::FrameStamp * getViewerFrameStamp()
Definition CompositeViewer:80
osgViewer::CompositeViewer::_firstFrame
bool _firstFrame
Definition CompositeViewer:139
osgViewer::CompositeViewer::getOperationThreads
virtual void getOperationThreads(OperationThreads &threads, bool onlyActive=true)
osgViewer::CompositeViewer::run
virtual int run()
osgViewer::CompositeViewer::elapsedTime
virtual double elapsedTime()
osgViewer::CompositeViewer::updateTraversal
virtual void updateTraversal()
osgViewer::CompositeViewer::addView
void addView(const osg::ref_ptr< T > &view)
Definition CompositeViewer:54
osgViewer::CompositeViewer::generateSlavePointerData
void generateSlavePointerData(osg::Camera *camera, osgGA::GUIEventAdapter &event)
osgViewer::CompositeViewer::getViewerStats
virtual osg::Stats * getViewerStats()
Definition CompositeViewer:47
osgViewer::CompositeViewer::_cameraWithFocus
osg::observer_ptr< osg::Camera > _cameraWithFocus
Definition CompositeViewer:146
osgViewer::CompositeViewer::getViewWithFocus
const osgViewer::View * getViewWithFocus() const
Definition CompositeViewer:108
osgViewer::CompositeViewer::getScenes
virtual void getScenes(Scenes &scenes, bool onlyValid=true)
osgViewer::CompositeViewer::_stats
osg::ref_ptr< osg::Stats > _stats
Definition CompositeViewer:141
osgViewer::View
Definition osgViewer/View:76
osgViewer::ViewerBase::Threads
std::vector< OpenThreads::Thread * > Threads
Definition ViewerBase:272
osgViewer::ViewerBase::OperationThreads
std::vector< osg::OperationThread * > OperationThreads
Definition ViewerBase:275
osgViewer::ViewerBase::ViewerBase
ViewerBase()
osgViewer::ViewerBase::Views
std::vector< osgViewer::View * > Views
Definition ViewerBase:281
osgViewer::ViewerBase::Cameras
std::vector< osg::Camera * > Cameras
Definition ViewerBase:263
osgViewer::ViewerBase::Contexts
std::vector< osg::GraphicsContext * > Contexts
Definition ViewerBase:266
osgViewer::ViewerBase::Scenes
std::vector< osgViewer::Scene * > Scenes
Definition ViewerBase:278
osg::ApplicationUsage
Definition ApplicationUsage:26
osg::ArgumentParser
Definition ArgumentParser:28
osg::Camera
Definition Camera:45
osg::CopyOp
Definition CopyOp:41
osg::CopyOp::SHALLOW_COPY
@ SHALLOW_COPY
Definition CopyOp:47
osg::FrameStamp
Definition FrameStamp:35
osg::Stats
Definition Stats:29
osg::observer_ptr
Definition observer_ptr:39
osg::ref_ptr
Definition ref_ptr:32
osg::ref_ptr::get
T * get() const
Definition ref_ptr:117
osgViewer
osg::Timer_t
unsigned long long Timer_t
Definition Timer:24
OSGVIEWER_EXPORT
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
View