~mir-team/mir/in-process-egl+input-conglomeration

« back to all changes in this revision

Viewing changes to 3rd_party/glm/glm/gtx/simd_mat4.hpp

Merged trunk and fixed issues

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
///////////////////////////////////////////////////////////////////////////////////
2
 
/// OpenGL Mathematics (glm.g-truc.net)
3
 
///
4
 
/// Copyright (c) 2005 - 2012 G-Truc Creation (www.g-truc.net)
5
 
/// Permission is hereby granted, free of charge, to any person obtaining a copy
6
 
/// of this software and associated documentation files (the "Software"), to deal
7
 
/// in the Software without restriction, including without limitation the rights
8
 
/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
 
/// copies of the Software, and to permit persons to whom the Software is
10
 
/// furnished to do so, subject to the following conditions:
11
 
/// 
12
 
/// The above copyright notice and this permission notice shall be included in
13
 
/// all copies or substantial portions of the Software.
14
 
/// 
15
 
/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
 
/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
 
/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
 
/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
 
/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
 
/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
 
/// THE SOFTWARE.
22
 
///
23
 
/// @ref gtx_simd_vec4
24
 
/// @file glm/gtx/simd_vec4.hpp
25
 
/// @date 2009-05-07 / 2011-06-07
26
 
/// @author Christophe Riccio
27
 
///
28
 
/// @see core (dependence)
29
 
///
30
 
/// @defgroup gtx_simd_mat4 GLM_GTX_simd_mat4: SIMD mat4 type and functions
31
 
/// @ingroup gtx
32
 
/// 
33
 
/// @brief SIMD implementation of mat4 type.
34
 
/// 
35
 
/// <glm/gtx/simd_mat4.hpp> need to be included to use these functionalities.
36
 
///////////////////////////////////////////////////////////////////////////////////
37
 
 
38
 
#ifndef GLM_GTX_simd_mat4
39
 
#define GLM_GTX_simd_mat4 GLM_VERSION
40
 
 
41
 
// Dependency:
42
 
#include "../glm.hpp"
43
 
 
44
 
#if(GLM_ARCH != GLM_ARCH_PURE)
45
 
 
46
 
#if(GLM_ARCH & GLM_ARCH_SSE2)
47
 
#       include "../core/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))
54
 
#       pragma message("GLM: GLM_GTX_simd_mat4 extension included")
55
 
#endif
56
 
 
57
 
