Skip to content

Commit

Permalink
Now it's able to calculate the draw quad by the shader.
Browse files Browse the repository at this point in the history
  • Loading branch information
andy840119 committed May 1, 2022
1 parent 6e90dcc commit ef7acee
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion osu.Framework.Font/Graphics/Sprites/LyricSpriteText.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public IReadOnlyList<IShader> Shaders
if (value != null)
shaders.AddRange(value);

Invalidate(Invalidation.DrawNode);
Invalidate();
}
}

Expand Down
10 changes: 7 additions & 3 deletions osu.Framework.Font/Graphics/Sprites/LyricSpriteText_DrawNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

using System;
using System.Collections.Generic;
using osu.Framework.Graphics.Extensions;
using System.Linq;
using osu.Framework.Graphics.OpenGL.Vertices;
using osu.Framework.Graphics.Primitives;
using osu.Framework.Graphics.Shaders;
Expand All @@ -17,8 +17,12 @@ public partial class LyricSpriteText
protected override Quad ComputeScreenSpaceDrawQuad()
{
// make draw size become bigger (for not masking the shader).
var newRectangle = DrawRectangle.Scale(2);
return ToScreenSpace(newRectangle);
var quad = ToScreenSpace(DrawRectangle);
var drawRectangele = Shaders.OfType<IApplicableToDrawQuad>()
.Select(x => x.ComputeScreenSpaceDrawQuad(quad).AABBFloat)
.Aggregate(quad.AABBFloat, RectangleF.Union);

return Quad.FromRectangle(drawRectangele);
}

protected override DrawNode CreateDrawNode()
Expand Down

0 comments on commit ef7acee

Please sign in to comment.