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 // disable data conversion warnings
23 //#pragma warning(disable : 4244) // MIPS
24 //#pragma warning(disable : 4136) // X86
25 //#pragma warning(disable : 4051) // ALPHA
26 #pragma warning(disable : 4244) // LordHavoc: MSVC++ 4 x86, double/float
27 #pragma warning(disable : 4305) // LordHavoc: MSVC++ 6 x86, double/float
28 #pragma warning(disable : 4018) // LordHavoc: MSVC++ 4 x86, signed/unsigned mismatch
33 #define strcasecmp stricmp
34 #define strncasecmp strnicmp
40 extern void GL_BeginRendering (int *x, int *y, int *width, int *height);
41 extern void GL_EndRendering (void);
43 extern int texture_extension_number;
45 extern float gldepthmin, gldepthmax;
47 extern void GL_Upload32 (void *data, int width, int height, qboolean mipmap, qboolean alpha);
48 extern void GL_Upload8 (byte *data, int width, int height, qboolean mipmap, qboolean alpha);
49 extern int GL_LoadTexture (char *identifier, int width, int height, byte *data, qboolean mipmap, qboolean alpha, int bytesperpixel);
50 extern int GL_FindTexture (char *identifier);
61 extern int glx, gly, glwidth, glheight;
63 // r_local.h -- private refresh defs
65 #define ALIAS_BASE_SIZE_RATIO (1.0 / 11.0)
66 // normalizing factor so player model works out to about
67 // 1 pixel per triangle
68 #define MAX_LBM_HEIGHT 480
70 #define BACKFACE_EPSILON 0.01
73 extern void R_TimeRefresh_f (void);
74 extern void R_ReadPointFile_f (void);
76 //====================================================
79 extern entity_t r_worldentity;
80 extern qboolean r_cache_thrash; // compatability
81 extern vec3_t modelorg, r_entorigin;
82 extern entity_t *currententity;
83 extern int r_visframecount; // ??? what difs?
84 extern int r_framecount;
85 extern mplane_t frustum[4];
86 extern int c_brush_polys, c_alias_polys, c_light_polys, c_nodes, c_leafs;
95 extern vec3_t r_origin;
100 extern refdef_t r_refdef;
101 extern mleaf_t *r_viewleaf, *r_oldviewleaf;
102 extern texture_t *r_notexture_mip;
103 extern int d_lightstylevalue[256]; // 8.8 fraction of base light value
105 extern qboolean envmap;
107 extern int skytexturenum; // index in cl.loadmodel, not gl texture object
109 extern cvar_t r_drawentities;
110 extern cvar_t r_drawviewmodel;
111 extern cvar_t r_speeds;
112 extern cvar_t r_fullbright;
113 extern cvar_t r_shadows;
114 extern cvar_t r_wateralpha;
115 extern cvar_t r_dynamic;
116 extern cvar_t r_novis;
117 extern cvar_t r_waterripple;
119 extern cvar_t gl_max_size;
121 extern float r_world_matrix[16];
123 extern const char *gl_vendor;
124 extern const char *gl_renderer;
125 extern const char *gl_version;
126 extern const char *gl_extensions;
129 #define TEXTURE0_SGIS 0x835E
130 #define TEXTURE1_SGIS 0x835F
133 #define APIENTRY /* */
136 extern qboolean gl_mtexable;
138 // LordHavoc: ARB multitexure support
139 extern int gl_mtex_enum;
140 // Micro$oft dropped GL support beyond 1.1, so...
143 //#define GL_POLYGON_OFFSET_POINT 0x2A01
144 //#define GL_POLYGON_OFFSET_LINE 0x2A02
145 //#define GL_POLYGON_OFFSET_FILL 0x8037
147 #define GL_ACTIVE_TEXTURE_ARB 0x84E0
148 #define GL_CLIENT_ACTIVE_TEXTURE_ARB 0x84E1
149 #define GL_MAX_TEXTURES_UNITS_ARB 0x84E2
150 #define GL_TEXTURE0_ARB 0x84C0
151 #define GL_TEXTURE1_ARB 0x84C1
152 #define GL_TEXTURE2_ARB 0x84C2
153 #define GL_TEXTURE3_ARB 0x84C3
154 // LordHavoc: ARB supports 32+ texture units, but hey I only use 2 anyway...
156 // LordHavoc: vertex array defines
157 #define GL_VERTEX_ARRAY 0x8074
158 //#define GL_NORMAL_ARRAY 0x8075
159 #define GL_COLOR_ARRAY 0x8076
160 //#define GL_INDEX_ARRAY 0x8077
161 #define GL_TEXTURE_COORD_ARRAY 0x8078
162 //#define GL_EDGE_FLAG_ARRAY 0x8079
164 #define GL_V2F 0x2A20
165 #define GL_V3F 0x2A21
166 #define GL_C4UB_V2F 0x2A22
167 #define GL_C4UB_V3F 0x2A23
168 #define GL_C3F_V3F 0x2A24
169 #define GL_N3F_V3F 0x2A25
170 #define GL_C4F_N3F_V3F 0x2A26
171 #define GL_T2F_V3F 0x2A27
172 #define GL_T4F_V4F 0x2A28
173 #define GL_T2F_C4UB_V3F 0x2A29
174 #define GL_T2F_C3F_V3F 0x2A2A
175 #define GL_T2F_N3F_V3F 0x2A2B
176 #define GL_T2F_C4F_N3F_V3F 0x2A2C
177 #define GL_T4F_C4F_N3F_V4F 0x2A2D
180 //extern void (APIENTRY *qglPolygonOffset)(GLfloat factor, GLfloat units);
181 extern void (APIENTRY *qglVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
182 //extern void (APIENTRY *qglNormalPointer)(GLenum type, GLsizei stride, const GLvoid *ptr);
183 extern void (APIENTRY *qglColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
184 //extern void (APIENTRY *qglIndexPointer)(GLenum type, GLsizei stride, const GLvoid *ptr);
185 extern void (APIENTRY *qglTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *ptr);
186 //extern void (APIENTRY *qglEdgeFlagPointer)(GLsizei stride, const GLvoid *ptr);
187 //extern void (APIENTRY *qglGetPointerv)(GLenum pname, void **params);
188 extern void (APIENTRY *qglArrayElement)(GLint i);
189 //extern void (APIENTRY *qglDrawArrays)(GLenum mode, GLint first, GLsizei count);
190 extern void (APIENTRY *qglDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices);
191 //extern void (APIENTRY *qglInterleavedArrays)(GLenum format, GLsizei stride, const GLvoid *pointer);
193 extern void (APIENTRY *qglMTexCoord2f) (GLenum, GLfloat, GLfloat);
194 extern void (APIENTRY *qglSelectTexture) (GLenum);
195 extern void (APIENTRY *glColorTableEXT)(int, int, int, int, int, const void*);
199 //#define qglPolygonOffset glPolygonOffset
200 #define qglVertexPointer glVertexPointer
201 //#define qglNormalPointer glNormalPointer
202 #define qglColorPointer glColorPointer
203 //#define qglIndexPointer glIndexPointer
204 #define qglTexCoordPointer glTexCoordPointer
205 //#define qglEdgeFlagPointer glEdgeFlagPointer
206 //#define qglGetPointerv glGetPointerv
207 #define qglArrayElement glArrayElement
208 //#define qglDrawArrays glDrawArrays
209 #define qglDrawElements glDrawElements
210 //#define qglInterleavedArrays glInterleavedArrays
212 extern void (*qglMTexCoord2f) (GLenum, GLfloat, GLfloat);
213 extern void (*qglSelectTexture) (GLenum);
215 extern void (*glColorTableEXT)(int, int, int, int, int, const void*);
220 // LordHavoc: vertex transform
221 #include "transform.h"
223 // LordHavoc: transparent polygon system
226 #define gl_solid_format 3
227 #define gl_alpha_format 4
231 // LordHavoc: was a major time waster
232 #define R_CullBox(mins,maxs) (frustum[0].BoxOnPlaneSideFunc(mins, maxs, &frustum[0]) == 2 || frustum[1].BoxOnPlaneSideFunc(mins, maxs, &frustum[1]) == 2 || frustum[2].BoxOnPlaneSideFunc(mins, maxs, &frustum[2]) == 2 || frustum[3].BoxOnPlaneSideFunc(mins, maxs, &frustum[3]) == 2)
233 #define R_NotCulledBox(mins,maxs) (frustum[0].BoxOnPlaneSideFunc(mins, maxs, &frustum[0]) != 2 && frustum[1].BoxOnPlaneSideFunc(mins, maxs, &frustum[1]) != 2 && frustum[2].BoxOnPlaneSideFunc(mins, maxs, &frustum[2]) != 2 && frustum[3].BoxOnPlaneSideFunc(mins, maxs, &frustum[3]) != 2)
235 extern qboolean fogenabled;
236 extern vec3_t fogcolor;
237 extern vec_t fogdensity;
238 //#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_refdef.vieworg[0]) * vpn[0] + ((v)[1] - r_refdef.vieworg[1]) * vpn[1] + ((v)[2] - r_refdef.vieworg[2]) * vpn[2])*(((v)[0] - r_refdef.vieworg[0]) * vpn[0] + ((v)[1] - r_refdef.vieworg[1]) * vpn[1] + ((v)[2] - r_refdef.vieworg[2]) * vpn[2]))))
239 #define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_refdef.vieworg[0])*((v)[0] - r_refdef.vieworg[0])+((v)[1] - r_refdef.vieworg[1])*((v)[1] - r_refdef.vieworg[1])+((v)[2] - r_refdef.vieworg[2])*((v)[2] - r_refdef.vieworg[2])))))
240 #define calcfogbyte(v) ((byte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
242 #include "r_modules.h"
244 extern void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, int frame, int skin, vec3_t org, int effects, int flags, int colormap);