-
Notifications
You must be signed in to change notification settings - Fork 2
/
Texture.h
93 lines (76 loc) · 2.34 KB
/
Texture.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
#ifndef TEXTURE_H
#define TEXTURE_H
#include "quakedef.h"
class Texture {
public:
Texture(const char *ident);
virtual ~Texture();
void calculateHash();
bool convert8To32Fullbright();
void convertToGrayscale();
void convert8To32();
void convert24To32();
void fixSize();
void resample(const int scaledHeight, const int scaledWidth);
void upload();
bool isMissMatch(const Texture *other);
bool operator==(const Texture &other) const;
bool operator!=(const Texture &other) const;
void setData(unsigned char *data);
void setData(unsigned char *data, bool copy);
bool hasData();
char *identifier;
int width;
int height;
int bytesPerPixel;
int dataHash;
GLuint textureType;
GLuint textureId;
GLuint fullbrightTextureId;
bool mipmap;
bool grayscale;
private:
unsigned char *data;
};
typedef struct {
const char *name;
GLuint minimize;
GLuint maximize;
} glFilterMode;
class TextureManager {
public:
static GLuint glFilterMax;
static GLuint glFilterMin;
static glFilterMode glFilterModes[];
static GLuint defaultTexture;
static GLuint shinetex_glass;
static GLuint shinetex_chrome;
static GLuint underwatertexture;
static GLuint highlighttexture;
static GLuint celtexture;
static GLuint vertextexture;
static GLuint crosshair_tex[32];
static int LoadExternTexture(const char* filename, bool complain, bool mipmap, bool grayscale);
static int LoadInternTexture(const char *identifier, int width, int height, byte *data, bool mipmap, bool fullbright, int bytesperpixel, bool grayscale);
static Texture *LoadTexture(Texture *texture);
static Texture *LoadFile(const char *filename, bool complain);
static Texture *LoadFilePNG(FILE *f, char *name);
static Texture *LoadFileJPG(FILE *f, char *name);
static Texture *LoadFileTGA(FILE *f, char *name);
static Texture *LoadFilePCX(FILE *f, char *name);
static void setTextureModeCMD();
static void resetTextureModes();
static Texture *findTexture(const char *identifier);
static Texture *findTexture(Texture *find);
static void addTexture(Texture *add);
static void removeTexture(Texture *remove);
static void clearAllTextures();
static void LoadDefaultTexture();
static void LoadMiscTextures();
static void LoadCrosshairTextures();
static void LoadModelShadingTextures();
static void Init();
static GLuint getTextureId();
static void delTextureId(GLuint);
};
#endif /* TEXTURE_H */