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.
25 extern float ixtable[4096];
27 // far clip distance for scene
28 extern float r_farclip;
31 extern void FOG_clear(void);
32 extern float fog_density, fog_red, fog_green, fog_blue;
36 extern int skyrendernow, skyrendermasked;
37 extern int R_SetSkyBox(char* sky);
38 extern void R_SkyStartFrame(void);
39 extern void R_Sky(void);
40 extern void R_ResetQuakeSky(void);
41 extern void R_ResetSkyBox(void);
43 // SHOWLMP stuff (Nehahra)
44 extern void SHOWLMP_decodehide(void);
45 extern void SHOWLMP_decodeshow(void);
46 extern void SHOWLMP_drawall(void);
47 extern void SHOWLMP_clear(void);
49 // render profiling stuff
50 extern qboolean intimerefresh;
51 extern char r_speeds_string[1024];
54 extern vec3_t lightspot;
55 extern cvar_t r_ambient;
56 extern int lightscalebit;
57 extern float lightscale;
59 // model rendering stuff
60 extern float *aliasvert;
61 extern float *aliasvertnorm;
62 extern float *aliasvertcolor;
65 extern cvar_t r_novis;
67 // detail texture stuff
68 extern cvar_t r_detailtextures;
70 // useful functions for rendering
71 void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b);
72 void R_FillColors(float *out, int verts, float r, float g, float b, float a);
74 #define TOP_RANGE 16 // soldier uniform colors
75 #define BOTTOM_RANGE 96
77 //=============================================================================
79 extern int r_framecount;
80 extern mplane_t frustum[4];
81 extern int c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
90 extern vec3_t r_origin;
92 extern mleaf_t *r_viewleaf, *r_oldviewleaf;
93 extern unsigned short d_lightstylevalue[256]; // 8.8 fraction of base light value
95 extern qboolean envmap;
97 extern cvar_t r_drawentities;
98 extern cvar_t r_drawviewmodel;
99 extern cvar_t r_speeds;
100 extern cvar_t r_fullbright;
101 extern cvar_t r_wateralpha;
102 extern cvar_t r_dynamic;
105 void R_RenderView (void); // must set r_refdef first
108 void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
110 void R_NewMap (void);
112 void R_DrawWorld(entity_render_t *ent);
113 void R_SurfMarkLights (entity_render_t *ent);
114 void R_PrepareSurfaces(entity_render_t *ent);
115 void R_DrawSurfaces(entity_render_t *ent, int type);
116 void R_DrawPortals(entity_render_t *ent);
117 void R_DrawParticles(void);
118 void R_DrawExplosions(void);
119 void R_DrawBrushModelSky (entity_render_t *ent);
120 void R_DrawBrushModelNormal (entity_render_t *ent);
121 void R_DrawZymoticModel (entity_render_t *ent);
122 void R_DrawQ1Q2AliasModel(entity_render_t *ent);
123 void R_DrawSpriteModel (entity_render_t *ent);
125 // LordHavoc: vertex transform
126 #include "transform.h"
128 #define gl_solid_format 3
129 #define gl_alpha_format 4
133 // LordHavoc: was a major time waster
134 #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)
135 #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)
137 extern qboolean fogenabled;
138 extern vec3_t fogcolor;
139 extern vec_t fogdensity;
140 #define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0])*((v)[0] - r_origin[0])+((v)[1] - r_origin[1])*((v)[1] - r_origin[1])+((v)[2] - r_origin[2])*((v)[2] - r_origin[2])))))
141 #define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
143 // start a farclip measuring session
144 void R_FarClip_Start(vec3_t origin, vec3_t direction, vec_t startfarclip);
145 // enlarge farclip to accomodate box
146 void R_FarClip_Box(vec3_t mins, vec3_t maxs);
147 // return farclip value
148 float R_FarClip_Finish(void);
150 // updates farclip distance so it is large enough for the specified box
152 void R_Mesh_EnlargeFarClipBBox(vec3_t mins, vec3_t maxs);
154 #include "r_modules.h"
156 #include "meshqueue.h"
158 extern float overbrightscale;
160 #include "r_lerpanim.h"
162 extern cvar_t r_render;
165 extern cvar_t r_textureunits;
166 extern cvar_t gl_dither;
168 // FIXME: this should live in the backend only
169 void GL_LockArray(int first, int count);
170 void GL_UnlockArray(void);
172 #include "gl_backend.h"
176 void R_TimeReport(char *name);
177 void R_TimeReport_Start(void);
178 void R_TimeReport_End(void);
181 void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
183 void R_DrawCrosshair(void);