texture.h 1.31 KB

/* 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;