fix linear perfect curves and subpaths

This commit is contained in:
MaxOhn
2021-04-28 21:23:51 +02:00
parent 97f3cb2030
commit bb6ee0332c
8 changed files with 107 additions and 109 deletions
@@ -75,17 +75,6 @@ impl OsuObject {
/ 100.0;
let span_duration = duration / *repeats as f32;
// Ensure path type validity
let path_type = if (*path_type == PathType::PerfectCurve && curve_points.len() > 3)
|| (*path_type == PathType::Linear && curve_points.len() != 2)
{
PathType::Bezier
} else if curve_points.len() == 2 {
PathType::Linear
} else {
*path_type
};
// Build the curve w.r.t. the curve points
let curve = match path_type {
PathType::Linear => Curve::linear(curve_points[0], curve_points[1]),
+4 -15
View File
@@ -62,23 +62,12 @@ impl OsuObject {
/ 100.0;
let span_duration = duration / *repeats as f32;
// Ensure path type validity
let path_type = if (*path_type == PathType::PerfectCurve && curve_points.len() > 3)
|| (*path_type == PathType::Linear && curve_points.len() != 2)
{
PathType::Bezier
} else if curve_points.len() == 2 {
PathType::Linear
} else {
*path_type
};
// Build the curve w.r.t. the curve points
let curve = match path_type {
PathType::Linear => Curve::linear(curve_points[0], curve_points[1]),
PathType::Bezier => Curve::bezier(&curve_points),
PathType::Catmull => Curve::catmull(&curve_points),
PathType::PerfectCurve => Curve::perfect(&curve_points),
PathType::Linear => Curve::linear(curve_points),
PathType::Bezier => Curve::bezier(curve_points),
PathType::Catmull => Curve::catmull(curve_points),
PathType::PerfectCurve => Curve::perfect(curve_points),
};
// Called on each slider object except for the head.