/////////////////////////////////////////////////////////////////////////////////////////////////// // OpenGL Mathematics Copyright (c) 2005 - 2011 G-Truc Creation (www.g-truc.net) /////////////////////////////////////////////////////////////////////////////////////////////////// // Created : 2008-08-03 // Updated : 2008-09-09 // Licence : This source is under MIT License // File : glm/core/func_vector_relational.hpp /////////////////////////////////////////////////////////////////////////////////////////////////// #ifndef glm_core_func_vector_relational #define glm_core_func_vector_relational #include "_detail.hpp" namespace glm { namespace test{ void main_core_func_vector_relational(); }//namespace test namespace core{ namespace function{ //! Define vector relational functions from Section 8.3 of GLSL 1.30.8 specification. //! Included in glm namespace. namespace vector_relational { /// \addtogroup core_funcs ///@{ //! Returns the component-wise comparison result of x < y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type lessThan ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'lessThan', GLM vector types required"); GLM_STATIC_ASSERT(detail::is_bool::_NO, "Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] < y[i]; return Result; } //! Returns the component-wise comparison of result x <= y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type lessThanEqual ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'lessThanEqual', GLM vector types required"); GLM_STATIC_ASSERT(detail::is_bool::_NO, "Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] <= y[i]; return Result; } //! Returns the component-wise comparison of result x > y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type greaterThan ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'greaterThan', GLM vector types required"); GLM_STATIC_ASSERT(detail::is_bool::_NO, "Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] > y[i]; return Result; } //! Returns the component-wise comparison of result x >= y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type greaterThanEqual ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'greaterThanEqual', GLM vector types required"); GLM_STATIC_ASSERT(detail::is_bool::_NO, "Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] >= y[i]; return Result; } //! Returns the component-wise comparison of result x == y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type equal ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'equal', GLM vector types required"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] == y[i]; return Result; } //! Returns the component-wise comparison of result x != y. //! (From GLSL 1.30.08 specification, section 8.6) template class vecType> inline typename vecType::bool_type notEqual ( vecType const & x, vecType const & y ) { GLM_STATIC_ASSERT(detail::is_vector >::_YES, "Invalid template instantiation of 'notEqual', GLM vector types required"); typename vecType::bool_type Result(vecType::null); for(typename vecType::size_type i = 0; i < vecType::value_size(); ++i) Result[i] = x[i] != y[i]; return Result; } //! Returns true if any component of x is true. //! (From GLSL 1.30.08 specification, section 8.6) template