texture.h
1.31 KB
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
/* texture.h */
/* texture coordinate input */
struct TC {
int s;
int t;
int w;
int l;
} ;
/* texture coordinate span */
struct TC_step {
int first;
struct TC pnt;
struct TC del;
} ;
/* interpolated perspective corrected texture coordinates */
struct TC tc_cur, tc_pre, tc_del;
int tc_div_count;
/* texture coordinate output */
struct Tex_coord {
int s;
int t;
int l;
} ;
/* texture color output */
struct Tex_color {
int r;
int g;
int b;
int a;
} ;
struct TC_step tc_step[2];
struct Tex_coord tex_coord[2];
struct Tex_color tex_color[2];
struct Image tex_image[2];
/* texture ram */
#define TRAM_SIZE 4096 /* in bytes */
#define TRAM_WSIZE 8 /* TRAM word size in bytes */
#define TRAM_WMASK 7 /* TRAM word mask */
#define TRAM_LSIZE 8 /* TRAM load word size in bytes */
#define TRAM_BANKS 16
unsigned char tram[TRAM_SIZE];
int txlsize;
/* texture ram tile */
struct Tile {
int w; /* width of tile in texels, full words */
int s, t; /* size of tile in texels */
int addr; /* address in tram of tile */
};
/* tram mipmaps */
#define MM_MAX_LEVEL 4 /* number of mipmap levels 0 to MM_MAX_LEVEL */
#define MM_MIN_SIZE 2 /* smallest mipmap tile */
#define MM_LEVEL_HI 2 /* flags for level over/underflow */
#define MM_LEVEL_IN 1
#define MM_LEVEL_LO 0
struct Tile mipmap[MM_MAX_LEVEL+1];
int max_mipmap;