Fixed build on MinGW

This commit is contained in:
Christophe Riccio 2011-06-02 10:08:44 +01:00
parent a0256b5946
commit 40f3e519a8

View File

@ -256,28 +256,28 @@ namespace quaternion
if(a <= typename detail::tquat<T>::value_type(0)) return x; if(a <= typename detail::tquat<T>::value_type(0)) return x;
if(a >= typename detail::tquat<T>::value_type(1)) return y; if(a >= typename detail::tquat<T>::value_type(1)) return y;
detail::tquat<T>::value_type fCos = dot(x, y); T fCos = dot(x, y);
detail::tquat<T> y2(y); //BUG!!! tquat<T> y2; detail::tquat<T> y2(y); //BUG!!! tquat<T> y2;
if(fCos < typename detail::tquat<T>::value_type(0)) if(fCos < T(0))
{ {
y2 = -y; y2 = -y;
fCos = -fCos; fCos = -fCos;
} }
//if(fCos > 1.0f) // problem //if(fCos > 1.0f) // problem
detail::tquat<T>::value_type k0, k1; T k0, k1;
if(fCos > typename detail::tquat<T>::value_type(0.9999)) if(fCos > T(0.9999))
{ {
k0 = typename detail::tquat<T>::value_type(1) - a; k0 = T(1) - a;
k1 = typename detail::tquat<T>::value_type(0) + a; //BUG!!! 1.0f + a; k1 = T(0) + a; //BUG!!! 1.0f + a;
} }
else else
{ {
typename detail::tquat<T>::value_type fSin = sqrt(T(1) - fCos * fCos); T fSin = sqrt(T(1) - fCos * fCos);
typename detail::tquat<T>::value_type fAngle = atan(fSin, fCos); T fAngle = atan(fSin, fCos);
typename detail::tquat<T>::value_type fOneOverSin = T(1) / fSin; T fOneOverSin = T(1) / fSin;
k0 = sin((typename detail::tquat<T>::value_type(1) - a) * fAngle) * fOneOverSin; k0 = sin((T(1) - a) * fAngle) * fOneOverSin;
k1 = sin((typename detail::tquat<T>::value_type(0) + a) * fAngle) * fOneOverSin; k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
} }
return detail::tquat<T>( return detail::tquat<T>(
@ -295,7 +295,7 @@ namespace quaternion
T const & a T const & a
) )
{ {
return glm::normalize(x * (detail::tquat<T>::value_type(1) - a) + (y * a)); return glm::normalize(x * (T(1) - a) + (y * a));
} }
}//namespace quaternion }//namespace quaternion