mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 10:14:35 +00:00
Fixed GTX_matrix_interpolation, issue #9
This commit is contained in:
parent
7e3f00d034
commit
b1ecabdd28
@ -65,6 +65,12 @@ namespace glm
|
|||||||
detail::tvec3<T> const & axis,
|
detail::tvec3<T> const & axis,
|
||||||
T const angle);
|
T const angle);
|
||||||
|
|
||||||
|
//! Extracts the rotation part of a matrix.
|
||||||
|
//! From GLM_GTX_matrix_interpolation extension.
|
||||||
|
template <typename T>
|
||||||
|
detail::tmat4x4<T> extractMatrixRotation(
|
||||||
|
detail::tmat4x4<T> const & mat);
|
||||||
|
|
||||||
//! Build a interpolation of 4 * 4 matrixes.
|
//! Build a interpolation of 4 * 4 matrixes.
|
||||||
//! From GLM_GTX_matrix_interpolation extension.
|
//! From GLM_GTX_matrix_interpolation extension.
|
||||||
//! Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results.
|
//! Warning! works only with rotation and/or translation matrixes, scale will generate unexpected results.
|
||||||
|
@ -97,6 +97,18 @@ namespace glm
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <typename T>
|
||||||
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> extractMatrixRotation(
|
||||||
|
detail::tmat4x4<T> const & mat)
|
||||||
|
{
|
||||||
|
return detail::tmat4x4<T>(
|
||||||
|
mat[0][0], mat[0][1], mat[0][2], 0.0,
|
||||||
|
mat[1][0], mat[1][1], mat[1][2], 0.0,
|
||||||
|
mat[2][0], mat[2][1], mat[2][2], 0.0,
|
||||||
|
0.0, 0.0, 0.0, 1.0
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate
|
GLM_FUNC_QUALIFIER detail::tmat4x4<T> interpolate
|
||||||
(
|
(
|
||||||
@ -109,7 +121,7 @@ namespace glm
|
|||||||
detail::tvec3<T> dltAxis;
|
detail::tvec3<T> dltAxis;
|
||||||
T dltAngle;
|
T dltAngle;
|
||||||
axisAngle(dltRotation, dltAxis, dltAngle);
|
axisAngle(dltRotation, dltAxis, dltAngle);
|
||||||
detail::tmat4x4<T> out = axisAngleMatrix(dltAxis, dltAngle * delta) * rotationMatrix(m1);
|
detail::tmat4x4<T> out = axisAngleMatrix(dltAxis, dltAngle * delta) * extractMatrixRotation(m1);
|
||||||
out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]);
|
out[3][0] = m1[3][0] + delta * (m2[3][0] - m1[3][0]);
|
||||||
out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]);
|
out[3][1] = m1[3][1] + delta * (m2[3][1] - m1[3][1]);
|
||||||
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
|
out[3][2] = m1[3][2] + delta * (m2[3][2] - m1[3][2]);
|
||||||
|
Loading…
Reference in New Issue
Block a user