cvar_t r_drawentities = {0, "r_drawentities","1"};
cvar_t r_drawviewmodel = {0, "r_drawviewmodel","1"};
-cvar_t r_shadows = {CVAR_SAVE, "r_shadows", "0"};
cvar_t r_shadow_staticworldlights = {0, "r_shadow_staticworldlights", "1"};
cvar_t r_speeds = {0, "r_speeds","0"};
cvar_t r_fullbright = {0, "r_fullbright","0"};
cvar_t r_lerpsprites = {CVAR_SAVE, "r_lerpsprites", "1"};
cvar_t r_lerpmodels = {CVAR_SAVE, "r_lerpmodels", "1"};
cvar_t r_waterscroll = {CVAR_SAVE, "r_waterscroll", "1"};
-
+cvar_t r_watershader = {CVAR_SAVE, "r_watershader", "1"};
void R_ModulateColors(float *in, float *out, int verts, float r, float g, float b)
Cmd_AddCommand("timerefresh", R_TimeRefresh_f);
Cvar_RegisterVariable(&r_drawentities);
Cvar_RegisterVariable(&r_drawviewmodel);
- Cvar_RegisterVariable(&r_shadows);
Cvar_RegisterVariable(&r_shadow_staticworldlights);
Cvar_RegisterVariable(&r_speeds);
Cvar_RegisterVariable(&r_fullbrights);
Cvar_RegisterVariable(&r_lerpsprites);
Cvar_RegisterVariable(&r_lerpmodels);
Cvar_RegisterVariable(&r_waterscroll);
+ Cvar_RegisterVariable(&r_watershader);
Cvar_RegisterVariable(&r_drawcollisionbrushes);
if (gamemode == GAME_NEHAHRA || gamemode == GAME_NEXUIZ)
Cvar_SetValue("r_fullbrights", 0);
}
}
-void R_DrawFakeShadows(void)
-{
- int i;
- entity_render_t *ent;
-
- ent = &cl_entities[0].render;
- if (ent->model && ent->model->DrawFakeShadow)
- ent->model->DrawFakeShadow(ent);
-
- if (!r_drawentities.integer)
- return;
- for (i = 0;i < r_refdef.numentities;i++)
- {
- ent = r_refdef.entities[i];
- if ((ent->flags & RENDER_SHADOW) && ent->model && ent->model->DrawFakeShadow)
- ent->model->DrawFakeShadow(ent);
- }
-}
-
#include "r_shadow.h"
int shadowframecount = 0;
GL_DepthMask(false);
GL_DepthTest(r_shadow_visiblevolumes.integer < 2);
qglDisable(GL_CULL_FACE);
- GL_Color(0.0 * r_colorscale, 0.0125 * r_colorscale, 0.1 * r_colorscale, 1);
+ GL_Color(0.0, 0.0125, 0.1, 1);
}
else
R_Shadow_Stage_Begin();
cullradius = RadiusFromBoundsAndOrigin(clipmins, clipmaxs, rd->origin);
VectorScale(rd->light, (1.0f / 4096.0f), lightcolor);
- if (gl_stencil || visiblevolumes)
+ if (r_shadow_shadows.integer && (gl_stencil || visiblevolumes))
{
if (!visiblevolumes)
R_Shadow_Stage_ShadowVolumes();
if (!visiblevolumes)
{
- if (gl_stencil)
+ if (r_shadow_shadows.integer && gl_stencil)
R_Shadow_Stage_LightWithShadows();
else
R_Shadow_Stage_LightWithoutShadows();
{
if (!gl_stencil)
{
- Con_Printf("Stencil not enabled, turning off r_shadow_realtime_world, please type vid_stencil 1;vid_bitsperpixel 32;vid_restart and try again\n");
+ Con_Printf("Realtime world lighting requires 32bit color turning off r_shadow_realtime_world, please type vid_bitsperpixel 32;vid_restart and try again\n");
Cvar_SetValueQuick(&r_shadow_realtime_world, 0);
}
}
R_TimeReport("markentity");
GL_SetupView_ViewPort(r_refdef.x, r_refdef.y, r_refdef.width, r_refdef.height);
- if (r_shadow_realtime_world.integer || gl_stencil)
+ if ((r_shadow_realtime_world.integer || r_shadow_shadows.integer) && gl_stencil)
GL_SetupView_Mode_PerspectiveInfiniteFarClip(r_refdef.fov_x, r_refdef.fov_y, 1.0f);
else
GL_SetupView_Mode_Perspective(r_refdef.fov_x, r_refdef.fov_y, 1.0f, r_farclip);
R_DrawModels();
R_TimeReport("models");
- if (r_shadows.integer == 1 && !r_shadow_realtime_world.integer)
- {
- R_DrawFakeShadows();
- R_TimeReport("fakeshadow");
- }
-
if (r_shadow_realtime_world.integer || r_shadow_realtime_dlight.integer)
{
R_ShadowVolumeLighting(false);
vertex3f[18] = mins[0];vertex3f[19] = maxs[1];vertex3f[20] = maxs[2];
vertex3f[21] = maxs[0];vertex3f[22] = maxs[1];vertex3f[23] = maxs[2];
GL_ColorPointer(color);
- R_FillColors(color, 8, cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
+ R_FillColors(color, 8, cr, cg, cb, ca);
if (fogenabled)
{
for (i = 0, v = vertex, c = color;i < 8;i++, v += 4, c += 4)
VectorSubtract(v, r_origin, diff);
f2 = exp(fogdensity/DotProduct(diff, diff));
f1 = 1 - f2;
- f2 *= r_colorscale;
c[0] = c[0] * f1 + fogcolor[0] * f2;
c[1] = c[1] * f1 + fogcolor[1] * f2;
c[2] = c[2] * f1 + fogcolor[2] * f2;
f1 = 1 - f2;
for (i = 0, c = color4f;i < 6;i++, c += 4)
{
- c[0] = (c[0] * f1 + fogcolor[0] * f2) * r_colorscale;
- c[1] = (c[1] * f1 + fogcolor[1] * f2) * r_colorscale;
- c[2] = (c[2] * f1 + fogcolor[2] * f2) * r_colorscale;
+ c[0] = (c[0] * f1 + fogcolor[0] * f2);
+ c[1] = (c[1] * f1 + fogcolor[1] * f2);
+ c[2] = (c[2] * f1 + fogcolor[2] * f2);
c[3] *= ent->alpha;
}
}
- else if (r_colorscale != 1 || ent->alpha != 1)
+ else if (ent->alpha != 1)
{
memcpy(color4f, nomodelcolor4f, sizeof(float[6*4]));
GL_ColorPointer(color4f);
for (i = 0, c = color4f;i < 6;i++, c += 4)
- {
- c[0] *= r_colorscale;
- c[1] *= r_colorscale;
- c[2] *= r_colorscale;
c[3] *= ent->alpha;
- }
}
else
GL_ColorPointer(nomodelcolor4f);
}
R_Mesh_Matrix(&r_identitymatrix);
- GL_Color(cr * r_colorscale, cg * r_colorscale, cb * r_colorscale, ca);
+ GL_Color(cr, cg, cb, ca);
GL_VertexPointer(varray_vertex3f);
GL_BlendFunc(blendfunc1, blendfunc2);
GL_DepthMask(false);