diff --git a/glm/detail/func_common.inl b/glm/detail/func_common.inl index 02468cc1..3e3a0b77 100644 --- a/glm/detail/func_common.inl +++ b/glm/detail/func_common.inl @@ -283,6 +283,26 @@ namespace detail return min(max(x, minVal), maxVal); } }; + + template class vecType> + struct compute_step_vector + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & edge, vecType const & x) + { + return mix(vecType(1), vecType(0), glm::lessThan(x, edge)); + } + }; + + template class vecType> + struct compute_smoothstep_vector + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & edge0, vecType const & edge1, vecType const & x) + { + GLM_STATIC_ASSERT(std::numeric_limits::is_iec559, "'step' only accept floating-point inputs"); + vecType const tmp(clamp((x - edge0) / (edge1 - edge0), static_cast(0), static_cast(1))); + return tmp * tmp * (static_cast(3) - static_cast(2) * tmp); + } + }; }//namespace detail template @@ -561,15 +581,13 @@ namespace detail template