From 40f085adeac9be012b4d8d27785c10fa3bfa276d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Thu, 4 Jun 2020 18:54:10 +0200 Subject: [PATCH] - draw fullscreen blends with the 2D drawer. Removing one special case of render setup. Now all 2D content is done by the same code. --- source/glbackend/hw_draw2d.cpp | 37 +++++++++------------------------- 1 file changed, 9 insertions(+), 28 deletions(-) diff --git a/source/glbackend/hw_draw2d.cpp b/source/glbackend/hw_draw2d.cpp index 4b9a9cf4f..796cb36ab 100644 --- a/source/glbackend/hw_draw2d.cpp +++ b/source/glbackend/hw_draw2d.cpp @@ -231,38 +231,19 @@ extern PalEntry palfadergb; void DrawFullscreenBlends() { - GLInterface.SetIdentityMatrix(Matrix_Model); - - GLInterface.EnableDepthTest(false); - GLInterface.EnableAlphaTest(false); - GLInterface.EnableBlend(true); - GLInterface.UseColorOnly(true); - - renderBeginScene(); - if (palfadergb.a > 0) - { - // Todo: reroute to the 2D drawer - GLInterface.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]); - GLInterface.SetColorub(palfadergb.r, palfadergb.g, palfadergb.b, palfadergb.a); - GLInterface.Draw(DT_TriangleStrip, FFlatVertexBuffer::PRESENT_INDEX, 4); - } + // These get prepended to the 2D drawer so they must be submitted in reverse order of drawing. if (tint_blood_r | tint_blood_g | tint_blood_b) { - GLInterface.SetRenderStyle(LegacyRenderStyles[STYLE_Add]); - - GLInterface.SetColorub(max(tint_blood_r, 0), max(tint_blood_g, 0), max(tint_blood_b, 0), 255); - GLInterface.Draw(DT_TriangleStrip, FFlatVertexBuffer::PRESENT_INDEX, 4); - - GLInterface.SetRenderStyle(LegacyRenderStyles[STYLE_Subtract]); - GLInterface.SetColorub(max(-tint_blood_r, 0), max(-tint_blood_g, 0), max(-tint_blood_b, 0), 255); - GLInterface.Draw(DT_TriangleStrip, FFlatVertexBuffer::PRESENT_INDEX, 4); - - GLInterface.SetColorub(255, 255, 255, 255); - GLInterface.SetRenderStyle(LegacyRenderStyles[STYLE_Translucent]); + PalEntry color2(255, std::max(-tint_blood_r, 0), std::max(-tint_blood_g, 0), std::max(-tint_blood_b, 0)); + twod->AddColorOnlyQuad(0, 0, twod->GetWidth(), twod->GetHeight(), color2, &LegacyRenderStyles[STYLE_Subtract], true); + PalEntry color(255, std::max(tint_blood_r, 0), std::max(tint_blood_g, 0), std::max(tint_blood_b, 0)); + twod->AddColorOnlyQuad(0, 0, twod->GetWidth(), twod->GetHeight(), color, &LegacyRenderStyles[STYLE_Add], true); } - renderFinishScene(); - GLInterface.UseColorOnly(false); + if (palfadergb.a > 0) + { + twod->AddColorOnlyQuad(0, 0, twod->GetWidth(), twod->GetHeight(), palfadergb, &LegacyRenderStyles[STYLE_Translucent], true); + } } void DrawRateStuff();