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_mat2x4.hpp 25 /// @date 2006-08-05 / 2011-06-15 26 /// @author Christophe Riccio 27 /////////////////////////////////////////////////////////////////////////////////// 28 29 #ifndef glm_core_type_mat2x4 30 #define glm_core_type_mat2x4 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 tmat2x4 43 { 44 enum ctor{_null}; 45 typedef T value_type; 46 typedef std::size_t size_type; 47 typedef tvec4<T, P> col_type; 48 typedef tvec2<T, P> row_type; 49 typedef tmat2x4<T, P> type; 50 typedef tmat4x2<T, P> transpose_type; 51 52 GLM_FUNC_DECL GLM_CONSTEXPR length_t length() const; 53 54 private: 55 // Data 56 col_type value[2]; 57 58 public: 59 // Constructors 60 GLM_FUNC_DECL tmat2x4(); 61 GLM_FUNC_DECL tmat2x4(tmat2x4<T, P> const & m); 62 template <precision Q> 63 GLM_FUNC_DECL tmat2x4(tmat2x4<T, Q> const & m); 64 65 GLM_FUNC_DECL explicit tmat2x4( 66 ctor); 67 GLM_FUNC_DECL explicit tmat2x4( 68 T const & s); 69 GLM_FUNC_DECL tmat2x4( 70 T const & x0, T const & y0, T const & z0, T const & w0, 71 T const & x1, T const & y1, T const & z1, T const & w1); 72 GLM_FUNC_DECL tmat2x4( 73 col_type const & v0, 74 col_type const & v1); 75 76 ////////////////////////////////////// 77 // Conversions 78 template < 79 typename X1, typename Y1, typename Z1, typename W1, 80 typename X2, typename Y2, typename Z2, typename W2> 81 GLM_FUNC_DECL tmat2x4( 82 X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, 83 X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2); 84 85 template <typename U, typename V> 86 GLM_FUNC_DECL tmat2x4( 87 tvec4<U, P> const & v1, 88 tvec4<V, P> const & v2); 89 90 ////////////////////////////////////// 91 // Matrix conversions 92 template <typename U, precision Q> 93 GLM_FUNC_DECL explicit tmat2x4(tmat2x4<U, Q> const & m); 94 95 GLM_FUNC_DECL explicit tmat2x4(tmat2x2<T, P> const & x); 96 GLM_FUNC_DECL explicit tmat2x4(tmat3x3<T, P> const & x); 97 GLM_FUNC_DECL explicit tmat2x4(tmat4x4<T, P> const & x); 98 GLM_FUNC_DECL explicit tmat2x4(tmat2x3<T, P> const & x); 99 GLM_FUNC_DECL explicit tmat2x4(tmat3x2<T, P> const & x); 100 GLM_FUNC_DECL explicit tmat2x4(tmat3x4<T, P> const & x); 101 GLM_FUNC_DECL explicit tmat2x4(tmat4x2<T, P> const & x); 102 GLM_FUNC_DECL explicit tmat2x4(tmat4x3<T, P> const & x); 103 104 // Accesses 105 GLM_FUNC_DECL col_type & operator[](length_t i); 106 GLM_FUNC_DECL col_type const & operator[](length_t i) const; 107 108 // Unary updatable operators 109 GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<T, P> const & m); 110 template <typename U> 111 GLM_FUNC_DECL tmat2x4<T, P>& operator= (tmat2x4<U, P> const & m); 112 template <typename U> 113 GLM_FUNC_DECL tmat2x4<T, P>& operator+= (U s); 114 template <typename U> 115 GLM_FUNC_DECL tmat2x4<T, P>& operator+= (tmat2x4<U, P> const & m); 116 template <typename U> 117 GLM_FUNC_DECL tmat2x4<T, P>& operator-= (U s); 118 template <typename U> 119 GLM_FUNC_DECL tmat2x4<T, P>& operator-= (tmat2x4<U, P> const & m); 120 template <typename U> 121 GLM_FUNC_DECL tmat2x4<T, P>& operator*= (U s); 122 template <typename U> 123 GLM_FUNC_DECL tmat2x4<T, P>& operator/= (U s); 124 125 ////////////////////////////////////// 126 // Increment and decrement operators 127 128 GLM_FUNC_DECL tmat2x4<T, P> & operator++ (); 129 GLM_FUNC_DECL tmat2x4<T, P> & operator-- (); 130 GLM_FUNC_DECL tmat2x4<T, P> operator++(int); 131 GLM_FUNC_DECL tmat2x4<T, P> operator--(int); 132 }; 133 134 // Binary operators 135 136 template <typename T, precision P> 137 GLM_FUNC_DECL tmat2x4<T, P> operator+ ( 138 tmat2x4<T, P> const & m, 139 T const & s); 140 141 template <typename T, precision P> 142 GLM_FUNC_DECL tmat2x4<T, P> operator+ ( 143 tmat2x4<T, P> const & m1, 144 tmat2x4<T, P> const & m2); 145 146 template <typename T, precision P> 147 GLM_FUNC_DECL tmat2x4<T, P> operator- ( 148 tmat2x4<T, P> const & m, 149 T const & s); 150 151 template <typename T, precision P> 152 GLM_FUNC_DECL tmat2x4<T, P> operator- ( 153 tmat2x4<T, P> const & m1, 154 tmat2x4<T, P> const & m2); 155 156 template <typename T, precision P> 157 GLM_FUNC_DECL tmat2x4<T, P> operator* ( 158 tmat2x4<T, P> const & m, 159 T const & s); 160 161 template <typename T, precision P> 162 GLM_FUNC_DECL tmat2x4<T, P> operator* ( 163 T const & s, 164 tmat2x4<T, P> const & m); 165 166 template <typename T, precision P> 167 GLM_FUNC_DECL typename tmat2x4<T, P>::col_type operator* ( 168 tmat2x4<T, P> const & m, 169 typename tmat2x4<T, P>::row_type const & v); 170 171 template <typename T, precision P> 172 GLM_FUNC_DECL typename tmat2x4<T, P>::row_type operator* ( 173 typename tmat2x4<T, P>::col_type const & v, 174 tmat2x4<T, P> const & m); 175 176 template <typename T, precision P> 177 GLM_FUNC_DECL tmat4x4<T, P> operator* ( 178 tmat2x4<T, P> const & m1, 179 tmat4x2<T, P> const & m2); 180 181 template <typename T, precision P> 182 GLM_FUNC_DECL tmat2x4<T, P> operator* ( 183 tmat2x4<T, P> const & m1, 184 tmat2x2<T, P> const & m2); 185 186 template <typename T, precision P> 187 GLM_FUNC_DECL tmat3x4<T, P> operator* ( 188 tmat2x4<T, P> const & m1, 189 tmat3x2<T, P> const & m2); 190 191 template <typename T, precision P> 192 GLM_FUNC_DECL tmat2x4<T, P> operator/ ( 193 tmat2x4<T, P> const & m, 194 T const & s); 195 196 template <typename T, precision P> 197 GLM_FUNC_DECL tmat2x4<T, P> operator/ ( 198 T const & s, 199 tmat2x4<T, P> const & m); 200 201 // Unary constant operators 202 template <typename T, precision P> 203 GLM_FUNC_DECL tmat2x4<T, P> const operator- ( 204 tmat2x4<T, P> const & m); 205 206 }//namespace detail 207 }//namespace glm 208 209 #ifndef GLM_EXTERNAL_TEMPLATE 210 #include "type_mat2x4.inl" 211 #endif 212 213 #endif //glm_core_type_mat2x4 214