bluecore/engine/TextureManager.h

93 lines
1.7 KiB
C
Raw Normal View History

2008-01-16 11:45:17 +00:00
//------------------------------------------------------------------------------
// Author: Gero Mueller <gero.mueller@cloo.de>
// Copyright: (c) 2006 Gero Mueller
// License: MIT License
//------------------------------------------------------------------------------
#ifndef BLUECORE_TEXTURE_MANAGER_H
#define BLUECORE_TEXTURE_MANAGER_H
// system includes
#include <map>
#include <string>
// project includes
#include "Utilities/Referenced.h"
namespace BlueCore
{
// forward declaration
class TextureManager;
class Texture : public Referenced
{
unsigned int _Id;
unsigned int _Width, _Height;
~Texture();
public:
Texture( unsigned int id, unsigned int width, unsigned int height ) :
_Id( id ),
_Width( width ),
_Height( height )
{
}
unsigned int getWidth() const
{
return _Width;
}
unsigned int getHeight() const
{
return _Height;
}
unsigned int getId() const
{
return _Id;
}
};
class TextureManager : public Referenced
{
private:
typedef std::map<std::string, Texture *> TextureMap;
TextureMap textures;
float _maxAnisotopy;
unsigned int _maxTextureSize;
unsigned int _lodDrop;
bool _textureCompression;
void clearTextures();
bool saveToCache ( const std::string &name, int levels );
bool loadFromCache (
const std::string &filename,
unsigned int &max_width,
unsigned int &max_height );
~TextureManager();
void TextureDestroySlot(Referenced *referenced);
public:
TextureManager();
Texture *loadTexture (
const std::string &filename,
int mipmapLevel = -1,
int compressionLevel = 1 );
};
}
#endif