OpenCOVER
coVRStatsDisplay.h
Go to the documentation of this file.
1/* This file is part of COVISE.
2
3 You can use it under the terms of the GNU Lesser General Public License
4 version 2.1 or later, see lgpl-2.1.txt.
5
6 * License: LGPL 2+ */
7
8#ifndef CO_coVRStatsDisplay_h
9#define CO_coVRStatsDisplay_h
10
11#include <util/coTypes.h>
12#include <osg/AnimationPath>
13#include <osgText/Text>
14#include <osgGA/GUIEventHandler>
15#include <osgGA/AnimationPathManipulator>
16
17#include <osgViewer/GraphicsWindow>
18#include <osgViewer/Viewer>
19
20//#include <osgDB/fstream>
21namespace opencover
22{
23class COVEREXPORT coVRStatsDisplay
24{
25 friend class VRViewer;
26public:
28 virtual ~coVRStatsDisplay(){};
29
31 {
32 NO_STATS = 0,
33 FRAME_RATE = 1,
34 VIEWER_STATS = 2,
35 CAMERA_SCENE_STATS = 3,
36 VIEWER_SCENE_STATS = 4,
37 LAST = 5
38 };
39
40 double getBlockMultiplier() const
41 {
42 return _blockMultiplier;
43 }
44
45 void reset();
46
47 osg::Camera *getCamera()
48 {
49 return _camera.get();
50 }
51 const osg::Camera *getCamera() const
52 {
53 return _camera.get();
54 }
55
56 void showStats(int whichStats, osgViewer::ViewerBase *viewer);
57
58 void enableGpuStats(bool enable, const std::string &devname = std::string());
59 void enableRhrStats(bool enable);
60 void enableFinishStats(bool enable);
61 void enableSyncStats(bool enable);
62
64 virtual void getUsage(osg::ApplicationUsage &usage) const;
65
66protected:
67 void setUpHUDCamera(osgViewer::ViewerBase *viewer);
68
69 osg::Geometry *createBackgroundRectangle(const osg::Vec3 &pos, const float width, const float height, osg::Vec4 &color);
70
71 osg::Geometry *createGeometry(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks);
72
73 osg::Geometry *createFrameMarkers(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks);
74
75 osg::Geometry *createTick(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numTicks);
76
77 osg::Node *createCameraTimeStats(const std::string &font, osg::Vec3 &pos, float startBlocks, bool acquireGPUStats, float characterSize, osg::Stats *viewerStats, osg::Camera *camera);
78
79 void setUpScene(osgViewer::ViewerBase *viewer);
80
81 void updateThreadingModelText(osgViewer::ViewerBase::ThreadingModel tm);
82
84
86 osg::ref_ptr<osg::Camera> _camera;
87
88 osg::ref_ptr<osg::Switch> _switch;
89
90 osgViewer::ViewerBase::ThreadingModel _threadingModel;
91 osg::ref_ptr<osgText::Text> _threadingModelText;
92
93 bool _finishStats = true;
94 bool _syncStats = true;
95 bool _gpuStats = false;
96 std::string _gpuName;
97 bool _rhrStats = false;
98 unsigned int _frameRateChildNum;
99 unsigned int _gpuMemChildNum;
100 unsigned int _gpuPCIeChildNum;
101 unsigned int _gpuClockChildNum;
102 unsigned int _gpuUtilChildNum;
104 unsigned int _rhrFpsChildNum;
106 unsigned int _rhrDelayChildNum;
108 unsigned int _viewerChildNum;
109 unsigned int _gpuChildNum;
112 unsigned int _numBlocks;
114
117};
118}
119#endif
Definition: ARToolKit.h:33
Definition: coVRStatsDisplay.h:24
void setUpHUDCamera(osgViewer::ViewerBase *viewer)
void enableRhrStats(bool enable)
osg::Camera * getCamera()
Definition: coVRStatsDisplay.h:47
virtual void getUsage(osg::ApplicationUsage &usage) const
unsigned int _rhrDelayChildNum
Definition: coVRStatsDisplay.h:106
unsigned int _rhrSkippedChildNum
Definition: coVRStatsDisplay.h:107
unsigned int _rhrBandwidthChildNum
Definition: coVRStatsDisplay.h:105
virtual ~coVRStatsDisplay()
Definition: coVRStatsDisplay.h:28
void enableGpuStats(bool enable, const std::string &devname=std::string())
osg::ref_ptr< osgText::Text > _threadingModelText
Definition: coVRStatsDisplay.h:91
float _statsHeight
Definition: coVRStatsDisplay.h:116
void setUpScene(osgViewer::ViewerBase *viewer)
unsigned int _gpuUtilChildNum
Definition: coVRStatsDisplay.h:102
int _statsType
Definition: coVRStatsDisplay.h:83
osg::Geometry * createTick(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numTicks)
osg::ref_ptr< osg::Switch > _switch
Definition: coVRStatsDisplay.h:88
const osg::Camera * getCamera() const
Definition: coVRStatsDisplay.h:51
void updateThreadingModelText(osgViewer::ViewerBase::ThreadingModel tm)
unsigned int _rhrFpsChildNum
Definition: coVRStatsDisplay.h:104
std::string _gpuName
Definition: coVRStatsDisplay.h:96
float _statsWidth
Definition: coVRStatsDisplay.h:115
double getBlockMultiplier() const
Definition: coVRStatsDisplay.h:40
unsigned int _gpuClockChildNum
Definition: coVRStatsDisplay.h:101
osg::Geometry * createFrameMarkers(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks)
osgViewer::ViewerBase::ThreadingModel _threadingModel
Definition: coVRStatsDisplay.h:90
osg::Geometry * createGeometry(const osg::Vec3 &pos, float height, const osg::Vec4 &colour, unsigned int numBlocks)
void showStats(int whichStats, osgViewer::ViewerBase *viewer)
unsigned int _frameRateChildNum
Definition: coVRStatsDisplay.h:98
StatsType
Definition: coVRStatsDisplay.h:31
unsigned int _threadingModelChildNum
Definition: coVRStatsDisplay.h:103
void enableSyncStats(bool enable)
osg::ref_ptr< osg::Camera > _camera
Definition: coVRStatsDisplay.h:86
unsigned int _gpuMemChildNum
Definition: coVRStatsDisplay.h:99
unsigned int _cameraSceneChildNum
Definition: coVRStatsDisplay.h:110
unsigned int _gpuChildNum
Definition: coVRStatsDisplay.h:109
osg::Geometry * createBackgroundRectangle(const osg::Vec3 &pos, const float width, const float height, osg::Vec4 &color)
unsigned int _viewerSceneChildNum
Definition: coVRStatsDisplay.h:111
unsigned int _viewerChildNum
Definition: coVRStatsDisplay.h:108
void enableFinishStats(bool enable)
bool _initialized
Definition: coVRStatsDisplay.h:85
unsigned int _numBlocks
Definition: coVRStatsDisplay.h:112
double _blockMultiplier
Definition: coVRStatsDisplay.h:113
unsigned int _gpuPCIeChildNum
Definition: coVRStatsDisplay.h:100
osg::Node * createCameraTimeStats(const std::string &font, osg::Vec3 &pos, float startBlocks, bool acquireGPUStats, float characterSize, osg::Stats *viewerStats, osg::Camera *camera)
Definition: VRViewer.h:53