openscenegraph
Viewer
Go to the documentation of this file.
1/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2006 Robert Osfield
2 *
3 * This library is open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version. The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * OpenSceneGraph Public License for more details.
12*/
13
14#ifndef OSGVIEWER_Viewer
15#define OSGVIEWER_Viewer 1
16
17#include <osg/ArgumentParser>
18#include <osgGA/EventVisitor>
19#include <osgUtil/UpdateVisitor>
21#include <osgViewer/View>
22
23
24namespace osgViewer {
25
28{
29 public:
30
32
34
36
37 virtual ~Viewer();
38
40
42 virtual void take(osg::View& rhs);
43
44
46 virtual void setViewerStats(osg::Stats* stats) { setStats(stats); }
47
49 virtual osg::Stats* getViewerStats() { return getStats(); }
50
52 virtual const osg::Stats* getViewerStats() const { return getStats(); }
53
54
56 virtual bool readConfiguration(const std::string& filename);
57
59 virtual bool isRealized() const;
60
62 virtual void realize();
63
64 virtual void setStartTick(osg::Timer_t tick);
65 void setReferenceTime(double time=0.0);
66
68
70 virtual void setSceneData(osg::Node* node);
71
72
75 virtual GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height);
76
77
78 virtual double elapsedTime();
79
80 virtual osg::FrameStamp* getViewerFrameStamp() { return getFrameStamp(); }
81
87 virtual int run();
88
90 virtual bool checkNeedToDoFrame();
91
93 virtual bool checkEvents();
94
95 virtual void advance(double simulationTime=USE_REFERENCE_TIME);
96
97 virtual void eventTraversal();
98
99 virtual void updateTraversal();
100
101 virtual void getCameras(Cameras& cameras, bool onlyActive=true);
102
103 virtual void getContexts(Contexts& contexts, bool onlyValid=true);
104
105 virtual void getAllThreads(Threads& threads, bool onlyActive=true);
106
107 virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
108
109 virtual void getScenes(Scenes& scenes, bool onlyValid=true);
110
111 virtual void getViews(Views& views, bool onlyValid=true);
112
114 virtual void getUsage(osg::ApplicationUsage& usage) const;
115
116 // ensure that osg::View provides the reiszerGLObjects and releaseGLObjects methods
117 virtual void resizeGLObjectBuffers(unsigned int maxSize) { osg::View::resizeGLObjectBuffers(maxSize); }
118 virtual void releaseGLObjects(osg::State* state = 0) const { osg::View::releaseGLObjects(state); }
119
120 protected:
121
123
124 virtual void viewerInit() { init(); }
125
129
130};
131
132
133}
134
135#endif
#define USE_REFERENCE_TIME
Definition ViewerBase:30
Definition GUIEventAdapter:82
Definition GraphicsWindow:218
Definition osgViewer/View:76
virtual void setSceneData(osg::Node *node)
Definition ViewerBase:36
std::vector< OpenThreads::Thread * > Threads
Definition ViewerBase:272
std::vector< osg::OperationThread * > OperationThreads
Definition ViewerBase:275
std::vector< osgViewer::View * > Views
Definition ViewerBase:281
std::vector< osg::Camera * > Cameras
Definition ViewerBase:263
std::vector< osg::GraphicsContext * > Contexts
Definition ViewerBase:266
std::vector< osgViewer::Scene * > Scenes
Definition ViewerBase:278
Definition Viewer:28
virtual void realize()
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Definition Viewer:117
virtual void setSceneData(osg::Node *node)
virtual osg::FrameStamp * getViewerFrameStamp()
Definition Viewer:80
virtual bool readConfiguration(const std::string &filename)
virtual bool checkNeedToDoFrame()
virtual void advance(double simulationTime=USE_REFERENCE_TIME)
virtual osg::Stats * getViewerStats()
Definition Viewer:49
virtual void take(osg::View &rhs)
virtual const osg::Stats * getViewerStats() const
Definition Viewer:52
Viewer(osg::ArgumentParser &arguments)
virtual void viewerInit()
Definition Viewer:124
virtual bool isRealized() const
virtual double elapsedTime()
void reprojectPointerData(osgGA::GUIEventAdapter &source_event, osgGA::GUIEventAdapter &dest_event)
virtual void eventTraversal()
virtual int run()
void generatePointerData(osgGA::GUIEventAdapter &event)
virtual void releaseGLObjects(osg::State *state=0) const
Definition Viewer:118
virtual void updateTraversal()
virtual void getUsage(osg::ApplicationUsage &usage) const
virtual bool checkEvents()
virtual void getContexts(Contexts &contexts, bool onlyValid=true)
virtual void setViewerStats(osg::Stats *stats)
Definition Viewer:46
void generateSlavePointerData(osg::Camera *camera, osgGA::GUIEventAdapter &event)
virtual void getAllThreads(Threads &threads, bool onlyActive=true)
virtual void getCameras(Cameras &cameras, bool onlyActive=true)
virtual void getOperationThreads(OperationThreads &threads, bool onlyActive=true)
void setReferenceTime(double time=0.0)
Viewer(const osgViewer::Viewer &viewer, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual void getScenes(Scenes &scenes, bool onlyValid=true)
META_Object(osgViewer, Viewer)
virtual GraphicsWindowEmbedded * setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height)
virtual void setStartTick(osg::Timer_t tick)
virtual void getViews(Views &views, bool onlyValid=true)
Definition ApplicationUsage:26
Definition ArgumentParser:28
Definition Camera:45
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Definition FrameStamp:35
Definition Node:72
Definition State:80
Definition Stats:29
Definition osg/View:30
virtual void releaseGLObjects(osg::State *=0) const
virtual void resizeGLObjectBuffers(unsigned int maxSize)
unsigned long long Timer_t
Definition Timer:24
#define OSGVIEWER_EXPORT
Definition osgViewer/Export:40