Fixed mix implementation to improve GLSL conformance #866

This commit is contained in:
Christophe Riccio 2019-03-01 11:20:01 +01:00
parent 8e7d0c307c
commit 6b62e66a7d
2 changed files with 4 additions and 3 deletions

View File

@ -84,7 +84,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
return vec<L, T, Q>(vec<L, U, Q>(x) + a * vec<L, U, Q>(y - x));
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(y) * a);
}
};
@ -107,7 +107,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
return vec<L, T, Q>(vec<L, U, Q>(x) + a * vec<L, U, Q>(y - x));
return vec<L, T, Q>(vec<L, U, Q>(x) * (static_cast<U>(1) - a) + vec<L, U, Q>(y) * a);
}
};
@ -127,7 +127,7 @@ namespace detail
{
GLM_STATIC_ASSERT(std::numeric_limits<U>::is_iec559 || GLM_CONFIG_UNRESTRICTED_GENTYPE, "'mix' only accept floating-point inputs for the interpolator a");
return static_cast<T>(static_cast<U>(x) + a * static_cast<U>(y - x));
return static_cast<T>(static_cast<U>(x) * (static_cast<U>(1) - a) + static_cast<U>(y) * a);
}
};

View File

@ -59,6 +59,7 @@ glm::mat4 camera(float Translate, glm::vec2 const& Rotate)
#### Fixes:
- Fixed in mat4x3 conversion #829
- Fixed constexpr issue on GCC #832
- Fixed mix implementation to improve GLSL conformance #866
### [GLM 0.9.9.3](https://github.com/g-truc/glm/releases/tag/0.9.9.3) - 2018-10-31
#### Features: