From 08f6615048babff7d5296988b970c726d1229736 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Vondru=C5=A1?= Date: Tue, 6 Aug 2019 16:51:06 +0200 Subject: [PATCH] Shaders: make alpha mask = 1.0 do what's expected. Yay tests! --- src/Magnum/Shaders/Flat.frag | 5 ++++- src/Magnum/Shaders/Phong.frag | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Magnum/Shaders/Flat.frag b/src/Magnum/Shaders/Flat.frag index 77f4e9098..87ce0931f 100644 --- a/src/Magnum/Shaders/Flat.frag +++ b/src/Magnum/Shaders/Flat.frag @@ -72,6 +72,9 @@ void main() { color; #ifdef ALPHA_MASK - if(fragmentColor.a < alphaMask) discard; + /* Using <= because if mask is set to 1.0, it should discard all, similarly + as when using 0, it should only discard what's already invisible + anyway. */ + if(fragmentColor.a <= alphaMask) discard; #endif } diff --git a/src/Magnum/Shaders/Phong.frag b/src/Magnum/Shaders/Phong.frag index 0e0575509..ed6bfc4ef 100644 --- a/src/Magnum/Shaders/Phong.frag +++ b/src/Magnum/Shaders/Phong.frag @@ -187,6 +187,9 @@ void main() { } #ifdef ALPHA_MASK - if(color.a < alphaMask) discard; + /* Using <= because if mask is set to 1.0, it should discard all, similarly + as when using 0, it should only discard what's already invisible + anyway. */ + if(color.a <= alphaMask) discard; #endif }