mirror of
https://git.code.sf.net/p/quake/nuq
synced 2024-11-25 13:31:19 +00:00
Changed model light clamping.
This commit is contained in:
parent
2b76b57a0b
commit
64b7080691
1 changed files with 13 additions and 21 deletions
|
@ -354,7 +354,7 @@ float r_avertexnormals[NUMVERTEXNORMALS][3] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
vec3_t shadevector;
|
vec3_t shadevector;
|
||||||
float shadelight, ambientlight;
|
float shadelight;
|
||||||
|
|
||||||
// precalculated dot products for quantized angles
|
// precalculated dot products for quantized angles
|
||||||
#define SHADEDOT_QUANT 16
|
#define SHADEDOT_QUANT 16
|
||||||
|
@ -551,46 +551,38 @@ static void R_DrawAliasModel (entity_t *e)
|
||||||
// get lighting information
|
// get lighting information
|
||||||
//
|
//
|
||||||
|
|
||||||
ambientlight = shadelight = R_LightPoint (currententity->origin);
|
shadelight = R_LightPoint (currententity->origin);
|
||||||
|
|
||||||
// allways give the gun some light
|
// allways give the gun some light
|
||||||
if (e == &cl.viewent && ambientlight < 24)
|
if (e == &cl.viewent && shadelight < 24)
|
||||||
ambientlight = shadelight = 24;
|
shadelight = 24;
|
||||||
|
|
||||||
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
|
for (lnum=0 ; lnum<MAX_DLIGHTS ; lnum++)
|
||||||
{
|
{
|
||||||
if (cl_dlights[lnum].die >= cl.time)
|
if (cl_dlights[lnum].die >= cl.time)
|
||||||
{
|
{
|
||||||
VectorSubtract (currententity->origin,
|
VectorSubtract (currententity->origin, cl_dlights[lnum].origin, dist);
|
||||||
cl_dlights[lnum].origin,
|
add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / (DotProduct(dist, dist));
|
||||||
dist);
|
|
||||||
add = (cl_dlights[lnum].radius * cl_dlights[lnum].radius * 8) / (DotProduct(dist, dist)); // FIXME Deek
|
|
||||||
|
|
||||||
if (add > 0)
|
if (add > 0)
|
||||||
{
|
|
||||||
ambientlight += add;
|
|
||||||
//ZOID models should be affected by dlights as well
|
|
||||||
shadelight += add;
|
shadelight += add;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// clamp lighting so it doesn't overbright as much
|
// clamp lighting
|
||||||
if (ambientlight > 128)
|
if (shadelight > 200)
|
||||||
ambientlight = 128;
|
shadelight = 200;
|
||||||
if (ambientlight + shadelight > 192)
|
|
||||||
shadelight = 192 - ambientlight;
|
|
||||||
|
|
||||||
// ZOID: never allow players to go totally black
|
// ZOID: never allow players to go totally black
|
||||||
if (!strcmp(clmodel->name, "progs/player.mdl"))
|
if (!strcmp(clmodel->name, "progs/player.mdl"))
|
||||||
{
|
{
|
||||||
if (ambientlight < 8)
|
if (shadelight < 8)
|
||||||
ambientlight = shadelight = 8;
|
shadelight = 8;
|
||||||
}
|
}
|
||||||
else if (!gl_fb_models->value && (!strcmp (clmodel->name, "progs/flame.mdl") || !strcmp (clmodel->name, "progs/flame2.mdl")))
|
else if (!gl_fb_models->value && (!strcmp (clmodel->name, "progs/flame.mdl") || !strcmp (clmodel->name, "progs/flame2.mdl")))
|
||||||
{
|
{
|
||||||
// HACK HACK HACK -- no fullbright colors, so make torches full light
|
// HACK HACK HACK -- no fullbright colors, so make torches full light
|
||||||
ambientlight = shadelight = 256;
|
shadelight = 200;
|
||||||
}
|
}
|
||||||
|
|
||||||
shadedots = r_avertexnormal_dots[((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
|
shadedots = r_avertexnormal_dots[((int)(e->angles[1] * (SHADEDOT_QUANT / 360.0))) & (SHADEDOT_QUANT - 1)];
|
||||||
|
@ -867,7 +859,7 @@ static void R_SetupGL (void)
|
||||||
// set up viewpoint
|
// set up viewpoint
|
||||||
//
|
//
|
||||||
glMatrixMode(GL_PROJECTION);
|
glMatrixMode(GL_PROJECTION);
|
||||||
glLoadIdentity ();
|
glLoadIdentity ();
|
||||||
x = r_refdef.vrect.x * glwidth/vid.width;
|
x = r_refdef.vrect.x * glwidth/vid.width;
|
||||||
x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth/vid.width;
|
x2 = (r_refdef.vrect.x + r_refdef.vrect.width) * glwidth/vid.width;
|
||||||
y = (vid.height-r_refdef.vrect.y) * glheight/vid.height;
|
y = (vid.height-r_refdef.vrect.y) * glheight/vid.height;
|
||||||
|
|
Loading…
Reference in a new issue