From 928d642e48e901ac2336f95e5c3d5815402d3d53 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 16 Apr 2022 13:55:35 +0800 Subject: [PATCH] rename and adjust property. --- .../Shaders/DefaultKaraokeLyricShader.cs | 18 +++++++++++------- .../Shaders/sh_DefaultKaraokeLyric.fs | 5 +++++ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs b/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs index 76700b13..d1f09226 100644 --- a/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs +++ b/osu.Framework.Font/Graphics/Shaders/DefaultKaraokeLyricShader.cs @@ -17,25 +17,29 @@ public class DefaultKaraokeLyricShader : InternalShader public Color4 OutlineColour { get; set; } - public Vector2 ShaderOffset { get; set; } + public Vector2 ShadowOffset { get; set; } - public int ShaderSize { get; set; } + public int ShadowSize { get; set; } - public int ShaderSigma { get; set; } + public int ShadowSigma { get; set; } - public Vector2 ShaderColour { get; set; } + public Vector2 ShadowColour { get; set; } public override void ApplyValue(FrameBuffer current) { - var radius = Radius; - GetUniform(@"g_Radius").UpdateValue(ref radius); - + // outline effect var colourMatrix = new Vector4(Colour.R, Colour.G, Colour.B, Colour.A); GetUniform(@"g_Colour").UpdateValue(ref colourMatrix); + var radius = Radius; + GetUniform(@"g_Radius").UpdateValue(ref radius); + var outlineColourMatrix = new Vector4(OutlineColour.R, OutlineColour.G, OutlineColour.B, OutlineColour.A); GetUniform(@"g_OutlineColour").UpdateValue(ref outlineColourMatrix); + // shadow effect + + // common property. var size = current.Size; GetUniform(@"g_TexSize").UpdateValue(ref size); } diff --git a/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs b/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs index 2933753d..d3ec7730 100644 --- a/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs +++ b/osu.Framework.Font/Resources/Shaders/sh_DefaultKaraokeLyric.fs @@ -7,8 +7,13 @@ varying mediump vec2 v_TexCoord; uniform lowp sampler2D m_Sampler; uniform mediump vec2 g_TexSize; + +// outline effect +uniform vec4 g_Colour; uniform int g_Radius; +uniform vec4 g_OutlineColour; +// shadow effect uniform mediump float g_Sigma; uniform highp vec2 g_BlurDirection;