]> icculus.org git repositories - divverent/darkplaces.git/blob - render.h
faster static light tracing (by not doing it as often), this also means results of...
[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 // 1.0f / N table
25 extern float ixtable[4096];
26
27 // far clip distance for scene
28 extern float r_farclip, r_newfarclip;
29
30 // fog stuff
31 extern void FOG_clear(void);
32 extern float fog_density, fog_red, fog_green, fog_blue;
33
34 // sky stuff
35 extern int R_SetSkyBox(char* sky);
36 extern cvar_t r_skyquality;
37 // these are exposed because surface rendering uses them
38 extern rtexture_t *solidskytexture;
39 extern rtexture_t *alphaskytexture;
40 extern int skyrendernow, skyrendermasked, skyrenderglquake;
41 extern void R_SkyStartFrame(void);
42 extern void R_Sky(void);
43
44 // SHOWLMP stuff (Nehahra)
45 extern void SHOWLMP_decodehide(void);
46 extern void SHOWLMP_decodeshow(void);
47 extern void SHOWLMP_drawall(void);
48 extern void SHOWLMP_clear(void);
49
50 // render profiling stuff
51 extern qboolean intimerefresh;
52 extern char r_speeds_string[1024];
53
54 // lighting stuff
55 extern vec3_t lightspot;
56 extern cvar_t r_ambient;
57 extern int lightscalebit;
58 extern float lightscale;
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 #define TOP_RANGE               16                      // soldier uniform colors
69 #define BOTTOM_RANGE    96
70
71 //=============================================================================
72
73 extern  entity_render_t *currentrenderentity;
74 extern  int                     r_framecount;
75 extern  mplane_t        frustum[4];
76 extern  int             c_brush_polys, c_alias_polys, c_light_polys, c_faces, c_nodes, c_leafs, c_models, c_bmodels, c_sprites, c_particles, c_dlights;
77
78
79 //
80 // view origin
81 //
82 extern  vec3_t  vup;
83 extern  vec3_t  vpn;
84 extern  vec3_t  vright;
85 extern  vec3_t  r_origin;
86
87 extern  mleaf_t         *r_viewleaf, *r_oldviewleaf;
88 extern  unsigned short  d_lightstylevalue[256]; // 8.8 fraction of base light value
89
90 extern  qboolean        envmap;
91
92 extern  cvar_t  r_drawentities;
93 extern  cvar_t  r_drawviewmodel;
94 extern  cvar_t  r_speeds;
95 extern  cvar_t  r_fullbright;
96 extern  cvar_t  r_wateralpha;
97 extern  cvar_t  r_dynamic;
98 extern  cvar_t  r_waterripple;
99
100 void R_Init (void);
101 void R_RenderView (void); // must set r_refdef first
102
103
104 void R_InitSky (qbyte *src, int bytesperpixel); // called at level load
105
106 void R_NewMap (void);
107
108 void R_DrawWorld(void);
109 void R_SetupForWorldRendering(void);
110 void R_MarkWorldLights(void);
111 void R_PrepareSurfaces(void);
112 void R_DrawSurfaces(int type);
113 void R_DrawPortals(void);
114 void R_DrawParticles(void);
115 void R_DrawExplosions(void);
116
117 #include "r_clip.h"
118
119 // LordHavoc: vertex transform
120 #include "transform.h"
121
122 #define gl_solid_format 3
123 #define gl_alpha_format 4
124
125 //#define PARANOID 1
126
127 // LordHavoc: was a major time waster
128 #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)
129 #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)
130
131 extern qboolean fogenabled;
132 extern vec3_t fogcolor;
133 extern vec_t fogdensity;
134 #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])))))
135 #define calcfogbyte(v) ((qbyte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
136
137 #include "r_modules.h"
138
139 extern float overbrightscale;
140
141 #include "r_lerpanim.h"
142
143 void R_DrawBrushModelSky (void);
144 void R_DrawBrushModelNormal (void);
145 void R_DrawAliasModel (void);
146 void R_DrawSpriteModel (void);
147
148 void R_ClipSprite (void);
149 void R_Entity_Callback(void *data, void *junk);
150
151 extern cvar_t r_render;
152 extern cvar_t r_ser;
153 #include "image.h"
154
155 extern cvar_t r_multitexture;
156 extern cvar_t gl_dither;
157
158 // FIXME: this should live in the backend only
159 void GL_LockArray(int first, int count);
160 void GL_UnlockArray(void);
161
162 #include "gl_backend.h"
163
164 #include "r_light.h"
165
166 extern rtexture_t *particlefonttexture;
167
168 // particletexture_t is a rectangle in the particlefonttexture
169 typedef struct
170 {
171         float s1, t1, s2, t2;
172 }
173 particletexture_t;
174
175 #define MAX_PARTICLETEXTURES 64
176 // [0] is normal, [1] is fog, they may be the same
177 extern particletexture_t particletexture[MAX_PARTICLETEXTURES][2];
178
179 void R_TimeReport(char *name);
180 void R_TimeReport_Start(void);
181 void R_TimeReport_End(void);
182
183 // r_stain
184 void R_Stain (vec3_t origin, float radius, int cr1, int cg1, int cb1, int ca1, int cr2, int cg2, int cb2, int ca2);
185
186 #endif
187