• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 ///////////////////////////////////////////////////////////////////////////////////
2 /// OpenGL Mathematics (glm.g-truc.net)
3 ///
4 /// Copyright (c) 2005 - 2014 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 
41 #ifndef GLM_CORE_func_vector_relational
42 #define GLM_CORE_func_vector_relational
43 
44 #include "precision.hpp"
45 #include "setup.hpp"
46 
47 #if !((GLM_COMPILER & GLM_COMPILER_VC) && (GLM_COMPILER <= GLM_COMPILER_VC10)) // Workaround a Visual C++ bug
48 
49 namespace glm
50 {
51 	/// @addtogroup core_func_vector_relational
52 	/// @{
53 
54 	/// Returns the component-wise comparison result of x < y.
55 	///
56 	/// @tparam vecType Floating-point or integer vector types.
57 	///
58 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThan.xml">GLSL lessThan 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 	// TODO: Mismatched
61 	//template <typename T, precision P, template <typename, precision> class vecType>
62 	//GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThan(vecType<T, P> const & x, vecType<T, P> const & y);
63 
64 	/// Returns the component-wise comparison of result x <= y.
65 	///
66 	/// @tparam vecType Floating-point or integer vector types.
67 	///
68 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/lessThanEqual.xml">GLSL lessThanEqual man page</a>
69 	/// @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>
70 	template <typename T, precision P, template <typename, precision> class vecType>
71 	GLM_FUNC_DECL typename vecType<T, P>::bool_type lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
72 
73 	/// Returns the component-wise comparison of result x > y.
74 	///
75 	/// @tparam vecType Floating-point or integer vector types.
76 	///
77 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThan.xml">GLSL greaterThan man page</a>
78 	/// @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>
79 	template <typename T, precision P, template <typename, precision> class vecType>
80 	GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThan(vecType<T, P> const & x, vecType<T, P> const & y);
81 
82 	/// Returns the component-wise comparison of result x >= y.
83 	///
84 	/// @tparam vecType Floating-point or integer vector types.
85 	///
86 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/greaterThanEqual.xml">GLSL greaterThanEqual man page</a>
87 	/// @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>
88 	template <typename T, precision P, template <typename, precision> class vecType>
89 	GLM_FUNC_DECL typename vecType<T, P>::bool_type greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y);
90 
91 	/// Returns the component-wise comparison of result x == y.
92 	///
93 	/// @tparam vecType Floating-point, integer or boolean vector types.
94 	///
95 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/equal.xml">GLSL equal man page</a>
96 	/// @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>
97 	//TODO: conflicts with definision
98 	//template <typename T, precision P, template <typename, precision> class vecType>
99 	//GLM_FUNC_DECL typename vecType<T, P>::bool_type equal(vecType<T, P> const & x, vecType<T, P> const & y);
100 
101 	/// Returns the component-wise comparison of result x != y.
102 	///
103 	/// @tparam vecType Floating-point, integer or boolean vector types.
104 	///
105 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/notEqual.xml">GLSL notEqual 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.7 Vector Relational Functions</a>
107 	template <typename T, precision P, template <typename, precision> class vecType>
108 	GLM_FUNC_DECL typename vecType<T, P>::bool_type notEqual(vecType<T, P> const & x, vecType<T, P> const & y);
109 
110 	/// Returns true if any component of x is true.
111 	///
112 	/// @tparam vecType Boolean vector types.
113 	///
114 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/any.xml">GLSL any man page</a>
115 	/// @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>
116 	template <precision P, template <typename, precision> class vecType>
117 	GLM_FUNC_DECL bool any(vecType<bool, P> const & v);
118 
119 	/// Returns true if all components of x are true.
120 	///
121 	/// @tparam vecType Boolean vector types.
122 	///
123 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/all.xml">GLSL all man page</a>
124 	/// @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>
125 	template <precision P, template <typename, precision> class vecType>
126 	GLM_FUNC_DECL bool all(vecType<bool, P> const & v);
127 
128 	/// Returns the component-wise logical complement of x.
129 	/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
130 	///
131 	/// @tparam vecType Boolean vector types.
132 	///
133 	/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
134 	/// @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>
135 	template <precision P, template <typename, precision> class vecType>
136 	GLM_FUNC_DECL vecType<bool, P> not_(vecType<bool, P> const & v);
137 
138 	/// @}
139 }//namespace glm
140 
141 #endif
142 
143 #include "func_vector_relational.inl"
144 
145 #endif//GLM_CORE_func_vector_relational
146