2 Copyright (C) 1996-1997 Id Software, Inc.
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.
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.
13 See the GNU General Public License for more details.
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.
20 // d_local.h: private rasterization driver defs
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
28 #define SCANBUFFERPAD 0x1000
30 #define R_SKY_SMASK 0x007F0000
31 #define R_SKY_TMASK 0x007F0000
33 #define DS_SPAN_LIST_END -128
35 #define SURFCACHE_SIZE_AT_320X200 600*1024
37 typedef struct surfcache_s
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
43 int size
; // including header
45 unsigned height
; // DEBUG only needed for debug
47 struct texture_s
*texture
; // checked for animating textures
48 byte data
[4]; // width*height elements
51 // !!! if this is changed, it must be changed in asm_draw.h too !!!
52 typedef struct sspan_s
57 extern cvar_t d_subdiv16
;
59 extern float scale_for_mip
;
61 extern qboolean d_roverwrapped
;
62 extern surfcache_t
*sc_rover
;
63 extern surfcache_t
*d_initial_rover
;
65 extern float d_sdivzstepu
, d_tdivzstepu
, d_zistepu
;
66 extern float d_sdivzstepv
, d_tdivzstepv
, d_zistepv
;
67 extern float d_sdivzorigin
, d_tdivzorigin
, d_ziorigin
;
69 fixed16_t sadjust
, tadjust
;
70 fixed16_t bbextents
, bbextentt
;
73 void D_DrawSpans8 (espan_t
*pspans
);
74 void D_DrawSpans16 (espan_t
*pspans
);
75 void D_DrawZSpans (espan_t
*pspans
);
76 void Turbulent8 (espan_t
*pspan
);
77 void D_SpriteDrawSpans (sspan_t
*pspan
);
79 void D_DrawSkyScans8 (espan_t
*pspan
);
80 void D_DrawSkyScans16 (espan_t
*pspan
);
82 void R_ShowSubDiv (void);
83 void (*prealspandrawer
)(void);
84 surfcache_t
*D_CacheSurface (msurface_t
*surface
, int miplevel
);
86 extern int D_MipLevelForScale (float scale
);
89 extern void D_PolysetAff8Start (void);
90 extern void D_PolysetAff8End (void);
93 extern short *d_pzbuffer
;
94 extern unsigned int d_zrowbytes
, d_zwidth
;
96 extern int *d_pscantable
;
97 extern int d_scantable
[MAXHEIGHT
];
99 extern int d_vrectx
, d_vrecty
, d_vrectright_particle
, d_vrectbottom_particle
;
101 extern int d_y_aspect_shift
, d_pix_min
, d_pix_max
, d_pix_shift
;
103 extern pixel_t
*d_viewbuffer
;
105 extern short *zspantable
[MAXHEIGHT
];
108 extern float d_scalemip
[3];
110 extern void (*d_drawspans
) (espan_t
*pspan
);