1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-01-21 09:53:50 +00:00
openmw-tes3mp/components/resource/texturemanager.hpp
scrawl 6ef848b7c5 Remove TextureManager::getTexture2D
Instead use getImage and let the caller create the Texture. Sharing of textures is then handled in post by the SharedStateManager.

This is closer to what the OSG serializer does.

Streamlines the TextureManager and will make it easier to multithread.
2016-02-05 23:01:11 +01:00

60 lines
1.2 KiB
C++

#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>
namespace osgViewer
{
class Viewer;
}
namespace VFS
{
class Manager;
}
namespace osgDB
{
class Options;
}
namespace Resource
{
/// @brief Handles loading/caching of Images.
class TextureManager
{
public:
TextureManager(const VFS::Manager* vfs);
~TextureManager();
/// Create or retrieve an Image
/// Returns the dummy image if the given image is not found.
osg::ref_ptr<osg::Image> getImage(const std::string& filename);
const VFS::Manager* getVFS() { return mVFS; }
osg::Texture2D* getWarningTexture();
private:
const VFS::Manager* mVFS;
// TODO: use ObjectCache
std::map<std::string, osg::ref_ptr<osg::Image> > mImages;
osg::ref_ptr<osg::Texture2D> mWarningTexture;
osg::ref_ptr<osg::Image> mWarningImage;
osg::ref_ptr<osgDB::Options> mOptions;
TextureManager(const TextureManager&);
void operator = (const TextureManager&);
};
}
#endif