transform2.hpp 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #elif GLM_MESSAGES == GLM_ENABLE && !defined(GLM_EXT_INCLUDED)
  20. # pragma message("GLM: GLM_GTX_transform2 extension included")
  21. #endif
  22. namespace glm
  23. {
  24. /// @addtogroup gtx_transform2
  25. /// @{
  26. //! Transforms a matrix with a shearing on X axis.
  27. //! From GLM_GTX_transform2 extension.
  28. template<typename T, qualifier Q>
  29. GLM_FUNC_DECL mat<3, 3, T, Q> shearX2D(mat<3, 3, T, Q> const& m, T y);
  30. //! Transforms a matrix with a shearing on Y axis.
  31. //! From GLM_GTX_transform2 extension.
  32. template<typename T, qualifier Q>
  33. GLM_FUNC_DECL mat<3, 3, T, Q> shearY2D(mat<3, 3, T, Q> const& m, T x);
  34. //! Transforms a matrix with a shearing on X axis
  35. //! From GLM_GTX_transform2 extension.
  36. template<typename T, qualifier Q>
  37. GLM_FUNC_DECL mat<4, 4, T, Q> shearX3D(mat<4, 4, T, Q> const& m, T y, T z);
  38. //! Transforms a matrix with a shearing on Y axis.
  39. //! From GLM_GTX_transform2 extension.
  40. template<typename T, qualifier Q>
  41. GLM_FUNC_DECL mat<4, 4, T, Q> shearY3D(mat<4, 4, T, Q> const& m, T x, T z);
  42. //! Transforms a matrix with a shearing on Z axis.
  43. //! From GLM_GTX_transform2 extension.
  44. template<typename T, qualifier Q>
  45. GLM_FUNC_DECL mat<4, 4, T, Q> shearZ3D(mat<4, 4, T, Q> const& m, T x, T y);
  46. //template<typename T> GLM_FUNC_QUALIFIER mat<4, 4, T, Q> shear(const mat<4, 4, T, Q> & m, shearPlane, planePoint, angle)
  47. // Identity + tan(angle) * cross(Normal, OnPlaneVector) 0
  48. // - dot(PointOnPlane, normal) * OnPlaneVector 1
  49. // Reflect functions seem to don't work
  50. //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)
  51. //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)
  52. //! Build planar projection matrix along normal axis.
  53. //! From GLM_GTX_transform2 extension.
  54. template<typename T, qualifier Q>
  55. GLM_FUNC_DECL mat<3, 3, T, Q> proj2D(mat<3, 3, T, Q> const& m, vec<3, T, Q> const& normal);
  56. //! Build planar projection matrix along normal axis.
  57. //! From GLM_GTX_transform2 extension.
  58. template<typename T, qualifier Q>
  59. GLM_FUNC_DECL mat<4, 4, T, Q> proj3D(mat<4, 4, T, Q> const & m, vec<3, T, Q> const& normal);
  60. //! Build a scale bias matrix.
  61. //! From GLM_GTX_transform2 extension.
  62. template<typename T, qualifier Q>
  63. GLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(T scale, T bias);
  64. //! Build a scale bias matrix.
  65. //! From GLM_GTX_transform2 extension.
  66. template<typename T, qualifier Q>
  67. GLM_FUNC_DECL mat<4, 4, T, Q> scaleBias(mat<4, 4, T, Q> const& m, T scale, T bias);
  68. /// @}
  69. }// namespace glm
  70. #include "transform2.inl"