-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImage.h
60 lines (57 loc) · 1.16 KB
/
Image.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#ifndef IMAGE_H
#define IMAGE_H
#include "GLIncludes.h"
#include <vector>
#include <string>
#include <cstring>
#include "Error.h"
#include "Utils.h"
class Image
{
friend class TextureManager;
private:
std::string name;
GLsizei width, height;
GLubyte bpp;
GLubyte *pixels;
ERR_RET __loadTGA(const std::string &);
ERR_RET __loadCompressedTGA(FILE *);
ERR_RET __loadUncompressedTGA(FILE *);
ERR_RET __loadRAW(const std::string &, const GLsizei, const GLsizei);
public:
Image() : width(0), height(0), bpp(0), pixels(0)
{
}
~Image()
{
delete[] pixels;
}
ERR_RET load(const std::string &);
ERR_RET loadTGA(const std::string &);
ERR_RET loadRAW(const std::string &, const GLsizei, const GLsizei);
GLsizei getWidth() const
{
return width;
}
GLsizei getHeight() const
{
return height;
}
std::string getName() const
{
return name;
}
void setName(const std::string &_name)
{
name = _name;
}
GLsizei size() const
{
return width * height * bpp;
}
GLubyte BPP() const
{
return bpp;
}
};
#endif