1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-16 05:52:55 +08:00

Improve curve visualisation.

This commit is contained in:
Dean Herbert 2016-11-28 16:28:47 +09:00
parent bf63be0602
commit b999d92ffb
2 changed files with 8 additions and 6 deletions

View File

@ -43,8 +43,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
{ {
base.LoadComplete(); base.LoadComplete();
for (int i = 0; i < slider.Curve.Path.Count; ++i) for (int i = 0; i < slider.Curve.Length; i += 10)
path.Positions.Add(slider.Curve.Path[i]); path.Positions.Add(slider.Curve.PositionAt(i / slider.Curve.Length));
path.PathWidth = startCircle.DrawWidth / 4; path.PathWidth = startCircle.DrawWidth / 4;

View File

@ -44,11 +44,13 @@ namespace osu.Game.Modes.Osu.Objects
public Vector2 PositionAt(double progress) public Vector2 PositionAt(double progress)
{ {
int index = (int)(progress * (calculatedPath.Count - 1)); progress = MathHelper.Clamp(progress, 0, 1);
Vector2 pos = calculatedPath[index]; double index = progress * (calculatedPath.Count - 1);
if (index != progress)
pos += (calculatedPath[index + 1] - pos) * (float)(progress - index); Vector2 pos = calculatedPath[(int)index];
if (index != (int)index)
pos += (calculatedPath[(int)index + 1] - pos) * (float)(index - (int)index);
return pos; return pos;
} }