type_mat4x2.hpp 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209
  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2015 G-Truc Creation (www.g-truc.net)
  5. /// Permission is hereby granted, free of charge, to any person obtaining a copy
  6. /// of this software and associated documentation files (the "Software"), to deal
  7. /// in the Software without restriction, including without limitation the rights
  8. /// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. /// copies of the Software, and to permit persons to whom the Software is
  10. /// furnished to do so, subject to the following conditions:
  11. ///
  12. /// The above copyright notice and this permission notice shall be included in
  13. /// all copies or substantial portions of the Software.
  14. ///
  15. /// Restrictions:
  16. /// By making use of the Software for military purposes, you choose to make
  17. /// a Bunny unhappy.
  18. ///
  19. /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  20. /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  21. /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  22. /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  23. /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  24. /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  25. /// THE SOFTWARE.
  26. ///
  27. /// @ref core
  28. /// @file glm/detail/type_mat4x2.hpp
  29. /// @date 2006-10-01 / 2011-06-15
  30. /// @author Christophe Riccio
  31. ///////////////////////////////////////////////////////////////////////////////////
  32. #pragma once
  33. #include "../fwd.hpp"
  34. #include "type_vec2.hpp"
  35. #include "type_vec4.hpp"
  36. #include "type_mat.hpp"
  37. #include <limits>
  38. #include <cstddef>
  39. namespace glm
  40. {
  41. template <typename T, precision P = defaultp>
  42. struct tmat4x2
  43. {
  44. typedef tvec2<T, P> col_type;
  45. typedef tvec4<T, P> row_type;
  46. typedef tmat4x2<T, P> type;
  47. typedef tmat2x4<T, P> transpose_type;
  48. typedef T value_type;
  49. private:
  50. /// @cond DETAIL
  51. col_type value[4];
  52. /// @endcond
  53. public:
  54. // Constructors
  55. GLM_FUNC_DECL tmat4x2();
  56. template <precision Q>
  57. GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m);
  58. GLM_FUNC_DECL explicit tmat4x2(ctor);
  59. GLM_FUNC_DECL explicit tmat4x2(T const & x);
  60. GLM_FUNC_DECL tmat4x2(
  61. T const & x0, T const & y0,
  62. T const & x1, T const & y1,
  63. T const & x2, T const & y2,
  64. T const & x3, T const & y3);
  65. GLM_FUNC_DECL tmat4x2(
  66. col_type const & v0,
  67. col_type const & v1,
  68. col_type const & v2,
  69. col_type const & v3);
  70. //////////////////////////////////////
  71. // Conversions
  72. template <
  73. typename X1, typename Y1,
  74. typename X2, typename Y2,
  75. typename X3, typename Y3,
  76. typename X4, typename Y4>
  77. GLM_FUNC_DECL tmat4x2(
  78. X1 const & x1, Y1 const & y1,
  79. X2 const & x2, Y2 const & y2,
  80. X3 const & x3, Y3 const & y3,
  81. X4 const & x4, Y4 const & y4);
  82. template <typename V1, typename V2, typename V3, typename V4>
  83. GLM_FUNC_DECL tmat4x2(
  84. tvec2<V1, P> const & v1,
  85. tvec2<V2, P> const & v2,
  86. tvec2<V3, P> const & v3,
  87. tvec2<V4, P> const & v4);
  88. //////////////////////////////////////
  89. // Matrix conversions
  90. # ifdef GLM_FORCE_EXPLICIT_CTOR
  91. template <typename U, precision Q>
  92. GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m);
  93. # else
  94. template <typename U, precision Q>
  95. GLM_FUNC_DECL tmat4x2(tmat4x2<U, Q> const & m);
  96. # endif
  97. GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x);
  98. GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x);
  99. GLM_FUNC_DECL explicit tmat4x2(tmat4x4<T, P> const & x);
  100. GLM_FUNC_DECL explicit tmat4x2(tmat2x3<T, P> const & x);
  101. GLM_FUNC_DECL explicit tmat4x2(tmat3x2<T, P> const & x);
  102. GLM_FUNC_DECL explicit tmat4x2(tmat2x4<T, P> const & x);
  103. GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x);
  104. GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x);
  105. //////////////////////////////////////
  106. // Accesses
  107. # ifdef GLM_FORCE_SIZE_FUNC
  108. typedef size_t size_type;
  109. GLM_FUNC_DECL GLM_CONSTEXPR size_t size() const;
  110. GLM_FUNC_DECL col_type & operator[](size_type i);
  111. GLM_FUNC_DECL col_type const & operator[](size_type i) const;
  112. # else
  113. typedef length_t length_type;
  114. GLM_FUNC_DECL GLM_CONSTEXPR length_type length() const;
  115. GLM_FUNC_DECL col_type & operator[](length_type i);
  116. GLM_FUNC_DECL col_type const & operator[](length_type i) const;
  117. # endif//GLM_FORCE_SIZE_FUNC
  118. //////////////////////////////////////
  119. // Unary arithmetic operators
  120. template <typename U>
  121. GLM_FUNC_DECL tmat4x2<T, P>& operator=(tmat4x2<U, P> const & m);
  122. template <typename U>
  123. GLM_FUNC_DECL tmat4x2<T, P>& operator+=(U s);
  124. template <typename U>
  125. GLM_FUNC_DECL tmat4x2<T, P>& operator+=(tmat4x2<U, P> const & m);
  126. template <typename U>
  127. GLM_FUNC_DECL tmat4x2<T, P>& operator-=(U s);
  128. template <typename U>
  129. GLM_FUNC_DECL tmat4x2<T, P>& operator-=(tmat4x2<U, P> const & m);
  130. template <typename U>
  131. GLM_FUNC_DECL tmat4x2<T, P>& operator*=(U s);
  132. template <typename U>
  133. GLM_FUNC_DECL tmat4x2<T, P>& operator/=(U s);
  134. //////////////////////////////////////
  135. // Increment and decrement operators
  136. GLM_FUNC_DECL tmat4x2<T, P> & operator++ ();
  137. GLM_FUNC_DECL tmat4x2<T, P> & operator-- ();
  138. GLM_FUNC_DECL tmat4x2<T, P> operator++(int);
  139. GLM_FUNC_DECL tmat4x2<T, P> operator--(int);
  140. };
  141. // Binary operators
  142. template <typename T, precision P>
  143. GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m, T const & s);
  144. template <typename T, precision P>
  145. GLM_FUNC_DECL tmat4x2<T, P> operator+(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
  146. template <typename T, precision P>
  147. GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m, T const & s);
  148. template <typename T, precision P>
  149. GLM_FUNC_DECL tmat4x2<T, P> operator-(tmat4x2<T, P> const & m1, tmat4x2<T, P> const & m2);
  150. template <typename T, precision P>
  151. GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m, T const & s);
  152. template <typename T, precision P>
  153. GLM_FUNC_DECL tmat4x2<T, P> operator*(T const & s, tmat4x2<T, P> const & m);
  154. template <typename T, precision P>
  155. GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator*(tmat4x2<T, P> const & m, typename tmat4x2<T, P>::row_type const & v);
  156. template <typename T, precision P>
  157. GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator*(typename tmat4x2<T, P>::col_type const & v, tmat4x2<T, P> const & m);
  158. template <typename T, precision P>
  159. GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat3x4<T, P> const & m2);
  160. template <typename T, precision P>
  161. GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat4x2<T, P> const & m1, tmat4x4<T, P> const & m2);
  162. template <typename T, precision P>
  163. GLM_FUNC_DECL tmat2x3<T, P> operator*(tmat4x3<T, P> const & m1, tmat2x4<T, P> const & m2);
  164. template <typename T, precision P>
  165. GLM_FUNC_DECL tmat4x2<T, P> operator/(tmat4x2<T, P> const & m, T const & s);
  166. template <typename T, precision P>
  167. GLM_FUNC_DECL tmat4x2<T, P> operator/(T const & s, tmat4x2<T, P> const & m);
  168. // Unary constant operators
  169. template <typename T, precision P>
  170. GLM_FUNC_DECL tmat4x2<T, P> const operator-(tmat4x2<T, P> const & m);
  171. }//namespace glm
  172. #ifndef GLM_EXTERNAL_TEMPLATE
  173. #include "type_mat4x2.inl"
  174. #endif