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