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