GLM Version 0.9.0
|
00001 00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) 00004 // Created : 2005-01-27 00005 // Updated : 2010-02-11 00006 // Licence : This source is under MIT License 00007 // File : glm/core/type_mat2x2.hpp 00009 00010 #ifndef glm_core_type_mat2x2 00011 #define glm_core_type_mat2x2 00012 00013 #include "type_mat.hpp" 00014 00015 namespace glm 00016 { 00017 namespace test 00018 { 00019 void main_mat2x2(); 00020 }//namespace test 00021 00022 namespace detail 00023 { 00024 template <typename T> struct tvec1; 00025 template <typename T> struct tvec2; 00026 template <typename T> struct tvec3; 00027 template <typename T> struct tvec4; 00028 template <typename T> struct tmat2x2; 00029 template <typename T> struct tmat2x3; 00030 template <typename T> struct tmat2x4; 00031 template <typename T> struct tmat3x2; 00032 template <typename T> struct tmat3x3; 00033 template <typename T> struct tmat3x4; 00034 template <typename T> struct tmat4x2; 00035 template <typename T> struct tmat4x3; 00036 template <typename T> struct tmat4x4; 00037 00039 template <typename T> 00040 struct tmat2x2 00041 { 00042 enum ctor{null}; 00043 typedef T value_type; 00044 typedef std::size_t size_type; 00045 typedef tvec2<T> col_type; 00046 typedef tvec2<T> row_type; 00047 static size_type col_size(); 00048 static size_type row_size(); 00049 00050 typedef tmat2x2<T> type; 00051 typedef tmat2x2<T> transpose_type; 00052 00053 public: 00054 // Implementation detail 00055 tmat2x2<T> _inverse() const; 00056 00057 private: 00058 // Data 00059 col_type value[2]; 00060 00061 public: 00062 // Constructors 00063 tmat2x2(); 00064 tmat2x2( 00065 tmat2x2 const & m); 00066 00067 explicit tmat2x2( 00068 ctor Null); 00069 explicit tmat2x2( 00070 value_type const & x); 00071 explicit tmat2x2( 00072 value_type const & x1, value_type const & y1, 00073 value_type const & x2, value_type const & y2); 00074 explicit tmat2x2( 00075 col_type const & v1, 00076 col_type const & v2); 00077 00078 // Conversions 00079 template <typename U> 00080 explicit tmat2x2(tmat2x2<U> const & m); 00081 00082 explicit tmat2x2(tmat3x3<T> const & x); 00083 explicit tmat2x2(tmat4x4<T> const & x); 00084 explicit tmat2x2(tmat2x3<T> const & x); 00085 explicit tmat2x2(tmat3x2<T> const & x); 00086 explicit tmat2x2(tmat2x4<T> const & x); 00087 explicit tmat2x2(tmat4x2<T> const & x); 00088 explicit tmat2x2(tmat3x4<T> const & x); 00089 explicit tmat2x2(tmat4x3<T> const & x); 00090 00092 // Accesses 00093 00094 col_type & operator[](size_type i); 00095 col_type const & operator[](size_type i) const; 00096 00097 // Unary updatable operators 00098 tmat2x2<T> & operator=(tmat2x2<T> const & m); 00099 template <typename U> 00100 tmat2x2<T> & operator=(tmat2x2<U> const & m); 00101 template <typename U> 00102 tmat2x2<T> & operator+=(U const & s); 00103 template <typename U> 00104 tmat2x2<T> & operator+=(tmat2x2<U> const & m); 00105 template <typename U> 00106 tmat2x2<T> & operator-=(U const & s); 00107 template <typename U> 00108 tmat2x2<T> & operator-=(tmat2x2<U> const & m); 00109 template <typename U> 00110 tmat2x2<T> & operator*=(U const & s); 00111 template <typename U> 00112 tmat2x2<T> & operator*=(tmat2x2<U> const & m); 00113 template <typename U> 00114 tmat2x2<T> & operator/=(U const & s); 00115 template <typename U> 00116 tmat2x2<T> & operator/=(tmat2x2<U> const & m); 00117 tmat2x2<T> & operator++(); 00118 tmat2x2<T> & operator--(); 00119 }; 00120 00121 // Binary operators 00122 template <typename T> 00123 tmat2x2<T> operator+ ( 00124 tmat2x2<T> const & m, 00125 typename tmat2x2<T>::value_type const & s); 00126 00127 template <typename T> 00128 tmat2x2<T> operator+ ( 00129 typename tmat2x2<T>::value_type const & s, 00130 tmat2x2<T> const & m); 00131 00132 template <typename T> 00133 tmat2x2<T> operator+ ( 00134 tmat2x2<T> const & m1, 00135 tmat2x2<T> const & m2); 00136 00137 template <typename T> 00138 tmat2x2<T> operator- ( 00139 tmat2x2<T> const & m, 00140 typename tmat2x2<T>::value_type const & s); 00141 00142 template <typename T> 00143 tmat2x2<T> operator- ( 00144 typename tmat2x2<T>::value_type const & s, 00145 tmat2x2<T> const & m); 00146 00147 template <typename T> 00148 tmat2x2<T> operator- ( 00149 tmat2x2<T> const & m1, 00150 tmat2x2<T> const & m2); 00151 00152 template <typename T> 00153 tmat2x2<T> operator* ( 00154 tmat2x2<T> const & m, 00155 typename tmat2x2<T>::value_type const & s); 00156 00157 template <typename T> 00158 tmat2x2<T> operator* ( 00159 typename tmat2x2<T>::value_type const & s, 00160 tmat2x2<T> const & m); 00161 00162 template <typename T> 00163 typename tmat2x2<T>::col_type operator* ( 00164 tmat2x2<T> const & m, 00165 typename tmat2x2<T>::row_type const & v); 00166 00167 template <typename T> 00168 typename tmat2x2<T>::row_type operator* ( 00169 typename tmat2x2<T>::col_type const & v, 00170 tmat2x2<T> const & m); 00171 00172 template <typename T> 00173 tmat2x2<T> operator* ( 00174 tmat2x2<T> const & m1, 00175 tmat2x2<T> const & m2); 00176 00177 template <typename T> 00178 tmat2x2<T> operator/ ( 00179 tmat2x2<T> const & m, 00180 typename tmat2x2<T>::value_type const & s); 00181 00182 template <typename T> 00183 tmat2x2<T> operator/ ( 00184 typename tmat2x2<T>::value_type const & s, 00185 tmat2x2<T> const & m); 00186 00187 template <typename T> 00188 typename tmat2x2<T>::col_type operator/ ( 00189 tmat2x2<T> const & m, 00190 typename tmat2x2<T>::row_type const & v); 00191 00192 template <typename T> 00193 typename tmat2x2<T>::row_type operator/ ( 00194 typename tmat2x2<T>::col_type const & v, 00195 tmat2x2<T> const & m); 00196 00197 template <typename T> 00198 tmat2x2<T> operator/ ( 00199 tmat2x2<T> const & m1, 00200 tmat2x2<T> const & m2); 00201 00202 // Unary constant operators 00203 template <typename T> 00204 tmat2x2<T> const operator- ( 00205 tmat2x2<T> const & m); 00206 00207 template <typename T> 00208 tmat2x2<T> const operator-- ( 00209 tmat2x2<T> const & m, 00210 int); 00211 00212 template <typename T> 00213 tmat2x2<T> const operator++ ( 00214 tmat2x2<T> const & m, 00215 int); 00216 00217 } //namespace detail 00218 00219 namespace core{ 00220 namespace type{ 00221 00222 namespace precision 00223 { 00227 typedef detail::tmat2x2<lowp_float> lowp_mat2x2; 00231 typedef detail::tmat2x2<mediump_float> mediump_mat2x2; 00235 typedef detail::tmat2x2<highp_float> highp_mat2x2; 00236 } 00237 //namespace precision 00238 00239 }//namespace type 00240 }//namespace core 00241 } //namespace glm 00242 00243 #include "type_mat2x2.inl" 00244 00245 #endif //glm_core_type_mat2x2