mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-15 19:49:54 +00:00
5b972ee777
Practical benefits: - Filter settings are now applied to native OSG format models. These models do not use TextureManager::getTexture2D since the model itself specifies a Texture. - The GUI render manager will be able to use its own separate textures, making it easier to turn off filtering for them.
59 lines
1.4 KiB
C++
59 lines
1.4 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 Resource
|
|
{
|
|
|
|
/// @brief Handles loading/caching of Images and Texture StateAttributes.
|
|
class TextureManager
|
|
{
|
|
public:
|
|
TextureManager(const VFS::Manager* vfs);
|
|
~TextureManager();
|
|
|
|
/// Create or retrieve a Texture2D using the specified image filename, and wrap parameters.
|
|
/// Returns the dummy texture if the given texture is not found.
|
|
osg::ref_ptr<osg::Texture2D> getTexture2D(const std::string& filename, osg::Texture::WrapMode wrapS, osg::Texture::WrapMode wrapT);
|
|
|
|
/// Create or retrieve an Image
|
|
osg::ref_ptr<osg::Image> getImage(const std::string& filename);
|
|
|
|
const VFS::Manager* getVFS() { return mVFS; }
|
|
|
|
osg::Texture2D* getWarningTexture();
|
|
|
|
private:
|
|
const VFS::Manager* mVFS;
|
|
|
|
typedef std::pair<std::pair<int, int>, std::string> MapKey;
|
|
|
|
std::map<std::string, osg::ref_ptr<osg::Image> > mImages;
|
|
|
|
std::map<MapKey, osg::ref_ptr<osg::Texture2D> > mTextures;
|
|
|
|
osg::ref_ptr<osg::Texture2D> mWarningTexture;
|
|
|
|
TextureManager(const TextureManager&);
|
|
void operator = (const TextureManager&);
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|