mirror of
https://github.com/g-truc/glm.git
synced 2024-11-29 19:34:36 +00:00
Fixed decompose warnings #373
This commit is contained in:
parent
37d4ca9c4c
commit
1e502c0919
@ -81,15 +81,15 @@ namespace glm
|
|||||||
tmat4x4<T, P> PerspectiveMatrix(LocalMatrix);
|
tmat4x4<T, P> PerspectiveMatrix(LocalMatrix);
|
||||||
|
|
||||||
for(length_t i = 0; i < 3; i++)
|
for(length_t i = 0; i < 3; i++)
|
||||||
PerspectiveMatrix[i][3] = 0;
|
PerspectiveMatrix[i][3] = static_cast<T>(0);
|
||||||
PerspectiveMatrix[3][3] = 1;
|
PerspectiveMatrix[3][3] = static_cast<T>(1);
|
||||||
|
|
||||||
/// TODO: Fixme!
|
/// TODO: Fixme!
|
||||||
if(determinant(PerspectiveMatrix) == static_cast<T>(0))
|
if(determinant(PerspectiveMatrix) == static_cast<T>(0))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// First, isolate perspective. This is the messiest.
|
// First, isolate perspective. This is the messiest.
|
||||||
if(LocalMatrix[0][3] != 0 || LocalMatrix[1][3] != 0 || LocalMatrix[2][3] != 0)
|
if(LocalMatrix[0][3] != static_cast<T>(0) || LocalMatrix[1][3] != static_cast<T>(0) || LocalMatrix[2][3] != static_cast<T>(0))
|
||||||
{
|
{
|
||||||
// rightHandSide is the right hand side of the equation.
|
// rightHandSide is the right hand side of the equation.
|
||||||
tvec4<T, P> RightHandSide;
|
tvec4<T, P> RightHandSide;
|
||||||
@ -108,8 +108,8 @@ namespace glm
|
|||||||
// v4MulPointByMatrix(rightHandSide, transposedInversePerspectiveMatrix, perspectivePoint);
|
// v4MulPointByMatrix(rightHandSide, transposedInversePerspectiveMatrix, perspectivePoint);
|
||||||
|
|
||||||
// Clear the perspective partition
|
// Clear the perspective partition
|
||||||
LocalMatrix[0][3] = LocalMatrix[1][3] = LocalMatrix[2][3] = 0;
|
LocalMatrix[0][3] = LocalMatrix[1][3] = LocalMatrix[2][3] = static_cast<T>(0);
|
||||||
LocalMatrix[3][3] = 1;
|
LocalMatrix[3][3] = static_cast<T>(1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -186,38 +186,38 @@ namespace glm
|
|||||||
|
|
||||||
T s, t, x, y, z, w;
|
T s, t, x, y, z, w;
|
||||||
|
|
||||||
t = Row[0][0] + Row[1][1] + Row[2][2] + 1.0;
|
t = Row[0][0] + Row[1][1] + Row[2][2] + static_cast<T>(1);
|
||||||
|
|
||||||
if(t > 1e-4)
|
if(t > static_cast<T>(1e-4))
|
||||||
{
|
{
|
||||||
s = 0.5 / sqrt(t);
|
s = static_cast<T>(0.5) / sqrt(t);
|
||||||
w = 0.25 / s;
|
w = static_cast<T>(0.25) / s;
|
||||||
x = (Row[2][1] - Row[1][2]) * s;
|
x = (Row[2][1] - Row[1][2]) * s;
|
||||||
y = (Row[0][2] - Row[2][0]) * s;
|
y = (Row[0][2] - Row[2][0]) * s;
|
||||||
z = (Row[1][0] - Row[0][1]) * s;
|
z = (Row[1][0] - Row[0][1]) * s;
|
||||||
}
|
}
|
||||||
else if(Row[0][0] > Row[1][1] && Row[0][0] > Row[2][2])
|
else if(Row[0][0] > Row[1][1] && Row[0][0] > Row[2][2])
|
||||||
{
|
{
|
||||||
s = sqrt (1.0 + Row[0][0] - Row[1][1] - Row[2][2]) * 2.0; // S=4*qx
|
s = sqrt (static_cast<T>(1) + Row[0][0] - Row[1][1] - Row[2][2]) * static_cast<T>(2); // S=4*qx
|
||||||
x = 0.25 * s;
|
x = static_cast<T>(0.25) * s;
|
||||||
y = (Row[0][1] + Row[1][0]) / s;
|
y = (Row[0][1] + Row[1][0]) / s;
|
||||||
z = (Row[0][2] + Row[2][0]) / s;
|
z = (Row[0][2] + Row[2][0]) / s;
|
||||||
w = (Row[2][1] - Row[1][2]) / s;
|
w = (Row[2][1] - Row[1][2]) / s;
|
||||||
}
|
}
|
||||||
else if(Row[1][1] > Row[2][2])
|
else if(Row[1][1] > Row[2][2])
|
||||||
{
|
{
|
||||||
s = sqrt (1.0 + Row[1][1] - Row[0][0] - Row[2][2]) * 2.0; // S=4*qy
|
s = sqrt (static_cast<T>(1) + Row[1][1] - Row[0][0] - Row[2][2]) * static_cast<T>(2); // S=4*qy
|
||||||
x = (Row[0][1] + Row[1][0]) / s;
|
x = (Row[0][1] + Row[1][0]) / s;
|
||||||
y = 0.25 * s;
|
y = static_cast<T>(0.25) * s;
|
||||||
z = (Row[1][2] + Row[2][1]) / s;
|
z = (Row[1][2] + Row[2][1]) / s;
|
||||||
w = (Row[0][2] - Row[2][0]) / s;
|
w = (Row[0][2] - Row[2][0]) / s;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = sqrt(1.0 + Row[2][2] - Row[0][0] - Row[1][1]) * 2.0; // S=4*qz
|
s = sqrt(static_cast<T>(1) + Row[2][2] - Row[0][0] - Row[1][1]) * static_cast<T>(2); // S=4*qz
|
||||||
x = (Row[0][2] + Row[2][0]) / s;
|
x = (Row[0][2] + Row[2][0]) / s;
|
||||||
y = (Row[1][2] + Row[2][1]) / s;
|
y = (Row[1][2] + Row[2][1]) / s;
|
||||||
z = 0.25 * s;
|
z = static_cast<T>(0.25) * s;
|
||||||
w = (Row[1][0] - Row[0][1]) / s;
|
w = (Row[1][0] - Row[0][1]) / s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,6 +80,7 @@ glm::mat4 camera(float Translate, glm::vec2 const & Rotate)
|
|||||||
- Fixed Intel compiler build error on Linux #354
|
- Fixed Intel compiler build error on Linux #354
|
||||||
- Fixed use of libstdc++ with Clang #351
|
- Fixed use of libstdc++ with Clang #351
|
||||||
- Fixed quaternion pow #346
|
- Fixed quaternion pow #346
|
||||||
|
- Fixed decompose warnings #373
|
||||||
|
|
||||||
##### Deprecation:
|
##### Deprecation:
|
||||||
- Removed integer specification for 'mod' in GTC_integer #308
|
- Removed integer specification for 'mod' in GTC_integer #308
|
||||||
|
@ -35,5 +35,15 @@ int main()
|
|||||||
{
|
{
|
||||||
int Error(0);
|
int Error(0);
|
||||||
|
|
||||||
|
glm::mat4 Matrix(1);
|
||||||
|
|
||||||
|
glm::vec3 Scale;
|
||||||
|
glm::quat Orientation;
|
||||||
|
glm::vec3 Translation;
|
||||||
|
glm::vec3 Skew(1);
|
||||||
|
glm::vec4 Perspective(1);
|
||||||
|
|
||||||
|
glm::decompose(Matrix, Scale, Orientation, Translation, Skew, Perspective);
|
||||||
|
|
||||||
return Error;
|
return Error;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user