1 /*
2 	vid.h
3 
4 	video driver defs
5 
6 	Copyright (C) 1996-1997  Id Software, Inc.
7 
8 	This program is free software; you can redistribute it and/or
9 	modify it under the terms of the GNU General Public License
10 	as published by the Free Software Foundation; either version 2
11 	of the License, or (at your option) any later version.
12 
13 	This program is distributed in the hope that it will be useful,
14 	but WITHOUT ANY WARRANTY; without even the implied warranty of
15 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
16 
17 	See the GNU General Public License for more details.
18 
19 	You should have received a copy of the GNU General Public License
20 	along with this program; if not, write to:
21 
22 		Free Software Foundation, Inc.
23 		59 Temple Place - Suite 330
24 		Boston, MA  02111-1307, USA
25 
26 */
27 
28 #ifndef __vid_h_
29 #define __vid_h_
30 
31 #include "QF/qtypes.h"
32 #include "QF/vrect.h"
33 
34 #define VID_CBITS	6
35 #define VID_GRADES	(1 << VID_CBITS)
36 
37 typedef struct {
38 	qboolean		 initialized;
39 	qboolean		 is8bit;
40 	void			*buffer;		// invisible buffer
41 	short			*zbuffer;
42 	void			*surfcache;
43 	byte			*gammatable;	// 256
44 	byte            *basepal;		// 256 * 3
45 	byte            *palette;		// 256 * 3
46 	byte			*colormap8;		// 256 * VID_GRADES size
47 	unsigned short	*colormap16;	// 256 * VID_GRADES size
48 	unsigned int	*colormap32;	// 256 * VID_GRADES size
49 	int				 fullbright;	// index of first fullbright color
50 	int				 rowbytes;		// may be > width if displayed in a window
51 	int				 width;
52 	int				 height;
53 	float			 aspect;	// width / height -- < 1 is taller than wide
54 	int				 numpages;
55 	qboolean		 recalc_refdef;	// if true, recalc vid-based stuff
56 	qboolean		 cshift_changed;
57 	quat_t           cshift_color;
58 	void			*conbuffer;
59 	int				 conrowbytes;
60 	int				 conwidth;
61 	int				 conheight;
62 	int				 maxwarpwidth;
63 	int				 maxwarpheight;
64 	byte			*direct;		// direct drawing to framebuffer, if not
65 									//  NULL
66 	int			   (*surf_cache_size)(int width, int height);
67 	void		   (*flush_caches)(void);
68 	void		   (*init_caches)(void *cache, int size);
69 	void		   (*do_screen_buffer)(void);
70 	void           (*set_palette)(const byte *palette);
71 
72 	// gl stuff
73 	void           (*load_gl)(void);
74 	void           (*init_gl)(void);
75 	void          *(*get_proc_address)(const char *name, qboolean crit);
76 	void           (*end_rendering)(void);
77 } viddef_t;
78 
79 #define viddef (*r_data->vid)
80 
81 extern unsigned int 	d_8to24table[256];	//FIXME nq/qw uses
82 
83 extern qboolean			vid_gamma_avail;
84 
85 void VID_Init_Cvars (void);
86 
87 // Called at startup to set up translation tables, takes 256 8 bit RGB values
88 // the palette data will go away after the call, so it must be copied off if
89 // the video driver will need it again
90 void VID_Init (byte *palette, byte *colormap);
91 void VID_Shutdown (void);
92 void VID_SetCaption (const char *text);
93 
94 #endif	// __vid_h_
95