Skip to content

Commit

Permalink
Fixed use of uninitialized color in LG_Evaluate when a given block ha…
Browse files Browse the repository at this point in the history
…s no sector.

Todo: This doesn't fix the core of the problem though. The issue is that the sector coverage determination done during initialization of the lightgrid is incorrectly determining that some blocks are not covered by any sector. This is most likely due to a numerical round-off problem but the question remains, is this current algorithm *really* what we want?
  • Loading branch information
danij committed Feb 1, 2009
1 parent 4d62dda commit 09bb8d6
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions doomsday/engine/portable/src/r_lgrid.c
Expand Up @@ -894,27 +894,23 @@ void LG_Evaluate(const float *point, float *color)

if(block->flags & GBF_CHANGED)
{ // We are waiting for an updated value, for now use the old.
color[0] = block->oldRGB[0];
color[1] = block->oldRGB[1];
color[2] = block->oldRGB[2];
color[CR] = block->oldRGB[CR];
color[CG] = block->oldRGB[CG];
color[CB] = block->oldRGB[CB];
}
else
{
color[0] = block->rgb[0];
color[1] = block->rgb[1];
color[2] = block->rgb[2];
color[CR] = block->rgb[CR];
color[CG] = block->rgb[CG];
color[CB] = block->rgb[CB];
}
}
#if 0
else
{
// DEBUG:
// Bright purple if the block doesn't have a sector.
color[0] = 1;
color[1] = 0;
color[2] = 1;
{ // The block has no sector!?
// Must be an error in the lightgrid covering sector determination.
// Init to black.
color[CR] = color[CG] = color[CB] = 1;
}
#endif

// Biased ambient light causes a dimming in the Z direction.
if(dz && block->bias)
Expand Down

0 comments on commit 09bb8d6

Please sign in to comment.