mirror of
https://github.com/g-truc/glm.git
synced 2025-04-10 07:18:54 +00:00
Replaced C casts by C++ casts
This commit is contained in:
parent
9b6eecc739
commit
694416701a
1 changed files with 13 additions and 13 deletions
|
@ -41,7 +41,7 @@ namespace glm
|
|||
detail::tquat<T, P> const & s2,
|
||||
T const & h)
|
||||
{
|
||||
return mix(mix(q1, q2, h), mix(s1, s2, h), T(2) * (T(1) - h) * h);
|
||||
return mix(mix(q1, q2, h), mix(s1, s2, h), static_cast<T>(2) * (static_cast<T>(1) - h) * h);
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
|
@ -53,7 +53,7 @@ namespace glm
|
|||
)
|
||||
{
|
||||
detail::tquat<T, P> invQuat = inverse(curr);
|
||||
return exp((log(next + invQuat) + log(prev + invQuat)) / T(-4)) * curr;
|
||||
return exp((log(next + invQuat) + log(prev + invQuat)) / static_cast<T>(-4)) * curr;
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
|
@ -152,7 +152,7 @@ namespace glm
|
|||
detail::tquat<T, P> const & q
|
||||
)
|
||||
{
|
||||
T w = static_cast<T>(1.0) - q.x * q.x - q.y * q.y - q.z * q.z;
|
||||
T w = static_cast<T>(1) - q.x * q.x - q.y * q.y - q.z * q.z;
|
||||
if(w < T(0))
|
||||
return T(0);
|
||||
else
|
||||
|
@ -176,12 +176,12 @@ namespace glm
|
|||
T const & a
|
||||
)
|
||||
{
|
||||
if(a <= T(0)) return x;
|
||||
if(a >= T(1)) return y;
|
||||
if(a <= static_cast<T>(0)) return x;
|
||||
if(a >= static_cast<T>(1)) return y;
|
||||
|
||||
T fCos = dot(x, y);
|
||||
detail::tquat<T, P> y2(y); //BUG!!! tquat<T> y2;
|
||||
if(fCos < T(0))
|
||||
if(fCos < static_cast<T>(0))
|
||||
{
|
||||
y2 = -y;
|
||||
fCos = -fCos;
|
||||
|
@ -189,7 +189,7 @@ namespace glm
|
|||
|
||||
//if(fCos > 1.0f) // problem
|
||||
T k0, k1;
|
||||
if(fCos > T(0.9999))
|
||||
if(fCos > (static_cast<T>(1) - epsilon<T>()))
|
||||
{
|
||||
k0 = static_cast<T>(1) - a;
|
||||
k1 = static_cast<T>(0) + a; //BUG!!! 1.0f + a;
|
||||
|
@ -199,8 +199,8 @@ namespace glm
|
|||
T fSin = sqrt(T(1) - fCos * fCos);
|
||||
T fAngle = atan(fSin, fCos);
|
||||
T fOneOverSin = static_cast<T>(1) / fSin;
|
||||
k0 = sin((T(1) - a) * fAngle) * fOneOverSin;
|
||||
k1 = sin((T(0) + a) * fAngle) * fOneOverSin;
|
||||
k0 = sin((static_cast<T>(1) - a) * fAngle) * fOneOverSin;
|
||||
k1 = sin((static_cast<T>(0) + a) * fAngle) * fOneOverSin;
|
||||
}
|
||||
|
||||
return detail::tquat<T, P>(
|
||||
|
@ -218,7 +218,7 @@ namespace glm
|
|||
T const & a
|
||||
)
|
||||
{
|
||||
return glm::normalize(x * (T(1) - a) + (y * a));
|
||||
return glm::normalize(x * (static_cast<T>(1) - a) + (y * a));
|
||||
}
|
||||
|
||||
template <typename T, precision P>
|
||||
|
@ -231,7 +231,7 @@ namespace glm
|
|||
T cosTheta = dot(orig, dest);
|
||||
detail::tvec3<T, P> rotationAxis;
|
||||
|
||||
if(cosTheta < T(-1) + epsilon<T>())
|
||||
if(cosTheta < static_cast<T>(-1) + epsilon<T>())
|
||||
{
|
||||
// special case when vectors in opposite directions :
|
||||
// there is no "ideal" rotation axis
|
||||
|
@ -249,11 +249,11 @@ namespace glm
|
|||
// Implementation from Stan Melax's Game Programming Gems 1 article
|
||||
rotationAxis = cross(orig, dest);
|
||||
|
||||
T s = sqrt((T(1) + cosTheta) * T(2));
|
||||
T s = sqrt((T(1) + cosTheta) * static_cast<T>(2));
|
||||
T invs = static_cast<T>(1) / s;
|
||||
|
||||
return detail::tquat<T, P>(
|
||||
s * T(0.5f),
|
||||
s * static_cast<T>(0.5f),
|
||||
rotationAxis.x * invs,
|
||||
rotationAxis.y * invs,
|
||||
rotationAxis.z * invs);
|
||||
|
|
Loading…
Add table
Reference in a new issue