]> icculus.org git repositories - taylor/freespace2.git/blob - include/grinternal.h
rendering functions mostly done; more complete shader setup
[taylor/freespace2.git] / include / grinternal.h
1 /*
2  * Copyright (C) Volition, Inc. 1999.  All rights reserved.
3  *
4  * All source code herein is the property of Volition, Inc. You may not sell 
5  * or otherwise commercially exploit the source or things you created based on
6  * the source.
7  */
8
9 /*
10  * $Logfile: /Freespace2/code/Graphics/GrInternal.h $
11  * $Revision$
12  * $Date$
13  * $Author$
14  *
15  * Include file for our Graphics directory
16  *
17  * $Log$
18  * Revision 1.3  2004/07/04 11:31:43  taylor
19  * amd64 support, compiler warning fixes, don't use software rendering
20  *
21  * Revision 1.2  2002/06/09 04:41:13  relnev
22  * added copyright header
23  *
24  * Revision 1.1.1.1  2002/05/03 03:28:12  root
25  * Initial import.
26  *
27  * 
28  * 7     6/29/99 10:35a Dave
29  * Interface polygon bitmaps! Whee!
30  * 
31  * 6     1/15/99 11:29a Neilk
32  * Fixed D3D screen/texture pixel formatting problem. 
33  * 
34  * 5     1/14/99 12:48a Dave
35  * Todo list bug fixes. Made a pass at putting briefing icons back into
36  * FRED. Sort of works :(
37  * 
38  * 4     12/02/98 5:47p Dave
39  * Put in interface xstr code. Converted barracks screen to new format.
40  * 
41  * 3     12/01/98 10:32a Johnson
42  * Fixed direct3d font problems. Fixed sun bitmap problem. Fixed direct3d
43  * starfield problem.
44  * 
45  * 2     10/07/98 10:53a Dave
46  * Initial checkin.
47  * 
48  * 1     10/07/98 10:49a Dave
49  * 
50  * 23    5/06/98 11:21p John
51  * Fixed a bitmap bug with Direct3D.  Started adding new caching code into
52  * D3D.
53  * 
54  * 22    4/08/98 4:09p John
55  * Fixed some potential bugs with high bit set in screen piointer.
56  * 
57  * 21    3/25/98 8:07p John
58  * Restructured software rendering into two modules; One for windowed
59  * debug mode and one for DirectX fullscreen.   
60  * 
61  * 20    3/24/98 3:58p John
62  * Put in (hopefully) final gamma setting code.
63  * 
64  * 19    3/10/98 4:18p John
65  * Cleaned up graphics lib.  Took out most unused gr functions.   Made D3D
66  * & Glide have popups and print screen.  Took out all >8bpp software
67  * support.  Made Fred zbuffer.  Made zbuffer allocate dynamically to
68  * support Fred.  Made zbuffering key off of functions rather than one
69  * global variable.
70  * 
71  * 18    2/07/98 7:50p John
72  * Added code so that we can use the old blending type of alphacolors if
73  * we want to.  Made the stars use them.
74  * 
75  * 17    1/26/98 5:12p John
76  * Added in code for Pentium Pro specific optimizations. Speed up
77  * zbuffered correct tmapper about 35%.   Speed up non-zbuffered scalers
78  * by about 25%.
79  * 
80  * 16    11/30/97 3:57p John
81  * Made fixed 32-bpp translucency.  Made BmpMan always map translucent
82  * color into 255 even if you aren't supposed to remap and make it's
83  * palette black.
84  * 
85  * 15    11/30/97 12:18p John
86  * added more 24 & 32-bpp primitives
87  * 
88  * 14    11/29/97 2:06p John
89  * added mode 16-bpp support
90  * 
91  * 13    11/14/97 12:30p John
92  * Fixed some DirectX bugs.  Moved the 8-16 xlat tables into Graphics
93  * libs.  Made 16-bpp DirectX modes know what bitmap format they're in.
94  * 
95  * 12    11/03/97 10:08p Hoffoss
96  * Changed gr_get_string_size to utilize an optional length specifier, if
97  * you want to use non-null terminated strings.
98  * 
99  * 11    10/19/97 12:55p John
100  * new code to lock / unlock surfaces for smooth directx integration.
101  * 
102  * 10    10/14/97 4:50p John
103  * more 16 bpp stuff.
104  * 
105  * 9     10/14/97 8:08a John
106  * added a bunch more 16 bit support
107  * 
108  * 8     7/18/97 12:40p John
109  * cached alphacolors to disk.  Also made cfopen be able to delete a file
110  * by passing NULL for mode.
111  * 
112  * 7     6/17/97 12:03p John
113  * Moved color/alphacolor functions into their own module.  Made all color
114  * functions be part of the low-level graphics drivers, not just the
115  * grsoft.
116  * 
117  * 6     6/12/97 5:04p John
118  * Initial rev of Glide support
119  * 
120  * 5     6/11/97 5:49p John
121  * Changed palette code to only recalculate alphacolors when needed, not
122  * when palette changes.
123  * 
124  * 4     6/06/97 4:41p John
125  * Fixed alpha colors to be smoothly integrated into gr_set_color_fast
126  * code.
127  * 
128  * 3     6/06/97 2:40p John
129  * Made all the radar dim in/out
130  * 
131  * 2     5/14/97 4:38p John
132  * Fixed print_screen bug.
133  * 
134  * 1     5/12/97 12:13p John
135  *
136  * $NoKeywords: $
137  */
138
139 #ifndef _GRINTERNAL_H
140 #define _GRINTERNAL_H
141
142 #include "font.h"
143 #include "2d.h"
144
145 extern int Gr_cursor;
146
147 extern ubyte Gr_original_palette[768];          // The palette 
148 extern ubyte Gr_current_palette[768];
149
150 typedef struct alphacolor {
151         int     used;
152         int     r,g,b,alpha;
153         int     type;                                           // See AC_TYPE_??? define
154         color   *clr;
155 } alphacolor;
156
157 extern alphacolor * Current_alphacolor;
158 void gr_init_alphacolors();
159
160 extern char Gr_current_palette_name[128];
161
162 typedef struct color_gun {
163         int     bits;
164         int     shift;
165         int     scale;
166         int     mask;
167 } color_gun;
168
169 // screen format
170 extern color_gun Gr_red, Gr_green, Gr_blue, Gr_alpha;
171
172 // texture format
173 extern color_gun Gr_t_red, Gr_t_green, Gr_t_blue, Gr_t_alpha;
174
175 // alpha texture format
176 extern color_gun Gr_ta_red, Gr_ta_green, Gr_ta_blue, Gr_ta_alpha;
177
178 // CURRENT FORMAT - note - this is what bmpman uses when fiddling with pixels/colors. so be sure its properly set to one
179 // of the above values
180 extern color_gun *Gr_current_red, *Gr_current_green, *Gr_current_blue, *Gr_current_alpha;
181
182 // zbuffer stuff
183 extern int Gr_zbuffering;
184 extern int Gr_zbuffering_mode;
185 extern int Gr_global_zbuffering;
186
187 // Translate the 768 byte 'src' palette into 
188 // the current screen format's palette.
189 // The size of the dst array is assumed to be gr_screen.bpp
190 // bytes per element.
191 void gr_xlat_palette( void *dst, bitmap *bmp );
192
193 extern float Gr_gamma;
194 extern int Gr_gamma_int;                                // int(Gr_gamma*100)
195 extern int Gr_gamma_lookup[256];
196
197 #define TCACHE_TYPE_AABITMAP                            0               // HUD bitmap.  All Alpha.
198 #define TCACHE_TYPE_NORMAL                                      1               // Normal bitmap. Alpha = 0.
199 #define TCACHE_TYPE_XPARENT                             2               // Bitmap with 0,255,0 = transparent.  Alpha=0 if transparent, 1 if not.
200 #define TCACHE_TYPE_BITMAP_SECTION              3               // section of a bitmap
201 #define TCACHE_TYPE_BITMAP_INTERFACE    4               // bitmap used for UI
202
203 #endif
204