0.9.7
simd_mat4.hpp
Go to the documentation of this file.
1 
42 #pragma once
43 
44 // Dependencies
45 #include "../detail/setup.hpp"
46 
47 #if(GLM_ARCH != GLM_ARCH_PURE)
48 
49 #if(GLM_ARCH & GLM_ARCH_SSE2)
50 # include "../detail/intrinsic_matrix.hpp"
51 # include "../gtx/simd_vec4.hpp"
52 #else
53 # error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics"
54 #endif
55 
56 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
57 # pragma message("GLM: GLM_GTX_simd_mat4 extension included")
58 #endif
59 
60 namespace glm{
61 namespace detail
62 {
65  GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
66  {
67  typedef float value_type;
68  typedef fvec4SIMD col_type;
69  typedef fvec4SIMD row_type;
70  typedef std::size_t size_type;
71  typedef fmat4x4SIMD type;
72  typedef fmat4x4SIMD transpose_type;
73 
74  typedef tmat4x4<float, defaultp> pure_type;
75  typedef tvec4<float, defaultp> pure_row_type;
76  typedef tvec4<float, defaultp> pure_col_type;
77  typedef tmat4x4<float, defaultp> pure_transpose_type;
78 
79 # ifdef GLM_META_PROG_HELPERS
80  static GLM_RELAXED_CONSTEXPR length_t components = 4;
81  static GLM_RELAXED_CONSTEXPR length_t cols = 4;
82  static GLM_RELAXED_CONSTEXPR length_t rows = 4;
83  static GLM_RELAXED_CONSTEXPR precision prec = defaultp;
84 # endif//GLM_META_PROG_HELPERS
85 
86  GLM_FUNC_DECL length_t length() const;
87 
88  fvec4SIMD Data[4];
89 
91  // Constructors
92 
93  fmat4x4SIMD() GLM_DEFAULT_CTOR;
94  explicit fmat4x4SIMD(float const & s);
95  explicit fmat4x4SIMD(
96  float const & x0, float const & y0, float const & z0, float const & w0,
97  float const & x1, float const & y1, float const & z1, float const & w1,
98  float const & x2, float const & y2, float const & z2, float const & w2,
99  float const & x3, float const & y3, float const & z3, float const & w3);
100  explicit fmat4x4SIMD(
101  fvec4SIMD const & v0,
102  fvec4SIMD const & v1,
103  fvec4SIMD const & v2,
104  fvec4SIMD const & v3);
105  explicit fmat4x4SIMD(
106  mat4x4 const & m);
107  explicit fmat4x4SIMD(
108  __m128 const in[4]);
109 
110  // Conversions
111  //template <typename U>
112  //explicit tmat4x4(tmat4x4<U> const & m);
113 
114  //explicit tmat4x4(tmat2x2<T> const & x);
115  //explicit tmat4x4(tmat3x3<T> const & x);
116  //explicit tmat4x4(tmat2x3<T> const & x);
117  //explicit tmat4x4(tmat3x2<T> const & x);
118  //explicit tmat4x4(tmat2x4<T> const & x);
119  //explicit tmat4x4(tmat4x2<T> const & x);
120  //explicit tmat4x4(tmat3x4<T> const & x);
121  //explicit tmat4x4(tmat4x3<T> const & x);
122 
123  // Accesses
124  fvec4SIMD & operator[](length_t i);
125  fvec4SIMD const & operator[](length_t i) const;
126 
127  // Unary updatable operators
128  fmat4x4SIMD & operator= (fmat4x4SIMD const & m) GLM_DEFAULT;
129  fmat4x4SIMD & operator+= (float const & s);
130  fmat4x4SIMD & operator+= (fmat4x4SIMD const & m);
131  fmat4x4SIMD & operator-= (float const & s);
132  fmat4x4SIMD & operator-= (fmat4x4SIMD const & m);
133  fmat4x4SIMD & operator*= (float const & s);
134  fmat4x4SIMD & operator*= (fmat4x4SIMD const & m);
135  fmat4x4SIMD & operator/= (float const & s);
136  fmat4x4SIMD & operator/= (fmat4x4SIMD const & m);
137  fmat4x4SIMD & operator++ ();
138  fmat4x4SIMD & operator-- ();
139  };
140 
141  // Binary operators
142  fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s);
143  fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m);
144  fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
145 
146  fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s);
147  fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m);
148  fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
149 
150  fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s);
151  fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m);
152 
153  fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v);
154  fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m);
155 
156  fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
157 
158  fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s);
159  fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m);
160 
161  fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v);
162  fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m);
163 
164  fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
165 
166  // Unary constant operators
167  fmat4x4SIMD const operator- (fmat4x4SIMD const & m);
168  fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int);
169  fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int);
170 }//namespace detail
171 
172  typedef detail::fmat4x4SIMD simdMat4;
173 
176 
179  mat4 mat4_cast(
180  detail::fmat4x4SIMD const & x);
181 
185  detail::fmat4x4SIMD matrixCompMult(
186  detail::fmat4x4SIMD const & x,
187  detail::fmat4x4SIMD const & y);
188 
193  detail::fmat4x4SIMD outerProduct(
194  detail::fvec4SIMD const & c,
195  detail::fvec4SIMD const & r);
196 
199  detail::fmat4x4SIMD transpose(
200  detail::fmat4x4SIMD const & x);
201 
204  float determinant(
205  detail::fmat4x4SIMD const & m);
206 
209  detail::fmat4x4SIMD inverse(
210  detail::fmat4x4SIMD const & m);
211 
213 }// namespace glm
214 
215 #include "simd_mat4.inl"
216 
217 #endif//(GLM_ARCH != GLM_ARCH_PURE)
GLM_FUNC_DECL T determinant(matType< T, P > const &m)
Returns the transposed matrix of x.
GLM_FUNC_DECL T length(vecType< T, P > const &x)
Returns the length of x, i.e., sqrt(x * x).
GLM_FUNC_DECL tmat4x4< T, P > mat4_cast(tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
highp_mat4x4 mat4x4
4 columns of 4 components matrix of floating-point numbers.
Definition: type_mat.hpp:425
Definition: _noise.hpp:40
GLM_FUNC_DECL matType< T, P > inverse(matType< T, P > const &m)
Return the inverse of a squared matrix.
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.
Definition: type_mat.hpp:442
GLM_FUNC_DECL detail::outerProduct_trait< T, P, vecTypeA, vecTypeB >::type outerProduct(vecTypeA< T, P > const &c, vecTypeB< T, P > const &r)
Treats the first parameter c as a column vector and the second parameter r as a row vector and does a...
GLM_FUNC_DECL matType< T, P > matrixCompMult(matType< T, P > const &x, matType< T, P > const &y)
Multiply matrix x by matrix y component-wise, i.e., result[i][j] is the scalar product of x[i][j] and...