OpenSceneGraph/include/osgProducer/ViewerEventHandler

87 lines
2.8 KiB
Plaintext
Raw Normal View History

/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2003 Robert Osfield
*
* This library is open source and may be redistributed and/or modified under
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
* (at your option) any later version. The full license is in LICENSE file
* included with this distribution, and on the openscenegraph.org website.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* OpenSceneGraph Public License for more details.
*/
#ifndef OSGPRODUCER_VIEWEREVENTHANDLER
#define OSGPRODUCER_VIEWEREVENTHANDLER 1
#include <osgGA/GUIEventHandler>
#include <osgProducer/Viewer>
namespace osgProducer {
class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler
{
public:
ViewerEventHandler(OsgCameraGroup* cg);
virtual bool handle(const osgGA::GUIEventAdapter& ea,osgGA::GUIActionAdapter& aa);
virtual void accept(osgGA::GUIEventHandlerVisitor& gehv);
/** Get the keyboard and mouse usage of this manipulator.*/
virtual void getUsage(osg::ApplicationUsage& usage) const;
OsgCameraGroup* getOsgCameraGroup() { return _cg; }
const OsgCameraGroup* getOsgCameraGroup() const { return _cg; }
void setWriteNodeFileName(const std::string& filename) { _writeNodeFileName = filename; }
const std::string& getWriteNodeFileName() const { return _writeNodeFileName; }
void setDisplayHelp(bool displayHelp) { _displayHelp = displayHelp; }
2003-03-27 00:48:29 +08:00
bool getDisplayHelp() const { return _displayHelp; }
2003-03-27 00:48:29 +08:00
enum FrameStatsMode
{
NO_STATS = 0,
FRAME_RATE = 1,
CAMERA_STATS = 2
};
void setFrameStatsMode(FrameStatsMode mode);
2003-03-27 00:48:29 +08:00
FrameStatsMode getFrameStatsMode() { return _frameStatsMode; }
void setWriteImageOnNextFrame(bool writeImageOnNextFrame);
void setWriteImageFileName(const std::string& filename);
const std::string& getWriteImageFileName() const { return _writeImageFileName; }
protected:
osgProducer::OsgCameraGroup* _cg;
std::string _writeNodeFileName;
bool _displayHelp;
FrameStatsMode _frameStatsMode;
bool _firstTimeTogglingFullScreen;
class StatsAndHelpDrawCallback;
StatsAndHelpDrawCallback* _statsAndHelpDrawCallback;
class SnapImageDrawCallback;
typedef std::vector<SnapImageDrawCallback*> SnapImageDrawCallbackList;
SnapImageDrawCallbackList _snapImageDrawCallbackList;
std::string _writeImageFileName;
};
}
#endif