OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Viewer.h
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>
20 #include <osgViewer/GraphicsWindow>
21 #include <osgViewer/View>
22 
23 
24 namespace osgViewer {
25 
28 {
29  public:
30 
31  Viewer();
32 
33  Viewer(osg::ArgumentParser& arguments);
34 
35  Viewer(const osgViewer::Viewer& viewer, const osg::CopyOp& copyop=osg::CopyOp::SHALLOW_COPY);
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  virtual void setSceneData(osg::Node* node);
69 
70 
73  virtual GraphicsWindowEmbedded* setUpViewerAsEmbeddedInWindow(int x, int y, int width, int height);
74 
75 
76  virtual double elapsedTime();
77 
78  virtual osg::FrameStamp* getViewerFrameStamp() { return getFrameStamp(); }
79 
85  virtual int run();
86 
88  virtual bool checkNeedToDoFrame();
89 
91  virtual bool checkEvents();
92 
93  virtual void advance(double simulationTime=USE_REFERENCE_TIME);
94 
95  virtual void eventTraversal();
96 
97  virtual void updateTraversal();
98 
99  virtual void getCameras(Cameras& cameras, bool onlyActive=true);
100 
101  virtual void getContexts(Contexts& contexts, bool onlyValid=true);
102 
103  virtual void getAllThreads(Threads& threads, bool onlyActive=true);
104 
105  virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
106 
107  virtual void getScenes(Scenes& scenes, bool onlyValid=true);
108 
109  virtual void getViews(Views& views, bool onlyValid=true);
110 
112  virtual void getUsage(osg::ApplicationUsage& usage) const;
113 
114 
115  protected:
116 
117  void constructorInit();
118 
119  virtual void viewerInit() { init(); }
120 
121  void generateSlavePointerData(osg::Camera* camera, osgGA::GUIEventAdapter& event);
122  void generatePointerData(osgGA::GUIEventAdapter& event);
123  void reprojectPointerData(osgGA::GUIEventAdapter& source_event, osgGA::GUIEventAdapter& dest_event);
124 
125 };
126 
127 
128 }
129 
130 #endif
#define OSGVIEWER_EXPORT
Definition: Export.h:40
#define USE_REFERENCE_TIME
Definition: ViewerBase.h:30
virtual const osg::Stats * getViewerStats() const
Definition: Viewer.h:52
unsigned long long Timer_t
Definition: Timer.h:24
#define META_Object(library, name)
Definition: Object.h:42
GLint GLenum GLsizei width
Definition: GLU.h:71
virtual void setViewerStats(osg::Stats *stats)
Definition: Viewer.h:46
GLint GLenum GLsizei GLsizei height
Definition: GLU.h:71
virtual osg::FrameStamp * getViewerFrameStamp()
Definition: Viewer.h:78
Definition: Node.h:71
virtual osg::Stats * getViewerStats()
Definition: Viewer.h:49
virtual void viewerInit()
Definition: Viewer.h:119
Definition: View.h:29