From 850efd10f1654844a08e4fd17883fd7a04ad618b Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 7 Feb 2005 20:44:18 +0000 Subject: [PATCH] From Paul Melis, fixed the setFrameStatsMode() method --- include/osgProducer/ViewerEventHandler | 2 +- src/osgProducer/ViewerEventHandler.cpp | 23 ++++++++++++++--------- 2 files changed, 15 insertions(+), 10 deletions(-) diff --git a/include/osgProducer/ViewerEventHandler b/include/osgProducer/ViewerEventHandler index 29dc181cf..26b083eda 100644 --- a/include/osgProducer/ViewerEventHandler +++ b/include/osgProducer/ViewerEventHandler @@ -52,7 +52,7 @@ class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler CAMERA_STATS = 2 }; - void setFrameStatsMode(FrameStatsMode mode) { _frameStatsMode = mode; } + void setFrameStatsMode(FrameStatsMode mode); FrameStatsMode getFrameStatsMode() { return _frameStatsMode; } void setWriteImageOnNextFrame(bool writeImageOnNextFrame); diff --git a/src/osgProducer/ViewerEventHandler.cpp b/src/osgProducer/ViewerEventHandler.cpp index 3f2c4709a..7318391f8 100644 --- a/src/osgProducer/ViewerEventHandler.cpp +++ b/src/osgProducer/ViewerEventHandler.cpp @@ -768,6 +768,18 @@ void ViewerEventHandler::setWriteImageFileName(const std::string& filename) } } +void ViewerEventHandler::setFrameStatsMode(FrameStatsMode mode) +{ + _frameStatsMode = mode; + if (_frameStatsMode==NO_STATS) + { + _cg->setInstrumentationMode(false); + } + else + { + _cg->setInstrumentationMode(true); + } +} bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa) { @@ -780,15 +792,8 @@ bool ViewerEventHandler::handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActio { case 's' : { - _frameStatsMode = (FrameStatsMode)((_frameStatsMode+1)%3); - if (_frameStatsMode==NO_STATS) - { - _cg->setInstrumentationMode(false); - } - else - { - _cg->setInstrumentationMode(true); - } + FrameStatsMode newFrameStatsMode = (FrameStatsMode)((_frameStatsMode+1)%3); + setFrameStatsMode(newFrameStatsMode); return true; } case 'v' :