Moved bounded function to GTX_common from EXT_vector_relational as there are quite new

This commit is contained in:
Christophe Riccio
2018-05-08 13:34:22 +02:00
parent 77acd2fe40
commit 4d4dbcade6
12 changed files with 275 additions and 126 deletions

View File

@@ -13,6 +13,7 @@
# pragma message("GLM: All extensions included (not recommended)")
#endif//GLM_MESSAGES
#include "./ext/vec1.hpp"
#include "./ext/vector_relational.hpp"
#include "./gtc/bitfield.hpp"

View File

@@ -390,6 +390,69 @@ namespace glm
template <typename T, qualifier Q = defaultp> using tvec1 = vec<1, T, Q>;
#endif//GLM_HAS_TEMPLATE_ALIASES
//////////////////////////
// vec1 definition
#if(defined(GLM_PRECISION_HIGHP_BOOL))
typedef highp_bvec1 bvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
typedef mediump_bvec1 bvec1;
#elif(defined(GLM_PRECISION_LOWP_BOOL))
typedef lowp_bvec1 bvec1;
#else
/// 1 component vector of boolean.
/// @see gtc_vec1 extension.
typedef highp_bvec1 bvec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_FLOAT))
typedef highp_vec1 vec1;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef mediump_vec1 vec1;
#elif(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_vec1 vec1;
#else
/// 1 component vector of floating-point numbers.
/// @see gtc_vec1 extension.
typedef highp_vec1 vec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_DOUBLE))
typedef highp_dvec1 dvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef mediump_dvec1 dvec1;
#elif(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dvec1 dvec1;
#else
/// 1 component vector of floating-point numbers.
/// @see gtc_vec1 extension.
typedef highp_dvec1 dvec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_INT))
typedef highp_ivec1 ivec1;
#elif(defined(GLM_PRECISION_MEDIUMP_INT))
typedef mediump_ivec1 ivec1;
#elif(defined(GLM_PRECISION_LOWP_INT))
typedef lowp_ivec1 ivec1;
#else
/// 1 component vector of signed integer numbers.
/// @see gtc_vec1 extension.
typedef highp_ivec1 ivec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_UINT))
typedef highp_uvec1 uvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef mediump_uvec1 uvec1;
#elif(defined(GLM_PRECISION_LOWP_UINT))
typedef lowp_uvec1 uvec1;
#else
/// 1 component vector of unsigned integer numbers.
/// @see gtc_vec1 extension.
typedef highp_uvec1 uvec1;
#endif//GLM_PRECISION
/// @}
}//namespace glm

View File

@@ -87,26 +87,6 @@ namespace glm
template<typename genType>
GLM_FUNC_DECL bool notEqual(genType const& x, genType const& y, genType const& epsilon);
/// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_vector_relational
template <length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, bool, Q> openBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
/// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_vector_relational
template <length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, bool, Q> closeBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
/// @}
}//namespace glm

View File

@@ -43,16 +43,4 @@ namespace glm
{
return greaterThanEqual(abs(x - y), epsilon);
}
template <length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, bool, Q> openBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
return greaterThan(Value, Min) && lessThan(Value, Max);
}
template <length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, bool, Q> closeBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max);
}
}//namespace glm

View File

@@ -49,11 +49,20 @@
///
/// @ingroup core
///
/// @defgroup gtc Stable extensions
/// @defgroup ext Stable extensions
///
/// @brief Additional features not specified by GLSL specification.
///
/// GTC extensions aim to be stable.
/// EXT extensions are fully tested and documented.
///
/// Even if it's highly unrecommended, it's possible to include all the extensions at once by
/// including <glm/ext.hpp>. Otherwise, each extension needs to be included a specific file.
///
/// @defgroup gtc Recommended extensions
///
/// @brief Additional features not specified by GLSL specification.
///
/// GTC extensions aim to be stable with tests and documentation.
///
/// Even if it's highly unrecommended, it's possible to include all the extensions at once by
/// including <glm/ext.hpp>. Otherwise, each extension needs to be included a specific file.

View File

