1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-11 16:57:21 +08:00

Use shader based implementation instead of sprites

This commit is contained in:
Dean Herbert 2022-10-27 13:16:15 +09:00
parent 8a80cb55bd
commit d48f95cf7c
2 changed files with 41 additions and 32 deletions

View File

@ -5,8 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Textures;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Skinning.Default; using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
@ -25,11 +24,13 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
private float rotationRandomness; private float rotationRandomness;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
const float droplet_scale_down = 0.5f; const float droplet_scale_down = 0.7f;
int largeBlobSeed = RNG.Next();
InternalChildren = new[] InternalChildren = new[]
{ {
@ -47,38 +48,42 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new Sprite new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
InnerRadius = 0.5f,
Alpha = 0.15f, Alpha = 0.15f,
Texture = getTexture("A") Seed = largeBlobSeed
}, },
new Sprite new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
InnerRadius = 0.4f,
Alpha = 0.5f, Alpha = 0.5f,
Scale = new Vector2(0.8f), Scale = new Vector2(0.7f),
Texture = getTexture("A") Seed = RNG.Next()
}, },
} }
}, },
hyperBorderPiece = new Sprite hyperBorderPiece = new CircularBlob
{ {
Scale = new Vector2(droplet_scale_down), Scale = new Vector2(droplet_scale_down),
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
InnerRadius = 0.5f,
Alpha = 0.15f, Alpha = 0.15f,
Texture = getTexture("A"), Seed = largeBlobSeed
}, },
}; };
Texture getTexture(string type) => textures.Get($"Gameplay/catch/blob-{type}{RNG.Next(1, 7)}");
} }
protected override void LoadComplete() protected override void LoadComplete()
@ -106,10 +111,8 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
for (int i = 0; i < layers.Count; i++) for (int i = 0; i < layers.Count; i++)
{ {
layers[i].Rotation -= layers[i].Rotation -=
// Layers are ordered from largest to smallest. Smaller layers should rotate more. (float)Clock.ElapsedFrameTime
(i * 4) * 0.4f * rotationRandomness
* (float)Clock.ElapsedFrameTime
* 0.2f * rotationRandomness
// Each layer should alternate rotation direction. // Each layer should alternate rotation direction.
* (i % 2 == 1 ? 0.5f : 1); * (i % 2 == 1 ? 0.5f : 1);
} }

View File

@ -5,8 +5,7 @@ using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Shapes; using osu.Framework.Graphics.Shapes;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.UserInterface;
using osu.Framework.Graphics.Textures;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Rulesets.Catch.Skinning.Default; using osu.Game.Rulesets.Catch.Skinning.Default;
using osu.Game.Rulesets.Catch.UI; using osu.Game.Rulesets.Catch.UI;
@ -25,11 +24,11 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
private float rotationRandomness; private float rotationRandomness;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(TextureStore textures) private void load()
{ {
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Texture largeTexture = getTexture("A"); int largeBlobSeed = RNG.Next();
InternalChildren = new[] InternalChildren = new[]
{ {
@ -44,43 +43,50 @@ namespace osu.Game.Rulesets.Catch.Skinning.Argon
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Children = new Drawable[] Children = new Drawable[]
{ {
new Sprite new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Alpha = 0.15f, Alpha = 0.15f,
Texture = largeTexture InnerRadius = 0.5f,
Size = new Vector2(1.1f),
Seed = largeBlobSeed,
}, },
new Sprite new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
InnerRadius = 0.2f,
Alpha = 0.5f, Alpha = 0.5f,
Texture = getTexture("B") Seed = RNG.Next(),
}, },
new Sprite new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Texture = getTexture("C") InnerRadius = 0.05f,
Seed = RNG.Next(),
}, },
} }
}, },
hyperBorderPiece = new Sprite hyperBorderPiece = new CircularBlob
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR, Colour = Catcher.DEFAULT_HYPER_DASH_COLOUR,
RelativeSizeAxes = Axes.Both,
Blending = BlendingParameters.Additive, Blending = BlendingParameters.Additive,
Alpha = 0.15f, InnerRadius = 0.08f,
Texture = largeTexture, Size = new Vector2(1.15f),
Seed = largeBlobSeed
}, },
}; };
Texture getTexture(string type) => textures.Get($"Gameplay/catch/blob-{type}{RNG.Next(1, 7)}");
} }
protected override void LoadComplete() protected override void LoadComplete()