mirror of
https://github.com/g-truc/glm.git
synced 2024-11-27 02:34:35 +00:00
Fixed abs function for half based types
This commit is contained in:
parent
cdf5d19275
commit
1fb8bec873
@ -22,7 +22,7 @@
|
||||
///
|
||||
/// @ref gtc_half_float
|
||||
/// @file glm/gtc/half_float.hpp
|
||||
/// @date 2009-04-29 / 2011-06-05
|
||||
/// @date 2009-04-29 / 2012-11-06
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
@ -416,6 +416,22 @@ namespace detail
|
||||
/// @see gtc_half_float
|
||||
typedef detail::tmat4x4<detail::half> hmat4x4;
|
||||
|
||||
/// Returns the absolute value of a half-precision floating-point value
|
||||
/// @see gtc_half_float
|
||||
half abs(half const & x);
|
||||
|
||||
/// Returns the absolute value of a half-precision floating-point two dimensional vector
|
||||
/// @see gtc_half_float
|
||||
hvec2 abs(hvec2 const & x);
|
||||
|
||||
/// Returns the absolute value of a half-precision floating-point three dimensional vector
|
||||
/// @see gtc_half_float
|
||||
hvec3 abs(hvec3 const & x);
|
||||
|
||||
/// Returns the absolute value of a half-precision floating-point four dimensional vector
|
||||
/// @see gtc_half_float
|
||||
hvec4 abs(hvec4 const & x);
|
||||
|
||||
/// @}
|
||||
}// namespace glm
|
||||
|
||||
|
@ -22,7 +22,7 @@
|
||||
///
|
||||
/// @ref gtc_half_float
|
||||
/// @file glm/gtc/half_float.inl
|
||||
/// @date 2009-04-29 / 2011-06-05
|
||||
/// @date 2009-04-29 / 2012-11-06
|
||||
/// @author Christophe Riccio
|
||||
///////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@ -1006,4 +1006,34 @@ namespace detail
|
||||
#endif//(GLM_COMPONENT == GLM_COMPONENT_CXX98)
|
||||
|
||||
}//namespace detail
|
||||
|
||||
GLM_FUNC_QUALIFIER half abs(half const & x)
|
||||
{
|
||||
return float(x) >= float(0) ? x : -x;
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER hvec2 abs(hvec2 const & v)
|
||||
{
|
||||
return hvec2(
|
||||
float(v.x) >= float(0) ? v.x : -v.x,
|
||||
float(v.y) >= float(0) ? v.y : -v.y);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER hvec3 abs(hvec3 const & v)
|
||||
{
|
||||
return hvec3(
|
||||
float(v.x) >= float(0) ? v.x : -v.x,
|
||||
float(v.y) >= float(0) ? v.y : -v.y,
|
||||
float(v.z) >= float(0) ? v.z : -v.z);
|
||||
}
|
||||
|
||||
GLM_FUNC_QUALIFIER hvec4 abs(hvec4 const & v)
|
||||
{
|
||||
return hvec4(
|
||||
float(v.x) >= float(0) ? v.x : -v.x,
|
||||
float(v.y) >= float(0) ? v.y : -v.y,
|
||||
float(v.z) >= float(0) ? v.z : -v.z,
|
||||
float(v.w) >= float(0) ? v.w : -v.w);
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
Loading…
Reference in New Issue
Block a user