]> de.git.xonotic.org Git - xonotic/darkplaces.git/blob - render.h
a little extra error checking in keynum lookup
[xonotic/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 matrix4x4_t r_identitymatrix;
25
26 // 1.0f / N table
27 extern float ixtable[4096];
28
29 // far clip distance for scene
30 extern float r_farclip;
31
32 // fog stuff
33 extern void FOG_clear(void);
34 extern float fog_density, fog_red, fog_green, fog_blue;
35
36 // sky stuff
37 extern cvar_t r_sky;
38 extern int skyrendernow, skyrendermasked;
39 extern int R_SetSkyBox(const char *sky);
40 extern void R_SkyStartFrame(void);
41 extern void R_Sky(void);
42 extern void R_ResetQuakeSky(void);
43 extern void R_ResetSkyBox(void);
44
45 // SHOWLMP stuff (Nehahra)
46 extern void SHOWLMP_decodehide(void);
47 extern void SHOWLMP_decodeshow(void);
48 extern void SHOWLMP_drawall(void);
49 extern void SHOWLMP_clear(void);
50
51 // render profiling stuff
52 extern qboolean intimerefresh;
53 extern char r_speeds_string[1024];
54
55 // lighting stuff
56 extern vec3_t lightspot;
57 extern cvar_t r_ambient;
58 extern int lightscalebit;
59 extern float lightscale;
60
61 // model rendering stuff
62 extern float *aliasvert;
63 extern float *aliasvertnorm;
64 extern float *aliasvertcolor;
65
66 // vis stuff
67 extern cvar_t r_novis;
68
69 // detail texture stuff
70 extern cvar_t r_detailtextures;
71
72 // useful functions for rendering
73 void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b);
74 void R_FillColors(float *out, int verts, float r, float g, float b, float a);
75
76 #define TOP_RANGE               16                      // soldier uniform colors
77 #define BOTTOM_RANGE    96
78
79 //=============================================================================
80
81 extern  int                     r_framecount;
82 extern  mplane_t        frustum[4];
83 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
85
86 //
87 // view origin
88 //
89 extern  vec3_t  vup;
90 extern  vec3_t  vpn;
91 extern  vec3_t  vright;
92 extern  vec3_t  r_origin;
93
94 extern  mleaf_t         *r_viewleaf, *r_oldviewleaf;
95 extern  unsigned short  d_lightstylevalue[256]; // 8.8 fraction of base light value
96
97 extern  qboolean        envmap;
98
99 extern  cvar_t  r_drawentities;
100 extern  cvar_t  r_drawviewmodel;
101 extern  cvar_t  r_speeds;
102 extern  cvar_t  r_fullbright;
103 extern  cvar_t  r_wateralpha;
104 extern  cvar_t  r_dynamic;
105
106 void R_Init (void);
107 void R_RenderView (void); // must set r_refdef first
108
109
110 void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
111
112 void R_NewMap (void);
113
114 void R_DrawWorld(entity_render_t *ent);
115 void R_DrawParticles(void);
116 void R_DrawExplosions(void);
117 void R_DrawBrushModelSky (entity_render_t *ent);
118 void R_DrawBrushModelNormal (entity_render_t *ent);
119 void R_DrawZymoticModel (entity_render_t *ent);
120 void R_DrawQ1Q2AliasModel(entity_render_t *ent);
121 void R_DrawSpriteModel (entity_render_t *ent);
122
123 // LordHavoc: vertex transform
124 #include "transform.h"
125
126 #define gl_solid_format 3
127 #define gl_alpha_format 4
128
129 //#define PARANOID 1
130
131 int R_CullBox(const vec3_t emins, const vec3_t emaxs);
132 int R_NotCulledBox(const vec3_t emins, const vec3_t emaxs);
133
134 extern qboolean fogenabled;
135 extern vec3_t fogcolor;
136 extern vec_t fogdensity;
137 #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])))))
138 #define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
139
140 // start a farclip measuring session
141 void R_FarClip_Start(vec3_t origin, vec3_t direction, vec_t startfarclip);
142 // enlarge farclip to accomodate box
143 void R_FarClip_Box(vec3_t mins, vec3_t maxs);
144 // return farclip value
145 float R_FarClip_Finish(void);
146
147 // updates farclip distance so it is large enough for the specified box
148 // (*important*)
149 void R_Mesh_EnlargeFarClipBBox(vec3_t mins, vec3_t maxs);
150
151 #include "r_modules.h"
152
153 #include "meshqueue.h"
154
155 extern float overbrightscale;
156
157 #include "r_lerpanim.h"
158
159 extern cvar_t r_render;
160 #include "image.h"
161
162 extern cvar_t r_textureunits;
163 extern cvar_t gl_dither;
164
165 // FIXME: this should live in the backend only
166 void GL_LockArray(int first, int count);
167 void GL_UnlockArray(void);
168
169 #include "gl_backend.h"
170
171 #include "r_light.h"
172
173 void R_TimeReport(char *name);
174 void R_TimeReport_Start(void);
175 void R_TimeReport_End(void);
176
177 // r_stain
178 void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
179
180 void R_DrawCrosshair(void);
181
182 #endif
183