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.

138 lines
6.8 KiB

4 years ago
  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_vector_relational.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.7 Vector Relational Functions</a>
  29. ///
  30. /// @defgroup core_func_vector_relational Vector Relational Functions
  31. /// @ingroup core
  32. ///
  33. /// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to
  34. /// operate on scalars and produce scalar Boolean results. For vector results,
  35. /// use the following built-in functions.
  36. ///
  37. /// In all cases, the sizes of all the input and return vectors for any particular
  38. /// call must match.
  39. ///////////////////////////////////////////////////////////////////////////////////
  40. #ifndef GLM_CORE_func_vector_relational
  41. #define GLM_CORE_func_vector_relational GLM_VERSION
  42. #include "_detail.hpp"
  43. namespace glm
  44. {
  45. /// @addtogroup core_func_vector_relational
  46. /// @{
  47. /// Returns the component-wise comparison result of x < y.
  48. ///
  49. /// @tparam vecType Floating-point or integer vector types.
  50. ///
  51. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
  52. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  53. template <typename vecType>
  54. GLM_FUNC_DECL typename vecType::bool_type lessThan(vecType const & x, vecType const & y);
  55. /// Returns the component-wise comparison of result x <= y.
  56. ///
  57. /// @tparam vecType Floating-point or integer vector types.
  58. ///
  59. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
  60. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  61. template <typename vecType>
  62. GLM_FUNC_DECL typename vecType::bool_type lessThanEqual(vecType const & x, vecType const & y);
  63. /// Returns the component-wise comparison of result x > y.
  64. ///
  65. /// @tparam vecType Floating-point or integer vector types.
  66. ///
  67. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
  68. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  69. template <typename vecType>
  70. GLM_FUNC_DECL typename vecType::bool_type greaterThan(vecType const & x, vecType const & y);
  71. /// Returns the component-wise comparison of result x >= y.
  72. ///
  73. /// @tparam vecType Floating-point or integer vector types.
  74. ///
  75. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
  76. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  77. template <typename vecType>
  78. GLM_FUNC_DECL typename vecType::bool_type greaterThanEqual(vecType const & x, vecType const & y);
  79. /// Returns the component-wise comparison of result x == y.
  80. ///
  81. /// @tparam vecType Floating-point, integer or boolean vector types.
  82. ///
  83. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal 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.7 Vector Relational Functions</a>
  85. template <typename vecType>
  86. GLM_FUNC_DECL typename vecType::bool_type equal(vecType const & x, vecType const & y);
  87. /// Returns the component-wise comparison of result x != y.
  88. ///
  89. /// @tparam vecType Floating-point, integer or boolean vector types.
  90. ///
  91. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
  92. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  93. template <typename vecType>
  94. GLM_FUNC_DECL typename vecType::bool_type notEqual(vecType const & x, vecType const & y);
  95. /// Returns true if any component of x is true.
  96. ///
  97. /// @tparam vecType Boolean vector types.
  98. ///
  99. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
  100. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  101. template <template <typename> class vecType>
  102. GLM_FUNC_DECL bool any(vecType<bool> const & v);
  103. /// Returns true if all components of x are true.
  104. ///
  105. /// @tparam vecType Boolean vector types.
  106. ///
  107. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
  108. /// @see <a href="http://www.opengl.org/registry/doc/GLSLangSpec.4.20.8.pdf">GLSL 4.20.8 specification, section 8.7 Vector Relational Functions</a>
  109. template <template <typename> class vecType>
  110. GLM_FUNC_DECL bool all(vecType<bool> const & v);
  111. /// Returns the component-wise logical complement of x.
  112. /// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
  113. ///
  114. /// @tparam vecType Boolean vector types.
  115. ///
  116. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not 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.7 Vector Relational Functions</a>
  118. template <template <typename> class vecType>
  119. GLM_FUNC_DECL vecType<bool> not_(vecType<bool> const & v);
  120. /// @}
  121. }//namespace glm
  122. #include "func_vector_relational.inl"
  123. #endif//GLM_CORE_func_vector_relational