From a6b3797982adf9efd584b623ce4b12b6baabeae3 Mon Sep 17 00:00:00 2001 From: Lubosz Sarnecki Date: Sat, 3 Aug 2024 14:59:32 +0200 Subject: [PATCH] CubicHermiteSpline: Explicitly cast enums to float. Fixes -Wdeprecated-enum-float-conversion on GCC 14. --- libraries/shared/src/CubicHermiteSpline.h | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/libraries/shared/src/CubicHermiteSpline.h b/libraries/shared/src/CubicHermiteSpline.h index f91b25aa7a..00e5339889 100644 --- a/libraries/shared/src/CubicHermiteSpline.h +++ b/libraries/shared/src/CubicHermiteSpline.h @@ -91,7 +91,7 @@ public: // given the spline parameter (0..1) output the arcLength of the spline up to that point. float arcLength(float t) const { - float index = t * NUM_SUBDIVISIONS; + float index = t * static_cast(NUM_SUBDIVISIONS); int prevIndex = std::min(std::max(0, (int)glm::floor(index)), (int)NUM_SUBDIVISIONS); int nextIndex = std::min(std::max(0, (int)glm::ceil(index)), (int)NUM_SUBDIVISIONS); float alpha = glm::fract(index); @@ -109,7 +109,7 @@ public: } int prevIndex = std::min(std::max(0, nextIndex - 1), (int)NUM_SUBDIVISIONS); float alpha = glm::clamp((s - _values[prevIndex]) / (_values[nextIndex] - _values[prevIndex]), 0.0f, 1.0f); - const float DELTA = 1.0f / NUM_SUBDIVISIONS; + const float DELTA = 1.0f / static_cast(NUM_SUBDIVISIONS); return lerp(prevIndex * DELTA, nextIndex * DELTA, alpha); } protected: @@ -117,7 +117,7 @@ protected: void initValues() { // initialize _values with the accumulated arcLength along the spline. - const float DELTA = 1.0f / NUM_SUBDIVISIONS; + const float DELTA = 1.0f / static_cast(NUM_SUBDIVISIONS); float alpha = 0.0f; float accum = 0.0f; _values[0] = 0.0f;