mirror of
https://github.com/g-truc/glm.git
synced 2024-11-23 09:14:34 +00:00
Fixed GTX_matrix_interpolation warnings
This commit is contained in:
parent
58053e5b89
commit
1c85dcefd4
@ -11,9 +11,8 @@ namespace glm{
|
|||||||
namespace gtx{
|
namespace gtx{
|
||||||
namespace matrix_interpolation
|
namespace matrix_interpolation
|
||||||
{
|
{
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline void axisAngle(
|
GLM_FUNC_QUALIFIER void axisAngle(
|
||||||
detail::tmat4x4<T> const & mat,
|
detail::tmat4x4<T> const & mat,
|
||||||
detail::tvec3<T> & axis,
|
detail::tvec3<T> & axis,
|
||||||
T & angle)
|
T & angle)
|
||||||
@ -70,7 +69,7 @@ namespace matrix_interpolation
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
T s = sqrt((mat[2][1] - mat[1][2]) * (mat[2][1] - mat[1][2]) + (mat[2][0] - mat[0][2]) * (mat[2][0] - mat[0][2]) + (mat[1][0] - mat[0][1]) * (mat[1][0] - mat[0][1]));
|
T s = sqrt((mat[2][1] - mat[1][2]) * (mat[2][1] - mat[1][2]) + (mat[2][0] - mat[0][2]) * (mat[2][0] - mat[0][2]) + (mat[1][0] - mat[0][1]) * (mat[1][0] - mat[0][1]));
|
||||||
if (fabs(s) < 0.001)
|
if (glm::abs(s) < T(0.001))
|
||||||
s = (T)1.0;
|
s = (T)1.0;
|
||||||
angle = acos((mat[0][0] + mat[1][1] + mat[2][2] - (T)1.0) / (T)2.0);
|
angle = acos((mat[0][0] + mat[1][1] + mat[2][2] - (T)1.0) / (T)2.0);
|
||||||
axis.x = (mat[1][2] - mat[2][1]) / s;
|
axis.x = (mat[1][2] - mat[2][1]) / s;
|
||||||
@ -79,25 +78,25 @@ namespace matrix_interpolation
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline detail::tmat4x4<T> axisAngleMatrix(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> axisAngleMatrix(
|
||||||
detail::tvec3<T> const & axis,
|
detail::tvec3<T> const & axis,
|
||||||
T const angle)
|
T const angle)
|
||||||
{
|
{
|
||||||
T c = cos(angle);
|
T c = cos(angle);
|
||||||
T s = sin(angle);
|
T s = sin(angle);
|
||||||
T t = 1.0 - c;
|
T t = T(1) - c;
|
||||||
detail::tvec3<T> n = normalize(axis);
|
detail::tvec3<T> n = normalize(axis);
|
||||||
|
|
||||||
return detail::tmat4x4<T>(
|
return detail::tmat4x4<T>(
|
||||||
t * n.x * n.x + c, t * n.x * n.y + n.z * s, t * n.x * n.z - n.y * s, 0.0,
|
t * n.x * n.x + c, t * n.x * n.y + n.z * s, t * n.x * n.z - n.y * s, T(0),
|
||||||
t * n.x * n.y - n.z * s, t * n.y * n.y + c, t * n.y * n.z + n.x * s, 0.0,
|
t * n.x * n.y - n.z * s, t * n.y * n.y + c, t * n.y * n.z + n.x * s, T(0),
|
||||||
t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, 0.0,
|
t * n.x * n.z + n.y * s, t * n.y * n.z - n.x * s, t * n.z * n.z + c, T(0),
|
||||||
0.0, 0.0, 0.0, 1.0
|
T(0), T(0), T(0), T(1)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline detail::tmat4x4<T> interpolate(
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate(
|
||||||
detail::tmat4x4<T> const & m1,
|
detail::tmat4x4<T> const & m1,
|
||||||
detail::tmat4x4<T> const & m2,
|
detail::tmat4x4<T> const & m2,
|
||||||
T const delta)
|
T const delta)
|
||||||
|
Loading…
Reference in New Issue
Block a user