2015-03-28 01:20:20 +00:00
|
|
|
#ifndef OPENMW_COMPONENTS_RESOURCE_TEXTUREMANAGER_H
|
|
|
|
#define OPENMW_COMPONENTS_RESOURCE_TEXTUREMANAGER_H
|
|
|
|
|
|
|
|
#include <string>
|
|
|
|
#include <map>
|
|
|
|
|
|
|
|
#include <osg/ref_ptr>
|
|
|
|
#include <osg/Image>
|
|
|
|
#include <osg/Texture2D>
|
|
|
|
|
2015-12-14 00:51:27 +00:00
|
|
|
namespace osgViewer
|
|
|
|
{
|
|
|
|
class Viewer;
|
|
|
|
}
|
|
|
|
|
2015-03-28 01:20:20 +00:00
|
|
|
namespace VFS
|
|
|
|
{
|
|
|
|
class Manager;
|
|
|
|
}
|
|
|
|
|
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:03:53 +00:00
|
|
|
class ImageManager
|
2015-03-28 01:20:20 +00:00
|
|
|
{
|
|
|
|
public:
|
2016-02-05 22:03:53 +00:00
|
|
|
ImageManager(const VFS::Manager* vfs);
|
|
|
|
~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.
|
2015-11-16 22:26:43 +00:00
|
|
|
osg::ref_ptr<osg::Image> getImage(const std::string& filename);
|
2015-03-28 01:20:20 +00:00
|
|
|
|
|
|
|
const VFS::Manager* getVFS() { return mVFS; }
|
|
|
|
|
2015-06-19 18:55:04 +00:00
|
|
|
osg::Texture2D* getWarningTexture();
|
|
|
|
|
2015-03-28 01:20:20 +00:00
|
|
|
private:
|
|
|
|
const VFS::Manager* mVFS;
|
|
|
|
|
2016-02-05 21:58:02 +00:00
|
|
|
// TODO: use ObjectCache
|
2015-11-16 22:26:43 +00:00
|
|
|
std::map<std::string, osg::ref_ptr<osg::Image> > mImages;
|
2015-03-28 01:20:20 +00:00
|
|
|
|
2015-03-28 01:57:39 +00:00
|
|
|
osg::ref_ptr<osg::Texture2D> mWarningTexture;
|
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;
|
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
|