2016-02-05 23:10:27 +01:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_IMAGEMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_IMAGEMANAGER_H
|
2015-03-28 02:20:20 +01:00
|
|
|
|
|
|
|
#include <map>
|
|
|
|
#include <string>
|
|
|
|
|
|
|
|
#include <osg/Image>
|
|
|
|
#include <osg/Texture2D>
|
|
|
|
#include <osg/ref_ptr>
|
|
|
|
|
2016-02-06 16:57:54 +01:00
|
|
|
#include "resourcemanager.hpp"
|
|
|
|
|
2016-02-05 20:23:41 +01:00
|
|
|
namespace osgDB
|
|
|
|
{
|
|
|
|
class Options;
|
|
|
|
}
|
|
|
|
|
2015-03-28 02:20:20 +01:00
|
|
|
namespace Resource
|
|
|
|
{
|
|
|
|
|
2016-02-05 22:58:02 +01:00
|
|
|
/// @brief Handles loading/caching of Images.
|
2016-02-05 23:31:59 +01:00
|
|
|
/// @note May be used from any thread.
|
2016-02-06 16:57:54 +01:00
|
|
|
class ImageManager : public ResourceManager
|
2015-03-28 02:20:20 +01:00
|
|
|
{
|
|
|
|
public:
|
2023-09-09 19:29:26 +02:00
|
|
|
explicit ImageManager(const VFS::Manager* vfs, double expiryDelay);
|
2016-02-05 23:03:53 +01:00
|
|
|
~ImageManager();
|
2015-03-28 02:20:20 +01:00
|
|
|
|
|
|
|
/// Create or retrieve an Image
|
2016-02-05 22:58:02 +01:00
|
|
|
/// Returns the dummy image if the given image is not found.
|
2023-05-21 16:39:32 +02:00
|
|
|
osg::ref_ptr<osg::Image> getImage(std::string_view filename, bool disableFlip = false);
|
2015-03-28 02:20:20 +01:00
|
|
|
|
2016-02-05 23:05:37 +01:00
|
|
|
osg::Image* getWarningImage();
|
2015-06-19 20:55:04 +02:00
|
|
|
|
2020-10-16 22:18:54 +04:00
|
|
|
void reportStats(unsigned int frameNumber, osg::Stats* stats) const override;
|
2017-02-22 02:18:18 +01:00
|
|
|
|
2015-03-28 02:20:20 +01:00
|
|
|
private:
|
2016-02-05 22:58:02 +01:00
|
|
|
osg::ref_ptr<osg::Image> mWarningImage;
|
2016-02-05 20:23:41 +01:00
|
|
|
osg::ref_ptr<osgDB::Options> mOptions;
|
2022-05-14 23:06:32 -07:00
|
|
|
osg::ref_ptr<osgDB::Options> mOptionsNoFlip;
|
2015-03-28 02:57:39 +01:00
|
|
|
|
2016-02-05 23:03:53 +01:00
|
|
|
ImageManager(const ImageManager&);
|
|
|
|
void operator=(const ImageManager&);
|
2015-03-28 02:20:20 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|