diff --git a/glm/detail/func_geometric.inl b/glm/detail/func_geometric.inl index 90d3741b..df6372ac 100644 --- a/glm/detail/func_geometric.inl +++ b/glm/detail/func_geometric.inl @@ -87,6 +87,15 @@ namespace detail return dot(Nref, I) < static_cast(0) ? N : -N; } }; + + template class vecType> + struct compute_reflect + { + GLM_FUNC_QUALIFIER static vecType call(vecType const & I, vecType const & N) + { + return I - N * dot(N, I) * static_cast(2); + } + }; }//namespace detail // length @@ -174,10 +183,10 @@ namespace detail } // reflect - template - GLM_FUNC_QUALIFIER genType reflect(genType const & I, genType const & N) + template class vecType> + GLM_FUNC_QUALIFIER vecType reflect(vecType const & I, vecType const & N) { - return I - N * dot(N, I) * static_cast(2); + return detail::compute_reflect::call(I, N); } // refract diff --git a/glm/detail/func_geometric_simd.inl b/glm/detail/func_geometric_simd.inl index 8bab4c69..75e98ae4 100644 --- a/glm/detail/func_geometric_simd.inl +++ b/glm/detail/func_geometric_simd.inl @@ -48,12 +48,24 @@ namespace detail { GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & N, tvec4 const & I, tvec4 const & Nref) { - __m128 const ffd0 = glm_f32v4_ffd(v.data); + __m128 const ffd0 = glm_f32v4_ffd(N.data. I.data, Nref.data); tvec4 result(uninitialize); result.data = ffd0; return result; } }; + + template + struct compute_reflect + { + GLM_FUNC_QUALIFIER static tvec4 call(tvec4 const & I, tvec4 const & N) + { + __m128 const rfe0 = glm_f32v4_rfe(I.data, N.data); + tvec4 result(uninitialize); + result.data = rfe0; + return result; + } + }; }//namespace detail }//namespace glm