Collection of DPF-based plugins for packaging
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.

165 lines
5.9KB

  1. /// @ref core
  2. /// @file glm/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. /// Include <glm/matrix.hpp> to use these core features.
  10. ///
  11. /// For each of the following built-in matrix functions, there is both a
  12. /// single-qualifier floating point version, where all arguments and return values
  13. /// are single qualifier, and a double-qualifier floating version, where all
  14. /// arguments and return values are double qualifier. Only the single-qualifier
  15. /// floating point version is shown.
  16. #pragma once
  17. // Dependencies
  18. #include "detail/qualifier.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. namespace glm {
  34. namespace detail
  35. {
  36. template<typename T, qualifier Q>
  37. struct outerProduct_trait<2, 2, T, Q>
  38. {
  39. typedef mat<2, 2, T, Q> type;
  40. };
  41. template<typename T, qualifier Q>
  42. struct outerProduct_trait<2, 3, T, Q>
  43. {
  44. typedef mat<3, 2, T, Q> type;
  45. };
  46. template<typename T, qualifier Q>
  47. struct outerProduct_trait<2, 4, T, Q>
  48. {
  49. typedef mat<4, 2, T, Q> type;
  50. };
  51. template<typename T, qualifier Q>
  52. struct outerProduct_trait<3, 2, T, Q>
  53. {
  54. typedef mat<2, 3, T, Q> type;
  55. };
  56. template<typename T, qualifier Q>
  57. struct outerProduct_trait<3, 3, T, Q>
  58. {
  59. typedef mat<3, 3, T, Q> type;
  60. };
  61. template<typename T, qualifier Q>
  62. struct outerProduct_trait<3, 4, T, Q>
  63. {
  64. typedef mat<4, 3, T, Q> type;
  65. };
  66. template<typename T, qualifier Q>
  67. struct outerProduct_trait<4, 2, T, Q>
  68. {
  69. typedef mat<2, 4, T, Q> type;
  70. };
  71. template<typename T, qualifier Q>
  72. struct outerProduct_trait<4, 3, T, Q>
  73. {
  74. typedef mat<3, 4, T, Q> type;
  75. };
  76. template<typename T, qualifier Q>
  77. struct outerProduct_trait<4, 4, T, Q>
  78. {
  79. typedef mat<4, 4, T, Q> type;
  80. };
  81. }//namespace detail
  82. /// @addtogroup core_func_matrix
  83. /// @{
  84. /// Multiply matrix x by matrix y component-wise, i.e.,
  85. /// result[i][j] is the scalar product of x[i][j] and y[i][j].
  86. ///
  87. /// @tparam C Integer between 1 and 4 included that qualify the number a column
  88. /// @tparam R Integer between 1 and 4 included that qualify the number a row
  89. /// @tparam T Floating-point or signed integer scalar types
  90. /// @tparam Q Value from qualifier enum
  91. ///
  92. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/matrixCompMult.xml">GLSL matrixCompMult 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<length_t C, length_t R, typename T, qualifier Q>
  95. GLM_FUNC_DECL mat<C, R, T, Q> matrixCompMult(mat<C, R, T, Q> const& x, mat<C, R, T, Q> const& y);
  96. /// Treats the first parameter c as a column vector
  97. /// and the second parameter r as a row vector
  98. /// and does a linear algebraic matrix multiply c * r.
  99. ///
  100. /// @tparam C Integer between 1 and 4 included that qualify the number a column
  101. /// @tparam R Integer between 1 and 4 included that qualify the number a row
  102. /// @tparam T Floating-point or signed integer scalar types
  103. /// @tparam Q Value from qualifier enum
  104. ///
  105. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/outerProduct.xml">GLSL outerProduct man page</a>
  106. /// @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>
  107. template<length_t C, length_t R, typename T, qualifier Q>
  108. GLM_FUNC_DECL typename detail::outerProduct_trait<C, R, T, Q>::type outerProduct(vec<C, T, Q> const& c, vec<R, T, Q> const& r);
  109. /// Returns the transposed matrix of x
  110. ///
  111. /// @tparam C Integer between 1 and 4 included that qualify the number a column
  112. /// @tparam R Integer between 1 and 4 included that qualify the number a row
  113. /// @tparam T Floating-point or signed integer scalar types
  114. /// @tparam Q Value from qualifier enum
  115. ///
  116. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/transpose.xml">GLSL transpose man page</a>
  117. /// @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>
  118. template<length_t C, length_t R, typename T, qualifier Q>
  119. GLM_FUNC_DECL typename mat<C, R, T, Q>::transpose_type transpose(mat<C, R, T, Q> const& x);
  120. /// Return the determinant of a squared matrix.
  121. ///
  122. /// @tparam C Integer between 1 and 4 included that qualify the number a column
  123. /// @tparam R Integer between 1 and 4 included that qualify the number a row
  124. /// @tparam T Floating-point or signed integer scalar types
  125. /// @tparam Q Value from qualifier enum
  126. ///
  127. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/determinant.xml">GLSL determinant man page</a>
  128. /// @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>
  129. template<length_t C, length_t R, typename T, qualifier Q>
  130. GLM_FUNC_DECL T determinant(mat<C, R, T, Q> const& m);
  131. /// Return the inverse of a squared matrix.
  132. ///
  133. /// @tparam C Integer between 1 and 4 included that qualify the number a column
  134. /// @tparam R Integer between 1 and 4 included that qualify the number a row
  135. /// @tparam T Floating-point or signed integer scalar types
  136. /// @tparam Q Value from qualifier enum
  137. ///
  138. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/inverse.xml">GLSL inverse man page</a>
  139. /// @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>
  140. template<length_t C, length_t R, typename T, qualifier Q>
  141. GLM_FUNC_DECL mat<C, R, T, Q> inverse(mat<C, R, T, Q> const& m);
  142. /// @}
  143. }//namespace glm
  144. #include "detail/func_matrix.inl"