1
0
mirror of https://gitlab.com/OpenMW/openmw.git synced 2025-01-09 21:42:13 +00:00
OpenMW/components/resource/stats.hpp

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
1.6 KiB
C++
Raw Normal View History

#ifndef OPENMW_COMPONENTS_RESOURCE_STATS_H
#define OPENMW_COMPONENTS_RESOURCE_STATS_H
#include <osgViewer/ViewerEventHandlers>
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;
}
namespace Resource
{
class Profiler : public osgViewer::StatsHandler
{
public:
2024-03-17 18:01:11 +00:00
explicit Profiler(bool offlineCollect, const VFS::Manager& vfs);
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;
};
class StatsHandler : public osgGA::GUIEventHandler
{
public:
2024-03-17 18:01:11 +00:00
explicit StatsHandler(bool offlineCollect, const VFS::Manager& vfs);
bool handle(const osgGA::GUIEventAdapter& ea, osgGA::GUIActionAdapter& aa) override;
/** Get the keyboard and mouse usage of this manipulator.*/
void getUsage(osg::ApplicationUsage& usage) const override;
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;
2024-03-17 18:01:11 +00:00
void setWindowSize(int w, int h);
2024-03-17 18:01:11 +00:00
void toggle(osgViewer::ViewerBase& viewer);
2024-03-17 18:01:11 +00:00
void setUpHUDCamera(osgViewer::ViewerBase& viewer);
2024-03-17 18:01:11 +00:00
void setUpScene(osgViewer::ViewerBase& viewer);
};
2024-03-17 18:01:11 +00:00
void collectStatistics(osgViewer::ViewerBase& viewer);
}
#endif