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 {
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 
00040                 template <typename T> 
00041                 struct tmat2x2
00042                 {
00043                         enum ctor{null};
00044                         typedef T value_type;
00045                         typedef std::size_t size_type;
00046                         typedef tvec2<T> col_type;
00047                         typedef tvec2<T> row_type;
00048                         static size_type col_size();
00049                         static size_type row_size();
00050 
00051                         typedef tmat2x2<T> type;
00052                         typedef tmat2x2<T> transpose_type;
00053 
00054                 public:
00055                         // Implementation detail
00056                         tmat2x2<T> _inverse() const;
00057 
00058                 private:
00059                         // Data 
00060                         col_type value[2];
00061 
00062                 public:
00063                         // Constructors
00064                         tmat2x2();
00065                         tmat2x2(
00066                                 tmat2x2 const & m);
00067 
00068                         explicit tmat2x2(
00069                                 ctor Null);
00070                         explicit tmat2x2(
00071                                 value_type const & x);
00072                         explicit tmat2x2(
00073                                 value_type const & x1, value_type const & y1, 
00074                                 value_type const & x2, value_type const & y2);
00075                         explicit tmat2x2(
00076                                 col_type const & v1, 
00077                                 col_type const & v2);
00078 
00079                         // Conversions
00080                         template <typename U> 
00081                         explicit tmat2x2(tmat2x2<U> const & m);
00082 
00083                         explicit tmat2x2(tmat3x3<T> const & x);
00084                         explicit tmat2x2(tmat4x4<T> const & x);
00085                         explicit tmat2x2(tmat2x3<T> const & x);
00086                         explicit tmat2x2(tmat3x2<T> const & x);
00087                         explicit tmat2x2(tmat2x4<T> const & x);
00088                         explicit tmat2x2(tmat4x2<T> const & x);
00089                         explicit tmat2x2(tmat3x4<T> const & x);
00090                         explicit tmat2x2(tmat4x3<T> const & x);
00091 
00093                         // Accesses
00094 
00095                         col_type & operator[](size_type i);
00096                         col_type const & operator[](size_type i) const;
00097 
00098                         // Unary updatable operators
00099                         tmat2x2<T> & operator=(tmat2x2<T> const & m);
00100                         template <typename U> 
00101                         tmat2x2<T> & operator=(tmat2x2<U> const & m);
00102                         template <typename U> 
00103                         tmat2x2<T> & operator+=(U const & s);
00104                         template <typename U> 
00105                         tmat2x2<T> & operator+=(tmat2x2<U> const & m);
00106                         template <typename U> 
00107                         tmat2x2<T> & operator-=(U const & s);
00108                         template <typename U> 
00109                         tmat2x2<T> & operator-=(tmat2x2<U> const & m);
00110                         template <typename U> 
00111                         tmat2x2<T> & operator*=(U const & s);
00112                         template <typename U> 
00113                         tmat2x2<T> & operator*=(tmat2x2<U> const & m);
00114                         template <typename U> 
00115                         tmat2x2<T> & operator/=(U const & s);
00116                         template <typename U> 
00117                         tmat2x2<T> & operator/=(tmat2x2<U> const & m);
00118                         tmat2x2<T> & operator++();
00119                         tmat2x2<T> & operator--();
00120                 };
00121 
00122                 // Binary operators
00123                 template <typename T> 
00124                 tmat2x2<T> operator+ (
00125                         tmat2x2<T> const & m, 
00126                         typename tmat2x2<T>::value_type const & s);
00127 
00128                 template <typename T> 
00129                 tmat2x2<T> operator+ (
00130                         typename tmat2x2<T>::value_type const & s, 
00131                         tmat2x2<T> const & m);
00132 
00133                 template <typename T> 
00134                 tmat2x2<T> operator+ (
00135                         tmat2x2<T> const & m1, 
00136                         tmat2x2<T> const & m2);
00137             
00138                 template <typename T> 
00139                 tmat2x2<T> operator- (
00140                         tmat2x2<T> const & m, 
00141                         typename tmat2x2<T>::value_type const & s);
00142 
00143                 template <typename T> 
00144                 tmat2x2<T> operator- (
00145                         typename tmat2x2<T>::value_type const & s, 
00146                         tmat2x2<T> const & m);
00147 
00148                 template <typename T> 
00149                 tmat2x2<T> operator- (
00150                         tmat2x2<T> const & m1, 
00151                         tmat2x2<T> const & m2);
00152 
00153                 template <typename T> 
00154                 tmat2x2<T> operator* (
00155                         tmat2x2<T> const & m, 
00156                         typename tmat2x2<T>::value_type const & s);
00157 
00158                 template <typename T> 
00159                 tmat2x2<T> operator* (
00160                         typename tmat2x2<T>::value_type const & s, 
00161                         tmat2x2<T> const & m);
00162 
00163                 template <typename T> 
00164                 typename tmat2x2<T>::col_type operator* (
00165                         tmat2x2<T> const & m, 
00166                         typename tmat2x2<T>::row_type const & v);
00167 
00168                 template <typename T> 
00169                 typename tmat2x2<T>::row_type operator* (
00170                         typename tmat2x2<T>::col_type const & v, 
00171                         tmat2x2<T> const & m);
00172 
00173                 template <typename T> 
00174                 tmat2x2<T> operator* (
00175                         tmat2x2<T> const & m1, 
00176                         tmat2x2<T> const & m2);
00177 
00178                 template <typename T> 
00179                 tmat2x2<T> operator/ (
00180                         tmat2x2<T> const & m, 
00181                         typename tmat2x2<T>::value_type const & s);
00182 
00183                 template <typename T> 
00184                 tmat2x2<T> operator/ (
00185                         typename tmat2x2<T>::value_type const & s,
00186                         tmat2x2<T> const & m);
00187 
00188                 template <typename T> 
00189                 typename tmat2x2<T>::col_type operator/ (
00190                         tmat2x2<T> const & m, 
00191                         typename tmat2x2<T>::row_type const & v);
00192 
00193                 template <typename T> 
00194                 typename tmat2x2<T>::row_type operator/ (
00195                         typename tmat2x2<T>::col_type const & v, 
00196                         tmat2x2<T> const & m);
00197 
00198                 template <typename T> 
00199                 tmat2x2<T> operator/ (
00200                         tmat2x2<T> const & m1, 
00201                         tmat2x2<T> const & m2);
00202 
00203                 // Unary constant operators
00204                 template <typename T> 
00205                 tmat2x2<T> const operator-  (
00206                         tmat2x2<T> const & m);
00207 
00208                 template <typename T> 
00209                 tmat2x2<T> const operator-- (
00210                         tmat2x2<T> const & m, 
00211                         int);
00212 
00213                 template <typename T> 
00214                 tmat2x2<T> const operator++ (
00215                         tmat2x2<T> const & m, 
00216                         int);
00217 
00218         } //namespace detail
00219 
00220         namespace core{
00221         namespace type{
00222 
00223         namespace precision
00224         {
00229                 typedef detail::tmat2x2<lowp_float>             lowp_mat2x2;
00234                 typedef detail::tmat2x2<mediump_float>  mediump_mat2x2;
00239                 typedef detail::tmat2x2<highp_float>    highp_mat2x2;
00240         }
00241         //namespace precision
00242 
00243         }//namespace type
00244         }//namespace core
00245 } //namespace glm
00246 
00247 #ifndef GLM_EXTERNAL_TEMPLATE
00248 #include "type_mat2x2.inl"
00249 #endif
00250 
00251 #endif //glm_core_type_mat2x2