type_mat2x2.hpp
Go to the documentation of this file.
00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 
00028 
00029 #ifndef glm_core_type_mat2x2
00030 #define glm_core_type_mat2x2
00031 
00032 #include "type_mat.hpp"
00033 
00034 namespace glm{
00035 namespace detail
00036 {
00037         template <typename T> struct tvec1;
00038         template <typename T> struct tvec2;
00039         template <typename T> struct tvec3;
00040         template <typename T> struct tvec4;
00041         template <typename T> struct tmat2x2;
00042         template <typename T> struct tmat2x3;
00043         template <typename T> struct tmat2x4;
00044         template <typename T> struct tmat3x2;
00045         template <typename T> struct tmat3x3;
00046         template <typename T> struct tmat3x4;
00047         template <typename T> struct tmat4x2;
00048         template <typename T> struct tmat4x3;
00049         template <typename T> struct tmat4x4;
00050 
00051         // @brief Template for 2 * 2 matrix of floating-point numbers.
00052         // @ingroup core_template
00053         template <typename T> 
00054         struct tmat2x2
00055         {
00056                 // Implementation detail
00057                 enum ctor{null};
00058                 typedef T value_type;
00059                 typedef std::size_t size_type;
00060                 typedef tvec2<T> col_type;
00061                 typedef tvec2<T> row_type;
00062                 static GLM_FUNC_DECL size_type col_size();
00063                 static GLM_FUNC_DECL size_type row_size();
00064 
00065                 typedef tmat2x2<T> type;
00066                 typedef tmat2x2<T> transpose_type;
00067         
00068                 GLM_FUNC_DECL size_type length() const;
00069         
00070         public:
00071                 // Implementation detail
00072                 GLM_FUNC_DECL tmat2x2<T> _inverse() const;
00073 
00074         private:
00076                 // Implementation detail
00077                 col_type value[2];
00078         
00079         public:
00081                 // Constructors
00082                 GLM_FUNC_DECL tmat2x2();
00083                 GLM_FUNC_DECL tmat2x2(
00084                         tmat2x2 const & m);
00085 
00086                 GLM_FUNC_DECL explicit tmat2x2(
00087                         ctor Null);
00088                 GLM_FUNC_DECL explicit tmat2x2(
00089                         value_type const & x);
00090                 GLM_FUNC_DECL explicit tmat2x2(
00091                         value_type const & x1, value_type const & y1, 
00092                         value_type const & x2, value_type const & y2);
00093                 GLM_FUNC_DECL explicit tmat2x2(
00094                         col_type const & v1, 
00095                         col_type const & v2);
00096 
00098                 // Conversions
00099                 template <typename U> 
00100                 GLM_FUNC_DECL explicit tmat2x2(
00101                         U const & x);
00102 
00103                 template <typename U, typename V, typename M, typename N> 
00104                 GLM_FUNC_DECL explicit tmat2x2(
00105                         U const & x1, V const & y1, 
00106                         M const & x2, N const & y2);
00107                         
00108                 template <typename U, typename V> 
00109                 GLM_FUNC_DECL explicit tmat2x2(
00110                         tvec2<U> const & v1, 
00111                         tvec2<V> const & v2);
00112 
00114                 // Matrix conversions
00115                 template <typename U> 
00116                 GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U> const & m);
00117 
00118                 GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T> const & x);
00119                 GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T> const & x);
00120                 GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T> const & x);
00121                 GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T> const & x);
00122                 GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T> const & x);
00123                 GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T> const & x);
00124                 GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T> const & x);
00125                 GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T> const & x);
00126 
00128                 // Accesses
00129 
00130                 GLM_FUNC_DECL col_type & operator[](size_type i);
00131                 GLM_FUNC_DECL col_type const & operator[](size_type i) const;
00132 
00133                 // Unary updatable operators
00134                 GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<T> const & m);
00135                 template <typename U> 
00136                 GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<U> const & m);
00137                 template <typename U> 
00138                 GLM_FUNC_DECL tmat2x2<T> & operator+=(U const & s);
00139                 template <typename U> 
00140                 GLM_FUNC_DECL tmat2x2<T> & operator+=(tmat2x2<U> const & m);
00141                 template <typename U> 
00142                 GLM_FUNC_DECL tmat2x2<T> & operator-=(U const & s);
00143                 template <typename U> 
00144                 GLM_FUNC_DECL tmat2x2<T> & operator-=(tmat2x2<U> const & m);
00145                 template <typename U> 
00146                 GLM_FUNC_DECL tmat2x2<T> & operator*=(U const & s);
00147                 template <typename U> 
00148                 GLM_FUNC_DECL tmat2x2<T> & operator*=(tmat2x2<U> const & m);
00149                 template <typename U> 
00150                 GLM_FUNC_DECL tmat2x2<T> & operator/=(U const & s);
00151                 template <typename U> 
00152                 GLM_FUNC_DECL tmat2x2<T> & operator/=(tmat2x2<U> const & m);
00153                 GLM_FUNC_DECL tmat2x2<T> & operator++();
00154                 GLM_FUNC_DECL tmat2x2<T> & operator--();
00155         };
00156 
00157         // Binary operators
00158         template <typename T> 
00159         tmat2x2<T> operator+ (
00160                 tmat2x2<T> const & m, 
00161                 typename tmat2x2<T>::value_type const & s);
00162 
00163         template <typename T> 
00164         tmat2x2<T> operator+ (
00165                 typename tmat2x2<T>::value_type const & s, 
00166                 tmat2x2<T> const & m);
00167 
00168         template <typename T> 
00169         tmat2x2<T> operator+ (
00170                 tmat2x2<T> const & m1, 
00171                 tmat2x2<T> const & m2);
00172             
00173         template <typename T> 
00174         tmat2x2<T> operator- (
00175                 tmat2x2<T> const & m, 
00176                 typename tmat2x2<T>::value_type const & s);
00177 
00178         template <typename T> 
00179         tmat2x2<T> operator- (
00180                 typename tmat2x2<T>::value_type const & s, 
00181                 tmat2x2<T> const & m);
00182 
00183         template <typename T> 
00184         tmat2x2<T> operator- (
00185                 tmat2x2<T> const & m1, 
00186                 tmat2x2<T> const & m2);
00187 
00188         template <typename T> 
00189         tmat2x2<T> operator* (
00190                 tmat2x2<T> const & m, 
00191                 typename tmat2x2<T>::value_type const & s);
00192 
00193         template <typename T> 
00194         tmat2x2<T> operator* (
00195                 typename tmat2x2<T>::value_type const & s, 
00196                 tmat2x2<T> const & m);
00197 
00198         template <typename T> 
00199         typename tmat2x2<T>::col_type operator* (
00200                 tmat2x2<T> const & m, 
00201                 typename tmat2x2<T>::row_type const & v);
00202 
00203         template <typename T> 
00204         typename tmat2x2<T>::row_type operator* (
00205                 typename tmat2x2<T>::col_type const & v, 
00206                 tmat2x2<T> const & m);
00207 
00208         template <typename T> 
00209         tmat2x2<T> operator* (
00210                 tmat2x2<T> const & m1, 
00211                 tmat2x2<T> const & m2);
00212                 
00213         template <typename T>
00214         tmat3x2<T> operator* (
00215                 tmat2x2<T> const & m1, 
00216                 tmat3x2<T> const & m2);
00217                 
00218         template <typename T>
00219         tmat4x2<T> operator* (
00220                 tmat2x2<T> const & m1, 
00221                 tmat4x2<T> const & m2);
00222 
00223         template <typename T> 
00224         tmat2x2<T> operator/ (
00225                 tmat2x2<T> const & m, 
00226                 typename tmat2x2<T>::value_type const & s);
00227 
00228         template <typename T> 
00229         tmat2x2<T> operator/ (
00230                 typename tmat2x2<T>::value_type const & s,
00231                 tmat2x2<T> const & m);
00232 
00233         template <typename T> 
00234         typename tmat2x2<T>::col_type operator/ (
00235                 tmat2x2<T> const & m, 
00236                 typename tmat2x2<T>::row_type const & v);
00237 
00238         template <typename T> 
00239         typename tmat2x2<T>::row_type operator/ (
00240                 typename tmat2x2<T>::col_type const & v, 
00241                 tmat2x2<T> const & m);
00242 
00243         template <typename T> 
00244         tmat2x2<T> operator/ (
00245                 tmat2x2<T> const & m1, 
00246                 tmat2x2<T> const & m2);
00247 
00248         // Unary constant operators
00249         template <typename T> 
00250         tmat2x2<T> const operator-  (
00251                 tmat2x2<T> const & m);
00252 
00253         template <typename T> 
00254         tmat2x2<T> const operator-- (
00255                 tmat2x2<T> const & m, 
00256                 int);
00257 
00258         template <typename T> 
00259         tmat2x2<T> const operator++ (
00260                 tmat2x2<T> const & m, 
00261                 int);
00262 } //namespace detail
00263 
00266 
00272         typedef detail::tmat2x2<lowp_float>             lowp_mat2;
00273 
00279         typedef detail::tmat2x2<mediump_float>  mediump_mat2;
00280 
00286         typedef detail::tmat2x2<highp_float>    highp_mat2;
00287 
00293         typedef detail::tmat2x2<lowp_float>             lowp_mat2x2;
00294 
00300         typedef detail::tmat2x2<mediump_float>  mediump_mat2x2;
00301 
00307         typedef detail::tmat2x2<highp_float>    highp_mat2x2;
00308 
00310 }//namespace glm
00311 
00312 #ifndef GLM_EXTERNAL_TEMPLATE
00313 #include "type_mat2x2.inl"
00314 #endif
00315 
00316 #endif //glm_core_type_mat2x2