type_mat4x4.hpp
00001 
00002 // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
00004 // Created : 2005-01-27
00005 // Updated : 2011-06-02
00006 // Licence : This source is under MIT License
00007 // File    : glm/core/type_mat4x4.hpp
00009 
00010 #ifndef glm_core_type_mat4x4
00011 #define glm_core_type_mat4x4
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 tmat4x4
00036         {
00037                 enum ctor{null};
00038                 typedef T value_type;
00039                 typedef std::size_t size_type;
00040                 typedef tvec4<T> col_type;
00041                 typedef tvec4<T> row_type;
00042                 static GLM_FUNC_DECL size_type col_size();
00043                 static GLM_FUNC_DECL size_type row_size();
00044 
00045                 typedef tmat4x4<T> type;
00046                 typedef tmat4x4<T> transpose_type;
00047 
00048         public:
00049                 // Implementation detail
00050                 GLM_FUNC_DECL tmat4x4<T> _inverse() const;
00051 
00052         private:
00053                 // Data 
00054                 col_type value[4];
00055 
00056         public:
00057                 // Constructors
00058                 GLM_FUNC_DECL tmat4x4();
00059                 GLM_FUNC_DECL tmat4x4(tmat4x4 const & m);
00060 
00061                 GLM_FUNC_DECL explicit tmat4x4(
00062                         ctor Null);
00063                 GLM_FUNC_DECL explicit tmat4x4(
00064                         value_type const & x);
00065                 GLM_FUNC_DECL explicit tmat4x4(
00066                         value_type const & x0, value_type const & y0, value_type const & z0, value_type const & w0,
00067                         value_type const & x1, value_type const & y1, value_type const & z1, value_type const & w1,
00068                         value_type const & x2, value_type const & y2, value_type const & z2, value_type const & w2,
00069                         value_type const & x3, value_type const & y3, value_type const & z3, value_type const & w3);
00070                 GLM_FUNC_DECL explicit tmat4x4(
00071                         col_type const & v0, 
00072                         col_type const & v1,
00073                         col_type const & v2,
00074                         col_type const & v3);
00075 
00077                 // Conversions
00078                 template <typename U> 
00079                 GLM_FUNC_DECL explicit tmat4x4(
00080             U const & x);
00081                         
00082                 template <
00083             typename X1, typename Y1, typename Z1, typename W1, 
00084             typename X2, typename Y2, typename Z2, typename W2, 
00085             typename X3, typename Y3, typename Z3, typename W3, 
00086             typename X4, typename Y4, typename Z4, typename W4> 
00087                 GLM_FUNC_DECL explicit tmat4x4(
00088             X1 const & x1, Y1 const & y1, Z1 const & z1, W1 const & w1, 
00089             X2 const & x2, Y2 const & y2, Z2 const & z2, W2 const & w2, 
00090             X3 const & x3, Y3 const & y3, Z3 const & z3, W3 const & w3, 
00091             X4 const & x4, Y4 const & y4, Z4 const & z4, W4 const & w4);
00092                         
00093                 template <typename V1, typename V2, typename V3, typename V4> 
00094                 GLM_FUNC_DECL explicit tmat4x4(
00095             tvec4<V1> const & v1, 
00096             tvec4<V2> const & v2,
00097             tvec4<V3> const & v3,
00098             tvec4<V4> const & v4);
00099             
00100                 // Matrix conversions
00101                 template <typename U> 
00102                 GLM_FUNC_DECL explicit tmat4x4(tmat4x4<U> const & m);
00103 
00104                 GLM_FUNC_DECL explicit tmat4x4(tmat2x2<T> const & x);
00105                 GLM_FUNC_DECL explicit tmat4x4(tmat3x3<T> const & x);
00106                 GLM_FUNC_DECL explicit tmat4x4(tmat2x3<T> const & x);
00107                 GLM_FUNC_DECL explicit tmat4x4(tmat3x2<T> const & x);
00108                 GLM_FUNC_DECL explicit tmat4x4(tmat2x4<T> const & x);
00109                 GLM_FUNC_DECL explicit tmat4x4(tmat4x2<T> const & x);
00110                 GLM_FUNC_DECL explicit tmat4x4(tmat3x4<T> const & x);
00111                 GLM_FUNC_DECL explicit tmat4x4(tmat4x3<T> const & x);
00112 
00113                 // Accesses
00114                 GLM_FUNC_DECL col_type & operator[](size_type i);
00115                 GLM_FUNC_DECL col_type const & operator[](size_type i) const;
00116 
00117                 // Unary updatable operators
00118                 GLM_FUNC_DECL tmat4x4<T> & operator=  (tmat4x4<T> const & m);
00119                 template <typename U>
00120                 GLM_FUNC_DECL tmat4x4<T> & operator=  (tmat4x4<U> const & m);
00121                 template <typename U>
00122                 GLM_FUNC_DECL tmat4x4<T> & operator+= (U const & s);
00123                 template <typename U>
00124                 GLM_FUNC_DECL tmat4x4<T> & operator+= (tmat4x4<U> const & m);
00125                 template <typename U>
00126                 GLM_FUNC_DECL tmat4x4<T> & operator-= (U const & s);
00127                 template <typename U>
00128                 GLM_FUNC_DECL tmat4x4<T> & operator-= (tmat4x4<U> const & m);
00129                 template <typename U>
00130                 GLM_FUNC_DECL tmat4x4<T> & operator*= (U const & s);
00131                 template <typename U>
00132                 GLM_FUNC_DECL tmat4x4<T> & operator*= (tmat4x4<U> const & m);
00133                 template <typename U>
00134                 GLM_FUNC_DECL tmat4x4<T> & operator/= (U const & s);
00135                 template <typename U>
00136                 GLM_FUNC_DECL tmat4x4<T> & operator/= (tmat4x4<U> const & m);
00137                 GLM_FUNC_DECL tmat4x4<T> & operator++ ();
00138                 GLM_FUNC_DECL tmat4x4<T> & operator-- ();
00139         };
00140 
00141         // Binary operators
00142         template <typename T> 
00143         tmat4x4<T> operator+ (
00144                 tmat4x4<T> const & m, 
00145                 typename tmat4x4<T>::value_type const & s);
00146 
00147         template <typename T> 
00148         tmat4x4<T> operator+ (
00149                 typename tmat4x4<T>::value_type const & s, 
00150                 tmat4x4<T> const & m);
00151 
00152         template <typename T> 
00153         tmat4x4<T> operator+ (
00154                 tmat4x4<T> const & m1, 
00155                 tmat4x4<T> const & m2);
00156             
00157         template <typename T> 
00158         tmat4x4<T> operator- (
00159                 tmat4x4<T> const & m, 
00160                 typename tmat4x4<T>::value_type const & s);
00161 
00162         template <typename T> 
00163         tmat4x4<T> operator- (
00164                 typename tmat4x4<T>::value_type const & s, 
00165                 tmat4x4<T> const & m);
00166 
00167         template <typename T> 
00168         tmat4x4<T> operator- (
00169                 tmat4x4<T> const & m1, 
00170                 tmat4x4<T> const & m2);
00171 
00172         template <typename T> 
00173         tmat4x4<T> operator* (
00174                 tmat4x4<T> const & m, 
00175                 typename tmat4x4<T>::value_type const & s);
00176 
00177         template <typename T> 
00178         tmat4x4<T> operator* (
00179                 typename tmat4x4<T>::value_type const & s, 
00180                 tmat4x4<T> const & m);
00181 
00182         template <typename T> 
00183         typename tmat4x4<T>::col_type operator* (
00184                 tmat4x4<T> const & m, 
00185                 typename tmat4x4<T>::row_type const & v);
00186 
00187         template <typename T> 
00188         typename tmat4x4<T>::row_type operator* (
00189                 typename tmat4x4<T>::col_type const & v, 
00190                 tmat4x4<T> const & m);
00191 
00192         template <typename T> 
00193         tmat4x4<T> operator* (
00194                 tmat4x4<T> const & m1, 
00195                 tmat4x4<T> const & m2);
00196 
00197         template <typename T> 
00198         tmat4x4<T> operator/ (
00199                 tmat4x4<T> const & m, 
00200                 typename tmat4x4<T>::value_type const & s);
00201 
00202         template <typename T> 
00203         tmat4x4<T> operator/ (
00204                 typename tmat4x4<T>::value_type const & s, 
00205                 tmat4x4<T> const & m);
00206 
00207         template <typename T> 
00208         typename tmat4x4<T>::col_type operator/ (
00209                 tmat4x4<T> const & m, 
00210                 typename tmat4x4<T>::row_type const & v);
00211 
00212         template <typename T> 
00213         typename tmat4x4<T>::row_type operator/ (
00214                 typename tmat4x4<T>::col_type & v, 
00215                 tmat4x4<T> const & m);
00216 
00217         template <typename T> 
00218         tmat4x4<T> operator/ (
00219                 tmat4x4<T> const & m1, 
00220                 tmat4x4<T> const & m2);
00221 
00222         // Unary constant operators
00223         template <typename T> 
00224         tmat4x4<T> const operator-  (
00225                 tmat4x4<T> const & m);
00226 
00227         template <typename T> 
00228         tmat4x4<T> const operator-- (
00229                 tmat4x4<T> const & m, int);
00230 
00231         template <typename T> 
00232         tmat4x4<T> const operator++ (
00233                 tmat4x4<T> const & m, int);
00234 
00235 } //namespace detail
00236 
00237 namespace core{
00238 namespace type{
00239 namespace precision
00240 {
00245         typedef detail::tmat4x4<lowp_float>             lowp_mat4;
00246 
00251         typedef detail::tmat4x4<mediump_float>  mediump_mat4;
00252 
00257         typedef detail::tmat4x4<highp_float>    highp_mat4;
00258 
00263         typedef detail::tmat4x4<lowp_float>             lowp_mat4x4;
00264 
00269         typedef detail::tmat4x4<mediump_float>  mediump_mat4x4;
00270 
00275         typedef detail::tmat4x4<highp_float>    highp_mat4x4;
00276 
00277 }//namespace precision
00278 }//namespace type
00279 }//namespace core
00280 }//namespace glm
00281 
00282 #ifndef GLM_EXTERNAL_TEMPLATE
00283 #include "type_mat4x4.inl"
00284 #endif//GLM_EXTERNAL_TEMPLATE
00285 
00286 #endif//glm_core_type_mat4x4