From Roland Smeenk, A year ago Stephan Maximilian Huber sent in a submission with enhanced statistics. Because I was interested in the scene statistics of his submission I tried to merge his changes with the current CVS head. I made a few changes to the way the statistics are displayed. Attached you will find the new StatsHandler and a screenshot of the statistics in the compositeviewer example.

This code will add two extra statistics options:
-Camera scene statistics, stats for the scene after culling (updated at 10 Hz)
-View scene statistics, stats for the complete scene (updated at 5 Hz)
 
Each camera and each view will expand the statistics to the right.
 
I also added the requests and objects to compile of the databasepager to the databasepager statistics.""
This commit is contained in:
Robert Osfield
2008-10-03 09:02:23 +00:00
parent 03cec07df8
commit fb9181ff17
2 changed files with 480 additions and 42 deletions

View File

@@ -80,7 +80,9 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler
NO_STATS = 0,
FRAME_RATE = 1,
VIEWER_STATS = 2,
LAST = 3
CAMERA_SCENE_STATS = 3,
VIEWER_SCENE_STATS = 4,
LAST = 5
};
void setKeyEventTogglesOnScreenStats(int key) { _keyEventTogglesOnScreenStats = key; }
@@ -105,13 +107,15 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler
void setUpHUDCamera(osgViewer::ViewerBase* viewer);
osg::Geometry* createBackgroundRectangle(const osg::Vec3& pos, const float width, const float height, osg::Vec4& color);
osg::Geometry* createGeometry(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
osg::Geometry* createFrameMarkers(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numBlocks);
osg::Geometry* createTick(const osg::Vec3& pos, float height, const osg::Vec4& colour, unsigned int numTicks);
osg::Node* createCameraStats(const std::string& font, osg::Vec3& pos, float startBlocks, bool aquireGPUStats, float characterSize, osg::Stats* viewerStats, osg::Camera* camera);
osg::Node* createCameraTimeStats(const std::string& font, osg::Vec3& pos, float startBlocks, bool acquireGPUStats, float characterSize, osg::Stats* viewerStats, osg::Camera* camera);
void setUpScene(osgViewer::ViewerBase* viewer);
@@ -132,10 +136,12 @@ class OSGVIEWER_EXPORT StatsHandler : public osgGA::GUIEventHandler
unsigned int _frameRateChildNum;
unsigned int _viewerChildNum;
unsigned int _sceneChildNum;
unsigned int _cameraSceneChildNum;
unsigned int _viewerSceneChildNum;
unsigned int _numBlocks;
double _blockMultiplier;
};
/** Event handler allowing to change the screen resolution (in windowed mode) and toggle between fullscreen and windowed mode. */