From afab51279e5879488cf738079eac0a1e7ec897ba Mon Sep 17 00:00:00 2001 From: Jonas Kulla Date: Tue, 7 Jul 2015 15:53:15 +0200 Subject: [PATCH] Graphics: Fix viewport color/flash effectiveness calculation Fixes #121. --- src/graphics.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/graphics.cpp b/src/graphics.cpp index 1862629..4d7eb59 100644 --- a/src/graphics.cpp +++ b/src/graphics.cpp @@ -174,7 +174,12 @@ public: const IntRect &viewpRect = glState.scissorBox.get(); const IntRect &screenRect = geometry.rect; - if (t.w != 0.0) + bool toneRGBEffect = t.xyzHasEffect(); + bool toneGrayEffect = t.w != 0; + bool colorEffect = c.w > 0; + bool flashEffect = f.w > 0; + + if (toneGrayEffect) { pp.swapRender(); @@ -206,19 +211,14 @@ public: glState.blend.pop(); } - bool toneEffect = t.xyzHasEffect(); - bool colorEffect = c.xyzHasEffect(); - bool flashEffect = f.xyzHasEffect(); - - if (!toneEffect && !colorEffect && !flashEffect) + if (!toneRGBEffect && !colorEffect && !flashEffect) return; FlatColorShader &shader = shState->shaders().flatColor; shader.bind(); shader.applyViewportProj(); - /* Apply tone */ - if (toneEffect) + if (toneRGBEffect) { /* First split up additive / substractive components */ Vec4 add, sub;