1 /// @ref core 2 /// @file glm/detail/type_mat3x2.hpp 3 4 #pragma once 5 6 #include "../fwd.hpp" 7 #include "type_vec2.hpp" 8 #include "type_vec3.hpp" 9 #include "type_mat.hpp" 10 #include <limits> 11 #include <cstddef> 12 13 namespace glm 14 { 15 template <typename T, precision P = defaultp> 16 struct tmat3x2 17 { 18 typedef tvec2<T, P> col_type; 19 typedef tvec3<T, P> row_type; 20 typedef tmat3x2<T, P> type; 21 typedef tmat2x3<T, P> transpose_type; 22 typedef T value_type; 23 24 private: 25 col_type value[3]; 26 27 public: 28 // -- Constructors -- 29 30 GLM_FUNC_DECL tmat3x2() GLM_DEFAULT_CTOR; 31 GLM_FUNC_DECL tmat3x2(tmat3x2<T, P> const & m) GLM_DEFAULT; 32 template <precision Q> 33 GLM_FUNC_DECL tmat3x2(tmat3x2<T, Q> const & m); 34 35 GLM_FUNC_DECL GLM_CONSTEXPR_CTOR explicit tmat3x2(ctor); 36 GLM_FUNC_DECL explicit tmat3x2(T scalar); 37 GLM_FUNC_DECL tmat3x2( 38 T x0, T y0, 39 T x1, T y1, 40 T x2, T y2); 41 GLM_FUNC_DECL tmat3x2( 42 col_type const & v0, 43 col_type const & v1, 44 col_type const & v2); 45 46 // -- Conversions -- 47 48 template< 49 typename X1, typename Y1, 50 typename X2, typename Y2, 51 typename X3, typename Y3> 52 GLM_FUNC_DECL tmat3x2( 53 X1 x1, Y1 y1, 54 X2 x2, Y2 y2, 55 X3 x3, Y3 y3); 56 57 template <typename V1, typename V2, typename V3> 58 GLM_FUNC_DECL tmat3x2( 59 tvec2<V1, P> const & v1, 60 tvec2<V2, P> const & v2, 61 tvec2<V3, P> const & v3); 62 63 // -- Matrix conversions -- 64 65 template <typename U, precision Q> 66 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x2<U, Q> const & m); 67 68 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x2<T, P> const & x); 69 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x3<T, P> const & x); 70 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x4<T, P> const & x); 71 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x3<T, P> const & x); 72 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat2x4<T, P> const & x); 73 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat3x4<T, P> const & x); 74 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x2<T, P> const & x); 75 GLM_FUNC_DECL GLM_EXPLICIT tmat3x2(tmat4x3<T, P> const & x); 76 77 // -- Accesses -- 78 79 typedef length_t length_type; lengthglm::tmat3x280 GLM_FUNC_DECL static length_type length(){return 3;} 81 82 GLM_FUNC_DECL col_type & operator[](length_type i); 83 GLM_FUNC_DECL col_type const & operator[](length_type i) const; 84 85 // -- Unary arithmetic operators -- 86 87 GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<T, P> const & m) GLM_DEFAULT; 88 89 template <typename U> 90 GLM_FUNC_DECL tmat3x2<T, P> & operator=(tmat3x2<U, P> const & m); 91 template <typename U> 92 GLM_FUNC_DECL tmat3x2<T, P> & operator+=(U s); 93 template <typename U> 94 GLM_FUNC_DECL tmat3x2<T, P> & operator+=(tmat3x2<U, P> const & m); 95 template <typename U> 96 GLM_FUNC_DECL tmat3x2<T, P> & operator-=(U s); 97 template <typename U> 98 GLM_FUNC_DECL tmat3x2<T, P> & operator-=(tmat3x2<U, P> const & m); 99 template <typename U> 100 GLM_FUNC_DECL tmat3x2<T, P> & operator*=(U s); 101 template <typename U> 102 GLM_FUNC_DECL tmat3x2<T, P> & operator/=(U s); 103 104 // -- Increment and decrement operators -- 105 106 GLM_FUNC_DECL tmat3x2<T, P> & operator++ (); 107 GLM_FUNC_DECL tmat3x2<T, P> & operator-- (); 108 GLM_FUNC_DECL tmat3x2<T, P> operator++(int); 109 GLM_FUNC_DECL tmat3x2<T, P> operator--(int); 110 }; 111 112 // -- Unary operators -- 113 114 template <typename T, precision P> 115 GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m); 116 117 template <typename T, precision P> 118 GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m); 119 120 // -- Binary operators -- 121 122 template <typename T, precision P> 123 GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m, T scalar); 124 125 template <typename T, precision P> 126 GLM_FUNC_DECL tmat3x2<T, P> operator+(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2); 127 128 template <typename T, precision P> 129 GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m, T scalar); 130 131 template <typename T, precision P> 132 GLM_FUNC_DECL tmat3x2<T, P> operator-(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2); 133 134 template <typename T, precision P> 135 GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m, T scalar); 136 137 template <typename T, precision P> 138 GLM_FUNC_DECL tmat3x2<T, P> operator*(T scalar, tmat3x2<T, P> const & m); 139 140 template <typename T, precision P> 141 GLM_FUNC_DECL typename tmat3x2<T, P>::col_type operator*(tmat3x2<T, P> const & m, typename tmat3x2<T, P>::row_type const & v); 142 143 template <typename T, precision P> 144 GLM_FUNC_DECL typename tmat3x2<T, P>::row_type operator*(typename tmat3x2<T, P>::col_type const & v, tmat3x2<T, P> const & m); 145 146 template <typename T, precision P> 147 GLM_FUNC_DECL tmat2x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat2x3<T, P> const & m2); 148 149 template <typename T, precision P> 150 GLM_FUNC_DECL tmat3x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat3x3<T, P> const & m2); 151 152 template <typename T, precision P> 153 GLM_FUNC_DECL tmat4x2<T, P> operator*(tmat3x2<T, P> const & m1, tmat4x3<T, P> const & m2); 154 155 template <typename T, precision P> 156 GLM_FUNC_DECL tmat3x2<T, P> operator/(tmat3x2<T, P> const & m, T scalar); 157 158 template <typename T, precision P> 159 GLM_FUNC_DECL tmat3x2<T, P> operator/(T scalar, tmat3x2<T, P> const & m); 160 161 // -- Boolean operators -- 162 163 template <typename T, precision P> 164 GLM_FUNC_DECL bool operator==(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2); 165 166 template <typename T, precision P> 167 GLM_FUNC_DECL bool operator!=(tmat3x2<T, P> const & m1, tmat3x2<T, P> const & m2); 168 169 }//namespace glm 170 171 #ifndef GLM_EXTERNAL_TEMPLATE 172 #include "type_mat3x2.inl" 173 #endif 174