mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 07:33:55 +09:00
Add back the concept of triangle ordering by size.
This commit is contained in:
@ -16,6 +16,7 @@ using osu.Framework.Graphics.Primitives;
|
|||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using osu.Framework.Graphics.Batches;
|
using osu.Framework.Graphics.Batches;
|
||||||
|
using osu.Framework.Lists;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Backgrounds
|
namespace osu.Game.Graphics.Backgrounds
|
||||||
{
|
{
|
||||||
@ -57,7 +58,7 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public float Velocity = 1;
|
public float Velocity = 1;
|
||||||
|
|
||||||
private readonly List<TriangleParticle> parts = new List<TriangleParticle>();
|
private readonly SortedList<TriangleParticle> parts = new SortedList<TriangleParticle>(Comparer<TriangleParticle>.Default);
|
||||||
|
|
||||||
private Shader shader;
|
private Shader shader;
|
||||||
private readonly Texture texture;
|
private readonly Texture texture;
|
||||||
@ -123,15 +124,17 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
float bottomPos = parts[i].Position.Y + triangle_size * parts[i].Scale * 0.866f / DrawHeight;
|
float bottomPos = parts[i].Position.Y + triangle_size * parts[i].Scale * 0.866f / DrawHeight;
|
||||||
|
|
||||||
if (bottomPos < 0)
|
if (bottomPos < 0)
|
||||||
parts[i] = createTriangle(false);
|
parts.RemoveAt(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
addTriangles(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTriangles(bool randomY)
|
private void addTriangles(bool randomY)
|
||||||
{
|
{
|
||||||
int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
int aimTriangleCount = (int)(DrawWidth * DrawHeight * 0.002f / (triangleScale * triangleScale) * SpawnRatio);
|
||||||
|
|
||||||
for (int i = 0; i < aimTriangleCount; i++)
|
for (int i = 0; i < aimTriangleCount - parts.Count; i++)
|
||||||
parts.Add(createTriangle(randomY));
|
parts.Add(createTriangle(randomY));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -229,11 +232,20 @@ namespace osu.Game.Graphics.Backgrounds
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct TriangleParticle
|
public struct TriangleParticle : IComparable<TriangleParticle>
|
||||||
{
|
{
|
||||||
public Vector2 Position;
|
public Vector2 Position;
|
||||||
public Color4 Colour;
|
public Color4 Colour;
|
||||||
public float Scale;
|
public float Scale;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Compares two <see cref="TriangleParticle"/>s. This is a reverse comparer because when the
|
||||||
|
/// triangles are added to the particles list, they should be drawn from largest to smallest
|
||||||
|
/// such that the smaller triangles appear on top.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="other"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public int CompareTo(TriangleParticle other) => other.Scale.CompareTo(Scale);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user