Skip to content

Commit

Permalink
Fixed lighting problem on HUD sprites due to wrapping light values (b…
Browse files Browse the repository at this point in the history
…ytes were used in calculations).
  • Loading branch information
danij committed Oct 2, 2006
1 parent 617dc73 commit de68331
Showing 1 changed file with 21 additions and 15 deletions.
36 changes: 21 additions & 15 deletions doomsday/engine/portable/src/rend_sprite.c
Expand Up @@ -329,25 +329,31 @@ void Rend_DrawPlayerSprites(void)

Rend_ApplyLightAdaptation(&light);

for(c = 0; c < 3; ++c)
if(isFullBright)
{
if(isFullBright)
{
rgba[c] = 255;
}
else
memset(&rgba, 255, 3);
}
else if(useBias)
{
memcpy(&rgba, &secbRGB, 3);
}
else
{
float lval;

for(c = 0; c < 3; ++c)
{
if(useBias)
{
rgba[c] = (byte) (255 * (secbRGB[c] / 255.0f));
}
else
{
rgba[c] = (byte) (light * (secRGB[c] / 255.0f));
}
lval = light * (secRGB[c] / 255.0f);

if(lval < 0)
lval = 0;
if(lval > 255)
lval = 255;

rgba[c] = (byte) lval;
}
}
rgba[CA] = (byte)(psp[i].alpha * 255.0f);
rgba[CA] = psp[i].alpha * 255.0f;

RL_VertexColors(&tempquad, light, rgba);

Expand Down

0 comments on commit de68331

Please sign in to comment.