1 /* Emacs style mode select   -*- C++ -*-
2  *-----------------------------------------------------------------------------
3  *
4  *
5  *  PrBoom: a Doom port merged with LxDoom and LSDLDoom
6  *  based on BOOM, a modified and improved DOOM engine
7  *  Copyright (C) 1999 by
8  *  id Software, Chi Hoang, Lee Killough, Jim Flynn, Rand Phares, Ty Halderman
9  *  Copyright (C) 1999-2000 by
10  *  Jess Haas, Nicolas Kalkhof, Colin Phipps, Florian Schulze
11  *  Copyright 2005, 2006 by
12  *  Florian Schulze, Colin Phipps, Neil Stevens, Andrey Budko
13  *
14  *  This program is free software; you can redistribute it and/or
15  *  modify it under the terms of the GNU General Public License
16  *  as published by the Free Software Foundation; either version 2
17  *  of the License, or (at your option) any later version.
18  *
19  *  This program is distributed in the hope that it will be useful,
20  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
21  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
22  *  GNU General Public License for more details.
23  *
24  *  You should have received a copy of the GNU General Public License
25  *  along with this program; if not, write to the Free Software
26  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
27  *  02111-1307, USA.
28  *
29  * DESCRIPTION:
30  *
31  *---------------------------------------------------------------------
32  */
33 
34 #ifndef _GL_STRUCT_H
35 #define _GL_STRUCT_H
36 
37 #include <SDL_opengl.h>
38 
39 extern int nodesVersion;
40 
41 typedef enum {
42   filter_nearest,
43   filter_linear,
44   filter_nearest_mipmap_nearest,
45   filter_nearest_mipmap_linear,
46   filter_linear_mipmap_nearest,
47   filter_linear_mipmap_linear,
48 
49   filter_count
50 } filter_texture_mode_t;
51 
52 typedef enum {
53   skytype_auto,
54   skytype_none,
55   skytype_standard,
56   skytype_skydome,
57   skytype_screen,
58 
59   skytype_count
60 } skytype_t;
61 
62 #define MAX_GLGAMMA 32
63 typedef enum
64 {
65   gl_lightmode_glboom,
66   gl_lightmode_gzdoom,
67   gl_lightmode_fogbased,
68 
69   gl_lightmode_last
70 } gl_lightmode_t;
71 extern int gl_skymode;
72 extern int gl_drawskys;
73 extern int gl_hardware_gamma;
74 extern gl_lightmode_t gl_lightmode;
75 extern const char *gl_lightmodes[];
76 extern int gl_light_ambient;
77 extern int useglgamma;
78 int gld_SetGammaRamp(int gamma);
79 void gld_CheckHardwareGamma(void);
80 void gld_FlushTextures(void);
81 void gld_ApplyGammaRamp(byte *buf, int pitch, int width, int height);
82 void M_ChangeLightMode(void);
83 
84 //detail
85 extern int gl_detail_maxdist;
86 extern int gl_allow_detail_textures;
87 
88 extern int gl_seamless;
89 void gld_InitVertexData();
90 void gld_CleanVertexData();
91 void gld_UpdateSplitData(sector_t *sector);
92 
93 extern int gl_boom_colormaps;
94 extern int gl_boom_colormaps_default;
95 
96 void gld_Init(int width, int height);
97 void gld_InitCommandLine(void);
98 void gld_InitTextureParams(void);
99 
100 void gld_DrawNumPatch(int x, int y, int lump, int cm, enum patch_translation_e flags);
101 void gld_DrawNumPatch_f(float x, float y, int lump, int cm, enum patch_translation_e flags);
102 
103 void gld_FillFlat(int lump, int x, int y, int width, int height, enum patch_translation_e flags);
104 #define gld_FillFlatName(flatname, x, y, width, height, flags) \
105   gld_FillFlat(R_FlatNumForName(flatname), (x), (y), (width), (height), (flags))
106 
107 void gld_FillPatch(int lump, int x, int y, int width, int height, enum patch_translation_e flags);
108 #define gld_FillPatchName(name, x, y, width, height, flags) \
109   gld_FillPatch(W_GetNumForName(name), (x), (y), (width), (height), (flags))
110 
111 void gld_DrawLine(int x0, int y0, int x1, int y1, int BaseColor);
112 void gld_DrawLine_f(float x0, float y0, float x1, float y1, int BaseColor);
113 void gld_DrawWeapon(int weaponlump, vissprite_t *vis, int lightlevel);
114 void gld_FillBlock(int x, int y, int width, int height, int col);
115 void gld_SetPalette(int palette);
116 unsigned char *gld_ReadScreen(void);
117 
118 void gld_CleanMemory(void);
119 void gld_CleanStaticMemory(void);
120 void gld_PreprocessLevel(void);
121 
122 void gld_Set2DMode();
123 void gld_InitDrawScene(void);
124 void gld_StartDrawScene(void);
125 void gld_AddPlane(int subsectornum, visplane_t *floor, visplane_t *ceiling);
126 void gld_AddWall(seg_t *seg);
127 void gld_ProjectSprite(mobj_t* thing);
128 void gld_DrawScene(player_t *player);
129 void gld_EndDrawScene(void);
130 void gld_Finish();
131 
132 //stuff
133 extern int gl_color_mip_levels;
134 
135 //blend animation from zdoomgl
136 extern int gl_blend_animations;
137 
138 // wipe
139 int gld_wipe_doMelt(int ticks, int *y_lookup);
140 int gld_wipe_exitMelt(int ticks);
141 int gld_wipe_StartScreen(void);
142 int gld_wipe_EndScreen(void);
143 
144 // hires
145 extern int gl_hires_24bit_colormap;
146 extern int gl_texture_external_hires;
147 extern int gl_texture_internal_hires;
148 extern int gl_hires_override_pwads;
149 extern const char *gl_texture_hires_dir;
150 int gld_PrecacheGUIPatches(void);
151 
152 //HQ resize
153 typedef enum
154 {
155   hq_scale_none,
156   hq_scale_2x,
157   hq_scale_3x,
158   hq_scale_4x,
159 
160   hq_scale_max
161 } gl_hqresizemode_t;
162 extern const char *gl_hqresizemodes[];
163 extern int gl_texture_hqresize;
164 extern int gl_texture_hqresize_textures;
165 extern int gl_texture_hqresize_sprites;
166 extern int gl_texture_hqresize_patches;
167 
168 //clipper
169 dboolean gld_clipper_SafeCheckRange(angle_t startAngle, angle_t endAngle);
170 void gld_clipper_SafeAddClipRange(angle_t startangle, angle_t endangle);
171 void gld_clipper_SafeAddClipRangeRealAngles(angle_t startangle, angle_t endangle);
172 void gld_clipper_Clear(void);
173 angle_t gld_FrustumAngle(void);
174 void gld_FrustrumSetup(void);
175 dboolean gld_SphereInFrustum(float x, float y, float z, float radius);
176 
177 //missing flats (fake floors and ceilings)
178 extern dboolean gl_use_stencil;
179 sector_t* GetBestFake(sector_t *sector, int ceiling, int validcount);
180 
181 //vertical sync for GL
182 extern int gl_vsync;
183 
184 //shadows
185 typedef struct shadow_params_s
186 {
187   int enable;
188   int loaded;
189 
190   GLuint tex_id;
191   int width;
192   int height;
193 
194   int max_radius;
195   int max_dist;
196   float factor;
197   float bias;
198 } simple_shadow_params_t;
199 
200 extern simple_shadow_params_t simple_shadows;
201 extern int gl_shadows_maxdist;
202 extern int gl_shadows_factor;
203 
204 void gld_DrawMapLines(void);
205 void gld_BeginLines(void);
206 void gld_EndLines(void);
207 
208 //sprites
209 typedef enum { spriteclip_const, spriteclip_always, spriteclip_smart } spriteclipmode_t;
210 extern spriteclipmode_t gl_spriteclip;
211 extern const char *gl_spriteclipmodes[];
212 extern int gl_spriteclip_threshold;
213 extern float gl_spriteclip_threshold_f;
214 extern int gl_sprites_frustum_culling;
215 extern int gl_sprite_offset_default;
216 extern float gl_sprite_offset;
217 extern int gl_sprite_blend;
218 extern int gl_mask_sprite_threshold;
219 
220 //skybox
221 int R_BoxSkyboxNumForName(const char *name);
222 void R_SetBoxSkybox(int texture);
223 
224 //multisampling
225 void gld_MultisamplingInit(void);
226 void gld_MultisamplingCheck(void);
227 void gld_MultisamplingSet(void);
228 
229 //display lists
230 extern int gl_use_display_lists;
231 
232 void gld_ProcessTexturedMap(void);
233 void gld_ResetTexturedAutomap(void);
234 void gld_MapDrawSubsectors(player_t *plr, int fx, int fy, fixed_t mx, fixed_t my, int fw, int fh, fixed_t scale);
235 
236 void gld_Init8InGLMode(void);
237 void gld_Draw8InGL(void);
238 
239 #endif // _GL_STRUCT_H
240