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.
24 extern qbyte r_pvsbits[(MAX_MAP_LEAFS+7)>>3];
26 extern matrix4x4_t r_identitymatrix;
29 extern float ixtable[4096];
31 // far clip distance for scene
32 extern float r_farclip;
35 extern void FOG_clear(void);
36 extern float fog_density, fog_red, fog_green, fog_blue;
40 extern cvar_t r_skyscroll1;
41 extern cvar_t r_skyscroll2;
42 extern int skyrendernow, skyrendermasked;
43 extern int R_SetSkyBox(const char *sky);
44 extern void R_SkyStartFrame(void);
45 extern void R_Sky(void);
46 extern void R_ResetSkyBox(void);
48 // SHOWLMP stuff (Nehahra)
49 extern void SHOWLMP_decodehide(void);
50 extern void SHOWLMP_decodeshow(void);
51 extern void SHOWLMP_drawall(void);
52 extern void SHOWLMP_clear(void);
54 // render profiling stuff
55 extern char r_speeds_string[1024];
58 extern cvar_t r_ambient;
61 extern cvar_t r_novis;
63 // detail texture stuff
64 extern cvar_t r_detailtextures;
66 extern cvar_t r_lerpsprites;
67 extern cvar_t r_lerpmodels;
68 extern cvar_t r_waterscroll;
69 extern cvar_t r_watershader;
71 // useful functions for rendering
72 void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b);
73 void R_FillColors(float *out, int verts, float r, float g, float b, float a);
75 #define TOP_RANGE 16 // soldier uniform colors
76 #define BOTTOM_RANGE 96
78 //=============================================================================
80 extern int r_framecount;
81 extern mplane_t frustum[4];
82 extern int c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
84 // brightness of world lightmaps and related lighting
85 // (often reduced when world rtlights are enabled)
86 extern float r_lightmapintensity;
87 // whether to draw world lights realtime, dlights realtime, and their shadows
88 extern qboolean r_rtworld;
89 extern qboolean r_rtworldshadows;
90 extern qboolean r_rtdlight;
91 extern qboolean r_rtdlightshadows;
93 // forces all rendering to draw triangle outlines
94 extern cvar_t r_showtris;
95 extern int r_showtrispass;
100 extern vec3_t r_vieworigin;
101 extern vec3_t r_viewforward;
102 extern vec3_t r_viewleft;
103 extern vec3_t r_viewright;
104 extern vec3_t r_viewup;
108 extern int r_view_width;
109 extern int r_view_height;
110 extern int r_view_depth;
111 extern float r_view_fov_x;
112 extern float r_view_fov_y;
113 extern matrix4x4_t r_view_matrix;
115 extern mleaf_t *r_viewleaf, *r_oldviewleaf;
116 extern unsigned short d_lightstylevalue[256]; // 8.8 fraction of base light value
118 extern qboolean envmap;
120 extern cvar_t r_drawentities;
121 extern cvar_t r_drawviewmodel;
122 extern cvar_t r_speeds;
123 extern cvar_t r_fullbright;
124 extern cvar_t r_wateralpha;
125 extern cvar_t r_dynamic;
126 extern cvar_t r_drawcollisionbrushes;
129 void R_UpdateWorld(void); // needs no r_refdef
130 void R_RenderView(void); // must call R_UpdateWorld and set r_refdef first
133 void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
135 void R_WorldVisibility();
136 void R_DrawParticles(void);
137 void R_DrawExplosions(void);
139 #define gl_solid_format 3
140 #define gl_alpha_format 4
142 int R_CullBox(const vec3_t mins, const vec3_t maxs);
143 #define VIS_CullBox(mins,maxs) (R_CullBox((mins), (maxs)) || (r_refdef.worldmodel && r_refdef.worldmodel->brush.BoxTouchingPVS && !r_refdef.worldmodel->brush.BoxTouchingPVS(r_refdef.worldmodel, r_pvsbits, (mins), (maxs))))
145 extern qboolean fogenabled;
146 extern vec3_t fogcolor;
147 extern vec_t fogdensity;
148 #define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_vieworigin[0])*((v)[0] - r_vieworigin[0])+((v)[1] - r_vieworigin[1])*((v)[1] - r_vieworigin[1])+((v)[2] - r_vieworigin[2])*((v)[2] - r_vieworigin[2])))))
149 #define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
151 #include "r_modules.h"
153 #include "meshqueue.h"
155 #include "r_lerpanim.h"
157 extern cvar_t r_render;
158 extern cvar_t r_waterwarp;
160 extern cvar_t r_textureunits;
161 extern cvar_t gl_polyblend;
162 extern cvar_t gl_dither;
164 #include "gl_backend.h"
168 void R_TimeReport(char *name);
169 void R_TimeReport_Start(void);
170 void R_TimeReport_End(void);
173 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);
175 void R_DrawWorldCrosshair(void);
176 void R_Draw2DCrosshair(void);
178 void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
179 void R_DrawSprite(int blendfunc1, int blendfunc2, rtexture_t *texture, 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);