6.2 KB、121行 生 Blame 履歴
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
20#pragma once
21
22#include "detail/qualifier.hpp"
23#include "detail/setup.hpp"
24
25namespace glm
26{
27 /// @addtogroup core_func_vector_relational
28 /// @{
29
30 /// Returns the component-wise comparison result of x < y.
31 ///
32 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
33 /// @tparam T A floating-point or integer scalar type.
34 ///
35 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan man page</a>
36 /// @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>
37 template<length_t L, typename T, qualifier Q>
38 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> lessThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
39
40 /// Returns the component-wise comparison of result x <= y.
41 ///
42 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
43 /// @tparam T A floating-point or integer scalar type.
44 ///
45 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
46 /// @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>
47 template<length_t L, typename T, qualifier Q>
48 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> lessThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
49
50 /// Returns the component-wise comparison of result x > y.
51 ///
52 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
53 /// @tparam T A floating-point or integer scalar type.
54 ///
55 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
56 /// @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>
57 template<length_t L, typename T, qualifier Q>
58 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> greaterThan(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
59
60 /// Returns the component-wise comparison of result x >= y.
61 ///
62 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
63 /// @tparam T A floating-point or integer scalar type.
64 ///
65 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
66 /// @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>
67 template<length_t L, typename T, qualifier Q>
68 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> greaterThanEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
69
70 /// Returns the component-wise comparison of result x == y.
71 ///
72 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
73 /// @tparam T A floating-point, integer or bool scalar type.
74 ///
75 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal 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<length_t L, typename T, qualifier Q>
78 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> equal(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
79
80 /// Returns the component-wise comparison of result x != y.
81 ///
82 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
83 /// @tparam T A floating-point, integer or bool scalar type.
84 ///
85 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual man page</a>
86 /// @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>
87 template<length_t L, typename T, qualifier Q>
88 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> notEqual(vec<L, T, Q> const& x, vec<L, T, Q> const& y);
89
90 /// Returns true if any component of x is true.
91 ///
92 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
93 ///
94 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
95 /// @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>
96 template<length_t L, qualifier Q>
97 GLM_FUNC_DECL GLM_CONSTEXPR bool any(vec<L, bool, Q> const& v);
98
99 /// Returns true if all components of x are true.
100 ///
101 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
102 ///
103 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
104 /// @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>
105 template<length_t L, qualifier Q>
106 GLM_FUNC_DECL GLM_CONSTEXPR bool all(vec<L, bool, Q> const& v);
107
108 /// Returns the component-wise logical complement of x.
109 /// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
110 ///
111 /// @tparam L An integer between 1 and 4 included that qualify the dimension of the vector.
112 ///
113 /// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
114 /// @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>
115 template<length_t L, qualifier Q>
116 GLM_FUNC_DECL GLM_CONSTEXPR vec<L, bool, Q> not_(vec<L, bool, Q> const& v);
117
118 /// @}
119}//namespace glm
120
121#include "detail/func_vector_relational.inl"