From 1b283930381283213a925c96a31e9312847edc50 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Wed, 28 Aug 2024 03:30:06 +0300 Subject: [PATCH] Don't set renderer blending in composite draw node --- .../Graphics/Containers/CompositeDrawable_DrawNode.cs | 3 +++ osu.Framework/Graphics/DrawNode.cs | 9 ++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs b/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs index 901ea0c68f..f88845c6ea 100644 --- a/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs +++ b/osu.Framework/Graphics/Containers/CompositeDrawable_DrawNode.cs @@ -176,6 +176,9 @@ private void updateQuadBatch(IRenderer renderer) quadBatch = renderer.CreateQuadBatch(100, 1000); } + // Children will set their own blending parameters. + internal override bool SetBlending => false; + protected override void Draw(IRenderer renderer) { updateQuadBatch(renderer); diff --git a/osu.Framework/Graphics/DrawNode.cs b/osu.Framework/Graphics/DrawNode.cs index 450fc529e0..3bf4d0839d 100644 --- a/osu.Framework/Graphics/DrawNode.cs +++ b/osu.Framework/Graphics/DrawNode.cs @@ -67,6 +67,11 @@ public virtual void ApplyState() InvalidationID = Source.InvalidationID; } + /// + /// Whether the renderer should set blending parameters of this . + /// + internal virtual bool SetBlending => true; + /// /// Draws this to the screen. /// @@ -76,7 +81,9 @@ public virtual void ApplyState() /// The renderer to draw with. protected virtual void Draw(IRenderer renderer) { - renderer.SetBlend(DrawColourInfo.Blending); + if (SetBlending) + renderer.SetBlend(DrawColourInfo.Blending); + renderer.BackbufferDepth.Set(drawDepth); }