From a5757521906f5fc7e2bd1d9e75677707e6690c50 Mon Sep 17 00:00:00 2001 From: Uncomfy Date: Thu, 6 Feb 2025 21:04:54 +0200 Subject: [PATCH] Split getRoundedColor into two separate parts Because it is doing way too many things at once --- osu.Framework/Resources/Shaders/sh_Masking.h | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/osu.Framework/Resources/Shaders/sh_Masking.h b/osu.Framework/Resources/Shaders/sh_Masking.h index 3fdc6c8846..f8a3044d49 100644 --- a/osu.Framework/Resources/Shaders/sh_Masking.h +++ b/osu.Framework/Resources/Shaders/sh_Masking.h @@ -61,13 +61,13 @@ lowp vec4 getBorderColour() return mix(top, bottom, relativeTexCoord.y); } -lowp vec4 getRoundedColor(lowp vec4 texel, mediump vec2 texCoord) +lowp vec4 multiplyByVColour(lowp vec4 colour) { - if (!g_IsMasking && v_BlendRange == vec2(0.0)) - { - return v_Colour * texel; - } + return colour * v_Colour; +} +lowp vec4 applyRounding(lowp vec4 texel, mediump vec2 texCoord) +{ highp float dist = distanceFromRoundedRect(vec2(0.0), g_CornerRadius); lowp float alphaFactor = 1.0; @@ -113,7 +113,7 @@ lowp vec4 getRoundedColor(lowp vec4 texel, mediump vec2 texCoord) highp float borderStart = 1.0 + fadeStart - g_BorderThickness; lowp float colourWeight = min(borderStart - dist, 1.0); - lowp vec4 contentColour = v_Colour * texel; + lowp vec4 contentColour = texel; if (colourWeight == 1.0) return vec4(contentColour.rgb, contentColour.a * alphaFactor); @@ -128,4 +128,11 @@ lowp vec4 getRoundedColor(lowp vec4 texel, mediump vec2 texCoord) return blend(borderColour, contentColour); } +lowp vec4 getRoundedColor(lowp vec4 texel, mediump vec2 texCoord) +{ + texel = multiplyByVColour(texel); + + return applyRounding(texel, texCoord); +} + #endif \ No newline at end of file