git-svn-id: http://bladebattles.com/kurok/SVN@11 20cd92bb-ff49-0410-b73e-96a06e42c3b9
[kurok.git] / d_iface.h
blob8f826b642bf606b93f91b84c39e3dac18bc4daeb
1 /*
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_iface.h: interface header file for rasterization driver modules
22 #define WARP_WIDTH 320
23 #define WARP_HEIGHT 200
25 #define MAX_LBM_HEIGHT 480
27 typedef struct
29 float u, v;
30 float s, t;
31 float zi;
32 } emitpoint_t;
34 typedef enum {
35 pt_static, pt_grav, pt_slowgrav, pt_fire, pt_explode, pt_explode2, pt_blob, pt_blob2
36 } ptype_t;
38 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
39 typedef struct particle_s
41 // driver-usable fields
42 vec3_t org;
43 float color;
44 // drivers never touch the following fields
45 struct particle_s *next;
46 vec3_t vel;
47 float ramp;
48 float die;
49 ptype_t type;
50 } particle_t;
52 #define PARTICLE_Z_CLIP 8.0
54 typedef struct polyvert_s {
55 float u, v, zi, s, t;
56 } polyvert_t;
58 typedef struct polydesc_s {
59 int numverts;
60 float nearzi;
61 msurface_t *pcurrentface;
62 polyvert_t *pverts;
63 } polydesc_t;
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;
72 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
73 typedef struct
75 void *pskin;
76 maliasskindesc_t *pskindesc;
77 int skinwidth;
78 int skinheight;
79 mtriangle_t *ptriangles;
80 finalvert_t *pfinalverts;
81 int numtriangles;
82 int drawtype;
83 int seamfixupX16;
84 } affinetridesc_t;
86 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
87 typedef struct {
88 float u, v, zi, color;
89 } screenpart_t;
91 typedef struct
93 int nump;
94 emitpoint_t *pverts; // there's room for an extra element at [nump],
95 // if the driver wants to duplicate element [0] at
96 // element [nump] to avoid dealing with wrapping
97 mspriteframe_t *pspriteframe;
98 vec3_t vup, vright, vpn; // in worldspace
99 float nearzi;
100 } spritedesc_t;
102 typedef struct
104 int u, v;
105 float zi;
106 int color;
107 } zpointdesc_t;
109 extern cvar_t r_drawflat;
110 extern int d_spanpixcount;
111 extern int r_framecount; // sequence # of current frame since Quake
112 // started
113 extern qboolean r_drawpolys; // 1 if driver wants clipped polygons
114 // rather than a span list
115 extern qboolean r_drawculledpolys; // 1 if driver wants clipped polygons that
116 // have been culled by the edge list
117 extern qboolean r_worldpolysbacktofront; // 1 if driver wants polygons
118 // delivered back to front rather
119 // than front to back
120 extern qboolean r_recursiveaffinetriangles; // true if a driver wants to use
121 // recursive triangular subdivison
122 // and vertex drawing via
123 // D_PolysetDrawFinalVerts() past
124 // a certain distance (normally
125 // only used by the software
126 // driver)
127 extern float r_aliasuvscale; // scale-up factor for screen u and v
128 // on Alias vertices passed to driver
129 extern int r_pixbytes;
130 extern qboolean r_dowarp;
132 extern affinetridesc_t r_affinetridesc;
133 extern spritedesc_t r_spritedesc;
134 extern zpointdesc_t r_zpointdesc;
135 extern polydesc_t r_polydesc;
137 extern int d_con_indirect; // if 0, Quake will draw console directly
138 // to vid.buffer; if 1, Quake will
139 // draw console via D_DrawRect. Must be
140 // defined by driver
142 extern vec3_t r_pright, r_pup, r_ppn;
145 void D_Aff8Patch (void *pcolormap);
146 void D_BeginDirectRect (int x, int y, byte *pbitmap, int width, int height);
147 void D_DisableBackBufferAccess (void);
148 void D_EndDirectRect (int x, int y, int width, int height);
149 void D_PolysetDraw (void);
150 void D_PolysetDrawFinalVerts (finalvert_t *fv, int numverts);
151 void D_DrawParticle (particle_t *pparticle);
152 void D_DrawPoly (void);
153 void D_DrawSprite (void);
154 void D_DrawSurfaces (void);
155 void D_DrawZPoint (void);
156 void D_EnableBackBufferAccess (void);
157 void D_EndParticles (void);
158 void D_Init (void);
159 void D_ViewChanged (void);
160 void D_SetupFrame (void);
161 void D_StartParticles (void);
162 void D_TurnZOn (void);
163 void D_WarpScreen (void);
165 void D_FillRect (vrect_t *vrect, int color);
166 void D_DrawRect (void);
167 void D_UpdateRects (vrect_t *prect);
169 // currently for internal use only, and should be a do-nothing function in
170 // hardware drivers
171 // FIXME: this should go away
172 void D_PolysetUpdateTables (void);
174 // these are currently for internal use only, and should not be used by drivers
175 extern int r_skydirect;
176 extern byte *r_skysource;
178 // transparency types for D_DrawRect ()
179 #define DR_SOLID 0
180 #define DR_TRANSPARENT 1
182 // !!! must be kept the same as in quakeasm.h !!!
183 #define TRANSPARENT_COLOR 0xFF
185 extern void *acolormap; // FIXME: should go away
187 //=======================================================================//
189 // callbacks to Quake
191 typedef struct
193 pixel_t *surfdat; // destination for generated surface
194 int rowbytes; // destination logical width in bytes
195 msurface_t *surf; // description for surface to generate
196 fixed8_t lightadj[MAXLIGHTMAPS];
197 // adjust for lightmap levels for dynamic lighting
198 texture_t *texture; // corrected for animating textures
199 int surfmip; // mipmapped ratio of surface texels / world pixels
200 int surfwidth; // in mipmapped texels
201 int surfheight; // in mipmapped texels
202 } drawsurf_t;
204 extern drawsurf_t r_drawsurf;
206 void R_DrawSurface (void);
207 void R_GenTile (msurface_t *psurf, void *pdest);
210 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
211 #define TURB_TEX_SIZE 64 // base turbulent texture size
213 // !!! if this is changed, it must be changed in d_ifacea.h too !!!
214 #define CYCLE 128 // turbulent cycle size
216 #define TILE_SIZE 128 // size of textures generated by R_GenTiledSurf
218 #define SKYSHIFT 7
219 #define SKYSIZE (1 << SKYSHIFT)
220 #define SKYMASK (SKYSIZE - 1)
222 extern float skyspeed, skyspeed2;
223 extern float skytime;
225 extern int c_surf;
226 extern vrect_t scr_vrect;
228 extern byte *r_warpbuffer;