From ac40ffad9239ba932f68944b951895e6941dfd45 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 24 Nov 2023 05:32:09 +0300 Subject: [PATCH 1/2] Add spinner glow texture --- .../Textures/Gameplay/osu/spinner-glow.png | Bin 0 -> 199 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 osu.Game.Resources/Textures/Gameplay/osu/spinner-glow.png diff --git a/osu.Game.Resources/Textures/Gameplay/osu/spinner-glow.png b/osu.Game.Resources/Textures/Gameplay/osu/spinner-glow.png new file mode 100644 index 0000000000000000000000000000000000000000..66f6b86472555ad6bc6ec1dd49547bba9fee46dc GIT binary patch literal 199 zcmeAS@N?(olHy`uVBq!ia0vp^j6j^t!3HF^RlV2>5-1LGcVbv~PUa<$!;&U>c zv7h@-A}f&3S>O>_%)r2R5QG_bOw4`@6pZn7aSYK2UOM46SAzkM^Xol6NB{r7oAqgf z!@|W6gd)z4*}Q$iB}CLu&7 literal 0 HcmV?d00001 From 1f7227878433b9d1dd17a5b86dca121a0eca513a Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 24 Nov 2023 07:12:56 +0300 Subject: [PATCH 2/2] Implement spinner glow shader --- osu.Game.Resources/Shaders/sh_SpinnerGlow.fs | 49 ++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 osu.Game.Resources/Shaders/sh_SpinnerGlow.fs diff --git a/osu.Game.Resources/Shaders/sh_SpinnerGlow.fs b/osu.Game.Resources/Shaders/sh_SpinnerGlow.fs new file mode 100644 index 00000000..f2dff619 --- /dev/null +++ b/osu.Game.Resources/Shaders/sh_SpinnerGlow.fs @@ -0,0 +1,49 @@ +#ifndef SPINNER_GLOW_FS +#define SPINNER_GLOW_FS + +#undef HIGH_PRECISION_VERTEX +#define HIGH_PRECISION_VERTEX + +#include "sh_Utils.h" +#include "sh_Masking.h" +#include "sh_CircularProgressUtils.h" + +layout(location = 2) in highp vec2 v_TexCoord; + +layout(std140, set = 0, binding = 0) uniform m_ProgressGlowParameters +{ + mediump float innerRadius; + mediump float progress; + highp float texelSize; + highp float glowSize; +}; + +layout(set = 1, binding = 0) uniform lowp texture2D m_Texture; +layout(set = 1, binding = 1) uniform lowp sampler m_Sampler; + +layout(location = 0) out vec4 o_Colour; + +void main(void) +{ + highp vec2 resolution = v_TexRect.zw - v_TexRect.xy; + + // Inflate coordinate space, so it would be (-glowSize -> 0 -> 1 -> glowSize) to preserve everything in place while inflating the draw quad + highp vec2 pixelPos = (v_TexCoord - v_TexRect.xy) / resolution * (vec2(1.0) + glowSize * 2.0) - glowSize; + + highp float dst = distanceToProgress(pixelPos, progress, innerRadius, true, texelSize); + highp float progressThickness = innerRadius * 0.25; + highp float relativeTextureHeight = glowSize + progressThickness; + + if (dst > relativeTextureHeight) + { + o_Colour = vec4(0.0); + return; + } + + highp float textureY = 1.0 - (dst / relativeTextureHeight); + lowp vec4 texCol = texture(sampler2D(m_Texture, m_Sampler), v_TexRect.xy + vec2(0.0, textureY) * resolution, -0.9); + + o_Colour = getRoundedColor(texCol, v_TexCoord); +} + +#endif