mirror of
https://github.com/g-truc/glm.git
synced 2024-11-26 18:24:35 +00:00
Fixed GTC_matrix_inverse affineInverse #192
This commit is contained in:
parent
ab0312be02
commit
fa18ca7c2e
@ -35,23 +35,24 @@ namespace glm
|
|||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse(tmat3x3<T, P> const & m)
|
GLM_FUNC_QUALIFIER tmat3x3<T, P> affineInverse(tmat3x3<T, P> const & m)
|
||||||
{
|
{
|
||||||
tmat3x3<T, P> Result(m);
|
tmat2x2<T, P> const Inv(inverse(tmat2x2<T, P>(m)));
|
||||||
Result[2] = tvec3<T, P>(0, 0, 1);
|
|
||||||
Result = transpose(Result);
|
return tmat3x3<T, P>(
|
||||||
tvec3<T, P> Translation = Result * tvec3<T, P>(-tvec2<T, P>(m[2]), m[2][2]);
|
tvec3<T, P>(Inv[0], static_cast<T>(0)),
|
||||||
Result[2] = Translation;
|
tvec3<T, P>(Inv[1], static_cast<T>(0)),
|
||||||
return Result;
|
tvec3<T, P>(-Inv * tvec2<T, P>(m[2]), static_cast<T>(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse(tmat4x4<T, P> const & m)
|
GLM_FUNC_QUALIFIER tmat4x4<T, P> affineInverse(tmat4x4<T, P> const & m)
|
||||||
{
|
{
|
||||||
tmat4x4<T, P> Result(m);
|
tmat3x3<T, P> const Inv(inverse(tmat3x3<T, P>(m)));
|
||||||
Result[3] = tvec4<T, P>(0, 0, 0, 1);
|
|
||||||
Result = transpose(Result);
|
return tmat4x4<T, P>(
|
||||||
tvec4<T, P> Translation = Result * tvec4<T, P>(-tvec3<T, P>(m[3]), m[3][3]);
|
tvec4<T, P>(Inv[0], static_cast<T>(0)),
|
||||||
Result[3] = Translation;
|
tvec4<T, P>(Inv[1], static_cast<T>(0)),
|
||||||
return Result;
|
tvec4<T, P>(Inv[2], static_cast<T>(0)),
|
||||||
|
tvec4<T, P>(-Inv * tvec3<T, P>(m[3]), static_cast<T>(1)));
|
||||||
}
|
}
|
||||||
|
|
||||||
template <typename T, precision P>
|
template <typename T, precision P>
|
||||||
|
@ -59,6 +59,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
|||||||
##### Fixes:
|
##### Fixes:
|
||||||
- Fixed GTC_round floorMultiple/ceilMultiple #412
|
- Fixed GTC_round floorMultiple/ceilMultiple #412
|
||||||
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
|
- Fixed GTC_packing unpackUnorm3x10_1x2 #414
|
||||||
|
- Fixed GTC_matrix_inverse affineInverse #192
|
||||||
|
|
||||||
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
|
#### [GLM 0.9.7.1](https://github.com/g-truc/glm/releases/tag/0.9.7.1) - 2015-09-07
|
||||||
##### Improvements:
|
##### Improvements:
|
||||||
|
Loading…
Reference in New Issue
Block a user