From 62e0c9226eb091760bbf92128c44e187f07dab87 Mon Sep 17 00:00:00 2001 From: vaxerski <43317083+vaxerski@users.noreply.github.com> Date: Fri, 3 Mar 2023 13:17:11 +0000 Subject: [PATCH] Up the bezier bake count --- src/helpers/BezierCurve.cpp | 4 ++-- src/helpers/BezierCurve.hpp | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/helpers/BezierCurve.cpp b/src/helpers/BezierCurve.cpp index f628c24f..440a87c0 100644 --- a/src/helpers/BezierCurve.cpp +++ b/src/helpers/BezierCurve.cpp @@ -61,8 +61,8 @@ float CBezierCurve::getYForPoint(float x) { } // in the name of performance i shall make a hack - const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, 199)]; - const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, 199)]; + const auto LOWERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * lowerT), 0, BAKEDPOINTS - 1)]; + const auto UPPERPOINT = &m_aPointsBaked[std::clamp((int)((float)BAKEDPOINTS * upperT), 0, BAKEDPOINTS - 1)]; const auto PERCINDELTA = (x - LOWERPOINT->x) / (UPPERPOINT->x - LOWERPOINT->x); diff --git a/src/helpers/BezierCurve.hpp b/src/helpers/BezierCurve.hpp index 81cf74b6..540d33a7 100644 --- a/src/helpers/BezierCurve.hpp +++ b/src/helpers/BezierCurve.hpp @@ -3,7 +3,7 @@ #include "../defines.hpp" #include -constexpr int BAKEDPOINTS = 200; +constexpr int BAKEDPOINTS = 255; constexpr float INVBAKEDPOINTS = 1.f / BAKEDPOINTS; // an implementation of a cubic bezier curve