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.
21 // refresh.h -- public interface to refresh functions
23 // far clip distance for scene
24 extern cvar_t r_farclip;
27 extern void FOG_clear(void);
28 extern float fog_density, fog_red, fog_green, fog_blue;
30 // SHOWLMP stuff (Nehahra)
31 extern void SHOWLMP_decodehide(void);
32 extern void SHOWLMP_decodeshow(void);
33 extern void SHOWLMP_drawall(void);
34 extern void SHOWLMP_clear(void);
36 // render profiling stuff
37 extern qboolean intimerefresh;
38 extern cvar_t r_speeds2;
39 extern char r_speeds2_string[1024];
42 extern vec3_t lightspot;
43 extern cvar_t r_ambient;
44 extern int lightscalebit;
45 extern float lightscale;
47 // model rendering stuff
48 extern float *aliasvert;
49 extern float *aliasvertnorm;
50 extern byte *aliasvertcolor;
51 extern float modelalpha;
54 extern cvar_t r_novis;
56 // model transform stuff
57 extern cvar_t gl_transform;
59 // LordHavoc: 1.0f / N table
60 extern float ixtable[4096];
62 #define TOP_RANGE 16 // soldier uniform colors
63 #define BOTTOM_RANGE 96
65 //=============================================================================
67 typedef struct entity_render_s
72 int visframe; // last frame this entity was found in an active leaf
74 model_t *model; // NULL = no model
75 int frame; // current desired frame (usually identical to frame2, but frame2 is not always used)
76 int colormap; // entity shirt and pants colors
77 int effects; // light, particles, etc
78 int skinnum; // for Alias models
79 int flags; // render flags
81 float alpha; // opacity (alpha) of the model
82 float scale; // size the model is shown
83 float trail_time; // last time for trail rendering
84 float colormod[3]; // color tint for model
86 model_t *lerp_model; // lerp resets when model changes
87 int frame1; // frame that the model is interpolating from
88 int frame2; // frame that the model is interpolating to
89 double lerp_starttime; // start of this transition
90 double framelerp; // interpolation factor, usually computed from lerp_starttime
91 double frame1start; // time frame1 began playing (for framegroup animations)
92 double frame2start; // time frame2 began playing (for framegroup animations)
96 typedef struct entity_s
98 entity_state_t state_baseline; // baseline for entity
99 entity_state_t state_previous; // previous state (interpolating from this)
100 entity_state_t state_current; // current state (interpolating to this)
102 entity_render_t render;
107 vrect_t vrect; // subwindow in video for refresh
121 extern refdef_t r_refdef;
122 extern vec3_t r_origin, vpn, vright, vup;
123 extern qboolean hlbsp;
126 void R_RenderView (void); // must set r_refdef first
127 void R_ViewChanged (vrect_t *pvrect, int lineadj, float aspect); // called whenever r_refdef or vid change
129 // LordHavoc: changed this for sake of GLQuake
130 void R_InitSky (byte *src, int bytesperpixel); // called at level load
132 //int R_VisibleCullBox (vec3_t mins, vec3_t maxs);
134 void R_NewMap (void);
136 #include "r_decals.h"
138 void R_ParseParticleEffect (void);
139 void R_RunParticleEffect (vec3_t org, vec3_t dir, int color, int count);
140 void R_RocketTrail (vec3_t start, vec3_t end, int type, entity_t *ent);
141 void R_RocketTrail2 (vec3_t start, vec3_t end, int type, entity_t *ent);
142 void R_SparkShower (vec3_t org, vec3_t dir, int count);
143 void R_BloodPuff (vec3_t org, vec3_t vel, int count);
144 void R_FlameCube (vec3_t mins, vec3_t maxs, int count);
145 void R_Flames (vec3_t org, vec3_t vel, int count);
147 void R_EntityParticles (entity_t *ent);
148 void R_BlobExplosion (vec3_t org);
149 void R_ParticleExplosion (vec3_t org, int smoke);
150 void R_ParticleExplosion2 (vec3_t org, int colorStart, int colorLength);
151 void R_LavaSplash (vec3_t org);
152 void R_TeleportSplash (vec3_t org);
154 void R_NewExplosion(vec3_t org);
156 void R_PushDlights (void);
157 void R_DrawWorld (void);
158 //void R_RenderDlights (void);
159 void R_DrawParticles (void);
160 void R_MoveParticles (void);
161 void R_DrawExplosions (void);
162 void R_MoveExplosions (void);
166 // LordHavoc: vertex transform
167 #include "transform.h"
169 // LordHavoc: transparent polygon system
172 #define gl_solid_format 3
173 #define gl_alpha_format 4
177 // LordHavoc: was a major time waster
178 #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)
179 #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)
181 extern qboolean fogenabled;
182 extern vec3_t fogcolor;
183 extern vec_t fogdensity;
184 //#define calcfog(v) (exp(-(fogdensity*fogdensity*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2])*(((v)[0] - r_origin[0]) * vpn[0] + ((v)[1] - r_origin[1]) * vpn[1] + ((v)[2] - r_origin[2]) * vpn[2]))))
185 #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])))))
186 #define calcfogbyte(v) ((byte) (bound(0, ((int) ((float) (calcfog((v)) * 255.0f))), 255)))
188 #include "r_modules.h"
190 extern qboolean lighthalf;
192 #include "r_lerpanim.h"
194 void GL_LockArray(int first, int count);
195 void GL_UnlockArray(void);
197 void R_DrawBrushModel (entity_t *e);
198 void R_DrawAliasModel (entity_t *ent, int cull, float alpha, model_t *clmodel, frameblend_t *blend, int skin, vec3_t org, vec3_t angles, vec_t scale, int effects, int flags, int colormap);
199 void R_DrawSpriteModel (entity_t *e, frameblend_t *blend);
201 void R_ClipSprite (entity_t *e, frameblend_t *blend);
202 void R_Entity_Callback(void *data, void *junk);
204 extern cvar_t r_render;
205 extern cvar_t r_upload;