Fixed VS2010 templating issues with decompose function caused by ambiguous type conversions and constants.

This commit is contained in:
Jonathon Racz 2014-12-29 17:58:16 -05:00
parent 2336264f4e
commit 2d30a6e21a

View File

@ -125,31 +125,32 @@ namespace glm
// Now get scale and shear. // Now get scale and shear.
for(length_t i = 0; i < 3; ++i) for(length_t i = 0; i < 3; ++i)
Row[i] = LocalMatrix[i]; for(int j = 0; j < 3; ++j)
Row[i][j] = LocalMatrix[i][j];
// Compute X scale factor and normalize first row. // Compute X scale factor and normalize first row.
Scale.x = length(Row[0]);// v3Length(Row[0]); Scale.x = length(Row[0]);// v3Length(Row[0]);
v3Scale(Row[0], 1.0); v3Scale(Row[0], static_cast<T>(1));
// Compute XY shear factor and make 2nd row orthogonal to 1st. // Compute XY shear factor and make 2nd row orthogonal to 1st.
Skew.z = dot(Row[0], Row[1]); Skew.z = dot(Row[0], Row[1]);
Row[1] = combine(Row[1], Row[0], 1.0, -Skew.z); Row[1] = combine(Row[1], Row[0], static_cast<T>(1.0), -Skew.z);
// Now, compute Y scale and normalize 2nd row. // Now, compute Y scale and normalize 2nd row.
Scale.y = length(Row[1]); Scale.y = length(Row[1]);
v3Scale(Row[1], 1.0); v3Scale(Row[1], static_cast<T>(1));
Skew.z /= Scale.y; Skew.z /= Scale.y;
// Compute XZ and YZ shears, orthogonalize 3rd row. // Compute XZ and YZ shears, orthogonalize 3rd row.
Skew.y = glm::dot(Row[0], Row[2]); Skew.y = glm::dot(Row[0], Row[2]);
Row[2] = combine(Row[2], Row[0], 1.0, -Skew.y); Row[2] = combine(Row[2], Row[0], static_cast<T>(1), -Skew.y);
Skew.x = glm::dot(Row[1], Row[2]); Skew.x = glm::dot(Row[1], Row[2]);
Row[2] = combine(Row[2], Row[1], 1.0, -Skew.x); Row[2] = combine(Row[2], Row[1], static_cast<T>(1), -Skew.x);
// Next, get Z scale and normalize 3rd row. // Next, get Z scale and normalize 3rd row.
Scale.z = length(Row[2]); Scale.z = length(Row[2]);
v3Scale(Row[2], 1.0); v3Scale(Row[2], static_cast<T>(1));
Skew.y /= Scale.z; Skew.y /= Scale.z;
Skew.x /= Scale.z; Skew.x /= Scale.z;