mplane_t frustum[4];
-int c_brush_polys, c_alias_polys;
+int c_brush_polys, c_alias_polys, c_light_polys, c_nodes, c_leafs;
qboolean envmap; // true during envmap command capture
cvar_t r_speeds2 = {"r_speeds2","0"};
cvar_t r_fullbright = {"r_fullbright","0"};
//cvar_t r_lightmap = {"r_lightmap","0"};
-//cvar_t r_shadows = {"r_shadows","0"};
+cvar_t r_shadows = {"r_shadows","0"};
cvar_t r_wateralpha = {"r_wateralpha","1"};
-//cvar_t r_dynamic = {"r_dynamic","1"};
+cvar_t r_dynamic = {"r_dynamic","1"};
cvar_t r_novis = {"r_novis","0"};
cvar_t r_waterripple = {"r_waterripple","0"};
cvar_t r_fullbrights = {"r_fullbrights", "1"};
//cvar_t gl_cull = {"gl_cull","1"};
//cvar_t gl_affinemodels = {"gl_affinemodels","0"};
//cvar_t gl_polyblend = {"gl_polyblend","1"};
-//cvar_t gl_flashblend = {"gl_flashblend","0"};
cvar_t gl_playermip = {"gl_playermip","0"};
//cvar_t gl_nocolors = {"gl_nocolors","0"};
//cvar_t gl_keeptjunctions = {"gl_keeptjunctions","1"};
cvar_t contrast = {"contrast", "1.0", TRUE}; // LordHavoc: a method of operating system independent color correction
cvar_t brightness = {"brightness", "1.0", TRUE}; // LordHavoc: a method of operating system independent color correction
cvar_t gl_lightmode = {"gl_lightmode", "1", TRUE}; // LordHavoc: overbright lighting
-//cvar_t r_particles = {"r_particles", "1"};
//cvar_t r_dynamicwater = {"r_dynamicwater", "1"};
-//cvar_t r_smokealpha = {"r_smokealpha", "0.25"};
//cvar_t r_dynamicbothsides = {"r_dynamicbothsides", "1"}; // LordHavoc: can disable dynamic lighting of backfaces, but quake maps are weird so it doesn't always work right...
+cvar_t r_farclip = {"r_farclip", "6144"};
cvar_t gl_fogenable = {"gl_fogenable", "0"};
cvar_t gl_fogdensity = {"gl_fogdensity", "0.25"};
if (fog_density)
{
fogenabled = true;
- fogdensity = -4096.0f / (fog_density * fog_density);
+ fogdensity = -4000.0f / (fog_density * fog_density);
fogcolor[0] = fog_red = bound(0.0f, fog_red , 1.0f);
fogcolor[1] = fog_green = bound(0.0f, fog_green, 1.0f);
fogcolor[2] = fog_blue = bound(0.0f, fog_blue , 1.0f);
Cvar_RegisterVariable (&brightness);
Cvar_RegisterVariable (&gl_lightmode);
// Cvar_RegisterVariable (&r_dynamicwater);
-// Cvar_RegisterVariable (&r_particles);
-// Cvar_RegisterVariable (&r_smokealpha);
// Cvar_RegisterVariable (&r_dynamicbothsides);
Cvar_RegisterVariable (&r_fullbrights);
if (nehahra)
glColor3f (1,1,1);
}
- /*
- if (r_shadows.value && !(currententity->effects & EF_ADDITIVE) && currententity != &cl.viewent)
+ if (!fogenabled && r_shadows.value && !(currententity->effects & EF_ADDITIVE) && currententity != &cl.viewent)
{
// flatten it to make a shadow
float *av = aliasvert + 2, l = lightspot[2] + 0.125;
glEnable (GL_TEXTURE_2D);
glColor3f (1,1,1);
}
- */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
glColor3f (1,1,1);
}
- /*
- if (r_shadows.value && !(currententity->effects & EF_ADDITIVE) && currententity != &cl.viewent)
+ if (!fogenabled && r_shadows.value && !(currententity->effects & EF_ADDITIVE) && currententity != &cl.viewent)
{
int i;
float *av = aliasvert + 2, l = lightspot[2] + 0.125;
glEnable (GL_TEXTURE_2D);
glColor3f (1,1,1);
}
- */
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
glEnable (GL_BLEND);
glDepthMask(1);
}
+int modeldlightbits[8];
+extern int r_dlightframecount;
+
/*
=================
R_DrawAliasModel
int i;
model_t *clmodel;
vec3_t mins, maxs;
- aliashdr_t *paliashdr;
- md2mem_t *pheader;
+ aliashdr_t *paliashdr = NULL;
+ md2mem_t *pheader = NULL;
int anim;
if (modelalpha < (1.0 / 64.0))
VectorCopy (currententity->origin, r_entorigin);
VectorSubtract (r_origin, r_entorigin, modelorg);
+ {
+ mleaf_t *leaf = Mod_PointInLeaf (currententity->origin, cl.worldmodel);
+ if (leaf->dlightframe == r_dlightframecount)
+ for (i = 0;i < 8;i++)
+ modeldlightbits[i] = leaf->dlightbits[i];
+ else
+ for (i = 0;i < 8;i++)
+ modeldlightbits[i] = 0;
+ }
+
// get lighting information
if (currententity->model->flags & EF_FULLBRIGHT || currententity->effects & EF_FULLBRIGHT)
// we can't dynamically colormap textures, so they are cached
// seperately for the players. Heads are just uncolored.
- if (currententity->colormap != vid.colormap/* && !gl_nocolors.value*/)
+ if (currententity->colormap != 0 /*vid.colormap*/ /* && !gl_nocolors.value*/)
{
i = currententity - cl_entities;
if (i >= 1 && i<=cl.maxclients /* && !strcmp (currententity->model->name, "progs/player.mdl") */)
- glBindTexture(GL_TEXTURE_2D, playertextures - 1 + i);
+ glBindTexture(GL_TEXTURE_2D, playertextures - 1 + i);
}
// if (gl_affinemodels.value)
{
// don't allow cheats in multiplayer
if (cl.maxclients > 1)
+ {
Cvar_Set ("r_fullbright", "0");
+ Cvar_Set ("r_ambient", "0");
+ }
R_AnimateLight ();
c_brush_polys = 0;
c_alias_polys = 0;
+ c_light_polys = 0;
+ c_nodes = 0;
+ c_leafs = 0;
}
-void MYgluPerspective( GLdouble fovy, GLdouble aspect,
- GLdouble zNear, GLdouble zFar )
+void MYgluPerspective( GLdouble fovy, GLdouble aspect, GLdouble zNear, GLdouble zFar )
{
GLdouble xmin, xmax, ymin, ymax;
// if (skyname[0]) // skybox enabled?
// MYgluPerspective (r_refdef.fov_y, screenaspect, 4, r_skyboxsize.value*1.732050807569 + 256); // this is size*sqrt(3) + 256
// else
- MYgluPerspective (r_refdef.fov_y, screenaspect, 4, 6144);
+ MYgluPerspective (r_refdef.fov_y, screenaspect, 4, r_farclip.value);
glCullFace(GL_FRONT);
r_refdef must be set before the first call
================
*/
+extern qboolean intimerefresh;
+extern qboolean skyisvisible;
+extern void R_Sky();
+extern void UploadLightmaps();
void R_RenderView (void)
{
- double currtime, temptime;
+// double currtime, temptime;
// if (r_norefresh.value)
// return;
lighthalf = gl_lightmode.value;
FOG_framebegin();
- transpolyclear();
+ skypolyclear();
wallpolyclear();
+ transpolyclear();
+ skyisvisible = false;
- if (r_speeds2.value)
- {
- currtime = Sys_FloatTime();
- Con_Printf("render time: ");
- }
+// if (r_speeds2.value)
+// {
+// currtime = Sys_FloatTime();
+// Con_Printf("render time: ");
+// }
R_Clear();
- TIMEREPORT("R_Clear")
+// TIMEREPORT("R_Clear")
// render normal view
R_SetupFrame ();
- TIMEREPORT("R_SetupFrame")
R_SetFrustum ();
- TIMEREPORT("R_SetFrustum")
R_SetupGL ();
- TIMEREPORT("R_SetupGL")
R_MarkLeaves (); // done here so we know if we're in water
- TIMEREPORT("R_MarkLeaves")
R_DrawWorld (); // adds static entities to the list
- TIMEREPORT("R_DrawWorld")
- S_ExtraUpdate (); // don't let sound get messed up if going slow
- TIMEREPORT("S_ExtraUpdate")
+ if (!intimerefresh)
+ S_ExtraUpdate (); // don't let sound get messed up if going slow
R_DrawEntitiesOnList1 (); // BSP models
- TIMEREPORT("R_DrawEntitiesOnList1")
- wallpolyrender();
- TIMEREPORT("wallpolyrender")
+
+ skypolyrender(); // fogged sky polys, affects depth
+ if (skyname[0] && skyisvisible && !fogenabled)
+ R_Sky(); // does not affect depth, draws over the sky polys
+
R_DrawEntitiesOnList2 (); // other models
- TIMEREPORT("R_DrawEntitiesOnList2")
// R_RenderDlights ();
R_DrawViewModel ();
- TIMEREPORT("R_DrawViewModel")
R_DrawParticles ();
- TIMEREPORT("R_DrawParticles")
+
+ UploadLightmaps();
+ wallpolyrender();
transpolyrender();
- TIMEREPORT("transpolyrender")
FOG_frameend();
GL_BlendView();
- TIMEREPORT("GL_BlendView")
- if (r_speeds2.value)
- Con_Printf("\n");
+// if (r_speeds2.value)
+// Con_Printf("\n");
}