OpenSceneGraph 3.6.5
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
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
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
Base class for all internal nodes in the scene graph.
Definition Node:72
Encapsulates the current applied OpenGL modes, attributes and vertex arrays settings,...
Definition State:80
Definition Stats:29
View - maintains a master camera view and a list of slave cameras that are relative to this master ca...
Definition View:30
osg::Stats * getStats()
Get the Viewers Stats object.
Definition View:47
virtual void releaseGLObjects(osg::State *=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
void setStats(osg::Stats *stats)
Set the Stats object used to collect various frame related timing and scene graph stats.
Definition View:44
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
osg::FrameStamp * getFrameStamp()
Get the frame stamp of the view.
Definition View:90
Event class for storing Keyboard, mouse and window events.
Definition GUIEventAdapter:82
Definition GraphicsWindow:218
View holds a single view on a scene, this view may be composed of one or more slave cameras.
Definition View:76
virtual void setSceneData(osg::Node *node)
Set the scene graph that the View will use.
Viewer holds a single view on to a single scene.
Definition Viewer:28
virtual void realize()
set up windows and associated threads.
virtual void resizeGLObjectBuffers(unsigned int maxSize)
Resize any per context GLObject buffers to specified size.
Definition Viewer:117
virtual void setSceneData(osg::Node *node)
Set the sene graph data that viewer with view.
virtual osg::FrameStamp * getViewerFrameStamp()
Definition Viewer:80
virtual bool readConfiguration(const std::string &filename)
read the viewer configuration from a configuration file.
virtual bool checkNeedToDoFrame()
check to see if the new frame is required, called by run(..) when FrameScheme is set to ON_DEMAND.
virtual void advance(double simulationTime=USE_REFERENCE_TIME)
virtual osg::Stats * getViewerStats()
Get the Viewers Stats object.
Definition Viewer:49
virtual void take(osg::View &rhs)
Take all the settings, Camera and Slaves from the passed in view(er), leaving it empty.
virtual const osg::Stats * getViewerStats() const
Get the Viewers Stats object.
Definition Viewer:52
Viewer(osg::ArgumentParser &arguments)
virtual void viewerInit()
Definition Viewer:124
virtual bool isRealized() const
Get whether at least of one of this viewers windows are realized.
virtual double elapsedTime()
void reprojectPointerData(osgGA::GUIEventAdapter &source_event, osgGA::GUIEventAdapter &dest_event)
virtual void eventTraversal()
virtual int run()
Execute a main frame loop.
void generatePointerData(osgGA::GUIEventAdapter &event)
virtual void releaseGLObjects(osg::State *state=0) const
If State is non-zero, this function releases any associated OpenGL objects for the specified graphics...
Definition Viewer:118
virtual void updateTraversal()
virtual void getUsage(osg::ApplicationUsage &usage) const
Get the keyboard and mouse usage of this viewer.
virtual bool checkEvents()
check to see if events have been received, return true if events are now available.
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 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)
Convenience method for setting up the viewer so it can be used embedded in an external managed window...
virtual void setStartTick(osg::Timer_t tick)
virtual void getViews(Views &views, bool onlyValid=true)
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.