From e9d200c045a0f33fe63ee476a6cb09042a0a62ec Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 16 Apr 2022 14:27:50 +0800 Subject: [PATCH] runnable. --- .../Graphics/Shaders/DefaultKaraokeLyricShader.cs | 7 ++++++- .../Resources/Shaders/sh_DefaultKaraokeLyric.fs | 5 ++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs b/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs index d1f0922..cb737d9 100644 --- a/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs +++ b/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs @@ -21,7 +21,7 @@ public class DefaultKaraokeLyricShader : InternalShader public int ShadowSize { get; set; } - public int ShadowSigma { get; set; } + public float ShadowSigma { get; set; } public Vector2 ShadowColour { get; set; } @@ -38,6 +38,11 @@ public override void ApplyValue(FrameBuffer current) GetUniform(@"g_OutlineColour").UpdateValue(ref outlineColourMatrix); // shadow effect + var shadowOffset = ShadowOffset; + GetUniform(@"g_BlurDirection").UpdateValue(ref shadowOffset); + + var shadowSigma = ShadowSigma; + GetUniform(@"g_Sigma").UpdateValue(ref shadowSigma); // common property. var size = current.Size; diff --git a/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs b/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs index d3ec773..de6652d 100644 --- a/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs +++ b/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs @@ -45,5 +45,8 @@ lowp vec4 blur(sampler2D tex, int radius, highp vec2 direction, mediump vec2 tex void main(void) { - gl_FragColor = blur(m_Sampler, g_Radius, g_BlurDirection, v_TexCoord, g_TexSize, g_Sigma); + mediump vec4 originTexture = texture2D(m_Sampler, v_TexCoord) * g_Colour; + lowp vec4 outline = blur(m_Sampler, g_Radius, g_BlurDirection, v_TexCoord, g_TexSize, g_Sigma) * g_OutlineColour; + lowp vec4 shadow = blur(m_Sampler, g_Radius, g_BlurDirection, v_TexCoord, g_TexSize, g_Sigma); + gl_FragColor = originTexture; } \ No newline at end of file