simd_mat4.hpp
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 
00030 
00031 
00032 
00033 
00034 
00035 
00036 
00037 
00038 #ifndef GLM_GTX_simd_mat4
00039 #define GLM_GTX_simd_mat4 50
00040 
00041 // Dependency:
00042 #include "../glm.hpp"
00043 
00044 #if(GLM_ARCH & GLM_ARCH_SSE2)
00045 #       include "../core/intrinsic_matrix.hpp"
00046 #       include "../gtx/simd_vec4.hpp"
00047 #else
00048 #       error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics"
00049 #endif
00050 
00051 #if(defined(GLM_MESSAGES) && !defined(glm_ext))
00052 #       pragma message("GLM: GLM_GTX_simd_mat4 extension included")
00053 #endif
00054 
00055 namespace glm{
00056 namespace detail
00057 {
00060         GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
00061         {
00062                 enum ctor{null};
00063 
00064                 typedef float value_type;
00065                 typedef fvec4SIMD col_type;
00066                 typedef fvec4SIMD row_type;
00067                 typedef std::size_t size_type;
00068                 static size_type value_size();
00069                 static size_type col_size();
00070                 static size_type row_size();
00071                 static bool is_matrix();
00072 
00073                 fvec4SIMD Data[4];
00074 
00076                 // Constructors
00077 
00078                 fmat4x4SIMD();
00079                 explicit fmat4x4SIMD(float const & s);
00080                 explicit fmat4x4SIMD(
00081                         float const & x0, float const & y0, float const & z0, float const & w0,
00082                         float const & x1, float const & y1, float const & z1, float const & w1,
00083                         float const & x2, float const & y2, float const & z2, float const & w2,
00084                         float const & x3, float const & y3, float const & z3, float const & w3);
00085                 explicit fmat4x4SIMD(
00086                         fvec4SIMD const & v0,
00087                         fvec4SIMD const & v1,
00088                         fvec4SIMD const & v2,
00089                         fvec4SIMD const & v3);
00090                 explicit fmat4x4SIMD(
00091                         tmat4x4<float> const & m);
00092 
00093                 // Conversions
00094                 //template <typename U> 
00095                 //explicit tmat4x4(tmat4x4<U> const & m);
00096 
00097                 //explicit tmat4x4(tmat2x2<T> const & x);
00098                 //explicit tmat4x4(tmat3x3<T> const & x);
00099                 //explicit tmat4x4(tmat2x3<T> const & x);
00100                 //explicit tmat4x4(tmat3x2<T> const & x);
00101                 //explicit tmat4x4(tmat2x4<T> const & x);
00102                 //explicit tmat4x4(tmat4x2<T> const & x);
00103                 //explicit tmat4x4(tmat3x4<T> const & x);
00104                 //explicit tmat4x4(tmat4x3<T> const & x);
00105 
00106                 // Accesses
00107                 fvec4SIMD & operator[](size_type i);
00108                 fvec4SIMD const & operator[](size_type i) const;
00109 
00110                 // Unary updatable operators
00111                 fmat4x4SIMD & operator= (fmat4x4SIMD const & m);
00112                 fmat4x4SIMD & operator+= (float const & s);
00113                 fmat4x4SIMD & operator+= (fmat4x4SIMD const & m);
00114                 fmat4x4SIMD & operator-= (float const & s);
00115                 fmat4x4SIMD & operator-= (fmat4x4SIMD const & m);
00116                 fmat4x4SIMD & operator*= (float const & s);
00117                 fmat4x4SIMD & operator*= (fmat4x4SIMD const & m);
00118                 fmat4x4SIMD & operator/= (float const & s);
00119                 fmat4x4SIMD & operator/= (fmat4x4SIMD const & m);
00120                 fmat4x4SIMD & operator++ ();
00121                 fmat4x4SIMD & operator-- ();
00122         };
00123 
00124         // Binary operators
00125         fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s);
00126         fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m);
00127         fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
00128             
00129         fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s);
00130         fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m);
00131         fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
00132 
00133         fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s);
00134         fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m);
00135 
00136         fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v);
00137         fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m);
00138 
00139         fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
00140 
00141         fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s);
00142         fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m);
00143 
00144         fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v);
00145         fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m);
00146 
00147         fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
00148 
00149         // Unary constant operators
00150         fmat4x4SIMD const operator-  (fmat4x4SIMD const & m);
00151         fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int);
00152         fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int);
00153 }//namespace detail
00154 
00155         typedef detail::fmat4x4SIMD simdMat4;
00156 
00159 
00162         detail::tmat4x4<float> mat4_cast(
00163                 detail::fmat4x4SIMD const & x);
00164 
00168         detail::fmat4x4SIMD matrixCompMult(
00169                 detail::fmat4x4SIMD const & x,
00170                 detail::fmat4x4SIMD const & y);
00171 
00176         detail::fmat4x4SIMD outerProduct(
00177                 detail::fvec4SIMD const & c,
00178                 detail::fvec4SIMD const & r);
00179 
00182         detail::fmat4x4SIMD transpose(
00183                 detail::fmat4x4SIMD const & x);
00184 
00187         float determinant(
00188                 detail::fmat4x4SIMD const & m);
00189 
00192         detail::fmat4x4SIMD inverse(
00193                 detail::fmat4x4SIMD const & m);
00194 
00196 }// namespace glm
00197 
00198 #include "simd_mat4.inl"
00199 
00200 #endif//GLM_GTX_simd_mat4