matrix_common.inl 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. #include "../matrix.hpp"
  2. #include "_matrix_vectorize.hpp"
  3. namespace glm
  4. {
  5. template<length_t C, length_t R, typename T, typename U, qualifier Q>
  6. GLM_FUNC_QUALIFIER mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, U a)
  7. {
  8. return mat<C, R, U, Q>(x) * (static_cast<U>(1) - a) + mat<C, R, U, Q>(y) * a;
  9. }
  10. template<length_t C, length_t R, typename T, typename U, qualifier Q>
  11. GLM_FUNC_QUALIFIER mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, mat<C, R, U, Q> const& a)
  12. {
  13. return matrixCompMult(mat<C, R, U, Q>(x), static_cast<U>(1) - a) + matrixCompMult(mat<C, R, U, Q>(y), a);
  14. }
  15. template<length_t C, length_t R, typename T, qualifier Q, bool Aligned>
  16. struct compute_abs_matrix
  17. {
  18. GLM_FUNC_QUALIFIER GLM_CONSTEXPR static mat<C, R, T, Q> call(mat<C, R, T, Q> const& x)
  19. {
  20. return detail::matrix_functor_1<mat, C, R, T, T, Q>::call(abs, x);
  21. }
  22. };
  23. template<length_t C, length_t R, typename T, qualifier Q>
  24. GLM_FUNC_DECL GLM_CONSTEXPR mat<C, R, T, Q> abs(mat<C, R, T, Q> const& x)
  25. {
  26. return compute_abs_matrix<C, R, T, Q, detail::is_aligned<Q>::value>::call(x);
  27. }
  28. }//namespace glm