1/* 2Copyright (C) 1996-1997 Id Software, Inc. 3 4This program is free software; you can redistribute it and/or 5modify it under the terms of the GNU General Public License 6as published by the Free Software Foundation; either version 2 7of the License, or (at your option) any later version. 8 9This program is distributed in the hope that it will be useful, 10but WITHOUT ANY WARRANTY; without even the implied warranty of 11MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 12 13See the GNU General Public License for more details. 14 15You should have received a copy of the GNU General Public License 16along with this program; if not, write to the Free Software 17Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 18 19*/ 20// d_iface.h: interface header file for rasterization driver modules 21 22#define WARP_WIDTH 320 23#define WARP_HEIGHT 200 24 25#define MAX_LBM_HEIGHT 480 26 27typedef struct 28{ 29 float u, v; 30 float s, t; 31 float zi; 32} emitpoint_t; 33 34typedef enum { 35 pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2, 36 ptype_t_max = 1 << 30 37} ptype_t; 38 39// !!! if this is changed, it must be changed in d_ifacea.h too !!! 40typedef struct particle_s 41{ 42// driver-usable fields 43 vec3_t org; 44 float color; 45// drivers never touch the following fields 46 struct particle_s *next; 47 vec3_t vel; 48 float ramp; 49 float die; 50 ptype_t type; 51} particle_t; 52 53#define PARTICLE_Z_CLIP 8.0 54 55typedef struct polyvert_s { 56 float u, v, zi, s, t; 57} polyvert_t; 58 59typedef struct polydesc_s { 60 int numverts; 61 float nearzi; 62 msurface_t *pcurrentface; 63 polyvert_t *pverts; 64} polydesc_t; 65 66// !!! if this is changed, it must be changed in d_ifacea.h too !!! 67typedef struct finalvert_s { 68 int v[6]; // u, v, s, t, l, 1/z 69 int flags; 70 float reserved; 71} finalvert_t; 72 73// !!! if this is changed, it must be changed in d_ifacea.h too !!! 74typedef struct 75{ 76 void *pskin; 77 maliasskindesc_t *pskindesc; 78 int skinwidth; 79 int skinheight; 80 mtriangle_t *ptriangles; 81 finalvert_t *pfinalverts; 82 int numtriangles; 83 int drawtype; 84 int seamfixupX16; 85} affinetridesc_t; 86 87// !!! if this is changed, it must be changed in d_ifacea.h too !!! 88typedef struct { 89 float u, v, zi, color; 90} screenpart_t; 91 92typedef struct 93{ 94 int nump; 95 emitpoint_t *pverts; // there's room for an extra element at [nump], 96 // if the driver wants to duplicate element [0] at 97 // element [nump] to avoid dealing with wrapping 98 mspriteframe_t *pspriteframe; 99 vec3_t vup, vright, vpn; // in worldspace 100 float nearzi; 101} spritedesc_t; 102 103typedef struct 104{ 105 int u, v; 106 float zi; 107 int color; 108} zpointdesc_t; 109 110extern cvar_t r_drawflat; 111extern int d_spanpixcount; 112extern int r_framecount; // sequence # of current frame since Quake 113 // started 114extern qboolean r_drawpolys; // 1 if driver wants clipped polygons 115 // rather than a span list 116extern qboolean r_drawculledpolys; // 1 if driver wants clipped polygons that 117 // have been culled by the edge list 118extern qboolean r_worldpolysbacktofront; // 1 if driver wants polygons 119 // delivered back to front rather 120 // than front to back 121extern qboolean r_recursiveaffinetriangles; // true if a driver wants to use 122 // recursive triangular subdivison 123 // and vertex drawing via 124 // D_PolysetDrawFinalVerts() past 125 // a certain distance (normally 126 // only used by the software 127 // driver) 128extern float r_aliasuvscale; // scale-up factor for screen u and v 129 // on Alias vertices passed to driver 130extern int r_pixbytes; 131extern qboolean r_dowarp; 132 133extern affinetridesc_t r_affinetridesc; 134extern spritedesc_t r_spritedesc; 135extern zpointdesc_t r_zpointdesc; 136extern polydesc_t r_polydesc; 137 138extern int d_con_indirect; // if 0, Quake will draw console directly 139 // to vid.buffer; if 1, Quake will 140 // draw console via D_DrawRect. Must be 141 // defined by driver 142 143extern vec3_t r_pright, r_pup, r_ppn; 144 145 146void D_Aff8Patch (void *pcolormap); 147void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height); 148void D_DisableBackBufferAccess (void); 149void D_EndDirectRect (int x, int y, int width, int height); 150void D_PolysetDraw (void); 151void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts); 152void D_DrawParticle (particle_t *pparticle); 153void D_DrawPoly (void); 154void D_DrawSprite (void); 155void D_DrawSurfaces (void); 156void D_DrawZPoint (void); 157void D_EnableBackBufferAccess (void); 158void D_EndParticles (void); 159void D_Init (void); 160void D_ViewChanged (void); 161void D_SetupFrame (void); 162void D_StartParticles (void); 163void D_TurnZOn (void); 164void D_WarpScreen (void); 165 166void D_FillRect (vrect_t *vrect, int color); 167void D_DrawRect (void); 168void D_UpdateRects (vrect_t *prect); 169 170// currently for internal use only, and should be a do-nothing function in 171// hardware drivers 172// FIXME: this should go away 173void D_PolysetUpdateTables (void); 174 175// these are currently for internal use only, and should not be used by drivers 176extern int r_skydirect; 177extern byte *r_skysource; 178 179// transparency types for D_DrawRect () 180#define DR_SOLID 0 181#define DR_TRANSPARENT 1 182 183// !!! must be kept the same as in quakeasm.h !!! 184#define TRANSPARENT_COLOR 0xFF 185 186extern void *acolormap; // FIXME: should go away 187 188//=======================================================================// 189 190// callbacks to Quake 191 192typedef struct 193{ 194 pixel_t *surfdat; // destination for generated surface 195 int rowbytes; // destination logical width in bytes 196 msurface_t *surf; // description for surface to generate 197 fixed8_t lightadj[MAXLIGHTMAPS]; 198 // adjust for lightmap levels for dynamic lighting 199 texture_t *texture; // corrected for animating textures 200 int surfmip; // mipmapped ratio of surface texels / world pixels 201 int surfwidth; // in mipmapped texels 202 int surfheight; // in mipmapped texels 203} drawsurf_t; 204 205extern drawsurf_t r_drawsurf; 206 207void R_DrawSurface (void); 208void R_GenTile (msurface_t *psurf, void *pdest); 209 210 211// !!! if this is changed, it must be changed in d_ifacea.h too !!! 212#define TURB_TEX_SIZE 64 // base turbulent texture size 213 214// !!! if this is changed, it must be changed in d_ifacea.h too !!! 215#define CYCLE 128 // turbulent cycle size 216 217#define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf 218 219#define SKYSHIFT 7 220#define SKYSIZE (1 << SKYSHIFT) 221#define SKYMASK (SKYSIZE - 1) 222 223extern float skyspeed, skyspeed2; 224extern float skytime; 225 226extern int c_surf; 227extern vrect_t scr_vrect; 228 229extern byte *r_warpbuffer; 230 231