summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2024-09-26 13:48:58 -0400
committerNat Goodspeed <nat@lindenlab.com>2024-09-26 13:48:58 -0400
commit8a6da4d6210192ada4a26ddd397c00d78b08dfcc (patch)
treeb54e474b526128540c824610c43a1a6e6e206c10
parent452e07489b95e8ba60bf585878f9c0ed8e13b5e3 (diff)
Rename our lerp() to flerp(); call where MSVC balks at std::lerp().
Now the lerp() in global namespace is std::lerp(), but it remains true that for some calls to std::lerp(), MSVC issues fatal argument conversion warnings. In those places, call flerp() (our historic lerp()) instead.
-rw-r--r--indra/llmath/llmath.h8
-rw-r--r--indra/llmath/llvolume.cpp28
-rw-r--r--indra/newview/llpanelprimmediacontrols.cpp2
3 files changed, 19 insertions, 19 deletions
diff --git a/indra/llmath/llmath.h b/indra/llmath/llmath.h
index 75284ef57e..1d6d986207 100644
--- a/indra/llmath/llmath.h
+++ b/indra/llmath/llmath.h
@@ -358,11 +358,11 @@ inline F32 snap_to_sig_figs(F32 foo, S32 sig_figs)
return new_foo;
}
+using std::lerp;
// Even though there's now a std::lerp() function that appears to do the same
-// as this function, for some reason MSVC likes this one better. Publishing
-// std::lerp() into the global namespace instead of defining this function
-// results in fatal argument conversion warnings.
-inline F32 lerp(F32 a, F32 b, F32 u)
+// 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);
}
diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 700e61467b..275e5bcb43 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 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ 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),
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 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ 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),
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 + lerp(0,params.getShear().mV[0],s)
- + lerp(-skew ,skew, t) * 0.5f,
- c + lerp(0,params.getShear().mV[1],s),
+ 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),
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<np;i++)
{
F32 t = lerp(params.getBegin(),params.getEnd(),(F32)i * mStep);
- mPath[i].mPos.set(lerp(0,params.getShear().mV[0],t),
- lerp(0,params.getShear().mV[1],t),
+ mPath[i].mPos.set(flerp(0,params.getShear().mV[0],t),
+ flerp(0,params.getShear().mV[1],t),
t - 0.5f);
LLQuaternion quat;
quat.setQuat(lerp(F_PI * params.getTwistBegin(),F_PI * params.getTwist(),t),0,0,1);
@@ -1559,10 +1559,10 @@ bool LLPath::generate(const LLPathParams& params, F32 detail, S32 split,
{
F32 t = (F32)i * mStep;
mPath[i].mPos.set(0,
- lerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t),
+ flerp(0, -sin(F_PI*params.getTwist()*t)*0.5f,t),
lerp(-0.5f, cos(F_PI*params.getTwist()*t)*0.5f,t));
- mPath[i].mScale.set(lerp(1,params.getScale().mV[0],t),
- lerp(1,params.getScale().mV[1],t), 0,1);
+ mPath[i].mScale.set(flerp(1,params.getScale().mV[0],t),
+ flerp(1,params.getScale().mV[1],t), 0,1);
mPath[i].mTexT = t;
LLQuaternion quat;
quat.setQuat(F_PI * params.getTwist() * t,1,0,0);
diff --git a/indra/newview/llpanelprimmediacontrols.cpp b/indra/newview/llpanelprimmediacontrols.cpp
index 1af585708e..1a092234fb 100644
--- a/indra/newview/llpanelprimmediacontrols.cpp
+++ b/indra/newview/llpanelprimmediacontrols.cpp
@@ -777,7 +777,7 @@ void LLPanelPrimMediaControls::draw()
else if(mFadeTimer.getStarted())
{
F32 time = mFadeTimer.getElapsedTimeF32();
- alpha *= llmax(lerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
+ alpha *= llmax(flerp(1.0, 0.0, time / mControlFadeTime), 0.0f);
if(time >= mControlFadeTime)
{