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_local.h: private rasterization driver defs 21 22#include "r_shared.h" 23 24// 25// TODO: fine-tune this; it's based on providing some overage even if there 26// is a 2k-wide scan, with subdivision every 8, for 256 spans of 12 bytes each 27// 28#define SCANBUFFERPAD 0x1000 29 30#define R_SKY_SMASK 0x007F0000 31#define R_SKY_TMASK 0x007F0000 32 33#define DS_SPAN_LIST_END -128 34 35#define SURFCACHE_SIZE_AT_320X200 600*1024 36 37typedef struct surfcache_s 38{ 39 struct surfcache_s *next; 40 struct surfcache_s **owner; // NULL is an empty chunk of memory 41 int lightadj[MAXLIGHTMAPS]; // checked for strobe flush 42 int dlight; 43 int size; // including header 44 unsigned width; 45 unsigned height; // DEBUG only needed for debug 46 float mipscale; 47 struct texture_s *texture; // checked for animating textures 48 byte data[4]; // width*height elements 49} surfcache_t; 50 51// !!! if this is changed, it must be changed in asm_draw.h too !!! 52typedef struct sspan_s 53{ 54 int u, v, count; 55} sspan_t; 56 57extern cvar_t d_subdiv16; 58 59extern float scale_for_mip; 60 61extern qboolean d_roverwrapped; 62extern surfcache_t *sc_rover; 63extern surfcache_t *d_initial_rover; 64 65extern float d_sdivzstepu, d_tdivzstepu, d_zistepu; 66extern float d_sdivzstepv, d_tdivzstepv, d_zistepv; 67extern float d_sdivzorigin, d_tdivzorigin, d_ziorigin; 68 69fixed16_t sadjust, tadjust; 70fixed16_t bbextents, bbextentt; 71 72 73void D_DrawSpans8 (espan_t *pspans); 74void D_DrawSpans16 (espan_t *pspans); 75void D_DrawZSpans (espan_t *pspans); 76void Turbulent8 (espan_t *pspan); 77void D_SpriteDrawSpans (sspan_t *pspan); 78 79void D_DrawSkyScans8 (espan_t *pspan); 80void D_DrawSkyScans16 (espan_t *pspan); 81 82void R_ShowSubDiv (void); 83void (*prealspandrawer)(void); 84surfcache_t *D_CacheSurface (msurface_t *surface, int miplevel); 85 86extern int D_MipLevelForScale (float scale); 87 88#if id386 89extern void D_PolysetAff8Start (void); 90extern void D_PolysetAff8End (void); 91#endif 92 93extern short *d_pzbuffer; 94extern unsigned int d_zrowbytes, d_zwidth; 95 96extern int *d_pscantable; 97extern int d_scantable[MAXHEIGHT]; 98 99extern int d_vrectx, d_vrecty, d_vrectright_particle, d_vrectbottom_particle; 100 101extern int d_y_aspect_shift, d_pix_min, d_pix_max, d_pix_shift; 102 103extern pixel_t *d_viewbuffer; 104 105extern short *zspantable[MAXHEIGHT]; 106 107extern int d_minmip; 108extern float d_scalemip[3]; 109 110extern void (*d_drawspans) (espan_t *pspan); 111 112