9
3

matrix_transform_2d.hpp 2.5 KB

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