diff --git a/osu.Game.Rulesets.Sentakki/Mods/SentakkiModHidden.cs b/osu.Game.Rulesets.Sentakki/Mods/SentakkiModHidden.cs index 2dc883e10..a1e52edc5 100644 --- a/osu.Game.Rulesets.Sentakki/Mods/SentakkiModHidden.cs +++ b/osu.Game.Rulesets.Sentakki/Mods/SentakkiModHidden.cs @@ -1,10 +1,10 @@ using System; using osu.Framework.Allocation; using osu.Framework.Graphics; -using osu.Framework.Graphics.Batches; using osu.Framework.Graphics.Containers; -using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Rendering; +using osu.Framework.Graphics.Rendering.Vertices; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Game.Graphics.OpenGL.Vertices; @@ -193,8 +193,8 @@ private class PlayfieldMaskDrawNode : DrawNode private Vector2 maskPosition; private Vector2 maskRadius; - private readonly VertexBatch quadBatch = new QuadBatch(1, 1); - private readonly Action addAction; + private IVertexBatch quadBatch; + private Action addAction; public PlayfieldMaskDrawNode(PlayfieldMask source) : base(source) @@ -216,16 +216,26 @@ public override void ApplyState() maskRadius = Source.MaskRadius * DrawInfo.Matrix.ExtractScale().Xy; } - public override void Draw(Action vertexAction) + public override void Draw(IRenderer renderer) { - base.Draw(vertexAction); + base.Draw(renderer); + + if (quadBatch == null) + { + quadBatch = renderer.CreateQuadBatch(1, 1); + addAction = v => quadBatch.Add(new PositionAndColourVertex + { + Position = v.Position, + Colour = v.Colour + }); + } shader.Bind(); shader.GetUniform("maskPosition").UpdateValue(ref maskPosition); shader.GetUniform("maskRadius").UpdateValue(ref maskRadius); - DrawQuad(Texture.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction); + renderer.DrawQuad(renderer.WhitePixel, screenSpaceDrawQuad, DrawColourInfo.Colour, vertexAction: addAction); shader.Unbind(); } diff --git a/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs b/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs index d2688f416..e63bc208f 100644 --- a/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs +++ b/osu.Game.Rulesets.Sentakki/SentakkiRuleset.cs @@ -203,7 +203,7 @@ public SentakkiIcon(Ruleset ruleset) private void load(GameHost host) { if (textureStore is null) - textureStore = new LargeTextureStore(host.CreateTextureLoaderStore(ruleset.CreateResourceStore())); + textureStore = new LargeTextureStore(host.Renderer, host.CreateTextureLoaderStore(ruleset.CreateResourceStore())); AddInternal(new Sprite { diff --git a/osu.Game.Rulesets.Sentakki/UI/Components/PlayfieldVisualization.cs b/osu.Game.Rulesets.Sentakki/UI/Components/PlayfieldVisualization.cs index 3ce605ad6..0da728f22 100644 --- a/osu.Game.Rulesets.Sentakki/UI/Components/PlayfieldVisualization.cs +++ b/osu.Game.Rulesets.Sentakki/UI/Components/PlayfieldVisualization.cs @@ -4,10 +4,10 @@ using osu.Framework.Bindables; using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; -using osu.Framework.Graphics.Batches; using osu.Framework.Graphics.Colour; -using osu.Framework.Graphics.OpenGL.Vertices; using osu.Framework.Graphics.Primitives; +using osu.Framework.Graphics.Rendering; +using osu.Framework.Graphics.Rendering.Vertices; using osu.Framework.Graphics.Shaders; using osu.Framework.Graphics.Textures; using osu.Framework.Utils; @@ -65,7 +65,7 @@ public class PlayfieldVisualisation : Drawable, IHasAccentColour private readonly float[] frequencyAmplitudes = new float[256]; private IShader shader; - private readonly Texture texture; + private Texture texture; public PlayfieldVisualisation() { @@ -75,16 +75,16 @@ public PlayfieldVisualisation() Size = new Vector2(.99f); Anchor = Anchor.Centre; Origin = Anchor.Centre; - texture = Texture.WhitePixel; Blending = BlendingParameters.Additive; } private readonly Bindable kiaiEffect = new Bindable(true); [BackgroundDependencyLoader(true)] - private void load(ShaderManager shaders, IBindable beatmap, SentakkiRulesetConfigManager settings) + private void load(IRenderer renderer, ShaderManager shaders, IBindable beatmap, SentakkiRulesetConfigManager settings) { this.beatmap.BindTo(beatmap); + texture = renderer.WhitePixel; shader = shaders.Load(VertexShaderDescriptor.TEXTURE_2, FragmentShaderDescriptor.TEXTURE_ROUNDED); settings?.BindWith(SentakkiRulesetSettings.KiaiEffects, kiaiEffect); @@ -181,7 +181,7 @@ private class VisualisationDrawNode : DrawNode private Color4 colour; private float[] audioData; - private readonly QuadBatch vertexBatch = new QuadBatch(100, 10); + private IVertexBatch vertexBatch; public VisualisationDrawNode(PlayfieldVisualisation source) : base(source) @@ -199,12 +199,14 @@ public override void ApplyState() audioData = Source.frequencyAmplitudes; } - public override void Draw(Action vertexAction) + public override void Draw(IRenderer renderer) { if (!Source.ShouldDraw) return; - base.Draw(vertexAction); + base.Draw(renderer); + + vertexBatch ??= renderer.CreateQuadBatch(100, 10); shader.Bind(); @@ -241,7 +243,7 @@ public override void Draw(Action vertexAction) Vector2Extensions.Transform(barPosition + bottomOffset + amplitudeOffset, DrawInfo.Matrix) ); - DrawQuad( + renderer.DrawQuad( texture, rectangle, colourInfo, @@ -260,7 +262,7 @@ protected override void Dispose(bool isDisposing) { base.Dispose(isDisposing); - vertexBatch.Dispose(); + vertexBatch?.Dispose(); } } } diff --git a/osu.Game.Rulesets.Sentakki/osu.Game.Rulesets.Sentakki.csproj b/osu.Game.Rulesets.Sentakki/osu.Game.Rulesets.Sentakki.csproj index 268a72658..c0f4427a3 100644 --- a/osu.Game.Rulesets.Sentakki/osu.Game.Rulesets.Sentakki.csproj +++ b/osu.Game.Rulesets.Sentakki/osu.Game.Rulesets.Sentakki.csproj @@ -9,7 +9,7 @@ osu.Game.Rulesets.Sentakki - +