matrix_transform_2d.hpp 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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. #pragma once
  14. // Dependency:
  15. #include "../mat3x3.hpp"
  16. #include "../vec2.hpp"
  17. #ifndef GLM_ENABLE_EXPERIMENTAL
  18. # 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."
  19. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  20. # pragma message("GLM: GLM_GTX_matrix_transform_2d extension included")
  21. #endif
  22. namespace glm
  23. {
  24. /// @addtogroup gtx_matrix_transform_2d
  25. /// @{
  26. /// Builds a translation 3 * 3 matrix created from a vector of 2 components.
  27. ///
  28. /// @param m Input matrix multiplied by this translation matrix.
  29. /// @param v Coordinates of a translation vector.
  30. template<typename T, qualifier Q>
  31. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> translate(
  32. mat<3, 3, T, Q> const& m,
  33. vec<2, T, Q> const& v);
  34. /// Builds a rotation 3 * 3 matrix created from an angle.
  35. ///
  36. /// @param m Input matrix multiplied by this translation matrix.
  37. /// @param angle Rotation angle expressed in radians.
  38. template<typename T, qualifier Q>
  39. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> rotate(
  40. mat<3, 3, T, Q> const& m,
  41. T angle);
  42. /// Builds a scale 3 * 3 matrix created from a vector of 2 components.
  43. ///
  44. /// @param m Input matrix multiplied by this translation matrix.
  45. /// @param v Coordinates of a scale vector.
  46. template<typename T, qualifier Q>
  47. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> scale(
  48. mat<3, 3, T, Q> const& m,
  49. vec<2, T, Q> const& v);
  50. /// Builds an horizontal (parallel to the x axis) shear 3 * 3 matrix.
  51. ///
  52. /// @param m Input matrix multiplied by this translation matrix.
  53. /// @param y Shear factor.
  54. template<typename T, qualifier Q>
  55. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearX(
  56. mat<3, 3, T, Q> const& m,
  57. T y);
  58. /// Builds a vertical (parallel to the y axis) shear 3 * 3 matrix.
  59. ///
  60. /// @param m Input matrix multiplied by this translation matrix.
  61. /// @param x Shear factor.
  62. template<typename T, qualifier Q>
  63. GLM_FUNC_QUALIFIER mat<3, 3, T, Q> shearY(
  64. mat<3, 3, T, Q> const& m,
  65. T x);
  66. /// @}
  67. }//namespace glm
  68. #include "matrix_transform_2d.inl"