Viewer
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_Viewer
#define OSGVIEWER_Viewer 1
#include <osg/ArgumentParser>
#include <osgGA/EventVisitor>
#include <osgUtil/UpdateVisitor>
#include <osgViewer/GraphicsWindow>
#include <osgViewer/View>
namespace osgViewer {
class OSGVIEWER_EXPORT Viewer : public ViewerBase, public osgViewer::View
{
public:
Viewer();
Viewer(osg::ArgumentParser& arguments);
Viewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
virtual ~Viewer();
META_Object(osgViewer,Viewer);
virtual void take(osg::View& rhs);
virtual void setViewerStats(osg::Stats* stats) { setStats(stats); }
virtual osg::Stats* getViewerStats() { return getStats(); }
virtual const osg::Stats* getViewerStats() const { return getStats(); }
virtual bool readConfiguration(const std::string& filename);
virtual bool isRealized() const;
virtual void realize();
virtual void setStartTick(osg::Timer_t tick);
void setReferenceTime(double time=0.0);
using osgViewer::View::setSceneData;
virtual void setSceneData(osg::Node* node);
virtual GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height);
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();
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;
// ensure that osg::View provides the reiszerGLObjects and releaseGLObjects methods
virtual void resizeGLObjectBuffers(unsigned int maxSize) { osg::View::resizeGLObjectBuffers(maxSize); }
virtual void releaseGLObjects(osg::State* state = 0) const { osg::View::releaseGLObjects(state); }
protected:
void constructorInit();
virtual void viewerInit() { init(); }
void generateSlavePointerData(osg::Camera* camera, osgGA::GUIEventAdapter& event);
void generatePointerData(osgGA::GUIEventAdapter& event);
void reprojectPointerData(osgGA::GUIEventAdapter& source_event, osgGA::GUIEventAdapter& dest_event);
};
}
#endif
ArgumentParser
EventVisitor
GraphicsWindow
UpdateVisitor
USE_REFERENCE_TIME
#define USE_REFERENCE_TIME
Definition ViewerBase:30
osgGA::GUIEventAdapter
Definition GUIEventAdapter:82
osgViewer::GraphicsWindowEmbedded
Definition GraphicsWindow:218
osgViewer::View
Definition osgViewer/View:76
osgViewer::View::setSceneData
virtual void setSceneData(osg::Node *node)
osgViewer::View::init
void init()
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
osgViewer::Viewer
Definition Viewer:28
osgViewer::Viewer::realize
virtual void realize()
osgViewer::Viewer::resizeGLObjectBuffers
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Definition Viewer:117
osgViewer::Viewer::setSceneData
virtual void setSceneData(osg::Node *node)
osgViewer::Viewer::getViewerFrameStamp
virtual osg::FrameStamp * getViewerFrameStamp()
Definition Viewer:80
osgViewer::Viewer::readConfiguration
virtual bool readConfiguration(const std::string &filename)
osgViewer::Viewer::checkNeedToDoFrame
virtual bool checkNeedToDoFrame()
osgViewer::Viewer::advance
virtual void advance(double simulationTime=USE_REFERENCE_TIME)
osgViewer::Viewer::getViewerStats
virtual osg::Stats * getViewerStats()
Definition Viewer:49
osgViewer::Viewer::take
virtual void take(osg::View &rhs)
osgViewer::Viewer::getViewerStats
virtual const osg::Stats * getViewerStats() const
Definition Viewer:52
osgViewer::Viewer::Viewer
Viewer(osg::ArgumentParser &arguments)
osgViewer::Viewer::viewerInit
virtual void viewerInit()
Definition Viewer:124
osgViewer::Viewer::isRealized
virtual bool isRealized() const
osgViewer::Viewer::elapsedTime
virtual double elapsedTime()
osgViewer::Viewer::reprojectPointerData
void reprojectPointerData(osgGA::GUIEventAdapter &source_event, osgGA::GUIEventAdapter &dest_event)
osgViewer::Viewer::~Viewer
virtual ~Viewer()
osgViewer::Viewer::eventTraversal
virtual void eventTraversal()
osgViewer::Viewer::run
virtual int run()
osgViewer::Viewer::generatePointerData
void generatePointerData(osgGA::GUIEventAdapter &event)
osgViewer::Viewer::releaseGLObjects
virtual void releaseGLObjects(osg::State *state=0) const
Definition Viewer:118
osgViewer::Viewer::updateTraversal
virtual void updateTraversal()
osgViewer::Viewer::getUsage
virtual void getUsage(osg::ApplicationUsage &usage) const
osgViewer::Viewer::checkEvents
virtual bool checkEvents()
osgViewer::Viewer::getContexts
virtual void getContexts(Contexts &contexts, bool onlyValid=true)
osgViewer::Viewer::setViewerStats
virtual void setViewerStats(osg::Stats *stats)
Definition Viewer:46
osgViewer::Viewer::generateSlavePointerData
void generateSlavePointerData(osg::Camera *camera, osgGA::GUIEventAdapter &event)
osgViewer::Viewer::getAllThreads
virtual void getAllThreads(Threads &threads, bool onlyActive=true)
osgViewer::Viewer::getCameras
virtual void getCameras(Cameras &cameras, bool onlyActive=true)
osgViewer::Viewer::getOperationThreads
virtual void getOperationThreads(OperationThreads &threads, bool onlyActive=true)
osgViewer::Viewer::constructorInit
void constructorInit()
osgViewer::Viewer::setReferenceTime
void setReferenceTime(double time=0.0)
osgViewer::Viewer::Viewer
Viewer()
osgViewer::Viewer::Viewer
Viewer(const osgViewer::Viewer &viewer, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
osgViewer::Viewer::getScenes
virtual void getScenes(Scenes &scenes, bool onlyValid=true)
osgViewer::Viewer::META_Object
META_Object(osgViewer, Viewer)
osgViewer::Viewer::setUpViewerAsEmbeddedInWindow
virtual GraphicsWindowEmbedded * setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height)
osgViewer::Viewer::setStartTick
virtual void setStartTick(osg::Timer_t tick)
osgViewer::Viewer::getViews
virtual void getViews(Views &views, bool onlyValid=true)
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::Node
Definition Node:72
osg::State
Definition State:80
osg::Stats
Definition Stats:29
osg::View
Definition osg/View:30
osg::View::getStats
osg::Stats * getStats()
Definition osg/View:47
osg::View::releaseGLObjects
virtual void releaseGLObjects(osg::State *=0) const
osg::View::setStats
void setStats(osg::Stats *stats)
Definition osg/View:44
osg::View::resizeGLObjectBuffers
virtual void resizeGLObjectBuffers(unsigned int maxSize)
osg::View::getFrameStamp
osg::FrameStamp * getFrameStamp()
Definition osg/View:90
osgViewer
osg::Timer_t
unsigned long long Timer_t
Definition Timer:24
OSGVIEWER_EXPORT
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40
View