summaryrefslogtreecommitdiff
path: root/src/glm/core/func_matrix.hpp
blob: b41e980343f4c436eca336838204b962defc15f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
///////////////////////////////////////////////////////////////////////////////////////////////////
// OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net)
///////////////////////////////////////////////////////////////////////////////////////////////////
// Created : 2008-08-03
// Updated : 2010-02-04
// Licence : This source is under MIT License
// File    : glm/core/func_matrix.hpp
///////////////////////////////////////////////////////////////////////////////////////////////////

#ifndef glm_core_func_matrix
#define glm_core_func_matrix

namespace glm
{
	namespace core{
	namespace function{
	//! Define all matrix functions from Section 8.5 of GLSL 1.30.8 specification. Included in glm namespace.
	namespace matrix{

	/// \addtogroup core_funcs
	///@{

	//! Multiply matrix x by matrix y component-wise, i.e., 
	//! result[i][j] is the scalar product of x[i][j] and y[i][j].
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5
	template <typename matType> 
	matType matrixCompMult(
		matType const & x, 
		matType const & y);

	//! Treats the first parameter c as a column vector 
	//! and the second parameter r as a row vector
	//! and does a linear algebraic matrix multiply c * r.
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5	
    template <typename vecType, typename matType> 
	matType outerProduct(
		vecType const & c, 
		vecType const & r);

	//! Returns the transposed matrix of x
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5	
    template <typename matType> 
	typename matType::transpose_type transpose(
		matType const & x);
	
	//! Return the determinant of a mat2 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5	
	template <typename T> 
	typename detail::tmat2x2<T>::value_type determinant(
		detail::tmat2x2<T> const & m);

	//! Return the determinant of a mat3 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5	
	template <typename T> 
	typename detail::tmat3x3<T>::value_type determinant(
		detail::tmat3x3<T> const & m);

	//! Return the determinant of a mat4 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
    //! \li GLSL 1.30.08 specification, section 8.5		
    template <typename T> 
	typename detail::tmat4x4<T>::value_type determinant(
		detail::tmat4x4<T> const & m);

	//! Return the inverse of a mat2 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
    //! \li GLSL 1.40.07 specification, section 8.5	 
	template <typename T> 
	detail::tmat2x2<T> inverse(
		detail::tmat2x2<T> const & m);

	//! Return the inverse of a mat3 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
    //! \li GLSL 1.40.07 specification, section 8.5 
	template <typename T> 
	detail::tmat3x3<T> inverse(
		detail::tmat3x3<T> const & m);

	//! Return the inverse of a mat4 matrix. 
    //!
    //! \li <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
    //! \li GLSL 1.40.07 specification, section 8.5
	template <typename T> 
	detail::tmat4x4<T> inverse(
		detail::tmat4x4<T> const & m);

	///@}

	}//namespace matrix
	}//namespace function
	}//namespace core

	using namespace core::function::matrix;
}//namespace glm

#include "func_matrix.inl"

#endif//glm_core_func_matrix