mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2024-11-29 23:52:30 +00:00
Fix ACZ fence texture
This commit is contained in:
parent
a321ec9135
commit
65da251a2f
1 changed files with 21 additions and 15 deletions
26
src/r_data.c
26
src/r_data.c
|
@ -230,25 +230,31 @@ static inline void R_DrawFlippedColumnInCache(column_t *patch, UINT8 *cache, tex
|
|||
UINT32 ASTBlendPixel(RGBA_t background, RGBA_t foreground, int style, UINT8 alpha)
|
||||
{
|
||||
RGBA_t output;
|
||||
INT16 fullalpha = (alpha - (0xFF - foreground.s.alpha));
|
||||
if (style == AST_TRANSLUCENT)
|
||||
{
|
||||
if (alpha == 0)
|
||||
if (fullalpha <= 0)
|
||||
output.rgba = background.rgba;
|
||||
else if (alpha == 0xFF)
|
||||
output.rgba = foreground.rgba;
|
||||
else if (alpha < 0xFF)
|
||||
else
|
||||
{
|
||||
// don't go too high
|
||||
if (fullalpha >= 0xFF)
|
||||
fullalpha = 0xFF;
|
||||
alpha = (UINT8)fullalpha;
|
||||
|
||||
// if the background pixel is empty,
|
||||
// match software and don't blend anything
|
||||
if (!background.s.alpha)
|
||||
output.s.alpha = 0;
|
||||
else
|
||||
{
|
||||
UINT8 beta = (0xFF - alpha);
|
||||
output.s.red = ((background.s.red * beta) + (foreground.s.red * alpha)) / 0xFF;
|
||||
output.s.green = ((background.s.green * beta) + (foreground.s.green * alpha)) / 0xFF;
|
||||
output.s.blue = ((background.s.blue * beta) + (foreground.s.blue * alpha)) / 0xFF;
|
||||
}
|
||||
// write foreground pixel alpha
|
||||
// if there's no pixel in here
|
||||
if (!background.rgba)
|
||||
output.s.alpha = foreground.s.alpha;
|
||||
else
|
||||
output.s.alpha = 0xFF;
|
||||
}
|
||||
}
|
||||
return output.rgba;
|
||||
}
|
||||
#define clamp(c) max(min(c, 0xFF), 0x00);
|
||||
|
|
Loading…
Reference in a new issue