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