type_mat3x2.hpp 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167
  1. /// @ref core
  2. /// @file glm/detail/type_mat3x2.hpp
  3. #pragma once
  4. #include "type_vec2.hpp"
  5. #include "type_vec3.hpp"
  6. #include <limits>
  7. #include <cstddef>
  8. namespace glm
  9. {
  10. template<typename T, qualifier Q>
  11. struct mat<3, 2, T, Q>
  12. {
  13. typedef vec<2, T, Q> col_type;
  14. typedef vec<3, T, Q> row_type;
  15. typedef mat<3, 2, T, Q> type;
  16. typedef mat<2, 3, T, Q> transpose_type;
  17. typedef T value_type;
  18. private:
  19. col_type value[3];
  20. public:
  21. // -- Accesses --
  22. typedef length_t length_type;
  23. GLM_FUNC_DECL static GLM_CONSTEXPR length_type length() { return 3; }
  24. GLM_FUNC_DECL col_type & operator[](length_type i);
  25. GLM_FUNC_DECL GLM_CONSTEXPR col_type const& operator[](length_type i) const;
  26. // -- Constructors --
  27. GLM_FUNC_DECL GLM_CONSTEXPR mat() GLM_DEFAULT;
  28. template<qualifier P>
  29. GLM_FUNC_DECL GLM_CONSTEXPR mat(mat<3, 2, T, P> const& m);
  30. GLM_FUNC_DECL explicit GLM_CONSTEXPR mat(T scalar);
  31. GLM_FUNC_DECL GLM_CONSTEXPR mat(
  32. T x0, T y0,
  33. T x1, T y1,
  34. T x2, T y2);
  35. GLM_FUNC_DECL GLM_CONSTEXPR mat(
  36. col_type const& v0,
  37. col_type const& v1,
  38. col_type const& v2);
  39. // -- Conversions --
  40. template<
  41. typename X1, typename Y1,
  42. typename X2, typename Y2,
  43. typename X3, typename Y3>
  44. GLM_FUNC_DECL GLM_CONSTEXPR mat(
  45. X1 x1, Y1 y1,
  46. X2 x2, Y2 y2,
  47. X3 x3, Y3 y3);
  48. template<typename V1, typename V2, typename V3>
  49. GLM_FUNC_DECL GLM_CONSTEXPR mat(
  50. vec<2, V1, Q> const& v1,
  51. vec<2, V2, Q> const& v2,
  52. vec<2, V3, Q> const& v3);
  53. // -- Matrix conversions --
  54. template<typename U, qualifier P>
  55. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 2, U, P> const& m);
  56. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 2, T, Q> const& x);
  57. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 3, T, Q> const& x);
  58. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 4, T, Q> const& x);
  59. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 3, T, Q> const& x);
  60. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<2, 4, T, Q> const& x);
  61. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<3, 4, T, Q> const& x);
  62. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 2, T, Q> const& x);
  63. GLM_FUNC_DECL GLM_EXPLICIT GLM_CONSTEXPR mat(mat<4, 3, T, Q> const& x);
  64. // -- Unary arithmetic operators --
  65. template<typename U>
  66. GLM_FUNC_DECL mat<3, 2, T, Q> & operator=(mat<3, 2, U, Q> const& m);
  67. template<typename U>
  68. GLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(U s);
  69. template<typename U>
  70. GLM_FUNC_DECL mat<3, 2, T, Q> & operator+=(mat<3, 2, U, Q> const& m);
  71. template<typename U>
  72. GLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(U s);
  73. template<typename U>
  74. GLM_FUNC_DECL mat<3, 2, T, Q> & operator-=(mat<3, 2, U, Q> const& m);
  75. template<typename U>
  76. GLM_FUNC_DECL mat<3, 2, T, Q> & operator*=(U s);
  77. template<typename U>
  78. GLM_FUNC_DECL mat<3, 2, T, Q> & operator/=(U s);
  79. // -- Increment and decrement operators --
  80. GLM_FUNC_DECL mat<3, 2, T, Q> & operator++ ();
  81. GLM_FUNC_DECL mat<3, 2, T, Q> & operator-- ();
  82. GLM_FUNC_DECL mat<3, 2, T, Q> operator++(int);
  83. GLM_FUNC_DECL mat<3, 2, T, Q> operator--(int);
  84. };
  85. // -- Unary operators --
  86. template<typename T, qualifier Q>
  87. GLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m);
  88. template<typename T, qualifier Q>
  89. GLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m);
  90. // -- Binary operators --
  91. template<typename T, qualifier Q>
  92. GLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m, T scalar);
  93. template<typename T, qualifier Q>
  94. GLM_FUNC_DECL mat<3, 2, T, Q> operator+(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
  95. template<typename T, qualifier Q>
  96. GLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m, T scalar);
  97. template<typename T, qualifier Q>
  98. GLM_FUNC_DECL mat<3, 2, T, Q> operator-(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
  99. template<typename T, qualifier Q>
  100. GLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m, T scalar);
  101. template<typename T, qualifier Q>
  102. GLM_FUNC_DECL mat<3, 2, T, Q> operator*(T scalar, mat<3, 2, T, Q> const& m);
  103. template<typename T, qualifier Q>
  104. GLM_FUNC_DECL typename mat<3, 2, T, Q>::col_type operator*(mat<3, 2, T, Q> const& m, typename mat<3, 2, T, Q>::row_type const& v);
  105. template<typename T, qualifier Q>
  106. GLM_FUNC_DECL typename mat<3, 2, T, Q>::row_type operator*(typename mat<3, 2, T, Q>::col_type const& v, mat<3, 2, T, Q> const& m);
  107. template<typename T, qualifier Q>
  108. GLM_FUNC_DECL mat<2, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<2, 3, T, Q> const& m2);
  109. template<typename T, qualifier Q>
  110. GLM_FUNC_DECL mat<3, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<3, 3, T, Q> const& m2);
  111. template<typename T, qualifier Q>
  112. GLM_FUNC_DECL mat<4, 2, T, Q> operator*(mat<3, 2, T, Q> const& m1, mat<4, 3, T, Q> const& m2);
  113. template<typename T, qualifier Q>
  114. GLM_FUNC_DECL mat<3, 2, T, Q> operator/(mat<3, 2, T, Q> const& m, T scalar);
  115. template<typename T, qualifier Q>
  116. GLM_FUNC_DECL mat<3, 2, T, Q> operator/(T scalar, mat<3, 2, T, Q> const& m);
  117. // -- Boolean operators --
  118. template<typename T, qualifier Q>
  119. GLM_FUNC_DECL bool operator==(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
  120. template<typename T, qualifier Q>
  121. GLM_FUNC_DECL bool operator!=(mat<3, 2, T, Q> const& m1, mat<3, 2, T, Q> const& m2);
  122. }//namespace glm
  123. #ifndef GLM_EXTERNAL_TEMPLATE
  124. #include "type_mat3x2.inl"
  125. #endif