1 /////////////////////////////////////////////////////////////////////////////////// 2 /// OpenGL Mathematics (glm.g-truc.net) 3 /// 4 /// Copyright (c) 2005 - 2014 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 /// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 /// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 /// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 /// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 /// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 /// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 /// THE SOFTWARE. 22 /// 23 /// @ref core 24 /// @file glm/core/type_mat4x2.hpp 25 /// @date 2006-10-01 / 2011-06-15 26 /// @author Christophe Riccio 27 /////////////////////////////////////////////////////////////////////////////////// 28 29 #ifndef glm_core_type_mat4x2 30 #define glm_core_type_mat4x2 31 32 #include "../fwd.hpp" 33 #include "type_vec2.hpp" 34 #include "type_vec4.hpp" 35 #include "type_mat.hpp" 36 #include <limits> 37 38 namespace glm{ 39 namespace detail 40 { 41 template <typename T, precision P> 42 struct tmat4x2 43 { 44 enum ctor{_null}; 45 typedef T value_type; 46 typedef std::size_t size_type; 47 typedef tvec2<T, P> col_type; 48 typedef tvec4<T, P> row_type; 49 typedef tmat4x2<T, P> type; 50 typedef tmat2x4<T, P> transpose_type; 51 52 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; 53 54 private: 55 // Data 56 col_type value[4]; 57 58 public: 59 // Constructors 60 GLM_FUNC_DECL tmat4x2(); 61 GLM_FUNC_DECL tmat4x2(tmat4x2<T, P> const & m); 62 template <precision Q> 63 GLM_FUNC_DECL tmat4x2(tmat4x2<T, Q> const & m); 64 65 GLM_FUNC_DECL explicit tmat4x2( 66 ctor Null); 67 GLM_FUNC_DECL explicit tmat4x2( 68 T const & x); 69 GLM_FUNC_DECL tmat4x2( 70 T const & x0, T const & y0, 71 T const & x1, T const & y1, 72 T const & x2, T const & y2, 73 T const & x3, T const & y3); 74 GLM_FUNC_DECL tmat4x2( 75 col_type const & v0, 76 col_type const & v1, 77 col_type const & v2, 78 col_type const & v3); 79 80 ////////////////////////////////////// 81 // Conversions 82 83 template< 84 typename X1, typename Y1, 85 typename X2, typename Y2, 86 typename X3, typename Y3, 87 typename X4, typename Y4> 88 GLM_FUNC_DECL tmat4x2( 89 X1 const & x1, Y1 const & y1, 90 X2 const & x2, Y2 const & y2, 91 X3 const & x3, Y3 const & y3, 92 X4 const & x4, Y4 const & y4); 93 94 template <typename V1, typename V2, typename V3, typename V4> 95 GLM_FUNC_DECL tmat4x2( 96 tvec2<V1, P> const & v1, 97 tvec2<V2, P> const & v2, 98 tvec2<V3, P> const & v3, 99 tvec2<V4, P> const & v4); 100 101 // Matrix conversions 102 template <typename U, precision Q> 103 GLM_FUNC_DECL explicit tmat4x2(tmat4x2<U, Q> const & m); 104 105 GLM_FUNC_DECL explicit tmat4x2(tmat2x2<T, P> const & x); 106 GLM_FUNC_DECL explicit tmat4x2(tmat3x3<T, P> const & x); 107 GLM_FUNC_DECL explicit tmat4x2(tmat4x4<T, P> const & x); 108 GLM_FUNC_DECL explicit tmat4x2(tmat2x3<T, P> const & x); 109 GLM_FUNC_DECL explicit tmat4x2(tmat3x2<T, P> const & x); 110 GLM_FUNC_DECL explicit tmat4x2(tmat2x4<T, P> const & x); 111 GLM_FUNC_DECL explicit tmat4x2(tmat4x3<T, P> const & x); 112 GLM_FUNC_DECL explicit tmat4x2(tmat3x4<T, P> const & x); 113 114 // Accesses 115 GLM_FUNC_DECL col_type & operator[](length_t i); 116 GLM_FUNC_DECL col_type const & operator[](length_t i) const; 117 118 // Unary updatable operators 119 GLM_FUNC_DECL tmat4x2<T, P>& operator= (tmat4x2<T, P> const & m); 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 ////////////////////////////////////// 136 // Increment and decrement operators 137 138 GLM_FUNC_DECL tmat4x2<T, P> & operator++ (); 139 GLM_FUNC_DECL tmat4x2<T, P> & operator-- (); 140 GLM_FUNC_DECL tmat4x2<T, P> operator++(int); 141 GLM_FUNC_DECL tmat4x2<T, P> operator--(int); 142 }; 143 144 // Binary operators 145 template <typename T, precision P> 146 GLM_FUNC_DECL tmat4x2<T, P> operator+ ( 147 tmat4x2<T, P> const & m, 148 T const & s); 149 150 template <typename T, precision P> 151 GLM_FUNC_DECL tmat4x2<T, P> operator+ ( 152 tmat4x2<T, P> const & m1, 153 tmat4x2<T, P> const & m2); 154 155 template <typename T, precision P> 156 GLM_FUNC_DECL tmat4x2<T, P> operator- ( 157 tmat4x2<T, P> const & m, 158 T const & s); 159 160 template <typename T, precision P> 161 GLM_FUNC_DECL tmat4x2<T, P> operator- ( 162 tmat4x2<T, P> const & m1, 163 tmat4x2<T, P> const & m2); 164 165 template <typename T, precision P> 166 GLM_FUNC_DECL tmat4x2<T, P> operator* ( 167 tmat4x2<T, P> const & m, 168 T const & s); 169 170 template <typename T, precision P> 171 GLM_FUNC_DECL tmat4x2<T, P> operator* ( 172 T const & s, 173 tmat4x2<T, P> const & m); 174 175 template <typename T, precision P> 176 GLM_FUNC_DECL typename tmat4x2<T, P>::col_type operator* ( 177 tmat4x2<T, P> const & m, 178 typename tmat4x2<T, P>::row_type const & v); 179 180 template <typename T, precision P> 181 GLM_FUNC_DECL typename tmat4x2<T, P>::row_type operator* ( 182 typename tmat4x2<T, P>::col_type const & v, 183 tmat4x2<T, P> const & m); 184 185 template <typename T, precision P> 186 GLM_FUNC_DECL tmat3x2<T, P> operator* ( 187 tmat4x2<T, P> const & m1, 188 tmat3x4<T, P> const & m2); 189 190 template <typename T, precision P> 191 GLM_FUNC_DECL tmat4x2<T, P> operator* ( 192 tmat4x2<T, P> const & m1, 193 tmat4x4<T, P> const & m2); 194 195 template <typename T, precision P> 196 GLM_FUNC_DECL tmat2x3<T, P> operator* ( 197 tmat4x3<T, P> const & m1, 198 tmat2x4<T, P> const & m2); 199 200 template <typename T, precision P> 201 GLM_FUNC_DECL tmat4x2<T, P> operator/ ( 202 tmat4x2<T, P> const & m, 203 T const & s); 204 205 template <typename T, precision P> 206 GLM_FUNC_DECL tmat4x2<T, P> operator/ ( 207 T const & s, 208 tmat4x2<T, P> const & m); 209 210 // Unary constant operators 211 template <typename T, precision P> 212 GLM_FUNC_DECL tmat4x2<T, P> const operator-( 213 tmat4x2<T, P> const & m); 214 215 }//namespace detail 216 }//namespace glm 217 218 #ifndef GLM_EXTERNAL_TEMPLATE 219 #include "type_mat4x2.inl" 220 #endif 221 222 #endif //glm_core_type_mat4x2 223