mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +08:00
ControlPoint -> PathControlPoint
Also Curve -> Path.
This commit is contained in:
parent
9cb4374b51
commit
bb2f8deb18
@ -42,7 +42,7 @@ namespace osu.Game.Rulesets.Catch.Tests
|
||||
Vector2.Zero,
|
||||
new Vector2(width * CatchPlayfield.BASE_WIDTH, 0)
|
||||
},
|
||||
CurveType = CurveType.Linear,
|
||||
PathType = PathType.Linear,
|
||||
Distance = width * CatchPlayfield.BASE_WIDTH,
|
||||
StartTime = i * 2000,
|
||||
NewCombo = i % 8 == 0
|
||||
|
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Catch.Beatmaps
|
||||
StartTime = obj.StartTime,
|
||||
Samples = obj.Samples,
|
||||
ControlPoints = curveData.ControlPoints,
|
||||
CurveType = curveData.CurveType,
|
||||
PathType = curveData.PathType,
|
||||
Distance = curveData.Distance,
|
||||
RepeatSamples = curveData.RepeatSamples,
|
||||
RepeatCount = curveData.RepeatCount,
|
||||
|
@ -50,7 +50,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
if (TickDistance == 0)
|
||||
return;
|
||||
|
||||
var length = Curve.Distance;
|
||||
var length = Path.Distance;
|
||||
var tickDistance = Math.Min(TickDistance, length);
|
||||
var spanDuration = length / Velocity;
|
||||
|
||||
@ -95,7 +95,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
AddNested(new TinyDroplet
|
||||
{
|
||||
StartTime = t,
|
||||
X = X + Curve.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
|
||||
X = X + Path.PositionAt(progress).X / CatchPlayfield.BASE_WIDTH,
|
||||
Samples = new List<SampleInfo>(Samples.Select(s => new SampleInfo
|
||||
{
|
||||
Bank = s.Bank,
|
||||
@ -110,7 +110,7 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
AddNested(new Droplet
|
||||
{
|
||||
StartTime = time,
|
||||
X = X + Curve.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
|
||||
X = X + Path.PositionAt(distanceProgress).X / CatchPlayfield.BASE_WIDTH,
|
||||
Samples = new List<SampleInfo>(Samples.Select(s => new SampleInfo
|
||||
{
|
||||
Bank = s.Bank,
|
||||
@ -127,12 +127,12 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
{
|
||||
Samples = Samples,
|
||||
StartTime = spanStartTime + spanDuration,
|
||||
X = X + Curve.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH
|
||||
X = X + Path.PositionAt(reversed ? 0 : 1).X / CatchPlayfield.BASE_WIDTH
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public double EndTime => StartTime + this.SpanCount() * Curve.Distance / Velocity;
|
||||
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
||||
|
||||
public float EndX => X + this.CurvePositionAt(1).X / CatchPlayfield.BASE_WIDTH;
|
||||
|
||||
@ -140,24 +140,24 @@ namespace osu.Game.Rulesets.Catch.Objects
|
||||
|
||||
public double Distance
|
||||
{
|
||||
get { return Curve.Distance; }
|
||||
set { Curve.Distance = value; }
|
||||
get { return Path.Distance; }
|
||||
set { Path.Distance = value; }
|
||||
}
|
||||
|
||||
public SliderCurve Curve { get; } = new SliderCurve();
|
||||
public SliderPath Path { get; } = new SliderPath();
|
||||
|
||||
public Vector2[] ControlPoints
|
||||
{
|
||||
get { return Curve.ControlPoints; }
|
||||
set { Curve.ControlPoints = value; }
|
||||
get { return Path.ControlPoints; }
|
||||
set { Path.ControlPoints = value; }
|
||||
}
|
||||
|
||||
public List<List<SampleInfo>> RepeatSamples { get; set; } = new List<List<SampleInfo>>();
|
||||
|
||||
public CurveType CurveType
|
||||
public PathType PathType
|
||||
{
|
||||
get { return Curve.CurveType; }
|
||||
set { Curve.CurveType = value; }
|
||||
get { return Path.PathType; }
|
||||
set { Path.PathType = value; }
|
||||
}
|
||||
|
||||
public double? LegacyLastTickOffset { get; set; }
|
||||
|
@ -181,7 +181,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
var slider = new Slider
|
||||
{
|
||||
CurveType = CurveType.Linear,
|
||||
PathType = PathType.Linear,
|
||||
StartTime = Time.Current + 1000,
|
||||
Position = new Vector2(-200, 0),
|
||||
ControlPoints = new[]
|
||||
@ -207,7 +207,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
var slider = new Slider
|
||||
{
|
||||
CurveType = CurveType.Bezier,
|
||||
PathType = PathType.Bezier,
|
||||
StartTime = Time.Current + 1000,
|
||||
Position = new Vector2(-200, 0),
|
||||
ControlPoints = new[]
|
||||
@ -232,7 +232,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
var slider = new Slider
|
||||
{
|
||||
CurveType = CurveType.Linear,
|
||||
PathType = PathType.Linear,
|
||||
StartTime = Time.Current + 1000,
|
||||
Position = new Vector2(0, 0),
|
||||
ControlPoints = new[]
|
||||
@ -264,7 +264,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
{
|
||||
StartTime = Time.Current + 1000,
|
||||
Position = new Vector2(-100, 0),
|
||||
CurveType = CurveType.Catmull,
|
||||
PathType = PathType.Catmull,
|
||||
ControlPoints = new[]
|
||||
{
|
||||
Vector2.Zero,
|
||||
|
@ -24,8 +24,8 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
typeof(SliderCircleSelectionMask),
|
||||
typeof(SliderBodyPiece),
|
||||
typeof(SliderCircle),
|
||||
typeof(ControlPointVisualiser),
|
||||
typeof(ControlPointPiece)
|
||||
typeof(PathControlPointVisualiser),
|
||||
typeof(PathControlPointPiece)
|
||||
};
|
||||
|
||||
private readonly DrawableSlider drawableObject;
|
||||
@ -41,7 +41,7 @@ namespace osu.Game.Rulesets.Osu.Tests
|
||||
new Vector2(150, 150),
|
||||
new Vector2(300, 0)
|
||||
},
|
||||
CurveType = CurveType.Bezier,
|
||||
PathType = PathType.Bezier,
|
||||
Distance = 350
|
||||
};
|
||||
|
||||
|
@ -36,7 +36,7 @@ namespace osu.Game.Rulesets.Osu.Beatmaps
|
||||
StartTime = original.StartTime,
|
||||
Samples = original.Samples,
|
||||
ControlPoints = curveData.ControlPoints,
|
||||
CurveType = curveData.CurveType,
|
||||
PathType = curveData.PathType,
|
||||
Distance = curveData.Distance,
|
||||
RepeatSamples = curveData.RepeatSamples,
|
||||
RepeatCount = curveData.RepeatCount,
|
||||
|
@ -108,7 +108,7 @@ namespace osu.Game.Rulesets.Osu.Difficulty.Preprocessing
|
||||
progress = progress % 1;
|
||||
|
||||
// ReSharper disable once PossibleInvalidOperationException (bugged in current r# version)
|
||||
var diff = slider.StackedPosition + slider.Curve.PositionAt(progress) - slider.LazyEndPosition.Value;
|
||||
var diff = slider.StackedPosition + slider.Path.PositionAt(progress) - slider.LazyEndPosition.Value;
|
||||
float dist = diff.Length;
|
||||
|
||||
if (dist > approxFollowCircleRadius)
|
||||
|
@ -14,7 +14,7 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||
{
|
||||
public class ControlPointPiece : CompositeDrawable
|
||||
public class PathControlPointPiece : CompositeDrawable
|
||||
{
|
||||
private readonly Slider slider;
|
||||
private readonly int index;
|
||||
@ -25,7 +25,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
public ControlPointPiece(Slider slider, int index)
|
||||
public PathControlPointPiece(Slider slider, int index)
|
||||
{
|
||||
this.slider = slider;
|
||||
this.index = index;
|
||||
@ -97,7 +97,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||
newControlPoints[index - 1] = newControlPoints[index];
|
||||
|
||||
slider.ControlPoints = newControlPoints;
|
||||
slider.Curve.Calculate(true);
|
||||
slider.Path.Calculate(true);
|
||||
|
||||
return true;
|
||||
}
|
@ -7,26 +7,26 @@ using osu.Game.Rulesets.Osu.Objects;
|
||||
|
||||
namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||
{
|
||||
public class ControlPointVisualiser : CompositeDrawable
|
||||
public class PathControlPointVisualiser : CompositeDrawable
|
||||
{
|
||||
private readonly Slider slider;
|
||||
|
||||
private readonly Container<ControlPointPiece> pieces;
|
||||
private readonly Container<PathControlPointPiece> pieces;
|
||||
|
||||
public ControlPointVisualiser(Slider slider)
|
||||
public PathControlPointVisualiser(Slider slider)
|
||||
{
|
||||
this.slider = slider;
|
||||
|
||||
InternalChild = pieces = new Container<ControlPointPiece> { RelativeSizeAxes = Axes.Both };
|
||||
InternalChild = pieces = new Container<PathControlPointPiece> { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
slider.ControlPointsChanged += _ => updateControlPoints();
|
||||
updateControlPoints();
|
||||
slider.ControlPointsChanged += _ => updatePathControlPoints();
|
||||
updatePathControlPoints();
|
||||
}
|
||||
|
||||
private void updateControlPoints()
|
||||
private void updatePathControlPoints()
|
||||
{
|
||||
while (slider.ControlPoints.Length > pieces.Count)
|
||||
pieces.Add(new ControlPointPiece(slider, pieces.Count));
|
||||
pieces.Add(new PathControlPointPiece(slider, pieces.Count));
|
||||
while (slider.ControlPoints.Length < pieces.Count)
|
||||
pieces.Remove(pieces[pieces.Count - 1]);
|
||||
}
|
@ -25,10 +25,10 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks.Components
|
||||
switch (position)
|
||||
{
|
||||
case SliderPosition.Start:
|
||||
Position = slider.StackedPosition + slider.Curve.PositionAt(0);
|
||||
Position = slider.StackedPosition + slider.Path.PositionAt(0);
|
||||
break;
|
||||
case SliderPosition.End:
|
||||
Position = slider.StackedPosition + slider.Curve.PositionAt(1);
|
||||
Position = slider.StackedPosition + slider.Path.PositionAt(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Edit.Masks.SliderMasks
|
||||
new SliderBodyPiece(sliderObject),
|
||||
headMask = new SliderCircleSelectionMask(slider.HeadCircle, sliderObject, SliderPosition.Start),
|
||||
new SliderCircleSelectionMask(slider.TailCircle, sliderObject, SliderPosition.End),
|
||||
new ControlPointVisualiser(sliderObject),
|
||||
new PathControlPointVisualiser(sliderObject),
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Osu.Mods
|
||||
newControlPoints[i] = new Vector2(slider.ControlPoints[i].X, -slider.ControlPoints[i].Y);
|
||||
|
||||
slider.ControlPoints = newControlPoints;
|
||||
slider.Curve?.Calculate(); // Recalculate the slider curve
|
||||
slider.Path?.Calculate(); // Recalculate the slider curve
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
|
||||
double completionProgress = MathHelper.Clamp((Time.Current - slider.StartTime) / slider.Duration, 0, 1);
|
||||
|
||||
foreach (var c in components.OfType<ISliderProgress>()) c.UpdateProgress(completionProgress);
|
||||
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Curve.PositionAt(Body.SnakedStart ?? 0), slider.Curve.PositionAt(Body.SnakedEnd ?? 0));
|
||||
foreach (var c in components.OfType<ITrackSnaking>()) c.UpdateSnakingPosition(slider.Path.PositionAt(Body.SnakedStart ?? 0), slider.Path.PositionAt(Body.SnakedEnd ?? 0));
|
||||
foreach (var t in components.OfType<IRequireTracking>()) t.Tracking = Ball.Tracking;
|
||||
|
||||
Size = Body.Size;
|
||||
|
@ -75,7 +75,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
public void Refresh()
|
||||
{
|
||||
// Generate the entire curve
|
||||
slider.Curve.GetPathToProgress(CurrentCurve, 0, 1);
|
||||
slider.Path.GetPathToProgress(CurrentCurve, 0, 1);
|
||||
SetVertices(CurrentCurve);
|
||||
|
||||
// The body is sized to the full path size to avoid excessive autosize computations
|
||||
@ -103,7 +103,7 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
|
||||
SnakedStart = p0;
|
||||
SnakedEnd = p1;
|
||||
|
||||
slider.Curve.GetPathToProgress(CurrentCurve, p0, p1);
|
||||
slider.Path.GetPathToProgress(CurrentCurve, p0, p1);
|
||||
|
||||
SetVertices(CurrentCurve);
|
||||
|
||||
|
@ -24,7 +24,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
public event Action<Vector2[]> ControlPointsChanged;
|
||||
|
||||
public double EndTime => StartTime + this.SpanCount() * Curve.Distance / Velocity;
|
||||
public double EndTime => StartTime + this.SpanCount() * Path.Distance / Velocity;
|
||||
public double Duration => EndTime - StartTime;
|
||||
|
||||
public Vector2 StackedPositionAt(double t) => StackedPosition + this.CurvePositionAt(t);
|
||||
@ -52,16 +52,16 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
}
|
||||
}
|
||||
|
||||
public SliderCurve Curve { get; } = new SliderCurve();
|
||||
public SliderPath Path { get; } = new SliderPath();
|
||||
|
||||
public Vector2[] ControlPoints
|
||||
{
|
||||
get => Curve.ControlPoints;
|
||||
get => Path.ControlPoints;
|
||||
set
|
||||
{
|
||||
if (Curve.ControlPoints == value)
|
||||
if (Path.ControlPoints == value)
|
||||
return;
|
||||
Curve.ControlPoints = value;
|
||||
Path.ControlPoints = value;
|
||||
|
||||
ControlPointsChanged?.Invoke(value);
|
||||
|
||||
@ -70,16 +70,16 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
}
|
||||
}
|
||||
|
||||
public CurveType CurveType
|
||||
public PathType PathType
|
||||
{
|
||||
get { return Curve.CurveType; }
|
||||
set { Curve.CurveType = value; }
|
||||
get { return Path.PathType; }
|
||||
set { Path.PathType = value; }
|
||||
}
|
||||
|
||||
public double Distance
|
||||
{
|
||||
get { return Curve.Distance; }
|
||||
set { Curve.Distance = value; }
|
||||
get { return Path.Distance; }
|
||||
set { Path.Distance = value; }
|
||||
}
|
||||
|
||||
public override Vector2 Position
|
||||
@ -189,7 +189,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
|
||||
private void createTicks()
|
||||
{
|
||||
var length = Curve.Distance;
|
||||
var length = Path.Distance;
|
||||
var tickDistance = MathHelper.Clamp(TickDistance, 0, length);
|
||||
|
||||
if (tickDistance == 0) return;
|
||||
@ -228,7 +228,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
SpanIndex = span,
|
||||
SpanStartTime = spanStartTime,
|
||||
StartTime = spanStartTime + timeProgress * SpanDuration,
|
||||
Position = Position + Curve.PositionAt(distanceProgress),
|
||||
Position = Position + Path.PositionAt(distanceProgress),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = sampleList
|
||||
@ -246,7 +246,7 @@ namespace osu.Game.Rulesets.Osu.Objects
|
||||
RepeatIndex = repeatIndex,
|
||||
SpanDuration = SpanDuration,
|
||||
StartTime = StartTime + repeat * SpanDuration,
|
||||
Position = Position + Curve.PositionAt(repeat % 2),
|
||||
Position = Position + Path.PositionAt(repeat % 2),
|
||||
StackHeight = StackHeight,
|
||||
Scale = Scale,
|
||||
Samples = new List<SampleInfo>(RepeatSamples[repeatIndex])
|
||||
|
@ -37,7 +37,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
{
|
||||
newCombo |= forceNewCombo;
|
||||
comboOffset += extraComboOffset;
|
||||
@ -52,7 +52,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
||||
ComboOffset = comboOffset,
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
PathType = pathType,
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
|
@ -70,7 +70,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
}
|
||||
else if (type.HasFlag(ConvertHitObjectType.Slider))
|
||||
{
|
||||
CurveType curveType = CurveType.Catmull;
|
||||
PathType pathType = PathType.Catmull;
|
||||
double length = 0;
|
||||
|
||||
string[] pointSplit = split[5].Split('|');
|
||||
@ -90,16 +90,16 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
switch (t)
|
||||
{
|
||||
case @"C":
|
||||
curveType = CurveType.Catmull;
|
||||
pathType = PathType.Catmull;
|
||||
break;
|
||||
case @"B":
|
||||
curveType = CurveType.Bezier;
|
||||
pathType = PathType.Bezier;
|
||||
break;
|
||||
case @"L":
|
||||
curveType = CurveType.Linear;
|
||||
pathType = PathType.Linear;
|
||||
break;
|
||||
case @"P":
|
||||
curveType = CurveType.PerfectCurve;
|
||||
pathType = PathType.PerfectCurve;
|
||||
break;
|
||||
}
|
||||
|
||||
@ -113,8 +113,8 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
// osu-stable special-cased colinear perfect curves to a CurveType.Linear
|
||||
bool isLinear(Vector2[] p) => Precision.AlmostEquals(0, (p[1].Y - p[0].Y) * (p[2].X - p[0].X) - (p[1].X - p[0].X) * (p[2].Y - p[0].Y));
|
||||
|
||||
if (points.Length == 3 && curveType == CurveType.PerfectCurve && isLinear(points))
|
||||
curveType = CurveType.Linear;
|
||||
if (points.Length == 3 && pathType == PathType.PerfectCurve && isLinear(points))
|
||||
pathType = PathType.Linear;
|
||||
|
||||
int repeatCount = Convert.ToInt32(split[6], CultureInfo.InvariantCulture);
|
||||
|
||||
@ -178,7 +178,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
for (int i = 0; i < nodes; i++)
|
||||
nodeSamples.Add(convertSoundType(nodeSoundTypes[i], nodeBankInfos[i]));
|
||||
|
||||
result = CreateSlider(pos, combo, comboOffset, points, length, curveType, repeatCount, nodeSamples);
|
||||
result = CreateSlider(pos, combo, comboOffset, points, length, pathType, repeatCount, nodeSamples);
|
||||
}
|
||||
else if (type.HasFlag(ConvertHitObjectType.Spinner))
|
||||
{
|
||||
@ -268,11 +268,11 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// <param name="comboOffset">When starting a new combo, the offset of the new combo relative to the current one.</param>
|
||||
/// <param name="controlPoints">The slider control points.</param>
|
||||
/// <param name="length">The slider length.</param>
|
||||
/// <param name="curveType">The slider curve type.</param>
|
||||
/// <param name="pathType">The slider curve type.</param>
|
||||
/// <param name="repeatCount">The slider repeat count.</param>
|
||||
/// <param name="repeatSamples">The samples to be played when the repeat nodes are hit. This includes the head and tail of the slider.</param>
|
||||
/// <returns>The hit object.</returns>
|
||||
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples);
|
||||
protected abstract HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> repeatSamples);
|
||||
|
||||
/// <summary>
|
||||
/// Creates a legacy Spinner-type hit object.
|
||||
|
@ -20,9 +20,9 @@ namespace osu.Game.Rulesets.Objects.Legacy
|
||||
/// <summary>
|
||||
/// <see cref="ConvertSlider"/>s don't need a curve since they're converted to ruleset-specific hitobjects.
|
||||
/// </summary>
|
||||
public SliderCurve Curve { get; } = null;
|
||||
public SliderPath Path { get; } = null;
|
||||
public Vector2[] ControlPoints { get; set; }
|
||||
public CurveType CurveType { get; set; }
|
||||
public PathType PathType { get; set; }
|
||||
|
||||
public double Distance { get; set; }
|
||||
|
||||
|
@ -26,14 +26,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Mania
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
{
|
||||
return new ConvertSlider
|
||||
{
|
||||
X = position.X,
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
PathType = pathType,
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
};
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
{
|
||||
newCombo |= forceNewCombo;
|
||||
comboOffset += extraComboOffset;
|
||||
@ -53,7 +53,7 @@ namespace osu.Game.Rulesets.Objects.Legacy.Osu
|
||||
ComboOffset = comboOffset,
|
||||
ControlPoints = controlPoints,
|
||||
Distance = Math.Max(0, length),
|
||||
CurveType = curveType,
|
||||
PathType = pathType,
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
|
@ -23,13 +23,13 @@ namespace osu.Game.Rulesets.Objects.Legacy.Taiko
|
||||
return new ConvertHit();
|
||||
}
|
||||
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, CurveType curveType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
protected override HitObject CreateSlider(Vector2 position, bool newCombo, int comboOffset, Vector2[] controlPoints, double length, PathType pathType, int repeatCount, List<List<SampleInfo>> repeatSamples)
|
||||
{
|
||||
return new ConvertSlider
|
||||
{
|
||||
ControlPoints = controlPoints,
|
||||
Distance = length,
|
||||
CurveType = curveType,
|
||||
PathType = pathType,
|
||||
RepeatSamples = repeatSamples,
|
||||
RepeatCount = repeatCount
|
||||
};
|
||||
|
@ -10,13 +10,13 @@ using OpenTK;
|
||||
|
||||
namespace osu.Game.Rulesets.Objects
|
||||
{
|
||||
public class SliderCurve
|
||||
public class SliderPath
|
||||
{
|
||||
public double Distance;
|
||||
|
||||
public Vector2[] ControlPoints;
|
||||
|
||||
public CurveType CurveType = CurveType.PerfectCurve;
|
||||
public PathType PathType = PathType.PerfectCurve;
|
||||
|
||||
public Vector2 Offset;
|
||||
|
||||
@ -25,15 +25,15 @@ namespace osu.Game.Rulesets.Objects
|
||||
|
||||
private List<Vector2> calculateSubpath(ReadOnlySpan<Vector2> subControlPoints)
|
||||
{
|
||||
switch (CurveType)
|
||||
switch (PathType)
|
||||
{
|
||||
case CurveType.Linear:
|
||||
case PathType.Linear:
|
||||
var result = new List<Vector2>(subControlPoints.Length);
|
||||
foreach (var c in subControlPoints)
|
||||
result.Add(c);
|
||||
|
||||
return result;
|
||||
case CurveType.PerfectCurve:
|
||||
case PathType.PerfectCurve:
|
||||
//we can only use CircularArc iff we have exactly three control points and no dissection.
|
||||
if (ControlPoints.Length != 3 || subControlPoints.Length != 3)
|
||||
break;
|
||||
@ -46,7 +46,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
break;
|
||||
|
||||
return subpath;
|
||||
case CurveType.Catmull:
|
||||
case PathType.Catmull:
|
||||
return new CatmullApproximator(subControlPoints).CreateCatmull();
|
||||
}
|
||||
|
||||
@ -93,7 +93,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
Vector2 diff = calculatedPath[i + 1] - calculatedPath[i];
|
||||
double d = diff.Length;
|
||||
|
||||
// Shorten slider curves that are too long compared to what's
|
||||
// Shorten slider paths that are too long compared to what's
|
||||
// in the .osu file.
|
||||
if (Distance - l < d)
|
||||
{
|
||||
@ -109,7 +109,7 @@ namespace osu.Game.Rulesets.Objects
|
||||
cumulativeLength.Add(l);
|
||||
}
|
||||
|
||||
// Lengthen slider curves that are too short compared to what's
|
||||
// Lengthen slider paths that are too short compared to what's
|
||||
// in the .osu file.
|
||||
if (l < Distance && calculatedPath.Count > 1)
|
||||
{
|
||||
@ -191,10 +191,10 @@ namespace osu.Game.Rulesets.Objects
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the slider curve until a given progress that ranges from 0 (beginning of the slider)
|
||||
/// Computes the slider path until a given progress that ranges from 0 (beginning of the slider)
|
||||
/// to 1 (end of the slider) and stores the generated path in the given list.
|
||||
/// </summary>
|
||||
/// <param name="path">The list to be filled with the computed curve.</param>
|
||||
/// <param name="path">The list to be filled with the computed path.</param>
|
||||
/// <param name="p0">Start progress. Ranges from 0 (beginning of the slider) to 1 (end of the slider).</param>
|
||||
/// <param name="p1">End progress. Ranges from 0 (beginning of the slider) to 1 (end of the slider).</param>
|
||||
public void GetPathToProgress(List<Vector2> path, double p0, double p1)
|
||||
@ -219,10 +219,10 @@ namespace osu.Game.Rulesets.Objects
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Computes the position on the slider at a given progress that ranges from 0 (beginning of the curve)
|
||||
/// to 1 (end of the curve).
|
||||
/// Computes the position on the slider at a given progress that ranges from 0 (beginning of the path)
|
||||
/// to 1 (end of the path).
|
||||
/// </summary>
|
||||
/// <param name="progress">Ranges from 0 (beginning of the curve) to 1 (end of the curve).</param>
|
||||
/// <param name="progress">Ranges from 0 (beginning of the path) to 1 (end of the path).</param>
|
||||
/// <returns></returns>
|
||||
public Vector2 PositionAt(double progress)
|
||||
{
|
@ -13,7 +13,7 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <summary>
|
||||
/// The curve.
|
||||
/// </summary>
|
||||
SliderCurve Curve { get; }
|
||||
SliderPath Path { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The control points that shape the curve.
|
||||
@ -23,7 +23,7 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <summary>
|
||||
/// The type of curve.
|
||||
/// </summary>
|
||||
CurveType CurveType { get; }
|
||||
PathType PathType { get; }
|
||||
}
|
||||
|
||||
public static class HasCurveExtensions
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Rulesets.Objects.Types
|
||||
/// <param name="progress">[0, 1] where 0 is the start time of the <see cref="HitObject"/> and 1 is the end time of the <see cref="HitObject"/>.</param>
|
||||
/// <returns>The position on the curve.</returns>
|
||||
public static Vector2 CurvePositionAt(this IHasCurve obj, double progress)
|
||||
=> obj.Curve.PositionAt(obj.ProgressAt(progress));
|
||||
=> obj.Path.PositionAt(obj.ProgressAt(progress));
|
||||
|
||||
/// <summary>
|
||||
/// Computes the progress along the curve relative to how much of the <see cref="HitObject"/> has been completed.
|
||||
|
@ -3,7 +3,7 @@
|
||||
|
||||
namespace osu.Game.Rulesets.Objects.Types
|
||||
{
|
||||
public enum CurveType
|
||||
public enum PathType
|
||||
{
|
||||
Catmull,
|
||||
Bezier,
|
Loading…
Reference in New Issue
Block a user