2010-04-05 21:38:50 +02:00
|
|
|
// ==============================================================
|
|
|
|
// This file is part of Glest Shared Library (www.glest.org)
|
|
|
|
//
|
|
|
|
// Copyright (C) 2001-2008 Martio Figueroa
|
|
|
|
//
|
|
|
|
// You can redistribute this code and/or modify it under
|
|
|
|
// the terms of the GNU General Public License as published
|
|
|
|
// by the Free Software Foundation; either version 2 of the
|
|
|
|
// License, or (at your option) any later version
|
|
|
|
// ==============================================================
|
|
|
|
|
|
|
|
#ifndef _SHARED_GRAPHICS_TEXTUREMANAGER_H_
|
|
|
|
#define _SHARED_GRAPHICS_TEXTUREMANAGER_H_
|
|
|
|
|
|
|
|
#include <vector>
|
|
|
|
#include "texture.h"
|
2010-09-07 07:25:40 +02:00
|
|
|
#include "leak_dumper.h"
|
2010-04-05 21:38:50 +02:00
|
|
|
|
|
|
|
using std::vector;
|
|
|
|
|
|
|
|
namespace Shared{ namespace Graphics{
|
|
|
|
|
|
|
|
// =====================================================
|
|
|
|
// class TextureManager
|
|
|
|
// =====================================================
|
|
|
|
|
|
|
|
//manages textures, creation on request and deletion on destruction
|
|
|
|
class TextureManager{
|
|
|
|
protected:
|
|
|
|
typedef vector<Texture*> TextureContainer;
|
|
|
|
|
|
|
|
protected:
|
|
|
|
TextureContainer textures;
|
|
|
|
|
|
|
|
Texture::Filter textureFilter;
|
|
|
|
int maxAnisotropy;
|
|
|
|
|
|
|
|
public:
|
|
|
|
TextureManager();
|
|
|
|
~TextureManager();
|
2010-04-05 22:42:05 +02:00
|
|
|
void init(bool forceInit=false);
|
2010-04-05 21:38:50 +02:00
|
|
|
void end();
|
|
|
|
|
|
|
|
void setFilter(Texture::Filter textureFilter);
|
|
|
|
void setMaxAnisotropy(int maxAnisotropy);
|
|
|
|
void initTexture(Texture *texture);
|
2010-06-24 12:52:58 +02:00
|
|
|
void endTexture(Texture *texture,bool mustExistInList=false);
|
|
|
|
void endLastTexture(bool mustExistInList=false);
|
2010-04-05 22:42:05 +02:00
|
|
|
void reinitTextures();
|
2010-04-05 21:38:50 +02:00
|
|
|
|
2010-10-28 02:51:25 +02:00
|
|
|
Texture::Filter getTextureFilter() const {return textureFilter;}
|
|
|
|
int getMaxAnisotropy() const {return maxAnisotropy;}
|
|
|
|
|
2010-04-05 21:38:50 +02:00
|
|
|
Texture *getTexture(const string &path);
|
|
|
|
Texture1D *newTexture1D();
|
|
|
|
Texture2D *newTexture2D();
|
|
|
|
Texture3D *newTexture3D();
|
|
|
|
TextureCube *newTextureCube();
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}}//end namespace
|
|
|
|
|
|
|
|
#endif
|