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