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:
|
2024-03-17 18:01:11 +00:00
|
|
|
explicit Profiler(bool offlineCollect, const 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();
|
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
bool mInitFonts = false;
|
|
|
|
bool mOfflineCollect;
|
|
|
|
osg::ref_ptr<osgText::Font> mTextFont;
|
2018-06-28 14:05:00 +00:00
|
|
|
};
|
2017-02-22 01:18:18 +00:00
|
|
|
|
|
|
|
class StatsHandler : public osgGA::GUIEventHandler
|
|
|
|
{
|
|
|
|
public:
|
2024-03-17 18:01:11 +00:00
|
|
|
explicit StatsHandler(bool offlineCollect, const VFS::Manager& vfs);
|
2017-02-22 01:18:18 +00:00
|
|
|
|
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
|
|
|
|
|
|
|
/** 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:
|
2024-03-17 18:01:11 +00:00
|
|
|
unsigned mPage = 0;
|
|
|
|
bool mInitialized = false;
|
|
|
|
bool mOfflineCollect;
|
|
|
|
osg::ref_ptr<osg::Switch> mSwitch;
|
|
|
|
osg::ref_ptr<osg::Camera> mCamera;
|
|
|
|
osg::ref_ptr<osgText::Font> mTextFont;
|
2023-12-21 23:23:49 +00:00
|
|
|
std::vector<std::string> mStatNames;
|
2017-02-22 01:18:18 +00:00
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
void setWindowSize(int w, int h);
|
2017-02-22 01:18:18 +00:00
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
void toggle(osgViewer::ViewerBase& viewer);
|
2017-02-22 01:18:18 +00:00
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
void setUpHUDCamera(osgViewer::ViewerBase& viewer);
|
2017-02-22 01:18:18 +00:00
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
void setUpScene(osgViewer::ViewerBase& viewer);
|
2017-02-22 01:18:18 +00:00
|
|
|
};
|
|
|
|
|
2024-03-17 18:01:11 +00:00
|
|
|
void collectStatistics(osgViewer::ViewerBase& viewer);
|
2017-02-22 01:18:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|