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

View File

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