@@ -19,71 +19,4 @@
# pragma message("GLM: GLM_GTC_vec1 extension included")
#endif
namespace glm
{
//////////////////////////
// vec1 definition
#if(defined(GLM_PRECISION_HIGHP_BOOL))
typedef highp_bvec1 bvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_BOOL))
typedef mediump_bvec1 bvec1;
#elif(defined(GLM_PRECISION_LOWP_BOOL))
typedef lowp_bvec1 bvec1;
#else
/// 1 component vector of boolean.
/// @see gtc_vec1 extension.
typedef highp_bvec1 bvec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_FLOAT))
typedef highp_vec1 vec1;
#elif(defined(GLM_PRECISION_MEDIUMP_FLOAT))
typedef mediump_vec1 vec1;
#elif(defined(GLM_PRECISION_LOWP_FLOAT))
typedef lowp_vec1 vec1;
#else
/// 1 component vector of floating-point numbers.
/// @see gtc_vec1 extension.
typedef highp_vec1 vec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_DOUBLE))
typedef highp_dvec1 dvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_DOUBLE))
typedef mediump_dvec1 dvec1;
#elif(defined(GLM_PRECISION_LOWP_DOUBLE))
typedef lowp_dvec1 dvec1;
#else
/// 1 component vector of floating-point numbers.
/// @see gtc_vec1 extension.
typedef highp_dvec1 dvec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_INT))
typedef highp_ivec1 ivec1;
#elif(defined(GLM_PRECISION_MEDIUMP_INT))
typedef mediump_ivec1 ivec1;
#elif(defined(GLM_PRECISION_LOWP_INT))
typedef lowp_ivec1 ivec1;
#else
/// 1 component vector of signed integer numbers.
/// @see gtc_vec1 extension.
typedef highp_ivec1 ivec1;
#endif//GLM_PRECISION
#if(defined(GLM_PRECISION_HIGHP_UINT))
typedef highp_uvec1 uvec1;
#elif(defined(GLM_PRECISION_MEDIUMP_UINT))
typedef mediump_uvec1 uvec1;
#elif(defined(GLM_PRECISION_LOWP_UINT))
typedef lowp_uvec1 uvec1;
#else
/// 1 component vector of unsigned integer numbers.
/// @see gtc_vec1 extension.
typedef highp_uvec1 uvec1;
#endif//GLM_PRECISION
}// namespace glm
#include "vec1.inl"

View File

@@ -50,6 +50,26 @@ namespace glm
template<length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, T, Q> fmod(vec<L, T, Q> const& v);
/// Returns whether vector components values are within an interval. A open interval excludes its endpoints, and is denoted with square brackets.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_vector_relational
template <length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, bool, Q> openBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
/// Returns whether vector components values are within an interval. A closed interval includes its endpoints, and is denoted with square brackets.
///
/// @tparam L Integer between 1 and 4 included that qualify the dimension of the vector
/// @tparam T Floating-point or integer scalar types
/// @tparam Q Value from qualifier enum
///
/// @see ext_vector_relational
template <length_t L, typename T, qualifier Q>
GLM_FUNC_DECL vec<L, bool, Q> closeBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max);
/// @}
}//namespace glm

View File

@@ -111,4 +111,16 @@ namespace detail
{
return detail::compute_fmod<L, T, Q, std::numeric_limits<T>::is_iec559>::call(x, y);
}
template <length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, bool, Q> openBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
return greaterThan(Value, Min) && lessThan(Value, Max);
}
template <length_t L, typename T, qualifier Q>
GLM_FUNC_QUALIFIER vec<L, bool, Q> closeBounded(vec<L, T, Q> const& Value, vec<L, T, Q> const& Min, vec<L, T, Q> const& Max)
{
return greaterThanEqual(Value, Min) && lessThanEqual(Value, Max);
}
}//namespace glm

View File

@@ -200,14 +200,17 @@ namespace glm{
template <typename genType>
GLM_FUNC_DECL genType backEaseInOut(genType const& a, genType const& o);
/// @see gtx_easing
template <typename genType>
GLM_FUNC_DECL genType bounceEaseIn(genType const& a);
/// @see gtx_easing
template <typename genType>
GLM_FUNC_DECL genType bounceEaseOut(genType const& a);
/// @see gtx_easing
template <typename genType>
GLM_FUNC_DECL genType bounceEaseInOut(genType const& a, genType);
GLM_FUNC_DECL genType bounceEaseInOut(genType const& a);
/// @}
}//namespace glm