OSG  3.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
CompositeViewer.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_CompositeViewer
15 #define OSGVIEWER_CompositeViewer 1
16 
17 #include <osg/ArgumentParser>
18 #include <osgUtil/UpdateVisitor>
19 #include <osgViewer/GraphicsWindow>
20 #include <osgViewer/View>
21 
22 namespace osgViewer {
23 
26 {
27  public:
28 
30 
32 
34 
36 
37  virtual ~CompositeViewer();
38 
40  bool readConfiguration(const std::string& filename);
41 
42 
44  virtual void setViewerStats(osg::Stats* stats) { _stats = stats; }
45 
47  virtual osg::Stats* getViewerStats() { return _stats.get(); }
48 
50  virtual const osg::Stats* getViewerStats() const { return _stats.get(); }
51 
52 
53  void addView(osgViewer::View* view);
54  void removeView(osgViewer::View* view);
55 
56  osgViewer::View* getView(unsigned i) { return _views[i].get(); }
57  const osgViewer::View* getView(unsigned i) const { return _views[i].get(); }
58 
59  unsigned int getNumViews() const { return _views.size(); }
60 
61 
63  virtual bool isRealized() const;
64 
66  virtual void realize();
67 
68  virtual void setStartTick(osg::Timer_t tick);
69 
70  void setReferenceTime(double time=0.0);
71 
72  osg::FrameStamp* getFrameStamp() { return _frameStamp.get(); }
73  const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
74 
75  virtual double elapsedTime();
76 
77  virtual osg::FrameStamp* getViewerFrameStamp() { return getFrameStamp(); }
78 
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 
100  void setCameraWithFocus(osg::Camera* camera);
101  osg::Camera* getCameraWithFocus() { return _cameraWithFocus.get(); }
102  const osg::Camera* getCameraWithFocus() const { return _cameraWithFocus.get(); }
103 
104  osgViewer::View* getViewWithFocus() { return _viewWithFocus.get(); }
105  const osgViewer::View* getViewWithFocus() const { return _viewWithFocus.get(); }
106 
107  virtual void getCameras(Cameras& cameras, bool onlyActive=true);
108 
109  virtual void getContexts(Contexts& contexts, bool onlyValid=true);
110 
111  virtual void getAllThreads(Threads& threads, bool onlyActive=true);
112 
113  virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
114 
115  virtual void getScenes(Scenes& scenes, bool onlyValid=true);
116 
117  virtual void getViews(Views& views, bool onlyValid=true);
118 
119 
121  virtual void getUsage(osg::ApplicationUsage& usage) const;
122 
123  protected:
124 
125  void constructorInit();
126 
127  virtual void viewerInit();
128 
129  void generateSlavePointerData(osg::Camera* camera, osgGA::GUIEventAdapter& event);
130  void generatePointerData(osgGA::GUIEventAdapter& event);
131  void reprojectPointerData(osgGA::GUIEventAdapter& source_event, osgGA::GUIEventAdapter& dest_event);
132 
133  typedef std::vector< osg::ref_ptr<osgViewer::View> > RefViews;
134  RefViews _views;
135 
137 
139 
142 
145 
147 
148 };
149 
150 
151 }
152 
153 #endif
osg::observer_ptr< osg::Camera > _cameraWithFocus
virtual osg::FrameStamp * getViewerFrameStamp()
virtual osg::Stats * getViewerStats()
osg::FrameStamp * getFrameStamp()
#define OSGVIEWER_EXPORT
Definition: Export.h:40
const osg::FrameStamp * getFrameStamp() const
#define USE_REFERENCE_TIME
Definition: ViewerBase.h:30
unsigned long long Timer_t
Definition: Timer.h:24
#define META_Object(library, name)
Definition: Object.h:42
osg::Camera * getCameraWithFocus()
osgViewer::View * getView(unsigned i)
virtual const osg::Stats * getViewerStats() const
osg::ref_ptr< osg::FrameStamp > _frameStamp
const osgViewer::View * getViewWithFocus() const
osg::ref_ptr< osgGA::GUIEventAdapter > _previousEvent
osgViewer::View * getViewWithFocus()
unsigned int getNumViews() const
std::vector< osg::ref_ptr< osgViewer::View > > RefViews
osg::ref_ptr< osg::Stats > _stats
virtual void setViewerStats(osg::Stats *stats)
const osg::Camera * getCameraWithFocus() const
osg::observer_ptr< osgViewer::View > _viewWithFocus
const osgViewer::View * getView(unsigned i) const