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