]> git.jsancho.org Git - lugaru.git/blob - Source/Texture.h
merge
[lugaru.git] / Source / Texture.h
1 #include <map>
2 #include <string>
3
4 //keeps track of which textures are loaded
5 class Texture {
6         private:
7                 static std::map<std::string,Texture> textures;
8         
9                 bool isSkin;
10                 std::string fileName;
11                 GLuint id;
12                 bool mipmap;
13                 bool hasalpha;
14                 GLubyte* array;
15                 int arraySize;
16                 int skinsize;
17
18                 void load();
19
20         public:
21                 Texture():
22                         isSkin(false), skinsize(0), arraySize(0),
23                         fileName(""), id(0), mipmap(false), hasalpha(false), array(NULL) { }
24                 ~Texture();
25                 Texture (const std::string& _fileName, bool _mipmap, bool _hasalpha):
26                         isSkin(false), skinsize(0), arraySize(0), array(NULL),
27                         fileName(_fileName), id(0), mipmap(_mipmap), hasalpha(_hasalpha) { }
28                 Texture (const std::string& _fileName, bool _mipmap, bool _hasalpha, bool _isSkin):
29                         isSkin(_isSkin), skinsize(0), arraySize(0), array(NULL),
30                         fileName(_fileName), id(0), mipmap(_mipmap), hasalpha(_hasalpha) { }
31                 GLuint getId() const { return id; }
32                 
33                 static GLuint Load(const std::string& fileName, bool mipmap, bool hasalpha);
34                 static GLuint Load(const std::string& fileName, bool mipmap, bool hasalpha, GLubyte* array, int* skinsize);
35 };
36