Details | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
5131 | clevermous | 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 | // d_init.c: rasterization driver initialization |
||
21 | |||
22 | #include "quakedef.h" |
||
23 | #include "d_local.h" |
||
24 | |||
25 | #define NUM_MIPS 4 |
||
26 | |||
27 | cvar_t d_subdiv16 = {"d_subdiv16", "1"}; |
||
28 | cvar_t d_mipcap = {"d_mipcap", "0"}; |
||
29 | cvar_t d_mipscale = {"d_mipscale", "1"}; |
||
30 | |||
31 | surfcache_t *d_initial_rover; |
||
32 | qboolean d_roverwrapped; |
||
33 | int d_minmip; |
||
34 | float d_scalemip[NUM_MIPS-1]; |
||
35 | |||
36 | static float basemip[NUM_MIPS-1] = {1.0, 0.5*0.8, 0.25*0.8}; |
||
37 | |||
38 | extern int d_aflatcolor; |
||
39 | |||
40 | void (*d_drawspans) (espan_t *pspan); |
||
41 | |||
42 | |||
43 | /* |
||
44 | =============== |
||
45 | D_Init |
||
46 | =============== |
||
47 | */ |
||
48 | void D_Init (void) |
||
49 | { |
||
50 | |||
51 | r_skydirect = 1; |
||
52 | |||
53 | Cvar_RegisterVariable (&d_subdiv16); |
||
54 | Cvar_RegisterVariable (&d_mipcap); |
||
55 | Cvar_RegisterVariable (&d_mipscale); |
||
56 | |||
57 | r_drawpolys = false; |
||
58 | r_worldpolysbacktofront = false; |
||
59 | r_recursiveaffinetriangles = true; |
||
60 | r_pixbytes = 1; |
||
61 | r_aliasuvscale = 1.0; |
||
62 | } |
||
63 | |||
64 | |||
65 | /* |
||
66 | =============== |
||
67 | D_CopyRects |
||
68 | =============== |
||
69 | */ |
||
70 | void D_CopyRects (vrect_t *prects, int transparent) |
||
71 | { |
||
72 | |||
73 | // this function is only required if the CPU doesn't have direct access to the |
||
74 | // back buffer, and there's some driver interface function that the driver |
||
75 | // doesn't support and requires Quake to do in software (such as drawing the |
||
76 | // console); Quake will then draw into wherever the driver points vid.buffer |
||
77 | // and will call this function before swapping buffers |
||
78 | |||
79 | UNUSED(prects); |
||
80 | UNUSED(transparent); |
||
81 | } |
||
82 | |||
83 | |||
84 | /* |
||
85 | =============== |
||
86 | D_EnableBackBufferAccess |
||
87 | =============== |
||
88 | */ |
||
89 | void D_EnableBackBufferAccess (void) |
||
90 | { |
||
91 | VID_LockBuffer (); |
||
92 | } |
||
93 | |||
94 | |||
95 | /* |
||
96 | =============== |
||
97 | D_TurnZOn |
||
98 | =============== |
||
99 | */ |
||
100 | void D_TurnZOn (void) |
||
101 | { |
||
102 | // not needed for software version |
||
103 | } |
||
104 | |||
105 | |||
106 | /* |
||
107 | =============== |
||
108 | D_DisableBackBufferAccess |
||
109 | =============== |
||
110 | */ |
||
111 | void D_DisableBackBufferAccess (void) |
||
112 | { |
||
113 | VID_UnlockBuffer (); |
||
114 | } |
||
115 | |||
116 | |||
117 | /* |
||
118 | =============== |
||
119 | D_SetupFrame |
||
120 | =============== |
||
121 | */ |
||
122 | void D_SetupFrame (void) |
||
123 | { |
||
124 | int i; |
||
125 | |||
126 | if (r_dowarp) |
||
127 | d_viewbuffer = r_warpbuffer; |
||
128 | else |
||
129 | d_viewbuffer = (void *)(byte *)vid.buffer; |
||
130 | |||
131 | if (r_dowarp) |
||
132 | screenwidth = WARP_WIDTH; |
||
133 | else |
||
134 | screenwidth = vid.rowbytes; |
||
135 | |||
136 | d_roverwrapped = false; |
||
137 | d_initial_rover = sc_rover; |
||
138 | |||
139 | d_minmip = d_mipcap.value; |
||
140 | if (d_minmip > 3) |
||
141 | d_minmip = 3; |
||
142 | else if (d_minmip < 0) |
||
143 | d_minmip = 0; |
||
144 | |||
145 | for (i=0 ; i<(NUM_MIPS-1) ; i++) |
||
146 | d_scalemip[i] = basemip[i] * d_mipscale.value; |
||
147 | |||
148 | #if id386 |
||
149 | if (d_subdiv16.value) |
||
150 | d_drawspans = D_DrawSpans16; |
||
151 | else |
||
152 | d_drawspans = D_DrawSpans8; |
||
153 | #else |
||
154 | d_drawspans = D_DrawSpans8; |
||
155 | #endif |
||
156 | |||
157 | d_aflatcolor = 0; |
||
158 | } |
||
159 | |||
160 | |||
161 | /* |
||
162 | =============== |
||
163 | D_UpdateRects |
||
164 | =============== |
||
165 | */ |
||
166 | void D_UpdateRects (vrect_t *prect) |
||
167 | { |
||
168 | |||
169 | // the software driver draws these directly to the vid buffer |
||
170 | |||
171 | UNUSED(prect); |
||
172 | }(NUM_MIPS-1)>> |
||
173 |