]> icculus.org git repositories - divverent/darkplaces.git/blob - render.h
fix a filesystem directory listing bug in FS_Search
[divverent/darkplaces.git] / render.h
1 /*
2 Copyright (C) 1996-1997 Id Software, Inc.
3
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.
8
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.
12
13 See the GNU General Public License for more details.
14
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.
18
19 */
20
21 #ifndef RENDER_H
22 #define RENDER_H
23
24 extern qbyte r_pvsbits[(MAX_MAP_LEAFS+7)>>3];
25
26 extern matrix4x4_t r_identitymatrix;
27
28 // 1.0f / N table
29 extern float ixtable[4096];
30
31 // far clip distance for scene
32 extern float r_farclip;
33
34 // fog stuff
35 extern void FOG_clear(void);
36 extern float fog_density, fog_red, fog_green, fog_blue;
37
38 // sky stuff
39 extern cvar_t r_sky;
40 extern int skyrendernow, skyrendermasked;
41 extern int R_SetSkyBox(const char *sky);
42 extern void R_SkyStartFrame(void);
43 extern void R_Sky(void);
44 extern void R_ResetQuakeSky(void);
45 extern void R_ResetSkyBox(void);
46
47 // SHOWLMP stuff (Nehahra)
48 extern void SHOWLMP_decodehide(void);
49 extern void SHOWLMP_decodeshow(void);
50 extern void SHOWLMP_drawall(void);
51 extern void SHOWLMP_clear(void);
52
53 // render profiling stuff
54 extern qboolean intimerefresh;
55 extern char r_speeds_string[1024];
56
57 // lighting stuff
58 extern cvar_t r_ambient;
59
60 // model rendering stuff
61 extern float *aliasvert;
62 extern float *aliasvertnorm;
63 extern float *aliasvertcolor;
64
65 // vis stuff
66 extern cvar_t r_novis;
67
68 // detail texture stuff
69 extern cvar_t r_detailtextures;
70
71 extern cvar_t r_lerpsprites;
72 extern cvar_t r_lerpmodels;
73 extern cvar_t r_waterscroll;
74 extern cvar_t r_watershader;
75
76 // useful functions for rendering
77 void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b);
78 void R_FillColors(float *out, int verts, float r, float g, float b, float a);
79
80 #define TOP_RANGE               16                      // soldier uniform colors
81 #define BOTTOM_RANGE    96
82
83 //=============================================================================
84
85 extern  int                     r_framecount;
86 extern  mplane_t        frustum[4];
87 extern  int             c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
88
89
90 //
91 // view origin
92 //
93 extern  vec3_t  r_vieworigin;
94 extern  vec3_t  r_viewforward;
95 extern  vec3_t  r_viewleft;
96 extern  vec3_t  r_viewright;
97 extern  vec3_t  r_viewup;
98
99 extern  mleaf_t         *r_viewleaf, *r_oldviewleaf;
100 extern  unsigned short  d_lightstylevalue[256]; // 8.8 fraction of base light value
101
102 extern  qboolean        envmap;
103
104 extern cvar_t r_drawentities;
105 extern cvar_t r_drawviewmodel;
106 extern cvar_t r_speeds;
107 extern cvar_t r_fullbright;
108 extern cvar_t r_wateralpha;
109 extern cvar_t r_dynamic;
110 extern cvar_t r_drawcollisionbrushes;
111
112 void R_Init (void);
113 void R_RenderView (void); // must set r_refdef first
114
115
116 void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
117
118 void R_WorldVisibility(entity_render_t *ent);
119 void R_DrawWorld(entity_render_t *ent);
120 void R_DrawParticles(void);
121 void R_DrawExplosions(void);
122
123 #define gl_solid_format 3
124 #define gl_alpha_format 4
125
126 //#define PARANOID 1
127
128 int R_CullBox(const vec3_t mins, const vec3_t maxs);
129
130 extern qboolean fogenabled;
131 extern vec3_t fogcolor;
132 extern vec_t fogdensity;
133 #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])))))
134 #define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
135
136 // start a farclip measuring session
137 void R_FarClip_Start(vec3_t origin, vec3_t direction, vec_t startfarclip);
138 // enlarge farclip to accomodate box
139 void R_FarClip_Box(vec3_t mins, vec3_t maxs);
140 // return farclip value
141 float R_FarClip_Finish(void);
142
143 // updates farclip distance so it is large enough for the specified box
144 // (*important*)
145 void R_Mesh_EnlargeFarClipBBox(vec3_t mins, vec3_t maxs);
146
147 #include "r_modules.h"
148
149 #include "meshqueue.h"
150
151 #include "r_lerpanim.h"
152
153 extern cvar_t r_render;
154
155 extern cvar_t r_textureunits;
156 extern cvar_t gl_dither;
157
158 #include "gl_backend.h"
159
160 #include "r_light.h"
161
162 void R_TimeReport(char *name);
163 void R_TimeReport_Start(void);
164 void R_TimeReport_End(void);
165
166 // r_stain
167 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);
168
169 void R_DrawWorldCrosshair(void);
170 void R_Draw2DCrosshair(void);
171
172 void R_CalcBeam_Vertex3f(float *vert, const vec3_t org1, const vec3_t org2, float width);
173 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);
174
175 #endif
176