- made AActor::alpha a floating point value

- replaced some uses of FRACUNIT with OPAQUE when it was about translucency.
- simplified some overly complicated translucency multiplications in the SBARINFO code.
This commit is contained in:
Christoph Oelckers 2016-03-21 12:18:46 +01:00
commit 4e60ea0252
50 changed files with 235 additions and 216 deletions

View file

@ -114,7 +114,7 @@ FArchive &operator<< (FArchive &arc, FRenderStyle &style)
//
//==========================================================================
bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
bool FRenderStyle::IsVisible(double alpha) const throw()
{
if (BlendOp == STYLEOP_None)
{
@ -124,13 +124,13 @@ bool FRenderStyle::IsVisible(fixed_t alpha) const throw()
{
if (Flags & STYLEF_Alpha1)
{
alpha = FRACUNIT;
alpha = 1.;
}
else
{
alpha = clamp(alpha, 0, FRACUNIT);
alpha = clamp(alpha, 0., 1.);
}
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != FRACUNIT;
return GetAlpha(SrcAlpha, alpha) != 0 || GetAlpha(DestAlpha, alpha) != OPAQUE;
}
// Treat anything else as visible.
return true;
@ -192,10 +192,23 @@ fixed_t GetAlpha(int type, fixed_t alpha)
switch (type)
{
case STYLEALPHA_Zero: return 0;
case STYLEALPHA_One: return FRACUNIT;
case STYLEALPHA_One: return OPAQUE;
case STYLEALPHA_Src: return alpha;
case STYLEALPHA_InvSrc: return FRACUNIT - alpha;
case STYLEALPHA_InvSrc: return OPAQUE - alpha;
default: return 0;
}
}
fixed_t GetAlpha(int type, double alpha)
{
switch (type)
{
case STYLEALPHA_Zero: return 0;
case STYLEALPHA_One: return OPAQUE;
case STYLEALPHA_Src: return FLOAT2FIXED(alpha);
case STYLEALPHA_InvSrc: return FLOAT2FIXED(1. - alpha);
default: return 0;
}
}