type_mat2x2.hpp
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 namespace detail
00017 {
00018         template <typename T> struct tvec1;
00019         template <typename T> struct tvec2;
00020         template <typename T> struct tvec3;
00021         template <typename T> struct tvec4;
00022         template <typename T> struct tmat2x2;
00023         template <typename T> struct tmat2x3;
00024         template <typename T> struct tmat2x4;
00025         template <typename T> struct tmat3x2;
00026         template <typename T> struct tmat3x3;
00027         template <typename T> struct tmat3x4;
00028         template <typename T> struct tmat4x2;
00029         template <typename T> struct tmat4x3;
00030         template <typename T> struct tmat4x4;
00031 
00034         template <typename T> 
00035         struct tmat2x2
00036         {
00037                 enum ctor{null};
00038                 typedef T value_type;
00039                 typedef std::size_t size_type;
00040                 typedef tvec2<T> col_type;
00041                 typedef tvec2<T> row_type;
00042                 static GLM_FUNC_DECL size_type col_size();
00043                 static GLM_FUNC_DECL size_type row_size();
00044 
00045                 typedef tmat2x2<T> type;
00046                 typedef tmat2x2<T> transpose_type;
00047 
00048         public:
00049                 // Implementation detail
00050                 GLM_FUNC_DECL tmat2x2<T> _inverse() const;
00051 
00052         private:
00054                 // Data 
00055                 col_type value[2];
00056 
00057         public:
00059                 // Constructors
00060                 GLM_FUNC_DECL tmat2x2();
00061                 GLM_FUNC_DECL tmat2x2(
00062                         tmat2x2 const & m);
00063 
00064                 GLM_FUNC_DECL explicit tmat2x2(
00065                         ctor Null);
00066                 GLM_FUNC_DECL explicit tmat2x2(
00067                         value_type const & x);
00068                 GLM_FUNC_DECL explicit tmat2x2(
00069                         value_type const & x1, value_type const & y1, 
00070                         value_type const & x2, value_type const & y2);
00071                 GLM_FUNC_DECL explicit tmat2x2(
00072                         col_type const & v1, 
00073                         col_type const & v2);
00074 
00076                 // Conversions
00077                 template <typename U> 
00078                 GLM_FUNC_DECL explicit tmat2x2(
00079                         U const & x);
00080                         
00081                 template <typename U, typename V, typename M, typename N> 
00082                 GLM_FUNC_DECL explicit tmat2x2(
00083                         U const & x1, V const & y1, 
00084                         M const & x2, N const & y2);
00085                         
00086                 template <typename U, typename V> 
00087                 GLM_FUNC_DECL explicit tmat2x2(
00088                         tvec2<U> const & v1, 
00089                         tvec2<V> const & v2);
00090 
00092                 // Matrix conversions
00093                 template <typename U> 
00094                 GLM_FUNC_DECL explicit tmat2x2(tmat2x2<U> const & m);
00095 
00096                 GLM_FUNC_DECL explicit tmat2x2(tmat3x3<T> const & x);
00097                 GLM_FUNC_DECL explicit tmat2x2(tmat4x4<T> const & x);
00098                 GLM_FUNC_DECL explicit tmat2x2(tmat2x3<T> const & x);
00099                 GLM_FUNC_DECL explicit tmat2x2(tmat3x2<T> const & x);
00100                 GLM_FUNC_DECL explicit tmat2x2(tmat2x4<T> const & x);
00101                 GLM_FUNC_DECL explicit tmat2x2(tmat4x2<T> const & x);
00102                 GLM_FUNC_DECL explicit tmat2x2(tmat3x4<T> const & x);
00103                 GLM_FUNC_DECL explicit tmat2x2(tmat4x3<T> const & x);
00104 
00106                 // Accesses
00107 
00108                 GLM_FUNC_DECL col_type & operator[](size_type i);
00109                 GLM_FUNC_DECL col_type const & operator[](size_type i) const;
00110 
00111                 // Unary updatable operators
00112                 GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<T> const & m);
00113                 template <typename U> 
00114                 GLM_FUNC_DECL tmat2x2<T> & operator=(tmat2x2<U> const & m);
00115                 template <typename U> 
00116                 GLM_FUNC_DECL tmat2x2<T> & operator+=(U const & s);
00117                 template <typename U> 
00118                 GLM_FUNC_DECL tmat2x2<T> & operator+=(tmat2x2<U> const & m);
00119                 template <typename U> 
00120                 GLM_FUNC_DECL tmat2x2<T> & operator-=(U const & s);
00121                 template <typename U> 
00122                 GLM_FUNC_DECL tmat2x2<T> & operator-=(tmat2x2<U> const & m);
00123                 template <typename U> 
00124                 GLM_FUNC_DECL tmat2x2<T> & operator*=(U const & s);
00125                 template <typename U> 
00126                 GLM_FUNC_DECL tmat2x2<T> & operator*=(tmat2x2<U> const & m);
00127                 template <typename U> 
00128                 GLM_FUNC_DECL tmat2x2<T> & operator/=(U const & s);
00129                 template <typename U> 
00130                 GLM_FUNC_DECL tmat2x2<T> & operator/=(tmat2x2<U> const & m);
00131                 GLM_FUNC_DECL tmat2x2<T> & operator++();
00132                 GLM_FUNC_DECL tmat2x2<T> & operator--();
00133         };
00134 
00135         // Binary operators
00136         template <typename T> 
00137         tmat2x2<T> operator+ (
00138                 tmat2x2<T> const & m, 
00139                 typename tmat2x2<T>::value_type const & s);
00140 
00141         template <typename T> 
00142         tmat2x2<T> operator+ (
00143                 typename tmat2x2<T>::value_type const & s, 
00144                 tmat2x2<T> const & m);
00145 
00146         template <typename T> 
00147         tmat2x2<T> operator+ (
00148                 tmat2x2<T> const & m1, 
00149                 tmat2x2<T> const & m2);
00150             
00151         template <typename T> 
00152         tmat2x2<T> operator- (
00153                 tmat2x2<T> const & m, 
00154                 typename tmat2x2<T>::value_type const & s);
00155 
00156         template <typename T> 
00157         tmat2x2<T> operator- (
00158                 typename tmat2x2<T>::value_type const & s, 
00159                 tmat2x2<T> const & m);
00160 
00161         template <typename T> 
00162         tmat2x2<T> operator- (
00163                 tmat2x2<T> const & m1, 
00164                 tmat2x2<T> const & m2);
00165 
00166         template <typename T> 
00167         tmat2x2<T> operator* (
00168                 tmat2x2<T> const & m, 
00169                 typename tmat2x2<T>::value_type const & s);
00170 
00171         template <typename T> 
00172         tmat2x2<T> operator* (
00173                 typename tmat2x2<T>::value_type const & s, 
00174                 tmat2x2<T> const & m);
00175 
00176         template <typename T> 
00177         typename tmat2x2<T>::col_type operator* (
00178                 tmat2x2<T> const & m, 
00179                 typename tmat2x2<T>::row_type const & v);
00180 
00181         template <typename T> 
00182         typename tmat2x2<T>::row_type operator* (
00183                 typename tmat2x2<T>::col_type const & v, 
00184                 tmat2x2<T> const & m);
00185 
00186         template <typename T> 
00187         tmat2x2<T> operator* (
00188                 tmat2x2<T> const & m1, 
00189                 tmat2x2<T> const & m2);
00190 
00191         template <typename T> 
00192         tmat2x2<T> operator/ (
00193                 tmat2x2<T> const & m, 
00194                 typename tmat2x2<T>::value_type const & s);
00195 
00196         template <typename T> 
00197         tmat2x2<T> operator/ (
00198                 typename tmat2x2<T>::value_type const & s,
00199                 tmat2x2<T> const & m);
00200 
00201         template <typename T> 
00202         typename tmat2x2<T>::col_type operator/ (
00203                 tmat2x2<T> const & m, 
00204                 typename tmat2x2<T>::row_type const & v);
00205 
00206         template <typename T> 
00207         typename tmat2x2<T>::row_type operator/ (
00208                 typename tmat2x2<T>::col_type const & v, 
00209                 tmat2x2<T> const & m);
00210 
00211         template <typename T> 
00212         tmat2x2<T> operator/ (
00213                 tmat2x2<T> const & m1, 
00214                 tmat2x2<T> const & m2);
00215 
00216         // Unary constant operators
00217         template <typename T> 
00218         tmat2x2<T> const operator-  (
00219                 tmat2x2<T> const & m);
00220 
00221         template <typename T> 
00222         tmat2x2<T> const operator-- (
00223                 tmat2x2<T> const & m, 
00224                 int);
00225 
00226         template <typename T> 
00227         tmat2x2<T> const operator++ (
00228                 tmat2x2<T> const & m, 
00229                 int);
00230 } //namespace detail
00231 
00232 namespace core{
00233 namespace type{
00234 namespace precision
00235 {
00240         typedef detail::tmat2x2<lowp_float>             lowp_mat2;
00241 
00246         typedef detail::tmat2x2<mediump_float>  mediump_mat2;
00247 
00252         typedef detail::tmat2x2<highp_float>    highp_mat2;
00253 
00258         typedef detail::tmat2x2<lowp_float>             lowp_mat2x2;
00259 
00264         typedef detail::tmat2x2<mediump_float>  mediump_mat2x2;
00265 
00270         typedef detail::tmat2x2<highp_float>    highp_mat2x2;
00271 
00272 }//namespace precision
00273 }//namespace type
00274 }//namespace core
00275 }//namespace glm
00276 
00277 #ifndef GLM_EXTERNAL_TEMPLATE
00278 #include "type_mat2x2.inl"
00279 #endif
00280 
00281 #endif //glm_core_type_mat2x2