diff --git a/osu.Game.Tests/Visual/Background/TestSceneTrianglesV2Background.cs b/osu.Game.Tests/Visual/Background/TestSceneTrianglesV2Background.cs
index 59922377b0..f6207c46a5 100644
--- a/osu.Game.Tests/Visual/Background/TestSceneTrianglesV2Background.cs
+++ b/osu.Game.Tests/Visual/Background/TestSceneTrianglesV2Background.cs
@@ -12,6 +12,8 @@ namespace osu.Game.Tests.Visual.Background
{
public class TestSceneTrianglesV2Background : OsuTestScene
{
+ private readonly TrianglesV2 triangles;
+
public TestSceneTrianglesV2Background()
{
AddRange(new Drawable[]
@@ -25,10 +27,10 @@ namespace osu.Game.Tests.Visual.Background
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
- Size = new Vector2(200),
+ Size = new Vector2(500),
Masking = true,
CornerRadius = 40,
- Child = new TrianglesV2
+ Child = triangles = new TrianglesV2
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@@ -39,5 +41,12 @@ namespace osu.Game.Tests.Visual.Background
}
});
}
+
+ protected override void LoadComplete()
+ {
+ base.LoadComplete();
+
+ AddSliderStep("Spawn ratio", 0f, 2f, 1f, s => triangles.SpawnRatio = s);
+ }
}
}
diff --git a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs
index da31c6112b..0c4bf59732 100644
--- a/osu.Game/Graphics/Backgrounds/TrianglesV2.cs
+++ b/osu.Game/Graphics/Backgrounds/TrianglesV2.cs
@@ -52,10 +52,16 @@ namespace osu.Game.Graphics.Backgrounds
///
protected virtual bool CreateNewTriangles => true;
+ private readonly BindableFloat spawnRatio = new BindableFloat(1f);
+
///
/// The amount of triangles we want compared to the default distribution.
///
- protected virtual float SpawnRatio => 1;
+ public float SpawnRatio
+ {
+ get => spawnRatio.Value;
+ set => spawnRatio.Value = value;
+ }
///
/// The relative velocity of the triangles. Default is 1.
@@ -94,7 +100,7 @@ namespace osu.Game.Graphics.Backgrounds
colourTop.BindValueChanged(_ => updateTexture());
colourBottom.BindValueChanged(_ => updateTexture(), true);
- addTriangles(true);
+ spawnRatio.BindValueChanged(_ => Reset(), true);
}
private void updateTexture()
@@ -166,7 +172,7 @@ namespace osu.Game.Graphics.Backgrounds
// Limited by the maximum size of QuadVertexBuffer for safety.
const int max_triangles = ushort.MaxValue / (IRenderer.VERTICES_PER_QUAD + 2);
- AimCount = (int)Math.Min(max_triangles, DrawWidth * DrawHeight * 0.001f * SpawnRatio);
+ AimCount = (int)Math.Min(max_triangles, DrawWidth * DrawHeight * 0.0005f * SpawnRatio);
int currentCount = parts.Count;