namespace glm{
58
 
namespace detail
59
 
{
60
 
        /// 4x4 Matrix implemented using SIMD SEE intrinsics.
61
 
        /// \ingroup gtx_simd_mat4
62
 
        GLM_ALIGNED_STRUCT(16) fmat4x4SIMD
63
 
        {
64
 
                enum ctor{null};
65
 
 
66
 
                typedef float value_type;
67
 
                typedef fvec4SIMD col_type;
68
 
                typedef fvec4SIMD row_type;
69
 
                typedef std::size_t size_type;
70
 
                static size_type value_size();
71
 
                static size_type col_size();
72
 
                static size_type row_size();
73
 
                static bool is_matrix();
74
 
 
75
 
                fvec4SIMD Data[4];
76
 
 
77
 
                //////////////////////////////////////
78
 
                // Constructors
79
 
 
80
 
                fmat4x4SIMD();
81
 
                explicit fmat4x4SIMD(float const & s);
82
 
                explicit fmat4x4SIMD(
83
 
                        float const & x0, float const & y0, float const & z0, float const & w0,
84
 
                        float const & x1, float const & y1, float const & z1, float const & w1,
85
 
                        float const & x2, float const & y2, float const & z2, float const & w2,
86
 
                        float const & x3, float const & y3, float const & z3, float const & w3);
87
 
                explicit fmat4x4SIMD(
88
 
                        fvec4SIMD const & v0,
89
 
                        fvec4SIMD const & v1,
90
 
                        fvec4SIMD const & v2,
91
 
                        fvec4SIMD const & v3);
92
 
                explicit fmat4x4SIMD(
93
 
                        tmat4x4<float> const & m);
94
 
 
95
 
                // Conversions
96
 
                //template <typename U> 
97
 
                //explicit tmat4x4(tmat4x4<U> const & m);
98
 
 
99
 
                //explicit tmat4x4(tmat2x2<T> const & x);
100
 
                //explicit tmat4x4(tmat3x3<T> const & x);
101
 
                //explicit tmat4x4(tmat2x3<T> const & x);
102
 
                //explicit tmat4x4(tmat3x2<T> const & x);
103
 
                //explicit tmat4x4(tmat2x4<T> const & x);
104
 
                //explicit tmat4x4(tmat4x2<T> const & x);
105
 
                //explicit tmat4x4(tmat3x4<T> const & x);
106
 
                //explicit tmat4x4(tmat4x3<T> const & x);
107
 
 
108
 
                // Accesses
109
 
                fvec4SIMD & operator[](size_type i);
110
 
                fvec4SIMD const & operator[](size_type i) const;
111
 
 
112
 
                // Unary updatable operators
113
 
                fmat4x4SIMD & operator= (fmat4x4SIMD const & m);
114
 
                fmat4x4SIMD & operator+= (float const & s);
115
 
                fmat4x4SIMD & operator+= (fmat4x4SIMD const & m);
116
 
                fmat4x4SIMD & operator-= (float const & s);
117
 
                fmat4x4SIMD & operator-= (fmat4x4SIMD const & m);
118
 
                fmat4x4SIMD & operator*= (float const & s);
119
 
                fmat4x4SIMD & operator*= (fmat4x4SIMD const & m);
120
 
                fmat4x4SIMD & operator/= (float const & s);
121
 
                fmat4x4SIMD & operator/= (fmat4x4SIMD const & m);
122
 
                fmat4x4SIMD & operator++ ();
123
 
                fmat4x4SIMD & operator-- ();
124
 
        };
125
 
 
126
 
        // Binary operators
127
 
        fmat4x4SIMD operator+ (fmat4x4SIMD const & m, float const & s);
128
 
        fmat4x4SIMD operator+ (float const & s, fmat4x4SIMD const & m);
129
 
        fmat4x4SIMD operator+ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
130
 
            
131
 
        fmat4x4SIMD operator- (fmat4x4SIMD const & m, float const & s);
132
 
        fmat4x4SIMD operator- (float const & s, fmat4x4SIMD const & m);
133
 
        fmat4x4SIMD operator- (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
134
 
 
135
 
        fmat4x4SIMD operator* (fmat4x4SIMD const & m, float const & s);
136
 
        fmat4x4SIMD operator* (float const & s, fmat4x4SIMD const & m);
137
 
 
138
 
        fvec4SIMD operator* (fmat4x4SIMD const & m, fvec4SIMD const & v);
139
 
        fvec4SIMD operator* (fvec4SIMD const & v, fmat4x4SIMD const & m);
140
 
 
141
 
        fmat4x4SIMD operator* (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
142
 
 
143
 
        fmat4x4SIMD operator/ (fmat4x4SIMD const & m, float const & s);
144
 
        fmat4x4SIMD operator/ (float const & s, fmat4x4SIMD const & m);
145
 
 
146
 
        fvec4SIMD operator/ (fmat4x4SIMD const & m, fvec4SIMD const & v);
147
 
        fvec4SIMD operator/ (fvec4SIMD const & v, fmat4x4SIMD const & m);
148
 
 
149
 
        fmat4x4SIMD operator/ (fmat4x4SIMD const & m1, fmat4x4SIMD const & m2);
150
 
 
151
 
        // Unary constant operators
152
 
        fmat4x4SIMD const operator-  (fmat4x4SIMD const & m);
153
 
        fmat4x4SIMD const operator-- (fmat4x4SIMD const & m, int);
154
 
        fmat4x4SIMD const operator++ (fmat4x4SIMD const & m, int);
155
 
}//namespace detail
156
 
 
157
 
        typedef detail::fmat4x4SIMD simdMat4;
158
 
 
159
 
        /// @addtogroup gtx_simd_mat4
160
 
        /// @{
161
 
 
162
 
        //! Convert a simdMat4 to a mat4.
163
 
        //! (From GLM_GTX_simd_mat4 extension)
164
 
        detail::tmat4x4<float> mat4_cast(
165
 
                detail::fmat4x4SIMD const & x);
166
 
 
167
 
        //! Multiply matrix x by matrix y component-wise, i.e.,
168
 
        //! result[i][j] is the scalar product of x[i][j] and y[i][j].
169
 
        //! (From GLM_GTX_simd_mat4 extension).
170
 
        detail::fmat4x4SIMD matrixCompMult(
171
 
                detail::fmat4x4SIMD const & x,
172
 
                detail::fmat4x4SIMD const & y);
173
 
 
174
 
        //! Treats the first parameter c as a column vector
175
 
        //! and the second parameter r as a row vector
176
 
        //! and does a linear algebraic matrix multiply c * r.
177
 
        //! (From GLM_GTX_simd_mat4 extension).
178
 
        detail::fmat4x4SIMD outerProduct(
179
 
                detail::fvec4SIMD const & c,
180
 
                detail::fvec4SIMD const & r);
181
 
 
182
 
        //! Returns the transposed matrix of x
183
 
        //! (From GLM_GTX_simd_mat4 extension).
184
 
        detail::fmat4x4SIMD transpose(
185
 
                detail::fmat4x4SIMD const & x);
186
 
 
187
 
        //! Return the determinant of a mat4 matrix.
188
 
        //! (From GLM_GTX_simd_mat4 extension).
189
 
        float determinant(
190
 
                detail::fmat4x4SIMD const & m);
191
 
 
192
 
        //! Return the inverse of a mat4 matrix.
193
 
        //! (From GLM_GTX_simd_mat4 extension).
194
 
        detail::fmat4x4SIMD inverse(
195
 
                detail::fmat4x4SIMD const & m);
196
 
 
197
 
        /// @}
198
 
}// namespace glm
199
 
 
200
 
#include "simd_mat4.inl"
201
 
 
202
 
#endif//(GLM_ARCH != GLM_ARCH_PURE)
203
 
 
204
 
#endif//GLM_GTX_simd_mat4