vector_relational.hpp 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. /// @ref core
  2. /// @file glm/vector_relational.hpp
  3. ///
  4. /// @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>
  5. ///
  6. /// @defgroup core_func_vector_relational Vector Relational Functions
  7. /// @ingroup core
  8. ///
  9. /// Relational and equality operators (<, <=, >, >=, ==, !=) are defined to
  10. /// operate on scalars and produce scalar Boolean results. For vector results,
  11. /// use the following built-in functions.
  12. ///
  13. /// In all cases, the sizes of all the input and return vectors for any particular
  14. /// call must match.
  15. ///
  16. /// Include <glm/vector_relational.hpp> to use these core features.
  17. ///
  18. /// @see ext_vector_relational
  19. #pragma once
  20. #include "detail/qualifier.hpp"
  21. #include "detail/setup.hpp"
  22. namespace glm
  23. {
  24. /// @addtogroup core_func_vector_relational
  25. /// @{
  26. /// Returns the component-wise comparison result of x < y.
  27. ///
  28. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  29. /// @tparam T A floating-point or integer scalar type.
  30. ///
  31. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
  32. /// @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>
  33. template<length_t L, typename T, qualifier Q>
  34. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> lessThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  35. /// Returns the component-wise comparison of result x <= y.
  36. ///
  37. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  38. /// @tparam T A floating-point or integer scalar type.
  39. ///
  40. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
  41. /// @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>
  42. template<length_t L, typename T, qualifier Q>
  43. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> lessThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  44. /// Returns the component-wise comparison of result x > y.
  45. ///
  46. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  47. /// @tparam T A floating-point or integer scalar type.
  48. ///
  49. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
  50. /// @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>
  51. template<length_t L, typename T, qualifier Q>
  52. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> greaterThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  53. /// Returns the component-wise comparison of result x >= y.
  54. ///
  55. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  56. /// @tparam T A floating-point or integer scalar type.
  57. ///
  58. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
  59. /// @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>
  60. template<length_t L, typename T, qualifier Q>
  61. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> greaterThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  62. /// Returns the component-wise comparison of result x == y.
  63. ///
  64. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  65. /// @tparam T A floating-point, integer or bool scalar type.
  66. ///
  67. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal 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<length_t L, typename T, qualifier Q>
  70. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  71. /// Returns the component-wise comparison of result x != y.
  72. ///
  73. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  74. /// @tparam T A floating-point, integer or bool scalar type.
  75. ///
  76. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
  77. /// @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>
  78. template<length_t L, typename T, qualifier Q>
  79. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
  80. /// Returns true if any component of x is true.
  81. ///
  82. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  83. ///
  84. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
  85. /// @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>
  86. template<length_t L, qualifier Q>
  87. GLM_FUNC_DECL GLM_CONSTEXPR bool any(vec<L, bool, Q> const& v);
  88. /// Returns true if all components of x are true.
  89. ///
  90. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  91. ///
  92. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all 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.7 Vector Relational Functions</a>
  94. template<length_t L, qualifier Q>
  95. GLM_FUNC_DECL GLM_CONSTEXPR bool all(vec<L, bool, Q> const& v);
  96. /// Returns the component-wise logical complement of x.
  97. /// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
  98. ///
  99. /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
  100. ///
  101. /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not 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.7 Vector Relational Functions</a>
  103. template<length_t L, qualifier Q>
  104. GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> not_(vec<L, bool, Q> const& v);
  105. /// @}
  106. }//namespace glm
  107. #include "detail/func_vector_relational.inl"