glm/glm/ext/matrix_common.hpp
Thibault de Villèle [UM] 48e1ff3fee Add glm::abs() function for the glm::mat<> class
This is added as part of the GLM_EXT_matrix_common extension, as this
function is not provided by the core GLSL specification (version 4.20).

The implementation of this glm::abs(mat<>) function mirrors the
glm::abs(vec<>) implementation. It should be functionning the same in
every way as the vec implementation.

Bonus points : AFAICT this allows to vectorize operations on compilers
that support optimization of these patterns, just like the functor1<>
struct in _vectorize.hpp for vectors.
2022-08-29 14:22:10 +02:00

40 lines
1.1 KiB
C++

/// @ref ext_matrix_common
/// @file glm/ext/matrix_common.hpp
///
/// @defgroup ext_matrix_common GLM_EXT_matrix_common
/// @ingroup ext
///
/// Defines functions for common matrix operations.
///
/// Include <glm/ext/matrix_common.hpp> to use the features of this extension.
///
/// @see ext_matrix_common
#pragma once
#include "../detail/qualifier.hpp"
#include "../detail/_fixes.hpp"
#if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
# pragma message("GLM: GLM_EXT_matrix_common extension included")
#endif
namespace glm
{
/// @addtogroup ext_matrix_common
/// @{
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_DECL 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);
template<length_t C, length_t R, typename T, typename U, qualifier Q>
GLM_FUNC_DECL mat<C, R, T, Q> mix(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y, U a);
template <length_t C, length_t R, typename T, qualifier Q>
GLM_FUNC_DECL GLM_CONSTEXPR mat<C, R, T, Q> abs(mat<C, R, T, Q> const& x);
/// @}
}//namespace glm
#include "matrix_common.inl"