mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Updated GTX_associated_min_max with vec1 support
This commit is contained in:
parent
c2d542562e
commit
d06db1133d
@ -22,7 +22,7 @@
|
||||
///
|
||||
/// @ref gtx_associated_min_max
|
||||
/// @file glm/gtx/associated_min_max.hpp
|
||||
/// @date 2008-03-10 / 2011-06-07
|
||||
/// @date 2008-03-10 / 2014-10-11
|
||||
/// @author Christophe Riccio
|
||||
///
|
||||
/// @see core (dependence)
|
||||
@ -49,53 +49,177 @@ namespace glm
|
||||
/// @addtogroup gtx_associated_min_max
|
||||
/// @{
|
||||
|
||||
/// Min comparison between 2 variables
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMin(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b);
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_DECL U associatedMin(T x, U a, T y, U b);
|
||||
|
||||
/// Min comparison between 3 variables
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMin(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b,
|
||||
const genTypeT& z, const genTypeU& c);
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL tvec2<U, P> associatedMin(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b);
|
||||
|
||||
/// Min comparison between 4 variables
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMin(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b,
|
||||
const genTypeT& z, const genTypeU& c,
|
||||
const genTypeT& w, const genTypeU& d);
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
T x, const vecType<U, P>& a,
|
||||
T y, const vecType<U, P>& b);
|
||||
|
||||
/// Max comparison between 2 variables
|
||||
/// Minimum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMax(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b);
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b);
|
||||
|
||||
/// Max comparison between 3 variables
|
||||
/// Minimum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMax(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b,
|
||||
const genTypeT& z, const genTypeU& c);
|
||||
template<typename T, typename U>
|
||||
GLM_FUNC_DECL U associatedMin(
|
||||
T x, U a,
|
||||
T y, U b,
|
||||
T z, U c);
|
||||
|
||||
/// Max comparison between 4 variables
|
||||
/// Minimum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename genTypeT, typename genTypeU>
|
||||
GLM_FUNC_DECL genTypeU associatedMax(
|
||||
const genTypeT& x, const genTypeU& a,
|
||||
const genTypeT& y, const genTypeU& b,
|
||||
const genTypeT& z, const genTypeU& c,
|
||||
const genTypeT& w, const genTypeU& d);
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U>
|
||||
GLM_FUNC_DECL U associatedMin(
|
||||
T x, U a,
|
||||
T y, U b,
|
||||
T z, U c,
|
||||
T w, U d);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c,
|
||||
vecType<T, P> const & w, vecType<U, P> const & d);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c,
|
||||
T w, vecType<U, P> const & d);
|
||||
|
||||
/// Minimum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMin(
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c,
|
||||
vecType<T, P> const & w, U d);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U>
|
||||
GLM_FUNC_DECL U associatedMax(T x, U a, T y, U b);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL tvec2<U, P> associatedMax(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> associatedMax(
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b);
|
||||
|
||||
/// Maximum comparison between 2 variables and returns 2 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U>
|
||||
GLM_FUNC_DECL U associatedMax(
|
||||
T x, U a,
|
||||
T y, U b,
|
||||
T z, U c);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<T, P> associatedMax(
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c);
|
||||
|
||||
/// Maximum comparison between 3 variables and returns 3 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U>
|
||||
GLM_FUNC_DECL U associatedMax(
|
||||
T x, U a,
|
||||
T y, U b,
|
||||
T z, U c,
|
||||
T w, U d);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c,
|
||||
vecType<T, P> const & w, vecType<U, P> const & d);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c,
|
||||
T w, vecType<U, P> const & d);
|
||||
|
||||
/// Maximum comparison between 4 variables and returns 4 associated variable values
|
||||
/// @see gtx_associated_min_max
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_DECL vecType<U, P> associatedMax(
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c,
|
||||
vecType<T, P> const & w, U d);
|
||||
|
||||
/// @}
|
||||
} //namespace glm
|
||||
|
@ -2,7 +2,7 @@
|
||||
// OpenGL Mathematics Copyright (c) 2005 - 2014 G-Truc Creation (www.g-truc.net)
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Created : 2008-03-10
|
||||
// Updated : 2008-03-15
|
||||
// Updated : 2014-10-11
|
||||
// Licence : This source is under MIT License
|
||||
// File : gtx_associated_min_max.inl
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
@ -16,118 +16,40 @@ GLM_FUNC_QUALIFIER U associatedMin(T x, U a, T y, U b)
|
||||
return x < y ? a : b;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b
|
||||
T x, const vecType<U, P>& a,
|
||||
T y, const vecType<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec2<U, P>& a,
|
||||
T y, const tvec2<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x < y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec3<U, P>& a,
|
||||
T y, const tvec3<U, P>& b
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x < y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec4<U, P>& a,
|
||||
T y, const tvec4<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x < y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
(
|
||||
tvec2<T, P> const & x, U a,
|
||||
tvec2<T, P> const & y, U b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a : b;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
(
|
||||
tvec3<T, P> const & x, U a,
|
||||
tvec3<T, P> const & y, U b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a : b;
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
const tvec4<T, P>& x, U a,
|
||||
const tvec4<T, P>& y, U b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? a : b;
|
||||
return Result;
|
||||
@ -146,43 +68,15 @@ GLM_FUNC_QUALIFIER U associatedMin
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b,
|
||||
const tvec2<T, P>& z, const tvec2<U, P>& c
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b,
|
||||
const tvec3<T, P>& z, const tvec3<U, P>& c
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b,
|
||||
const tvec4<T, P>& z, const tvec4<U, P>& c
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] < y[i] ? (x[i] < z[i] ? a[i] : c[i]) : (y[i] < z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
@ -207,16 +101,16 @@ GLM_FUNC_QUALIFIER U associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b,
|
||||
const tvec2<T, P>& z, const tvec2<U, P>& c,
|
||||
const tvec2<T, P>& w, const tvec2<U, P>& d
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c,
|
||||
vecType<T, P> const & w, vecType<U, P> const & d
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
@ -229,63 +123,19 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b,
|
||||
const tvec3<T, P>& z, const tvec3<U, P>& c,
|
||||
const tvec3<T, P>& w, const tvec3<U, P>& d
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
T Test2 = min(z[i], w[i]);
|
||||
U Result1 = x[i] < y[i] ? a[i] : b[i];
|
||||
U Result2 = z[i] < w[i] ? c[i] : d[i];
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b,
|
||||
const tvec4<T, P>& z, const tvec4<U, P>& c,
|
||||
const tvec4<T, P>& w, const tvec4<U, P>& d
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
T Test2 = min(z[i], w[i]);
|
||||
U Result1 = x[i] < y[i] ? a[i] : b[i];
|
||||
U Result2 = z[i] < w[i] ? c[i] : d[i];
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec2<U, P>& a,
|
||||
T y, const tvec2<U, P>& b,
|
||||
T z, const tvec2<U, P>& c,
|
||||
T w, const tvec2<U, P>& d
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c,
|
||||
T w, vecType<U, P> const & d
|
||||
)
|
||||
{
|
||||
T Test1 = min(x, y);
|
||||
T Test2 = min(z, w);
|
||||
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x < y ? a[i] : b[i];
|
||||
@ -296,106 +146,16 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec3<U, P>& a,
|
||||
T y, const tvec3<U, P>& b,
|
||||
T z, const tvec3<U, P>& c,
|
||||
T w, const tvec3<U, P>& d
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c,
|
||||
vecType<T, P> const & w, U d
|
||||
)
|
||||
{
|
||||
T Test1 = min(x, y);
|
||||
T Test2 = min(z, w);
|
||||
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x < y ? a[i] : b[i];
|
||||
U Result2 = z < w ? c[i] : d[i];
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
T x, const tvec4<U, P>& a,
|
||||
T y, const tvec4<U, P>& b,
|
||||
T z, const tvec4<U, P>& c,
|
||||
T w, const tvec4<U, P>& d
|
||||
)
|
||||
{
|
||||
T Test1 = min(x, y);
|
||||
T Test2 = min(z, w);
|
||||
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x < y ? a[i] : b[i];
|
||||
U Result2 = z < w ? c[i] : d[i];
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMin
|
||||
(
|
||||
const tvec2<T, P>& x, U a,
|
||||
const tvec2<T, P>& y, U b,
|
||||
const tvec2<T, P>& z, U c,
|
||||
const tvec2<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
T Test2 = min(z[i], w[i]);;
|
||||
U Result1 = x[i] < y[i] ? a : b;
|
||||
U Result2 = z[i] < w[i] ? c : d;
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMin
|
||||
(
|
||||
const tvec3<T, P>& x, U a,
|
||||
const tvec3<T, P>& y, U b,
|
||||
const tvec3<T, P>& z, U c,
|
||||
const tvec3<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
T Test2 = min(z[i], w[i]);;
|
||||
U Result1 = x[i] < y[i] ? a : b;
|
||||
U Result2 = z[i] < w[i] ? c : d;
|
||||
Result[i] = Test1 < Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Min comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMin
|
||||
(
|
||||
const tvec4<T, P>& x, U a,
|
||||
const tvec4<T, P>& y, U b,
|
||||
const tvec4<T, P>& z, U c,
|
||||
const tvec4<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = min(x[i], y[i]);
|
||||
@ -415,126 +175,42 @@ GLM_FUNC_QUALIFIER U associatedMax(T x, U a, T y, U b)
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec2<U, P>& a,
|
||||
T y, const tvec2<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec3<U, P>& a,
|
||||
T y, const tvec3<U, P>& b
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec4<U, P>& a,
|
||||
T y, const tvec4<U, P>& b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? a[i] : b[i];
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, U a,
|
||||
const tvec2<T, P>& y, U b
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a : b;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, U a,
|
||||
const tvec3<T, P>& y, U b
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a : b;
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 2 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, U a,
|
||||
const tvec4<T, P>& y, U b
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
vecType<T, P> Result(vecType<T, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? a : b;
|
||||
return Result;
|
||||
@ -554,135 +230,45 @@ GLM_FUNC_QUALIFIER U associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b,
|
||||
const tvec2<T, P>& z, const tvec2<U, P>& c
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<T, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b,
|
||||
const tvec3<T, P>& z, const tvec3<U, P>& c
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b,
|
||||
const tvec4<T, P>& z, const tvec4<U, P>& c
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a[i] : c[i]) : (y[i] > z[i] ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec2<U, P>& a,
|
||||
T y, const tvec2<U, P>& b,
|
||||
T z, const tvec2<U, P>& c
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec3<U, P>& a,
|
||||
T y, const tvec3<U, P>& b,
|
||||
T z, const tvec3<U, P>& c
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec4<U, P>& a,
|
||||
T y, const tvec4<U, P>& b,
|
||||
T z, const tvec4<U, P>& c
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x > y ? (x > z ? a[i] : c[i]) : (y > z ? b[i] : c[i]);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, U a,
|
||||
const tvec2<T, P>& y, U b,
|
||||
const tvec2<T, P>& z, U c
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, U a,
|
||||
const tvec3<T, P>& y, U b,
|
||||
const tvec3<T, P>& z, U c
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 3 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, U a,
|
||||
const tvec4<T, P>& y, U b,
|
||||
const tvec4<T, P>& z, U c
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
vecType<T, P> Result(vecType<T, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
Result[i] = x[i] > y[i] ? (x[i] > z[i] ? a : c) : (y[i] > z[i] ? b : c);
|
||||
return Result;
|
||||
@ -707,16 +293,16 @@ GLM_FUNC_QUALIFIER U associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, const tvec2<U, P>& a,
|
||||
const tvec2<T, P>& y, const tvec2<U, P>& b,
|
||||
const tvec2<T, P>& z, const tvec2<U, P>& c,
|
||||
const tvec2<T, P>& w, const tvec2<U, P>& d
|
||||
vecType<T, P> const & x, vecType<U, P> const & a,
|
||||
vecType<T, P> const & y, vecType<U, P> const & b,
|
||||
vecType<T, P> const & z, vecType<U, P> const & c,
|
||||
vecType<T, P> const & w, vecType<U, P> const & d
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
@ -729,63 +315,19 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, const tvec3<U, P>& a,
|
||||
const tvec3<T, P>& y, const tvec3<U, P>& b,
|
||||
const tvec3<T, P>& z, const tvec3<U, P>& c,
|
||||
const tvec3<T, P>& w, const tvec3<U, P>& d
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
T Test2 = max(z[i], w[i]);
|
||||
U Result1 = x[i] > y[i] ? a[i] : b[i];
|
||||
U Result2 = z[i] > w[i] ? c[i] : d[i];
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, const tvec4<U, P>& a,
|
||||
const tvec4<T, P>& y, const tvec4<U, P>& b,
|
||||
const tvec4<T, P>& z, const tvec4<U, P>& c,
|
||||
const tvec4<T, P>& w, const tvec4<U, P>& d
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
T Test2 = max(z[i], w[i]);
|
||||
U Result1 = x[i] > y[i] ? a[i] : b[i];
|
||||
U Result2 = z[i] > w[i] ? c[i] : d[i];
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec2<U, P>& a,
|
||||
T y, const tvec2<U, P>& b,
|
||||
T z, const tvec2<U, P>& c,
|
||||
T w, const tvec2<U, P>& d
|
||||
T x, vecType<U, P> const & a,
|
||||
T y, vecType<U, P> const & b,
|
||||
T z, vecType<U, P> const & c,
|
||||
T w, vecType<U, P> const & d
|
||||
)
|
||||
{
|
||||
T Test1 = max(x, y);
|
||||
T Test2 = max(z, w);
|
||||
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x > y ? a[i] : b[i];
|
||||
@ -796,62 +338,16 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
template<typename T, typename U, precision P, template <typename, precision> class vecType>
|
||||
GLM_FUNC_QUALIFIER vecType<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec3<U, P>& a,
|
||||
T y, const tvec3<U, P>& b,
|
||||
T z, const tvec3<U, P>& c,
|
||||
T w, const tvec3<U, P>& d
|
||||
vecType<T, P> const & x, U a,
|
||||
vecType<T, P> const & y, U b,
|
||||
vecType<T, P> const & z, U c,
|
||||
vecType<T, P> const & w, U d
|
||||
)
|
||||
{
|
||||
T Test1 = max(x, y);
|
||||
T Test2 = max(z, w);
|
||||
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x > y ? a[i] : b[i];
|
||||
U Result2 = z > w ? c[i] : d[i];
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
T x, const tvec4<U, P>& a,
|
||||
T y, const tvec4<U, P>& b,
|
||||
T z, const tvec4<U, P>& c,
|
||||
T w, const tvec4<U, P>& d
|
||||
)
|
||||
{
|
||||
T Test1 = max(x, y);
|
||||
T Test2 = max(z, w);
|
||||
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
U Result1 = x > y ? a[i] : b[i];
|
||||
U Result2 = z > w ? c[i] : d[i];
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
(
|
||||
const tvec2<T, P>& x, U a,
|
||||
const tvec2<T, P>& y, U b,
|
||||
const tvec2<T, P>& z, U c,
|
||||
const tvec2<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec2<U, P> Result(tvec2<U, P>::_null);
|
||||
vecType<U, P> Result(vecType<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
@ -862,49 +358,4 @@ GLM_FUNC_QUALIFIER tvec2<U, P> associatedMax
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec3<U, P> associatedMax
|
||||
(
|
||||
const tvec3<T, P>& x, U a,
|
||||
const tvec3<T, P>& y, U b,
|
||||
const tvec3<T, P>& z, U c,
|
||||
const tvec3<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec3<U, P> Result(tvec3<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
T Test2 = max(z[i], w[i]);;
|
||||
U Result1 = x[i] > y[i] ? a : b;
|
||||
U Result2 = z[i] > w[i] ? c : d;
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
// Max comparison between 4 variables
|
||||
template<typename T, typename U, precision P>
|
||||
GLM_FUNC_QUALIFIER tvec4<U, P> associatedMax
|
||||
(
|
||||
const tvec4<T, P>& x, U a,
|
||||
const tvec4<T, P>& y, U b,
|
||||
const tvec4<T, P>& z, U c,
|
||||
const tvec4<T, P>& w, U d
|
||||
)
|
||||
{
|
||||
tvec4<U, P> Result(tvec4<U, P>::_null);
|
||||
for(detail::component_count_t i = 0; i < detail::component_count(Result); ++i)
|
||||
{
|
||||
T Test1 = max(x[i], y[i]);
|
||||
T Test2 = max(z[i], w[i]);;
|
||||
U Result1 = x[i] > y[i] ? a : b;
|
||||
U Result2 = z[i] > w[i] ? c : d;
|
||||
Result[i] = Test1 > Test2 ? Result1 : Result2;
|
||||
}
|
||||
return Result;
|
||||
}
|
||||
|
||||
}//namespace glm
|
||||
|
@ -63,6 +63,7 @@ GLM 0.9.6.0: 2014-XX-XX
|
||||
- Added GLM_FORCE_SIZE_FUNC to replace .length() by .size() #245
|
||||
- Fixed GTX_string_cast to support for integer types #249
|
||||
- Removed GLM_FORCE_CUDA, Cuda is implicitly detected
|
||||
- Updated GTX_associated_min_max with vec1 support
|
||||
|
||||
================================================================================
|
||||
GLM 0.9.5.4: 2014-06-21
|
||||
|
Loading…
Reference in New Issue
Block a user