From f9d4ea842419e2ffebf81b1f7bc024e7dfb15554 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sat, 9 Mar 2019 13:12:24 +0100 Subject: [PATCH] - missed the part that the blend function was still drawing multiplicative blends. This should be cleanly separated. --- src/rendering/2d/v_draw.cpp | 22 +++++++++++++++------- src/v_video.h | 2 +- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/src/rendering/2d/v_draw.cpp b/src/rendering/2d/v_draw.cpp index fb66f4f5f..9f309cd3b 100644 --- a/src/rendering/2d/v_draw.cpp +++ b/src/rendering/2d/v_draw.cpp @@ -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()); } diff --git a/src/v_video.h b/src/v_video.h index 6ac2aaf20..d4fedf17c 100644 --- a/src/v_video.h +++ b/src/v_video.h @@ -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