transform2.hpp 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. /// @ref gtx_transform2
  2. /// @file glm/gtx/transform2.hpp
  3. ///
  4. /// @see core (dependence)
  5. /// @see gtx_transform (dependence)
  6. ///
  7. /// @defgroup gtx_transform2 GLM_GTX_transform2
  8. /// @ingroup gtx
  9. ///
  10. /// Include <glm/gtx/transform2.hpp> to use the features of this extension.
  11. ///
  12. /// Add extra transformation matrices
  13. #pragma once
  14. // Dependency:
  15. #include "../glm.hpp"
  16. #include "../gtx/transform.hpp"
  17. #ifndef GLM_ENABLE_EXPERIMENTAL
  18. # error "GLM: GLM_GTX_transform2 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. #endif
  20. #if GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  21. # pragma message("GLM: GLM_GTX_transform2 extension included")
  22. #endif
  23. namespace glm
  24. {
  25. /// @addtogroup gtx_transform2
  26. /// @{
  27. //! Transforms a matrix with a shearing on X axis.
  28. //! From GLM_GTX_transform2 extension.
  29. template<typename T, qualifier Q>
  30. GLM_FUNC_DECL mat<3, 3, T, Q> shearX2D(mat<3, 3, T, Q> const& m, T y);
  31. //! Transforms a matrix with a shearing on Y axis.
  32. //! From GLM_GTX_transform2 extension.
  33. template<typename T, qualifier Q>
  34. GLM_FUNC_DECL mat<3, 3, T, Q> shearY2D(mat<3, 3, T, Q> const& m, T x);
  35. //! Transforms a matrix with a shearing on X axis
  36. //! From GLM_GTX_transform2 extension.
  37. template<typename T, qualifier Q>
  38. GLM_FUNC_DECL mat<4, 4, T, Q> shearX3D(mat<4, 4, T, Q> const& m, T y, T z);
  39. //! Transforms a matrix with a shearing on Y axis.
  40. //! From GLM_GTX_transform2 extension.
  41. template<typename T, qualifier Q>
  42. GLM_FUNC_DECL mat<4, 4, T, Q> shearY3D(mat<4, 4, T, Q> const& m, T x, T z);
  43. //! Transforms a matrix with a shearing on Z axis.
  44. //! From GLM_GTX_transform2 extension.
  45. template<typename T, qualifier Q>
  46. GLM_FUNC_DECL mat<4, 4, T, Q> shearZ3D(mat<4, 4, T, Q> const& m, T x, T y);
  47. //template<typename T> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> shear(const mat<4, 4, T, Q> & m, shearPlane, planePoint, angle)
  48. // Identity + tan(angle) * cross(Normal, OnPlaneVector) 0
  49. // - dot(PointOnPlane, normal) * OnPlaneVector 1
  50. // Reflect functions seem to don't work
  51. //template<typename T> mat<3, 3, T, Q> reflect2D(const mat<3, 3, T, Q> & m, const vec<3, T, Q>& normal){return reflect2DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension)
  52. //template<typename T> mat<4, 4, T, Q> reflect3D(const mat<4, 4, T, Q> & m, const vec<3, T, Q>& normal){return reflect3DGTX(m, normal);} //!< \brief Build a reflection matrix (from GLM_GTX_transform2 extension)
  53. //! Build planar projection matrix along normal axis.
  54. //! From GLM_GTX_transform2 extension.
  55. template<typename T, qualifier Q>
  56. GLM_FUNC_DECL mat<3, 3, T, Q> proj2D(mat<3, 3, T, Q> const& m, vec<3, T, Q> const& normal);
  57. //! Build planar projection matrix along normal axis.
  58. //! From GLM_GTX_transform2 extension.
  59. template<typename T, qualifier Q>
  60. GLM_FUNC_DECL mat<4, 4, T, Q> proj3D(mat<4, 4, T, Q> const & m, vec<3, T, Q> const& normal);
  61. //! Build a scale bias matrix.
  62. //! From GLM_GTX_transform2 extension.
  63. template<typename T, qualifier Q>
  64. GLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(T scale, T bias);
  65. //! Build a scale bias matrix.
  66. //! From GLM_GTX_transform2 extension.
  67. template<typename T, qualifier Q>
  68. GLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(mat<4, 4, T, Q> const& m, T scale, T bias);
  69. /// @}
  70. }// namespace glm
  71. #include "transform2.inl"