1 /// @ref core
2 /// @file glm/detail/func_matrix.hpp
3 ///
4 /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
5 ///
6 /// @defgroup core_func_matrix Matrix functions
7 /// @ingroup core
8 ///
9 /// For each of the following built-in matrix functions, there is both a
10 /// single-precision floating point version, where all arguments and return values
11 /// are single precision, and a double-precision floating version, where all
12 /// arguments and return values are double precision. Only the single-precision
13 /// floating point version is shown.
14 
15 #pragma once
16 
17 // Dependencies
18 #include "../detail/precision.hpp"
19 #include "../detail/setup.hpp"
20 #include "../detail/type_mat.hpp"
21 #include "../vec2.hpp"
22 #include "../vec3.hpp"
23 #include "../vec4.hpp"
24 #include "../mat2x2.hpp"
25 #include "../mat2x3.hpp"
26 #include "../mat2x4.hpp"
27 #include "../mat3x2.hpp"
28 #include "../mat3x3.hpp"
29 #include "../mat3x4.hpp"
30 #include "../mat4x2.hpp"
31 #include "../mat4x3.hpp"
32 #include "../mat4x4.hpp"
33 
34 namespace glm{
35 namespace detail
36 {
37 	template <typename T, precision P>
38 	struct outerProduct_trait<T, P, tvec2, tvec2>
39 	{
40 		typedef tmat2x2<T, P> type;
41 	};
42 
43 	template <typename T, precision P>
44 	struct outerProduct_trait<T, P, tvec2, tvec3>
45 	{
46 		typedef tmat3x2<T, P> type;
47 	};
48 
49 	template <typename T, precision P>
50 	struct outerProduct_trait<T, P, tvec2, tvec4>
51 	{
52 		typedef tmat4x2<T, P> type;
53 	};
54 
55 	template <typename T, precision P>
56 	struct outerProduct_trait<T, P, tvec3, tvec2>
57 	{
58 		typedef tmat2x3<T, P> type;
59 	};
60 
61 	template <typename T, precision P>
62 	struct outerProduct_trait<T, P, tvec3, tvec3>
63 	{
64 		typedef tmat3x3<T, P> type;
65 	};
66 
67 	template <typename T, precision P>
68 	struct outerProduct_trait<T, P, tvec3, tvec4>
69 	{
70 		typedef tmat4x3<T, P> type;
71 	};
72 
73 	template <typename T, precision P>
74 	struct outerProduct_trait<T, P, tvec4, tvec2>
75 	{
76 		typedef tmat2x4<T, P> type;
77 	};
78 
79 	template <typename T, precision P>
80 	struct outerProduct_trait<T, P, tvec4, tvec3>
81 	{
82 		typedef tmat3x4<T, P> type;
83 	};
84 
85 	template <typename T, precision P>
86 	struct outerProduct_trait<T, P, tvec4, tvec4>
87 	{
88 		typedef tmat4x4<T, P> type;
89 	};
90 
91 }//namespace detail
92 
93 	/// @addtogroup core_func_matrix
94 	/// @{
95 
96 	/// Multiply matrix x by matrix y component-wise, i.e.,
97 	/// result[i][j] is the scalar product of x[i][j] and y[i][j].
98 	///
99 	/// @tparam matType Floating-point matrix types.
100 	///
101 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
102 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
103 	template <typename T, precision P, template <typename, precision> class matType>
104 	GLM_FUNC_DECL matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y);
105 
106 	/// Treats the first parameter c as a column vector
107 	/// and the second parameter r as a row vector
108 	/// and does a linear algebraic matrix multiply c * r.
109 	///
110 	/// @tparam matType Floating-point matrix types.
111 	///
112 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
113 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
114 	template <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
115 	GLM_FUNC_DECL typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r);
116 
117 	/// Returns the transposed matrix of x
118 	///
119 	/// @tparam matType Floating-point matrix types.
120 	///
121 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
122 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
123 #	if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
124 		template <typename T, precision P, template <typename, precision> class matType>
125 		GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
126 #	endif
127 
128 	/// Return the determinant of a squared matrix.
129 	///
130 	/// @tparam valType Floating-point scalar types.
131 	///
132 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
133 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
134 	template <typename T, precision P, template <typename, precision> class matType>
135 	GLM_FUNC_DECL T determinant(matType<T, P> const & m);
136 
137 	/// Return the inverse of a squared matrix.
138 	///
139 	/// @tparam valType Floating-point scalar types.
140 	///
141 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
142 	/// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.6 Matrix Functions</a>
143 	template <typename T, precision P, template <typename, precision> class matType>
144 	GLM_FUNC_DECL matType<T, P> inverse(matType<T, P> const & m);
145 
146 	/// @}
147 }//namespace glm
148 
149 #include "func_matrix.inl"
150