- moved side_t::GetLightLevel out of software rendering code.

SVN r3252 (trunk)
This commit is contained in:
Christoph Oelckers 2011-07-05 21:30:17 +00:00
parent 5bf6398d85
commit 0d43ecdd9d
2 changed files with 68 additions and 56 deletions

View File

@ -899,3 +899,71 @@ void subsector_t::BuildPolyBSP()
BSP->Subsectors[i].sector = sector; BSP->Subsectors[i].sector = sector;
} }
} }
//==========================================================================
//
//
//
//==========================================================================
CUSTOM_CVAR(Int, r_fakecontrast, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self < 0) self = 1;
else if (self > 2) self = 2;
}
//==========================================================================
//
//
//
//==========================================================================
int side_t::GetLightLevel (bool foggy, int baselight, int *pfakecontrast) const
{
if (Flags & WALLF_ABSLIGHTING)
{
baselight = Light;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = 0;
}
if (!foggy) // Don't do relative lighting in foggy sectors
{
if (!(Flags & WALLF_NOFAKECONTRAST) && r_fakecontrast != 0)
{
int rel;
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_fakecontrast == 2) &&
linedef->dx != 0)
{
rel = xs_RoundToInt // OMG LEE KILLOUGH LIVES! :/
(
level.WallHorizLight
+ fabs(atan(double(linedef->dy) / linedef->dx) / 1.57079)
* (level.WallVertLight - level.WallHorizLight)
);
}
else
{
rel = linedef->dx == 0 ? level.WallVertLight :
linedef->dy == 0 ? level.WallHorizLight : 0;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = rel;
}
else
{
baselight += rel;
}
}
if (!(Flags & WALLF_ABSLIGHTING))
{
baselight += this->Light;
}
}
return baselight;
}

View File

@ -2047,62 +2047,6 @@ void R_NewWall (bool needlights)
} }
} }
CUSTOM_CVAR(Int, r_fakecontrast, true, CVAR_ARCHIVE|CVAR_GLOBALCONFIG)
{
if (self < 0) self = 1;
else if (self > 2) self = 2;
}
int side_t::GetLightLevel (bool foggy, int baselight, int *pfakecontrast) const
{
if (Flags & WALLF_ABSLIGHTING)
{
baselight = Light;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = 0;
}
if (!foggy) // Don't do relative lighting in foggy sectors
{
if (!(Flags & WALLF_NOFAKECONTRAST) && r_fakecontrast != 0)
{
int rel;
if (((level.flags2 & LEVEL2_SMOOTHLIGHTING) || (Flags & WALLF_SMOOTHLIGHTING) || r_fakecontrast == 2) &&
linedef->dx != 0)
{
rel = xs_RoundToInt // OMG LEE KILLOUGH LIVES! :/
(
level.WallHorizLight
+ fabs(atan(double(linedef->dy) / linedef->dx) / 1.57079)
* (level.WallVertLight - level.WallHorizLight)
);
}
else
{
rel = linedef->dx == 0 ? level.WallVertLight :
linedef->dy == 0 ? level.WallHorizLight : 0;
}
if (pfakecontrast != NULL)
{
*pfakecontrast = rel;
}
else
{
baselight += rel;
}
}
if (!(Flags & WALLF_ABSLIGHTING))
{
baselight += this->Light;
}
}
return baselight;
}
// //
// R_CheckDrawSegs // R_CheckDrawSegs