From d48f95cf7c0f317c6b532e9d455b592e9a521fb0 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Thu, 27 Oct 2022 13:16:15 +0900 Subject: [PATCH] Use shader based implementation instead of sprites --- .../Skinning/Argon/ArgonDropletPiece.cs | 37 ++++++++++--------- .../Skinning/Argon/ArgonFruitPiece.cs | 36 ++++++++++-------- 2 files changed, 41 insertions(+), 32 deletions(-) diff --git a/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonDropletPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonDropletPiece.cs index c607b96729..63a41edaf7 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonDropletPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonDropletPiece.cs @@ -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); } diff --git a/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonFruitPiece.cs b/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonFruitPiece.cs index 2412de7dbe..28538d48b3 100644 --- a/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonFruitPiece.cs +++ b/osu.Game.Rulesets.Catch/Skinning/Argon/ArgonFruitPiece.cs @@ -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()