- missed the part that the blend function was still drawing multiplicative blends.

This should be cleanly separated.
This commit is contained in:
Christoph Oelckers 2019-03-09 13:12:24 +01:00
parent 0e4a860c5e
commit f9d4ea8424
2 changed files with 16 additions and 8 deletions

View File

@ -1357,7 +1357,7 @@ void DFrameBuffer::DrawBorder (FTextureID picnum, int x1, int y1, int x2, int y2
//
//==========================================================================
FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector, PalEntry *modulateColor)
{
float blend[4] = { 0,0,0,0 };
PalEntry blendv = 0;
@ -1367,6 +1367,8 @@ FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
player_t *player = nullptr;
bool fullbright = false;
if (modulateColor) *modulateColor = 0xffffffff;
if (players[consoleplayer].camera != nullptr)
{
player = players[consoleplayer].camera->player;
@ -1428,7 +1430,7 @@ FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
// black multiplicative blends are ignored
if (extra_red || extra_green || extra_blue)
{
screen->Dim(blendv, 1, 0, 0, screen->GetWidth(), screen->GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
if (modulateColor) *modulateColor = blendv;
}
blendv = 0;
}
@ -1468,9 +1470,9 @@ FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
}
}
}
if (color != 0xffffffff)
{
screen->Dim(color, 1, 0, 0, screen->GetWidth(), screen->GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
if (modulateColor)
{
*modulateColor = color;
}
}
@ -1500,9 +1502,15 @@ FVector4 DFrameBuffer::CalcBlend(sector_t * viewsector)
void DFrameBuffer::DrawBlend(sector_t * viewsector)
{
auto blend = CalcBlend(viewsector);
PalEntry modulateColor;
auto blend = CalcBlend(viewsector, &modulateColor);
if (modulateColor != 0xffffffff)
{
Dim(modulateColor, 1, 0, 0, GetWidth(), GetHeight(), &LegacyRenderStyles[STYLE_Multiply]);
}
const PalEntry bcolor(255, uint8_t(blend.X), uint8_t(blend.Y), uint8_t(blend.Z));
screen->Dim(bcolor, blend.W, 0, 0, screen->GetWidth(), screen->GetHeight());
Dim(bcolor, blend.W, 0, 0, GetWidth(), GetHeight());
}

View File

@ -502,7 +502,7 @@ public:
// Dim part of the canvas
void Dim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
void DoDim(PalEntry color, float amount, int x1, int y1, int w, int h, FRenderStyle *style = nullptr);
FVector4 CalcBlend(sector_t * viewsector);
FVector4 CalcBlend(sector_t * viewsector, PalEntry *modulateColor);
void DrawBlend(sector_t * viewsector);
// Fill an area with a texture