9
3

transform2.hpp 3.4 KB

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