Added not function

master
Christophe Riccio ago%!(EXTRA string=11 years)
parent 72a2f49834
commit bf9e4458b6
  1. 14
      glm/detail/func_vector_relational.hpp
  2. 8
      glm/detail/func_vector_relational.inl
  3. 2
      glm/detail/setup.hpp
  4. 1
      readme.txt
  5. 35
      test/core/core_func_vector_relational.cpp

@ -132,6 +132,20 @@ namespace glm
template <precision P, template <typename, precision> class vecType> template <precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> not_(vecType<bool, P> const & v); GLM_FUNC_DECL vecType<bool, P> not_(vecType<bool, P> const & v);
# if GLM_COMPILER & GLM_COMPILER_VC && GLM_COMPILER >= GLM_COMPILER_VC12
/// Returns the component-wise logical complement of x.
/// /!\ Because of language incompatibilities between C++ and GLSL, GLM defines the function not but not_ instead.
///
/// @tparam vecType Boolean vector types.
///
/// @see <a href="http://www.opengl.org/sdk/docs/manglsl/xhtml/not.xml">GLSL not man page</a>
/// @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>
template <precision P, template <typename, precision> class vecType>
GLM_FUNC_DECL vecType<bool, P> not(vecType<bool, P> const & v){return not_(v);}
# endif
/// @} /// @}
}//namespace glm }//namespace glm

@ -33,8 +33,6 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<bool, P> lessThan(vecType<T, P> const & x, vecType<T, P> const & y)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'lessThan', GLM vector types required floating-point or integer value types vectors");
assert(detail::component_count(x) == detail::component_count(y)); assert(detail::component_count(x) == detail::component_count(y));
vecType<bool, P> Result(uninitialize); vecType<bool, P> Result(uninitialize);
@ -47,8 +45,6 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<bool, P> lessThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'lessThanEqual', GLM vector types required floating-point or integer value types vectors");
assert(detail::component_count(x) == detail::component_count(y)); assert(detail::component_count(x) == detail::component_count(y));
vecType<bool, P> Result(uninitialize); vecType<bool, P> Result(uninitialize);
@ -60,8 +56,6 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<bool, P> greaterThan(vecType<T, P> const & x, vecType<T, P> const & y)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'greaterThan', GLM vector types required floating-point or integer value types vectors");
assert(detail::component_count(x) == detail::component_count(y)); assert(detail::component_count(x) == detail::component_count(y));
vecType<bool, P> Result(uninitialize); vecType<bool, P> Result(uninitialize);
@ -73,8 +67,6 @@ namespace glm
template <typename T, precision P, template <typename, precision> class vecType> template <typename T, precision P, template <typename, precision> class vecType>
GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y) GLM_FUNC_QUALIFIER vecType<bool, P> greaterThanEqual(vecType<T, P> const & x, vecType<T, P> const & y)
{ {
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559 || std::numeric_limits<T>::is_integer,
"Invalid template instantiation of 'greaterThanEqual', GLM vector types required floating-point or integer value types vectors");
assert(detail::component_count(x) == detail::component_count(y)); assert(detail::component_count(x) == detail::component_count(y));
vecType<bool, P> Result(uninitialize); vecType<bool, P> Result(uninitialize);

@ -391,7 +391,7 @@
# define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG) # define GLM_LANG (GLM_LANG_CXX98 | GLM_LANG_CXXMS_FLAG)
# endif # endif
# else # else
# if(GLM_COMPILER >= GLM_COMPILER_VC10 # if GLM_COMPILER >= GLM_COMPILER_VC10
# define GLM_LANG GLM_LANG_CXX0X # define GLM_LANG GLM_LANG_CXX0X
# else # else
# define GLM_LANG GLM_LANG_CXX98 # define GLM_LANG GLM_LANG_CXX98

@ -75,6 +75,7 @@ GLM 0.9.6.0: 2014-XX-XX
- Separated Apple Clang and LLVM compiler detection - Separated Apple Clang and LLVM compiler detection
- Added GLM_FORCE_NO_CTOR_INIT - Added GLM_FORCE_NO_CTOR_INIT
- Added 'uninitialize' to explicitly not initialize a GLM type - Added 'uninitialize' to explicitly not initialize a GLM type
- Added not function (from GLSL specification) on VC12
================================================================================ ================================================================================
GLM 0.9.5.4: 2014-06-21 GLM 0.9.5.4: 2014-06-21

@ -7,12 +7,45 @@
// File : test/core/vector_relational.cpp // File : test/core/vector_relational.cpp
/////////////////////////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////////////////////////
#include <glm/glm.hpp> #include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <glm/vec4.hpp>
#include <glm/vector_relational.hpp>
#include <glm/gtc/vec1.hpp>
int test_not()
{
int Error(0);
{
glm::bvec1 v(false);
Error += glm::all(glm::not_(v)) ? 0 : 1;
}
{
glm::bvec2 v(false);
Error += glm::all(glm::not_(v)) ? 0 : 1;
}
{
glm::bvec3 v(false);
Error += glm::all(glm::not_(v)) ? 0 : 1;
}
{
glm::bvec4 v(false);
Error += glm::all(glm::not_(v)) ? 0 : 1;
}
return Error;
}
int main() int main()
{ {
int Error(0); int Error(0);
Error += test_not();
return Error; return Error;
} }

Loading…
Cancel
Save