Skip to content

Commit de69b9f

Browse files
committed
Fix builtin types in parameter animation, causing MSVC warnings.
1 parent 4a48222 commit de69b9f

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/libs/math/math/Interpolation/ParameterAnimation.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ struct Bezier
232232
T_parameter mp33 = mp3 * mp3 * mp3;
233233
T_parameter r = std::sqrt(mp33);
234234
T_parameter t = -q2 / r;
235-
T_parameter cosphi = t < -1.f ? -1.f : t > 1.f ? 1. : t;
235+
T_parameter cosphi = t < -1.f ? -1.f : t > 1.f ? 1.f : t;
236236
T_parameter phi = std::acos(cosphi);
237237
T_parameter t1 = cubeRoot(r) * 2.f;
238238

@@ -332,14 +332,16 @@ struct MassSpringDamper
332332
{
333333
T_parameter mDecayRate = mDampening / (2 * mMass);
334334
T_parameter mAngularFreq =
335-
sqrt((4 * mSpringStrength * mMass) - std::pow(mDampening, 2)) / (2 * mMass);
335+
sqrt((T_parameter{4} * mSpringStrength * mMass) - std::pow(mDampening, T_parameter{2}))
336+
/ (T_parameter{2} * mMass);
336337
// This 10 times log(2)/mDecayRate this wait for the decay to reach 1/1024
337338
T_parameter mLifetime =
338339
T_parameter{10} * (T_parameter{0.69314718056} / mDecayRate);
339340
T_parameter t = aInput * mLifetime;
341+
const T_parameter g1{1};
340342
T_parameter value =
341-
1 + (-1 * std::exp(-mDecayRate * t) * std::cos(mAngularFreq * t))
342-
+ (((mInitialVelocity + mDecayRate * -1.) / mAngularFreq)
343+
g1 + (-g1 * std::exp(-mDecayRate * t) * std::cos(mAngularFreq * t))
344+
+ (((mInitialVelocity + mDecayRate * -g1) / mAngularFreq)
343345
* std::exp(-mDecayRate * t) * std::sin(mAngularFreq * t));
344346
return value;
345347
}

0 commit comments

Comments
 (0)