mirror of
https://github.com/ppy/osu.git
synced 2024-11-07 13:07:25 +08:00
c64a919a9d
As pointed out in https://github.com/ppy/osu/discussions/16435, beatmaps with too many control points (usually added via external automation apps) could cause the lazer editor to grind to a halt. The overheads here are mostly from the GL side. An eventual goal would be to render this in a smarter way, rather than using thousands of drawables. Until that, this optimisation should help reduce the overhead by omitting control points in close proximity that are redundant for display purposes. I've tried to contain this in the display logic directly, with the goal that it can be ripped out as fast as it was added. Certainly required more changes than I hoped for, but I don't think it's too ugly.
33 lines
1012 B
C#
33 lines
1012 B
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using osu.Framework.Allocation;
|
|
using osu.Framework.Graphics;
|
|
using osu.Game.Beatmaps.ControlPoints;
|
|
using osu.Game.Graphics;
|
|
using osu.Game.Screens.Edit.Components.Timelines.Summary.Visualisations;
|
|
|
|
namespace osu.Game.Screens.Edit.Components.Timelines.Summary.Parts
|
|
{
|
|
public class ControlPointVisualisation : PointVisualisation, IControlPointVisualisationRedundant
|
|
{
|
|
protected readonly ControlPoint Point;
|
|
|
|
public ControlPointVisualisation(ControlPoint point)
|
|
{
|
|
Point = point;
|
|
|
|
Height = 0.25f;
|
|
Origin = Anchor.TopCentre;
|
|
}
|
|
|
|
[BackgroundDependencyLoader]
|
|
private void load(OsuColour colours)
|
|
{
|
|
Colour = Point.GetRepresentingColour(colours);
|
|
}
|
|
|
|
public bool IsRedundant(ControlPoint other) => other.GetType() == Point.GetType();
|
|
}
|
|
}
|