You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

150 lines
6.9 KiB

  1. ///////////////////////////////////////////////////////////////////////////////////
  2. /// OpenGL Mathematics (glm.g-truc.net)
  3. ///
  4. /// Copyright (c) 2005 - 2013 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 core
  24. /// @file glm/core/func_matrix.hpp
  25. /// @date 2008-08-03 / 2011-06-15
  26. /// @author Christophe Riccio
  27. ///
  28. /// @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>
  29. ///
  30. /// @defgroup core_func_matrix Matrix functions
  31. /// @ingroup core
  32. ///
  33. /// For each of the following built-in matrix functions, there is both a
  34. /// single-precision floating point version, where all arguments and return values
  35. /// are single precision, and a double-precision floating version, where all
  36. /// arguments and return values are double precision. Only the single-precision
  37. /// floating point version is shown.
  38. ///////////////////////////////////////////////////////////////////////////////////
  39. #ifndef GLM_CORE_func_matrix
  40. #define GLM_CORE_func_matrix GLM_VERSION
  41. namespace glm
  42. {
  43. /// @addtogroup core_func_matrix
  44. /// @{
  45. /// Multiply matrix x by matrix y component-wise, i.e.,
  46. /// result[i][j] is the scalar product of x[i][j] and y[i][j].
  47. ///
  48. /// @tparam matType Floating-point matrix types.
  49. ///
  50. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult man page</a>
  51. /// @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>
  52. template <typename matType>
  53. GLM_FUNC_DECL matType matrixCompMult(
  54. matType const & x,
  55. matType const & y);
  56. /// Treats the first parameter c as a column vector
  57. /// and the second parameter r as a row vector
  58. /// and does a linear algebraic matrix multiply c * r.
  59. ///
  60. /// @tparam matType Floating-point matrix types.
  61. ///
  62. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
  63. /// @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>
  64. ///
  65. /// @todo Clarify the declaration to specify that matType doesn't have to be provided when used.
  66. template <typename vecType, typename matType>
  67. GLM_FUNC_DECL matType outerProduct(
  68. vecType const & c,
  69. vecType const & r);
  70. /// Returns the transposed matrix of x
  71. ///
  72. /// @tparam matType Floating-point matrix types.
  73. ///
  74. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
  75. /// @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>
  76. template <typename matType>
  77. GLM_FUNC_DECL typename matType::transpose_type transpose(
  78. matType const & x);
  79. /// Return the determinant of a mat2 matrix.
  80. ///
  81. /// @tparam valType Floating-point scalar types.
  82. ///
  83. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
  84. /// @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>
  85. template <typename valType>
  86. GLM_FUNC_DECL typename detail::tmat2x2<valType>::value_type determinant(
  87. detail::tmat2x2<valType> const & m);
  88. /// Return the determinant of a mat3 matrix.
  89. ///
  90. /// @tparam valType Floating-point scalar types.
  91. ///
  92. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
  93. /// @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>
  94. template <typename valType>
  95. GLM_FUNC_DECL typename detail::tmat3x3<valType>::value_type determinant(
  96. detail::tmat3x3<valType> const & m);
  97. /// Return the determinant of a mat4 matrix.
  98. ///
  99. /// @tparam valType Floating-point scalar types.
  100. ///
  101. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant 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 valType>
  104. GLM_FUNC_DECL typename detail::tmat4x4<valType>::value_type determinant(
  105. detail::tmat4x4<valType> const & m);
  106. /// Return the inverse of a mat2 matrix.
  107. ///
  108. /// @tparam valType Floating-point scalar types.
  109. ///
  110. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
  111. /// @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>
  112. template <typename valType>
  113. GLM_FUNC_DECL detail::tmat2x2<valType> inverse(
  114. detail::tmat2x2<valType> const & m);
  115. /// Return the inverse of a mat3 matrix.
  116. ///
  117. /// @tparam valType Floating-point scalar types.
  118. ///
  119. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
  120. /// @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>
  121. template <typename valType>
  122. GLM_FUNC_DECL detail::tmat3x3<valType> inverse(
  123. detail::tmat3x3<valType> const & m);
  124. /// Return the inverse of a mat4 matrix.
  125. ///
  126. /// @tparam valType Floating-point scalar types.
  127. ///
  128. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
  129. /// @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>
  130. template <typename valType>
  131. GLM_FUNC_DECL detail::tmat4x4<valType> inverse(
  132. detail::tmat4x4<valType> const & m);
  133. /// @}
  134. }//namespace glm
  135. #include "func_matrix.inl"
  136. #endif//GLM_CORE_func_matrix