+#define gl_solid_format 3
+#define gl_alpha_format 4
+
+int R_CullBox(const vec3_t mins, const vec3_t maxs);
+
+#define FOGTABLEWIDTH 1024
+extern vec3_t fogcolor;
+extern vec_t fogdensity;
+extern vec_t fogrange;
+extern vec_t fograngerecip;
+extern int fogtableindex;
+extern vec_t fogtabledistmultiplier;
+extern float fogtable[FOGTABLEWIDTH];
+extern qboolean fogenabled;
+#define VERTEXFOGTABLE(dist) (fogtableindex = (int)((dist) * fogtabledistmultiplier), fogtable[bound(0, fogtableindex, FOGTABLEWIDTH - 1)])
+
+#include "r_modules.h"
+
+#include "meshqueue.h"
+
+#include "r_lerpanim.h"
+
+extern cvar_t r_render;
+extern cvar_t r_waterwarp;
+
+extern cvar_t r_textureunits;
+extern cvar_t r_glsl;
+extern cvar_t r_glsl_offsetmapping;
+extern cvar_t r_glsl_offsetmapping_scale;
+extern cvar_t r_glsl_offsetmapping_bias;
+extern cvar_t r_glsl_usehalffloat;
+extern cvar_t r_glsl_surfacenormalize;
+
+extern cvar_t gl_polyblend;
+extern cvar_t gl_dither;
+
+extern cvar_t r_smoothnormals_areaweighting;
+
+#include "gl_backend.h"
+
+#include "r_light.h"
+
+extern rtexture_t *r_texture_blanknormalmap;
+extern rtexture_t *r_texture_white;
+extern rtexture_t *r_texture_black;
+extern rtexture_t *r_texture_notexture;
+extern rtexture_t *r_texture_whitecube;
+extern rtexture_t *r_texture_normalizationcube;
+extern rtexture_t *r_texture_fogattenuation;
+extern rtexture_t *r_texture_fogintensity;
+
+void R_TimeReport(char *name);
+
+// r_stain
+void R_Stain(const vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
+
+void R_DrawWorldCrosshair(void);
+void R_Draw2DCrosshair(void);
+
+void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
+void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, rtexture_t *fogtexture, int depthdisable, const vec3_t origin, const vec3_t left, const vec3_t up, float scalex1, float scalex2, float scaley1, float scaley2, float cr, float cg, float cb, float ca);
+
+struct entity_render_s;
+struct texture_s;
+struct msurface_s;
+void R_UpdateTextureInfo(const entity_render_t *ent, texture_t *t);
+void R_UpdateAllTextureInfo(entity_render_t *ent);
+void R_QueueTextureSurfaceList(entity_render_t *ent, struct texture_s *texture, int texturenumsurfaces, const struct msurface_s **texturesurfacelist, const vec3_t modelorg);
+void R_DrawSurfaces(entity_render_t *ent, qboolean skysurfaces);
+
+#define SHADERPERMUTATION_MODE_LIGHTSOURCE (1<<0) // (lightsource) use directional pixel shading from light source (rtlight)
+#define SHADERPERMUTATION_MODE_LIGHTDIRECTIONMAP (1<<1) // (lightmap) use directional pixel shading from texture containing light directions (deluxemap)
+#define SHADERPERMUTATION_MODE_LIGHTDIRECTION (1<<2) // (lightmap) use directional pixel shading from fixed light direction (q3bsp)
+#define SHADERPERMUTATION_GLOW (1<<3) // (lightmap) blend in an additive glow texture
+#define SHADERPERMUTATION_FOG (1<<4) // tint the color by fog color or black if using additive blend mode
+#define SHADERPERMUTATION_COLORMAPPING (1<<5) // indicates this is a colormapped skin
+#define SHADERPERMUTATION_SPECULAR (1<<6) // (lightsource or deluxemapping) render specular effects
+#define SHADERPERMUTATION_CUBEFILTER (1<<7) // (lightsource) use cubemap light filter
+#define SHADERPERMUTATION_OFFSETMAPPING (1<<8) // adjust texcoords to roughly simulate a displacement mapped surface
+#define SHADERPERMUTATION_SURFACENORMALIZE (1<<9) // (lightsource or deluxemapping) improved bumpmapping
+#define SHADERPERMUTATION_GEFORCEFX (1<<10) // use half vector types if available (NVIDIA specific)
+#define SHADERPERMUTATION_COUNT (1<<11) // how many permutations are possible
+
+typedef struct r_glsl_permutation_s
+{
+ // indicates if we have tried compiling this permutation already
+ qboolean compiled;
+ // 0 if compilation failed
+ int program;
+ int loc_Texture_Normal;
+ int loc_Texture_Color;
+ int loc_Texture_Gloss;
+ int loc_Texture_Cube;
+ int loc_Texture_FogMask;
+ int loc_Texture_Pants;
+ int loc_Texture_Shirt;
+ int loc_Texture_Lightmap;
+ int loc_Texture_Deluxemap;
+ int loc_Texture_Glow;
+ int loc_FogColor;
+ int loc_LightPosition;
+ int loc_EyePosition;
+ int loc_LightColor;
+ int loc_Color_Pants;
+ int loc_Color_Shirt;
+ int loc_FogRangeRecip;
+ int loc_AmbientScale;
+ int loc_DiffuseScale;
+ int loc_SpecularScale;
+ int loc_SpecularPower;
+ int loc_OffsetMapping_Scale;
+ int loc_OffsetMapping_Bias;
+ int loc_AmbientColor;
+ int loc_DiffuseColor;
+ int loc_SpecularColor;
+ int loc_LightDir;
+}
+r_glsl_permutation_t;