1 /// @ref gtx_matrix_transform_2d 2 /// @file glm/gtx/matrix_transform_2d.hpp 3 /// @author Miguel Ángel Pérez Martínez 4 /// 5 /// @see core (dependence) 6 /// 7 /// @defgroup gtx_matrix_transform_2d GLM_GTX_matrix_transform_2d 8 /// @ingroup gtx 9 /// 10 /// @brief Defines functions that generate common 2d transformation matrices. 11 /// 12 /// <glm/gtx/matrix_transform_2d.hpp> need to be included to use these functionalities. 13 14 #pragma once 15 16 // Dependency: 17 #include "../mat3x3.hpp" 18 #include "../vec2.hpp" 19 20 21 #if GLM_MESSAGES == GLM_MESSAGES_ENABLED && !defined(GLM_EXT_INCLUDED) 22 # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") 23 #endif 24 25 namespace glm 26 { 27 /// @addtogroup gtx_matrix_transform_2d 28 /// @{ 29 30 /// Builds a translation 3 * 3 matrix created from a vector of 2 components. 31 /// 32 /// @param m Input matrix multiplied by this translation matrix. 33 /// @param v Coordinates of a translation vector. 34 template <typename T, precision P> 35 GLM_FUNC_QUALIFIER tmat3x3<T, P> translate( 36 tmat3x3<T, P> const & m, 37 tvec2<T, P> const & v); 38 39 /// Builds a rotation 3 * 3 matrix created from an angle. 40 /// 41 /// @param m Input matrix multiplied by this translation matrix. 42 /// @param angle Rotation angle expressed in radians if GLM_FORCE_RADIANS is defined or degrees otherwise. 43 template <typename T, precision P> 44 GLM_FUNC_QUALIFIER tmat3x3<T, P> rotate( 45 tmat3x3<T, P> const & m, 46 T angle); 47 48 /// Builds a scale 3 * 3 matrix created from a vector of 2 components. 49 /// 50 /// @param m Input matrix multiplied by this translation matrix. 51 /// @param v Coordinates of a scale vector. 52 template <typename T, precision P> 53 GLM_FUNC_QUALIFIER tmat3x3<T, P> scale( 54 tmat3x3<T, P> const & m, 55 tvec2<T, P> const & v); 56 57 /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. 58 /// 59 /// @param m Input matrix multiplied by this translation matrix. 60 /// @param y Shear factor. 61 template <typename T, precision P> 62 GLM_FUNC_QUALIFIER tmat3x3<T, P> shearX( 63 tmat3x3<T, P> const & m, 64 T y); 65 66 /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. 67 /// 68 /// @param m Input matrix multiplied by this translation matrix. 69 /// @param x Shear factor. 70 template <typename T, precision P> 71 GLM_FUNC_QUALIFIER tmat3x3<T, P> shearY( 72 tmat3x3<T, P> const & m, 73 T x); 74 75 /// @} 76 }//namespace glm 77 78 #include "matrix_transform_2d.inl" 79