| 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 | /// Include <glm/gtx/matrix_transform_2d.hpp> to use the features of this extension. |
| 11 | /// |
| 12 | /// Defines functions that generate common 2d transformation matrices. |
| 13 | |
| 14 | #pragma once |
| 15 | |
| 16 | // Dependency: |
| 17 | #include "../mat3x3.hpp" |
| 18 | #include "../vec2.hpp" |
| 19 | |
| 20 | #ifndef GLM_ENABLE_EXPERIMENTAL |
| 21 | # error "GLM: GLM_GTX_matrix_transform_2d is an experimental extension and may change in the future. Use #define GLM_ENABLE_EXPERIMENTAL before including it, if you really want to use it." |
| 22 | #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED) |
| 23 | # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included") |
| 24 | #endif |
| 25 | |
| 26 | namespace glm |
| 27 | { |
| 28 | /// @addtogroup gtx_matrix_transform_2d |
| 29 | /// @{ |
| 30 | |
| 31 | /// Builds a translation 3 * 3 matrix created from a vector of 2 components. |
| 32 | /// |
| 33 | /// @param m Input matrix multiplied by this translation matrix. |
| 34 | /// @param v Coordinates of a translation vector. |
| 35 | template<typename T, qualifier Q> |
| 36 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate( |
| 37 | mat<3, 3, T, Q> const& m, |
| 38 | vec<2, T, Q> const& v); |
| 39 | |
| 40 | /// Builds a rotation 3 * 3 matrix created from an angle. |
| 41 | /// |
| 42 | /// @param m Input matrix multiplied by this translation matrix. |
| 43 | /// @param angle Rotation angle expressed in radians. |
| 44 | template<typename T, qualifier Q> |
| 45 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate( |
| 46 | mat<3, 3, T, Q> const& m, |
| 47 | T angle); |
| 48 | |
| 49 | /// Builds a scale 3 * 3 matrix created from a vector of 2 components. |
| 50 | /// |
| 51 | /// @param m Input matrix multiplied by this translation matrix. |
| 52 | /// @param v Coordinates of a scale vector. |
| 53 | template<typename T, qualifier Q> |
| 54 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale( |
| 55 | mat<3, 3, T, Q> const& m, |
| 56 | vec<2, T, Q> const& v); |
| 57 | |
| 58 | /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix. |
| 59 | /// |
| 60 | /// @param m Input matrix multiplied by this translation matrix. |
| 61 | /// @param y Shear factor. |
| 62 | template<typename T, qualifier Q> |
| 63 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX( |
| 64 | mat<3, 3, T, Q> const& m, |
| 65 | T y); |
| 66 | |
| 67 | /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix. |
| 68 | /// |
| 69 | /// @param m Input matrix multiplied by this translation matrix. |
| 70 | /// @param x Shear factor. |
| 71 | template<typename T, qualifier Q> |
| 72 | GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY( |
| 73 | mat<3, 3, T, Q> const& m, |
| 74 | T x); |
| 75 | |
| 76 | /// @} |
| 77 | }//namespace glm |
| 78 | |
| 79 | #include "matrix_transform_2d.inl" |