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