From d3833b6d618ff05f44c28eab67bc91ee5a3ba92d Mon Sep 17 00:00:00 2001 From: Ansariel Hiller Date: Fri, 27 Sep 2024 03:35:42 +0200 Subject: Fix lerp issues and eliminate flerp in favor of std::lerp (#2712) --- indra/llmath/llmath.h | 9 +-------- indra/llmath/llvolume.cpp | 28 ++++++++++++++-------------- indra/newview/llpanelprimmediacontrols.cpp | 2 +- 3 files changed, 16 insertions(+), 23 deletions(-) (limited to 'indra') diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h index 1d6d986207..0348dad8fe 100644 --- a/indra/llmath/llmath.h +++ b/indra/llmath/llmath.h @@ -359,13 +359,6 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs) } using std::lerp; -// Even though there's now a std::lerp() function that appears to do the same -// as this function, in some cases MSVC likes this one better: some calls to -// std::lerp() produce fatal argument conversion warnings. -inline F32 flerp(F32 a, F32 b, F32 u) -{ - return a + ((b - a) * u); -} inline F32 lerp2d(F32 x00, F32 x01, F32 x10, F32 x11, F32 u, F32 v) { @@ -490,7 +483,7 @@ inline U32 get_next_power_two(U32 val, U32 max_power_two) //get the gaussian value given the linear distance from axis x and guassian value o inline F32 llgaussian(F32 x, F32 o) { - return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2*o*o)); + return 1.f/(F_SQRT_TWO_PI*o)*powf(F_E, -(x*x)/(2.f*o*o)); } //helper function for removing outliers diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp index 275e5bcb43..00a56edf68 100644 --- a/indra/llmath/llvolume.cpp +++ b/indra/llmath/llvolume.cpp @@ -1294,9 +1294,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) - + flerp(-skew ,skew, t) * 0.5f, - c + flerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + lerp(0.f,params.getShear().mV[0],s) + + lerp(-skew ,skew, t) * 0.5f, + c + lerp(0.f,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), hole_y * lerp(taper_y_begin, taper_y_end, t), @@ -1327,9 +1327,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); s = sin(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) - + flerp(-skew ,skew, t) * 0.5f, - c + flerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + lerp(0.f,params.getShear().mV[0],s) + + lerp(-skew ,skew, t) * 0.5f, + c + lerp(0.f,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), @@ -1354,9 +1354,9 @@ void LLPath::genNGon(const LLPathParams& params, S32 sides, F32 startOff, F32 en c = cos(ang)*lerp(radius_start, radius_end, t); s = sin(ang)*lerp(radius_start, radius_end, t); - pt->mPos.set(0 + flerp(0,params.getShear().mV[0],s) - + flerp(-skew ,skew, t) * 0.5f, - c + flerp(0,params.getShear().mV[1],s), + pt->mPos.set(0 + lerp(0.f,params.getShear().mV[0],s) + + lerp(-skew ,skew, t) * 0.5f, + c + lerp(0.f,params.getShear().mV[1],s), s); pt->mScale.set(hole_x * lerp(taper_x_begin, taper_x_end, t), hole_y * lerp(taper_y_begin, taper_y_end, t), @@ -1494,8 +1494,8 @@ bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split, for (S32 i=0;i= mControlFadeTime) { -- cgit v1.2.3