From 14524237acb85e77c8253484d4c78c3adf5b6340 Mon Sep 17 00:00:00 2001 From: Andrei Zavatski Date: Fri, 3 Feb 2023 10:32:41 +0300 Subject: [PATCH] Add comment explaining texelSize value --- osu.Game/Graphics/Backgrounds/Triangles.cs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/osu.Game/Graphics/Backgrounds/Triangles.cs b/osu.Game/Graphics/Backgrounds/Triangles.cs index ca5f5d06d3..598278b2e4 100644 --- a/osu.Game/Graphics/Backgrounds/Triangles.cs +++ b/osu.Game/Graphics/Backgrounds/Triangles.cs @@ -253,7 +253,6 @@ namespace osu.Game.Graphics.Backgrounds private class TrianglesDrawNode : DrawNode { private float fill = 1f; - private float texelSize = 0f; protected new Triangles Source => (Triangles)base.Source; @@ -295,6 +294,11 @@ namespace osu.Game.Graphics.Backgrounds vertexBatch = renderer.CreateQuadBatch(Source.AimCount, 1); } + //Due to triangles having various sizes we would need to set a different "texelSize" value for each of them, which is insanely expensive, thus we should use one single value. + //texelSize computed for an average triangle (size 100) will result in big triangles becoming blurry, so we may just use 0 for all of them. + //But we still need to specify at least something, because otherwise other shader usages will override this value. + float texelSize = 0f; + shader.Bind(); shader.GetUniform("thickness").UpdateValue(ref fill); shader.GetUniform("texelSize").UpdateValue(ref texelSize);