GLM 0.9.5

- Main Page
- Related Pages
- Modules
- Namespaces
- Files

- File List

simd_mat4.hpp
1
38 #ifndef GLM_GTX_simd_mat4
39 #define GLM_GTX_simd_mat4
40
41 // Dependencies
42 #include "../detail/setup.hpp"
43
44 #if(GLM_ARCH != GLM_ARCH_PURE)
45
46 #if(GLM_ARCH & GLM_ARCH_SSE2)
47 # include "../detail/intrinsic_matrix.hpp"
48 # include "../gtx/simd_vec4.hpp"
49 #else
50 # error "GLM: GLM_GTX_simd_mat4 requires compiler support of SSE2 through intrinsics"
51 #endif
52
53 #if(defined(GLM_MESSAGES) && !defined(GLM_EXT_INCLUDED))
54 # pragma message("GLM: GLM_GTX_simd_mat4 extension included")
55 #endif
56
57 namespace glm{
58 namespace detail
59 {
62 GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
63 {
64 enum ctor{_null};
65 typedef float value_type;
66 typedef fvec4SIMD col_type;
67 typedef fvec4SIMD row_type;
68 typedef std::size_t size_type;
69 typedef fmat4x4SIMD type;
70 typedef fmat4x4SIMD transpose_type;
71
72 GLM_FUNC_DECL length_t length() const;
73
74 fvec4SIMD Data[4];
75
77 // Constructors
78
79 fmat4x4SIMD();
80 explicit fmat4x4SIMD(float const & s);
81 explicit fmat4x4SIMD(
82 float const & x0, float const & y0, float const & z0, float const & w0,
83 float const & x1, float const & y1, float const & z1, float const & w1,
84 float const & x2, float const & y2, float const & z2, float const & w2,
85 float const & x3, float const & y3, float const & z3, float const & w3);
86 explicit fmat4x4SIMD(
87 fvec4SIMD const & v0,
88 fvec4SIMD const & v1,
89 fvec4SIMD const & v2,
90 fvec4SIMD const & v3);
91 explicit fmat4x4SIMD(
92 mat4x4 const & m);
93 explicit fmat4x4SIMD(
94 __m128 const in[4]);
95
96 // Conversions
97 //template <typename U>
98 //explicit tmat4x4(tmat4x4<U> const & m);
99
100 //explicit tmat4x4(tmat2x2<T> const & x);
101 //explicit tmat4x4(tmat3x3<T> const & x);
102 //explicit tmat4x4(tmat2x3<T> const & x);
103 //explicit tmat4x4(tmat3x2<T> const & x);
104 //explicit tmat4x4(tmat2x4<T> const & x);
105 //explicit tmat4x4(tmat4x2<T> const & x);
106 //explicit tmat4x4(tmat3x4<T> const & x);
107 //explicit tmat4x4(tmat4x3<T> const & x);
108
109 // Accesses
110 fvec4SIMD & operator[](length_t i);
111 fvec4SIMD const & operator[](length_t i) const;
112
113 // Unary updatable operators
114 fmat4x4SIMD & operator= (fmat4x4SIMD const & m);
115 fmat4x4SIMD & operator+= (float const & s);
116 fmat4x4SIMD & operator+= (fmat4x4SIMD const & m);
117 fmat4x4SIMD & operator-= (float const & s);
118 fmat4x4SIMD & operator-= (fmat4x4SIMD const & m);
119 fmat4x4SIMD & operator*= (float const & s);
120 fmat4x4SIMD & operator*= (fmat4x4SIMD const & m);
121 fmat4x4SIMD & operator/= (float const & s);
122 fmat4x4SIMD & operator/= (fmat4x4SIMD const & m);
123 fmat4x4SIMD & operator++ ();
124 fmat4x4SIMD & operator-- ();
125 };
126
127 // Binary operators
128 fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s);
129 fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m);
130 fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
131
132 fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s);
133 fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m);
134 fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
135
136 fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s);
137 fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m);
138
139 fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v);
140 fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m);
141
142 fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
143
144 fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s);
145 fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m);
146
147 fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v);
148 fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m);
149
150 fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
151
152 // Unary constant operators
153 fmat4x4SIMD const operator- (fmat4x4SIMD const & m);
154 fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int);
155 fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int);
156 }//namespace detail
157
158 typedef detail::fmat4x4SIMD simdMat4;
159
162
165 mat4 mat4_cast(
166 detail::fmat4x4SIMD const & x);
167
171 detail::fmat4x4SIMD matrixCompMult(
172 detail::fmat4x4SIMD const & x,
173 detail::fmat4x4SIMD const & y);
174
179 detail::fmat4x4SIMD outerProduct(
180 detail::fvec4SIMD const & c,
181 detail::fvec4SIMD const & r);
182
185 detail::fmat4x4SIMD transpose(
186 detail::fmat4x4SIMD const & x);
187
190 float determinant(
191 detail::fmat4x4SIMD const & m);
192
195 detail::fmat4x4SIMD inverse(
196 detail::fmat4x4SIMD const & m);
197
199 }// namespace glm
200
201 #include "simd_mat4.inl"
202
203 #endif//(GLM_ARCH != GLM_ARCH_PURE)
204
205 #endif//GLM_GTX_simd_mat4
glm::mat4x4
highp_mat4x4 mat4x4
4 columns of 4 components matrix of floating-point numbers.
Definition: type_mat.hpp:425
glm::mat4
mat4x4 mat4
4 columns of 4 components matrix of floating-point numbers.
Definition: type_mat.hpp:442
glm::mat4_cast
GLM_FUNC_DECL detail::tmat4x4< T, P > mat4_cast(detail::tquat< T, P > const &x)
Converts a quaternion to a 4 * 4 matrix.
glm::length
GLM_FUNC_DECL genType::value_type length(genType const &x)
Returns the length of x, i.e., sqrt(x * x).
glm::inverse
GLM_FUNC_DECL detail::tquat< T, P > inverse(detail::tquat< T, P > const &q)
Returns the q inverse.