1b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///////////////////////////////////////////////////////////////////////////////////
2b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OpenGL Mathematics (glm.g-truc.net)
3b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
4b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
5b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// Permission is hereby granted, free of charge, to any person obtaining a copy
6b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// of this software and associated documentation files (the "Software"), to deal
7b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// in the Software without restriction, including without limitation the rights
8b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// copies of the Software, and to permit persons to whom the Software is
10b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// furnished to do so, subject to the following conditions:
11b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
12b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// The above copyright notice and this permission notice shall be included in
13b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// all copies or substantial portions of the Software.
14b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
15b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// THE SOFTWARE.
22b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
23b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ref core
24b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @file glm/core/func_matrix.hpp
25b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @date 2008-08-03 / 2011-06-15
26b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @author Christophe Riccio
27b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
28b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @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>
29b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
30b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @defgroup core_func_matrix Matrix functions
31b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// @ingroup core
32b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///
33b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// For each of the following built-in matrix functions, there is both a
34b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// single-precision floating point version, where all arguments and return values
35b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// are single precision, and a double-precision floating version, where all
36b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// arguments and return values are double precision. Only the single-precision
37b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG/// floating point version is shown.
38b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG///////////////////////////////////////////////////////////////////////////////////
39b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
40b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#ifndef GLM_CORE_func_matrix
41b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#define GLM_CORE_func_matrix
42b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
43b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG// Dependencies
44b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../detail/precision.hpp"
45b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../detail/setup.hpp"
46b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../detail/type_mat.hpp"
47b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../vec2.hpp"
48b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../vec3.hpp"
49b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../vec4.hpp"
50b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat2x2.hpp"
51b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat2x3.hpp"
52b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat2x4.hpp"
53b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat3x2.hpp"
54b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat3x3.hpp"
55b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat3x4.hpp"
56b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat4x2.hpp"
57b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat4x3.hpp"
58b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "../mat4x4.hpp"
59b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
60b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarGnamespace glm{
61b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarGnamespace detail
62b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG{
63b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
64b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec2, tvec2>
65b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
66b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat2x2<T, P> type;
67b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
68b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
69b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
70b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec2, tvec3>
71b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
72b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat2x3<T, P> type;
73b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
74b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
75b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
76b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec2, tvec4>
77b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
78b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat2x4<T, P> type;
79b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
80b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
81b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
82b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec3, tvec2>
83b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
84b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat3x2<T, P> type;
85b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
86b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
87b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
88b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec3, tvec3>
89b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
90b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat3x3<T, P> type;
91b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
92b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
93b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
94b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec3, tvec4>
95b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
96b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat3x4<T, P> type;
97b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
98b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
99b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
100b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec4, tvec2>
101b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
102b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat4x2<T, P> type;
103b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
104b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
105b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
106b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec4, tvec3>
107b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
108b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat4x3<T, P> type;
109b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
110b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
111b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P>
112b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	struct outerProduct_trait<T, P, tvec4, tvec4>
113b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	{
114b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		typedef tmat4x4<T, P> type;
115b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	};
116b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
117b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG}//namespace detail
118b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
119b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @addtogroup core_func_matrix
120b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @{
121b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
122b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// Multiply matrix x by matrix y component-wise, i.e.,
123b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// result[i][j] is the scalar product of x[i][j] and y[i][j].
124b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
125b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @tparam matType Floating-point matrix types.
126b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
127b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
128b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @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>
129b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P, template <typename, precision> class matType>
130b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	GLM_FUNC_DECL matType<T, P> matrixCompMult(matType<T, P> const & x, matType<T, P> const & y);
131b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
132b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// Treats the first parameter c as a column vector
133b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// and the second parameter r as a row vector
134b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// and does a linear algebraic matrix multiply c * r.
135b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
136b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @tparam matType Floating-point matrix types.
137b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
138b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
139b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @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>
140b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
141b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
142b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P, template <typename, precision> class vecTypeA, template <typename, precision> class vecTypeB>
143b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	GLM_FUNC_DECL typename detail::outerProduct_trait<T, P, vecTypeA, vecTypeB>::type outerProduct(vecTypeA<T, P> const & c, vecTypeB<T, P> const & r);
144b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
145b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// Returns the transposed matrix of x
146b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
147b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @tparam matType Floating-point matrix types.
148b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
149b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
150b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @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>
151b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#	if((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER >= GLM_COMPILER_VC11))
152b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		template <typename T, precision P, template <typename, precision> class matType>
153b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG		GLM_FUNC_DECL typename matType<T, P>::transpose_type transpose(matType<T, P> const & x);
154b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#	endif
155b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
156b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// Return the determinant of a squared matrix.
157b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
158b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @tparam valType Floating-point scalar types.
159b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
160b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
161b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @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>
162b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P, template <typename, precision> class matType>
163b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	GLM_FUNC_DECL T determinant(matType<T, P> const & m);
164b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
165b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// Return the inverse of a squared matrix.
166b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
167b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @tparam valType Floating-point scalar types.
168b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	///
169b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
170b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @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>
171b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	template <typename T, precision P, template <typename, precision> class matType>
172b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	GLM_FUNC_DECL matType<T, P> inverse(matType<T, P> const & m);
173b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
174b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG	/// @}
175b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG}//namespace glm
176b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
177b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#include "func_matrix.inl"
178b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG
179b0b195df6c4343219e339ccb37978e8432a5f871Tony-LunarG#endif//GLM_CORE_func_matrix
180