shithub: qk1

ref: 9f50a531673811a2cfe1622b5bf5d0bc7d9c68e0
dir: /d_iface.h/

View raw version
// d_iface.h: interface header file for rasterization driver modules

#define MAX_LBM_HEIGHT	480

typedef struct
{
	float u, v, s, t, zi;
} emitpoint_t;

typedef enum {
	pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
} ptype_t;

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct particle_s
{
	// driver-usable fields
	vec3_t		org;
	pixel_t		color;
	// drivers never touch the following fields
	struct particle_s	*next;
	vec3_t		vel;
	float		ramp;
	float		die;
	ptype_t		type;
} particle_t;
extern particle_t	*active_particles, *free_particles;

#define PARTICLE_Z_CLIP	8.0

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct finalvert_s {
	union {
		struct {
			int u, v, s, t, zi;
			int l[3];
		};
		int x[5+3];
	};
	int flags;
} finalvert_t;

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
typedef struct
{
	pixel_t				*pskin;
	maliasskindesc_t	*pskindesc;
	mtriangle_t			*ptriangles;
	finalvert_t			*pfinalverts;
	int					skinwidth;
	int					skinheight;
	int					numtriangles;
	int					drawtype;
	int					seamfixupX16;
} affinetridesc_t;

typedef struct
{
	emitpoint_t	*pverts;	// there's room for an extra element at [nump],
							//  if the driver wants to duplicate element [0] at
							//  element [nump] to avoid dealing with wrapping
	mspriteframe_t	*pspriteframe;
	int			nump;
	vec3_t			vup, vright, vpn;	// in worldspace
	float			nearzi;
} spritedesc_t;

extern int		r_framecount;		// sequence # of current frame since Quake
									//  started
extern bool	r_recursiveaffinetriangles;	// true if a driver wants to use
											//  recursive triangular subdivison
											//  and vertex drawing via
											//  D_PolysetDrawFinalVerts() past
											//  a certain distance (normally
											//  only used by the software
											//  driver)
extern float	r_aliasuvscale;		// scale-up factor for screen u and v
									//  on Alias vertices passed to driver
extern bool	r_dowarp;

extern affinetridesc_t	r_affinetridesc;
extern spritedesc_t		r_spritedesc;
extern vec3_t	r_pright, r_pup, r_ppn;


void D_PolysetDraw (pixel_t *colormap);
void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts, pixel_t *colormap, byte alpha);
void D_DrawParticle (particle_t *pparticle);
void D_DrawSprite (view_t *v);
void D_DrawSurfaces (view_t *v);
void D_Init (void);
void D_ViewChanged (void);
void D_SetupFrame (void);
void D_WarpScreen (void);

void D_DrawRect (void);

// currently for internal use only, and should be a do-nothing function in
// hardware drivers
// FIXME: this should go away
void D_PolysetUpdateTables (void);

// these are currently for internal use only, and should not be used by drivers
extern pixel_t *r_skysource[2];

// transparency types for D_DrawRect ()
#define DR_SOLID		0
#define DR_TRANSPARENT	1

extern void *acolormap;	// FIXME: should go away

//=======================================================================//

// callbacks to Quake

typedef struct
{
	msurface_t	*m;		// description for surface to generate
	texture_t	*texture;	// corrected for animating textures
	pixel_t		*dat;	// destination for generated surface
	int			mip;	// mipmapped ratio of surface texels / world pixels
	int			width;	// in mipmapped texels
	int			height;	// in mipmapped texels
	unsigned	blocklights[3][18*18];
	fixed8_t	lightadj[MAXLIGHTMAPS];
}drawsurf_t;

void R_DrawSurface (entity_t *e, drawsurf_t *surf);

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
#define TURB_TEX_SIZE	64		// base turbulent texture size

// !!! if this is changed, it must be changed in d_ifacea.h too !!!
#define	CYCLE			128		// turbulent cycle size

#define TILE_SIZE		128		// size of textures generated by R_GenTiledSurf

extern float	skyspeed;
extern float	skytime;

extern vrect_t	scr_vrect;

extern pixel_t *r_warpbuffer;