-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathTextures.h
96 lines (80 loc) · 1.78 KB
/
Textures.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
94
95
96
#ifndef TEXTURES_H
#define TEXTURES_H
#include <GL/glew.h>
//#include <gl/gl.h>
#include "convert.h"
enum FILTERS
{
None,
SaI,
xBRZ,
};
struct CachedTexture
{
GLuint glName;
u32 address;
u32 crc;
// float fulS, fulT;
// WORD ulS, ulT, lrS, lrT;
float offsetS, offsetT;
u32 maskS, maskT;
u32 clampS, clampT;
u32 mirrorS, mirrorT;
u32 line;
u32 size;
u32 format;
u32 tMem;
u32 palette;
u32 width, height; // N64 width and height
u32 clampWidth, clampHeight; // Size to clamp to
u32 realWidth, realHeight; // Actual texture size
f32 scaleS, scaleT; // Scale to map to 0.0-1.0
f32 shiftScaleS, shiftScaleT; // Scale to shift
u32 textureBytes;
CachedTexture *lower, *higher;
u32 lastDList;
u32 frameBufferTexture;
};
struct TextureCache
{
CachedTexture *bottom, *top;
CachedTexture* (current[2]);
u32 maxBytes;
u32 cachedBytes;
u32 numCached;
u32 hits, misses;
GLuint glNoiseNames[32];
//GLuint glDummyName;
CachedTexture* dummy;
u32 textureFilter, bitDepth;
};
extern TextureCache cache;
inline u32 pow2(u32 dim)
{
u32 i = 1;
while (i < dim) i <<= 1;
return i;
}
inline u32 powof(u32 dim)
{
u32 num = 1;
u32 i = 0;
while (num < dim)
{
num <<= 1;
i++;
}
return i;
}
CachedTexture* TextureCache_AddTop();
void TextureCache_MoveToTop(CachedTexture* newtop);
void TextureCache_Remove(CachedTexture* texture);
void TextureCache_RemoveBottom();
void TextureCache_Init();
void TextureCache_Destroy();
void TextureCache_Update(u32 t);
void TextureCache_ActivateTexture(u32 t, CachedTexture* texture);
void TextureCache_ActivateNoise(u32 t);
void TextureCache_ActivateDummy(u32 t);
BOOL TextureCache_Verify();
#endif