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