QuaternionSlerp: Fix GCC issue & minor refactoring (Reversing thing mistake)

This commit is contained in:
s1lent 2019-08-26 02:51:40 +07:00
parent 411a02843e
commit da591f8cb3

View File

@ -615,22 +615,22 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
float sclp, sclq;
float cosom = (p[0] * q[0] + p[1] * q[1] + p[2] * q[2] + p[3] * q[3]);
if ((1.0 + cosom) > 0.00000001)
if ((1.0f + cosom) > 0.000001f)
{
if ((1.0 - cosom) > 0.00000001)
if ((1.0f - cosom) > 0.000001f)
{
real_t cosomega = Q_acos(real_t(cosom));
float omega = cosomega;
float sinom = Q_sin(cosomega);
sclp = Q_sin((1.0 - t) * omega) / sinom;
sclp = Q_sin((1.0f - t) * omega) / sinom;
sclq = Q_sin(real_t(omega * t)) / sinom;
}
else
{
sclq = t;
sclp = 1.0 - t;
sclp = 1.0f - t;
}
for (i = 0; i < 4; i++)
@ -643,8 +643,8 @@ void QuaternionSlerp(vec_t *p, vec_t *q, float t, vec_t *qt)
qt[2] = -q[3];
qt[3] = q[2];
sclp = Q_sin((1.0 - t) * 0.5 * M_PI);
sclq = Q_sin(t * 0.5 * M_PI);
sclp = Q_sin((1.0f - t) * (0.5f * M_PI));
sclq = Q_sin(t * (0.5f * M_PI));
for (i = 0; i < 3; i++)
qt[i] = sclp * p[i] + sclq * qt[i];