mirror of
https://github.com/ppy/osu.git
synced 2024-12-05 09:42:54 +08:00
Use BackdropBlurPath
instead of BackdropBlurContainer
for translucent sliders
This commit is contained in:
parent
f97cf4ec29
commit
d080a8a614
@ -12,7 +12,6 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Layout;
|
||||
using osu.Framework.Utils;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Rulesets.Judgements;
|
||||
@ -23,7 +22,6 @@ using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Skinning;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
@ -39,8 +37,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
[Cached]
|
||||
public DrawableSliderBall Ball { get; private set; }
|
||||
|
||||
public BackdropBlurContainer BlurContainer { get; private set; }
|
||||
|
||||
public SkinnableDrawable Body { get; private set; }
|
||||
|
||||
private ShakeContainer shakeContainer;
|
||||
@ -110,14 +106,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Children = new[]
|
||||
{
|
||||
BlurContainer = new BackdropBlurContainer
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
BlurSigma = new Vector2(5f),
|
||||
MaskCutoff = 0.25f,
|
||||
EffectBufferScale = new Vector2(0.5f),
|
||||
Child = Body = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderBody), _ => new DefaultSliderBody(), confineMode: ConfineMode.NoScaling)
|
||||
},
|
||||
Body = new SkinnableDrawable(new OsuSkinComponentLookup(OsuSkinComponents.SliderBody), _ => new DefaultSliderBody(), confineMode: ConfineMode.NoScaling),
|
||||
// proxied here so that the tail is drawn under repeats/ticks - legacy skins rely on this
|
||||
tailContainer.CreateProxy(),
|
||||
tickContainer = new Container<DrawableSliderTick> { RelativeSizeAxes = Axes.Both },
|
||||
@ -146,7 +135,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
foreach (var drawableHitObject in NestedHitObjects)
|
||||
drawableHitObject.AccentColour.Value = colour.NewValue;
|
||||
BlurContainer.EffectColour = Interpolation.ValueAt(0.5, colour.NewValue, Color4.White, 0, 1);
|
||||
}, true);
|
||||
}
|
||||
|
||||
@ -294,8 +282,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
relativeAnchorPositionLayout.Validate();
|
||||
}
|
||||
|
||||
BlurContainer.MaskCutoff = Body.Alpha * 0.25f;
|
||||
}
|
||||
|
||||
public override void OnKilled()
|
||||
@ -353,7 +339,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
|
||||
// The backdrop blur opacity should fade in quicker, but the overall alpha should fade in linearly.
|
||||
// By using OutQuad easing on both the blur container & the child, we end up getting a linear fade in.
|
||||
BlurContainer.FadeInFromZero(HitObject.TimeFadeIn, Easing.OutQuad);
|
||||
Body.FadeInFromZero(HitObject.TimeFadeIn, Easing.OutQuad);
|
||||
Body.FadeInFromZero(HitObject.TimeFadeIn, Easing.OutQuad);
|
||||
}
|
||||
|
||||
@ -375,7 +361,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
{
|
||||
case ArmedState.Hit:
|
||||
if (HeadCircle.IsHit && SliderBody?.SnakingOut.Value == true)
|
||||
BlurContainer.FadeOut(40); // short fade to allow for any body colour to smoothly disappear.
|
||||
Body.FadeOut(40); // short fade to allow for any body colour to smoothly disappear.
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Default
|
||||
{
|
||||
public abstract partial class DrawableSliderPath : SmoothPath
|
||||
public abstract partial class DrawableSliderPath : BackdropBlurPath
|
||||
{
|
||||
public const float BORDER_PORTION = 0.128f;
|
||||
public const float GRADIENT_PORTION = 1 - BORDER_PORTION;
|
||||
|
@ -7,6 +7,7 @@ using osu.Game.Rulesets.Osu.Objects;
|
||||
using osu.Game.Rulesets.Osu.Skinning.Default;
|
||||
using osu.Game.Skinning;
|
||||
using osu.Game.Utils;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
@ -23,6 +24,16 @@ namespace osu.Game.Rulesets.Osu.Skinning.Legacy
|
||||
|
||||
private partial class LegacyDrawableSliderPath : DrawableSliderPath
|
||||
{
|
||||
public LegacyDrawableSliderPath()
|
||||
{
|
||||
BlurSigma = new Vector2(8f);
|
||||
|
||||
BackdropTintStrength = 0.5f;
|
||||
|
||||
// To prevent shadows from contributing to the background blur effect
|
||||
MaskCutoff = 0.25f;
|
||||
}
|
||||
|
||||
protected override Color4 ColourAt(float position)
|
||||
{
|
||||
// https://github.com/peppy/osu-stable-reference/blob/3ea48705eb67172c430371dcfc8a16a002ed0d3d/osu!/Graphics/Renderers/MmSliderRendererGL.cs#L99
|
||||
|
Loading…
Reference in New Issue
Block a user