type_mat4x2.hpp 5.4 KB

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