2003-03-19 22:27:05 +08:00
|
|
|
/* -*-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.
|
|
|
|
*/
|
|
|
|
|
2003-03-25 23:13:20 +08:00
|
|
|
#ifndef OSGPRODUCER_VIEWEREVENTHANDLER
|
|
|
|
#define OSGPRODUCER_VIEWEREVENTHANDLER 1
|
2003-03-19 22:27:05 +08:00
|
|
|
|
|
|
|
#include <osgGA/GUIEventHandler>
|
|
|
|
#include <osgProducer/Viewer>
|
|
|
|
|
|
|
|
namespace osgProducer {
|
|
|
|
|
2003-04-09 16:20:08 +08:00
|
|
|
class OSGPRODUCER_EXPORT ViewerEventHandler : public osgGA::GUIEventHandler
|
2003-03-19 22:27:05 +08:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2003-03-26 20:50:30 +08:00
|
|
|
ViewerEventHandler(OsgCameraGroup* cg);
|
2003-03-19 22:27:05 +08:00
|
|
|
|
|
|
|
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;
|
2003-03-26 20:50:30 +08:00
|
|
|
|
|
|
|
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
|
|
|
|
2003-03-26 20:50:30 +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) { _frameStatsMode = mode; }
|
|
|
|
FrameStatsMode getFrameStatsMode() { return _frameStatsMode; }
|
2003-03-19 22:27:05 +08:00
|
|
|
|
2004-10-05 17:53:36 +08:00
|
|
|
void setWriteImageOnNextFrame(bool writeImageOnNextFrame);
|
|
|
|
|
|
|
|
void setWriteImageFileName(const std::string& filename);
|
|
|
|
const std::string& getWriteImageFileName() const { return _writeImageFileName; }
|
|
|
|
|
2003-03-19 22:27:05 +08:00
|
|
|
protected:
|
|
|
|
|
2003-03-25 23:13:20 +08:00
|
|
|
osgProducer::OsgCameraGroup* _cg;
|
|
|
|
|
2004-10-05 17:53:36 +08:00
|
|
|
std::string _writeNodeFileName;
|
2003-03-26 20:50:30 +08:00
|
|
|
|
2004-10-05 17:53:36 +08:00
|
|
|
bool _displayHelp;
|
|
|
|
FrameStatsMode _frameStatsMode;
|
2003-04-04 19:06:09 +08:00
|
|
|
|
2004-10-05 17:53:36 +08:00
|
|
|
bool _firstTimeTogglingFullScreen;
|
2003-04-08 03:19:01 +08:00
|
|
|
|
|
|
|
class StatsAndHelpDrawCallback;
|
|
|
|
StatsAndHelpDrawCallback* _statsAndHelpDrawCallback;
|
|
|
|
|
|
|
|
class SnapImageDrawCallback;
|
|
|
|
typedef std::vector<SnapImageDrawCallback*> SnapImageDrawCallbackList;
|
2004-10-05 17:53:36 +08:00
|
|
|
SnapImageDrawCallbackList _snapImageDrawCallbackList;
|
|
|
|
std::string _writeImageFileName;
|
2003-04-08 03:19:01 +08:00
|
|
|
|
2003-03-19 22:27:05 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|