2017-02-22 01:18:18 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_STATS_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_STATS_H
|
|
|
|
|
2018-06-28 14:05:00 +00:00
|
|
|
#include <osgViewer/ViewerEventHandlers>
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
namespace osgViewer
|
|
|
|
{
|
|
|
|
class ViewerBase;
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace osg
|
|
|
|
{
|
|
|
|
class Switch;
|
|
|
|
}
|
|
|
|
|
2022-07-17 16:53:38 +00:00
|
|
|
namespace osgText
|
|
|
|
{
|
|
|
|
class Font;
|
|
|
|
}
|
|
|
|
|
2022-07-07 15:34:18 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
|
|
|
|
2017-02-22 01:18:18 +00:00
|
|
|
namespace Resource
|
|
|
|
{
|
2018-06-28 14:05:00 +00:00
|
|
|
class Profiler : public osgViewer::StatsHandler
|
|
|
|
{
|
|
|
|
public:
|
2022-07-07 15:34:18 +00:00
|
|
|
Profiler(bool offlineCollect, VFS::Manager* vfs);
|
2021-01-27 08:04:33 +00:00
|
|
|
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override;
|
|
|
|
|
|
|
|
private:
|
2022-07-17 16:53:38 +00:00
|
|
|
void setUpFonts();
|
|
|
|
|
2021-01-27 08:04:33 +00:00
|
|
|
bool _offlineCollect;
|
2022-07-17 16:53:38 +00:00
|
|
|
bool _initFonts;
|
|
|
|
osg::ref_ptr<osgText::Font> _textFont;
|
2018-06-28 14:05:00 +00:00
|
|
|
};
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
class StatsHandler : public osgGA::GUIEventHandler
|
|
|
|
{
|
|
|
|
public:
|
2022-07-07 15:34:18 +00:00
|
|
|
StatsHandler(bool offlineCollect, VFS::Manager* vfs);
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
void setKey(int key) { _key = key; }
|
|
|
|
int getKey() const { return _key; }
|
|
|
|
|
2020-10-16 18:18:54 +00:00
|
|
|
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override;
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
void setWindowSize(int w, int h);
|
|
|
|
|
|
|
|
void toggle(osgViewer::ViewerBase* viewer);
|
|
|
|
|
|
|
|
void setUpHUDCamera(osgViewer::ViewerBase* viewer);
|
|
|
|
void setUpScene(osgViewer::ViewerBase* viewer);
|
|
|
|
|
|
|
|
/** Get the keyboard and mouse usage of this manipulator.*/
|
2020-10-16 18:18:54 +00:00
|
|
|
void getUsage(osg::ApplicationUsage& usage) const override;
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
osg::ref_ptr<osg::Switch> _switch;
|
|
|
|
int _key;
|
|
|
|
osg::ref_ptr<osg::Camera> _camera;
|
|
|
|
bool _initialized;
|
|
|
|
bool _statsType;
|
2021-01-27 08:04:33 +00:00
|
|
|
bool _offlineCollect;
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
float _statsWidth;
|
|
|
|
float _statsHeight;
|
|
|
|
|
|
|
|
float _characterSize;
|
|
|
|
|
|
|
|
int _resourceStatsChildNum;
|
|
|
|
|
2022-07-17 16:53:38 +00:00
|
|
|
osg::ref_ptr<osgText::Font> _textFont;
|
2017-02-22 01:18:18 +00:00
|
|
|
};
|
|
|
|
|
2021-01-27 08:04:33 +00:00
|
|
|
void CollectStatistics(osgViewer::ViewerBase* viewer);
|
|
|
|
|
2017-02-22 01:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|