forked from cyxx/f2bgl
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtexturecache.h
44 lines (34 loc) · 968 Bytes
/
texturecache.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
/*
* Fade To Black engine rewrite
* Copyright (C) 2006-2012 Gregory Montoir ([email protected])
*/
#ifndef TEXTURECACHE_H__
#define TEXTURECACHE_H__
#include "util.h"
struct Texture {
GLuint id;
int bitmapW, bitmapH;
uint8_t *bitmapData;
int texW, texH;
float u, v;
Texture *next;
int16_t key;
};
struct TextureCache {
TextureCache();
~TextureCache();
void init();
void flush();
Texture *getCachedTexture(const uint8_t *data, int w, int h, int16_t key);
void convertTexture(const uint8_t *src, int w, int h, const uint16_t *clut, uint16_t *dst, int dstPitch);
Texture *createTexture(const uint8_t *data, int w, int h);
void destroyTexture(Texture *);
void updateTexture(Texture *, const uint8_t *data, int w, int h);
void setPalette(const uint8_t *pal, bool updateTextures = true);
int _fmt;
Texture *_texturesListHead, *_texturesListTail;
uint16_t _clut[256];
uint16_t *_texBuf;
bool _npotTex;
};
#endif // TEXTURECACHE_H__