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