OpenSceneGraph 3.6.5
CompositeViewer
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>
20#include <osgViewer/View>
21
22namespace osgViewer {
23
26{
27 public:
28
30
32
34
36
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
54 template<class T> void addView(const osg::ref_ptr<T>& view) { addView(view.get()); }
55
57 template<class T> void removeView(const osg::ref_ptr<T>& view) { removeView(view.get()); }
58
59 osgViewer::View* getView(unsigned i) { return _views[i].get(); }
60 const osgViewer::View* getView(unsigned i) const { return _views[i].get(); }
61
62 unsigned int getNumViews() const { return _views.size(); }
63
64
66 virtual bool isRealized() const;
67
69 virtual void realize();
70
71 virtual void setStartTick(osg::Timer_t tick);
72
73 void setReferenceTime(double time=0.0);
74
76 const osg::FrameStamp* getFrameStamp() const { return _frameStamp.get(); }
77
78 virtual double elapsedTime();
79
81
82
88 virtual int run();
89
91 virtual bool checkNeedToDoFrame();
92
94 virtual bool checkEvents();
95
96 virtual void advance(double simulationTime=USE_REFERENCE_TIME);
97
98 virtual void eventTraversal();
99
100 virtual void updateTraversal();
101
102
105 const osg::Camera* getCameraWithFocus() const { return _cameraWithFocus.get(); }
106
108 const osgViewer::View* getViewWithFocus() const { return _viewWithFocus.get(); }
109
110 virtual void getCameras(Cameras& cameras, bool onlyActive=true);
111
112 virtual void getContexts(Contexts& contexts, bool onlyValid=true);
113
114 virtual void getAllThreads(Threads& threads, bool onlyActive=true);
115
116 virtual void getOperationThreads(OperationThreads& threads, bool onlyActive=true);
117
118 virtual void getScenes(Scenes& scenes, bool onlyValid=true);
119
120 virtual void getViews(Views& views, bool onlyValid=true);
121
122
124 virtual void getUsage(osg::ApplicationUsage& usage) const;
125
126 protected:
127
129
130 virtual void viewerInit();
131
135
136 typedef std::vector< osg::ref_ptr<osgViewer::View> > RefViews;
138
140
142
145
148
150
151};
152
153
154}
155
156#endif
#define USE_REFERENCE_TIME
Definition ViewerBase:30
unsigned long long Timer_t
Definition Timer:24
The osgViewer library provides high level viewer functionality designed to make it easier to write a ...
Definition ApplicationUsage:26
Definition ArgumentParser:28
Camera - is a subclass of Transform which represents encapsulates the settings of a Camera.
Definition Camera:45
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
@ SHALLOW_COPY
Definition CopyOp:47
Class which encapsulates the frame number, reference time and calendar time of specific frame,...
Definition FrameStamp:35
Smart pointer for observed objects, that automatically set pointers to them to null when they are del...
Definition observer_ptr:39
Smart pointer for handling referenced counted objects.
Definition ref_ptr:32
T * get() const
Definition ref_ptr:117
Definition Stats:29
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
osgViewer::View * getView(unsigned i)
Definition CompositeViewer:59
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this viewer.
void reprojectPointerData(osgGA::GUIEventAdapter &source_event, osgGA::GUIEventAdapter &dest_event)
virtual bool checkEvents()
check to see if events have been received, return true if events are now available.
RefViews _views
Definition CompositeViewer:137
virtual void getCameras(Cameras &cameras, bool onlyActive=true)
void removeView(const osg::ref_ptr< T > &view)
Definition CompositeViewer:57
osg::ref_ptr< osg::FrameStamp > _frameStamp
Definition CompositeViewer:144
void removeView(osgViewer::View *view)
virtual void getAllThreads(Threads &threads, bool onlyActive=true)
void generatePointerData(osgGA::GUIEventAdapter &event)
virtual void getContexts(Contexts &contexts, bool onlyValid=true)
virtual void setViewerStats(osg::Stats *stats)
Set the Stats object used to collect various frame related timing and scene graph stats.
Definition CompositeViewer:44
virtual void advance(double simulationTime=USE_REFERENCE_TIME)
osg::observer_ptr< osgViewer::View > _viewWithFocus
Definition CompositeViewer:147
virtual void realize()
Set up windows and associated threads.
void setReferenceTime(double time=0.0)
virtual void getViews(Views &views, bool onlyValid=true)
osg::Camera * getCameraWithFocus()
Definition CompositeViewer:104
const osg::Camera * getCameraWithFocus() const
Definition CompositeViewer:105
CompositeViewer(const CompositeViewer &, const osg::CopyOp &copyop=osg::CopyOp::SHALLOW_COPY)
virtual bool isRealized() const
Get whether at least of one of this viewer's windows are realized.
const osgViewer::View * getView(unsigned i) const
Definition CompositeViewer:60
osg::ref_ptr< osgGA::GUIEventAdapter > _previousEvent
Definition CompositeViewer:149
virtual const osg::Stats * getViewerStats() const
Get the Viewers Stats object.
Definition CompositeViewer:50
virtual void eventTraversal()
virtual void setStartTick(osg::Timer_t tick)
virtual bool checkNeedToDoFrame()
Check to see if the new frame is required, called by run() when FrameScheme is set to ON_DEMAND.
const osg::FrameStamp * getFrameStamp() const
Definition CompositeViewer:76
CompositeViewer(osg::ArgumentParser &arguments)
bool readConfiguration(const std::string &filename)
Read the viewer configuration from a configuration file.
void setCameraWithFocus(osg::Camera *camera)
unsigned int getNumViews() const
Definition CompositeViewer:62
osg::Timer_t _startTick
Definition CompositeViewer:143
osg::FrameStamp * getFrameStamp()
Definition CompositeViewer:75
void addView(osgViewer::View *view)
META_Object(osgViewer, CompositeViewer)
osgViewer::View * getViewWithFocus()
Definition CompositeViewer:107
std::vector< osg::ref_ptr< osgViewer::View > > RefViews
Definition CompositeViewer:136
virtual osg::FrameStamp * getViewerFrameStamp()
Definition CompositeViewer:80
bool _firstFrame
Definition CompositeViewer:139
virtual void getOperationThreads(OperationThreads &threads, bool onlyActive=true)
virtual int run()
Execute a main frame loop.
virtual double elapsedTime()
virtual void updateTraversal()
void addView(const osg::ref_ptr< T > &view)
Definition CompositeViewer:54
void generateSlavePointerData(osg::Camera *camera, osgGA::GUIEventAdapter &event)
virtual osg::Stats * getViewerStats()
Get the Viewers Stats object.
Definition CompositeViewer:47
osg::observer_ptr< osg::Camera > _cameraWithFocus
Definition CompositeViewer:146
const osgViewer::View * getViewWithFocus() const
Definition CompositeViewer:108
virtual void getScenes(Scenes &scenes, bool onlyValid=true)
osg::ref_ptr< osg::Stats > _stats
Definition CompositeViewer:141
View holds a single view on a scene, this view may be composed of one or more slave cameras.
Definition View:76
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
#define OSGVIEWER_EXPORT
Definition Export:40

osg logo
Generated at Wed Jul 23 2025 00:00:00 for the OpenSceneGraph by doxygen 1.14.0.