From Paul Melis, fixed the setFrameStatsMode() method

This commit is contained in:
Robert Osfield 2005-02-07 20:44:18 +00:00
parent 46ce4c3df3
commit 850efd10f1
2 changed files with 15 additions and 10 deletions

View File

@ -52,7 +52,7 @@ class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler
CAMERA_STATS = 2 CAMERA_STATS = 2
}; };
void setFrameStatsMode(FrameStatsMode mode) { _frameStatsMode = mode; } void setFrameStatsMode(FrameStatsMode mode);
FrameStatsMode getFrameStatsMode() { return _frameStatsMode; } FrameStatsMode getFrameStatsMode() { return _frameStatsMode; }
void setWriteImageOnNextFrame(bool writeImageOnNextFrame); void setWriteImageOnNextFrame(bool writeImageOnNextFrame);

View File

@ -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) 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' : case 's' :
{ {
_frameStatsMode = (FrameStatsMode)((_frameStatsMode+1)%3); FrameStatsMode newFrameStatsMode = (FrameStatsMode)((_frameStatsMode+1)%3);
if (_frameStatsMode==NO_STATS) setFrameStatsMode(newFrameStatsMode);
{
_cg->setInstrumentationMode(false);
}
else
{
_cg->setInstrumentationMode(true);
}
return true; return true;
} }
case 'v' : case 'v' :