mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Fixed conflict with Boost, ticket #158
This commit is contained in:
parent
c7d752cdf8
commit
040ea3ce7e
@ -87,29 +87,32 @@ namespace glm
|
|||||||
|
|
||||||
VECTORIZE_VEC(exp2)
|
VECTORIZE_VEC(exp2)
|
||||||
|
|
||||||
namespace detail
|
namespace _detail
|
||||||
{
|
{
|
||||||
template <int PATH = float_or_int_value::GLM_ERROR>
|
template <int _PATH = detail::float_or_int_value::GLM_ERROR>
|
||||||
struct compute_log2
|
struct _compute_log2
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T operator() (T const & Value) const
|
T operator() (T const & Value) const;
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");
|
GLM_STATIC_ASSERT(0, "'log2' parameter has an invalid template parameter type. GLM core features only supports floating-point types, include <glm/gtx/integer.hpp> for integer types support. Others types are not supported.");
|
||||||
return Value;
|
return Value;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct compute_log2<float_or_int_value::GLM_FLOAT>
|
struct _compute_log2<detail::float_or_int_value::GLM_FLOAT>
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T operator() (T const & Value) const
|
T operator() (T const & Value) const
|
||||||
{
|
{
|
||||||
return ::std::log(Value) / T(0.69314718055994530941723212145818);
|
return T(::std::log(Value)) / T(0.69314718055994530941723212145818);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}//namespace detail
|
|
||||||
|
}//namespace _detail
|
||||||
|
|
||||||
// log2, ln2 = 0.69314718055994530941723212145818f
|
// log2, ln2 = 0.69314718055994530941723212145818f
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
@ -119,7 +122,7 @@ namespace detail
|
|||||||
)
|
)
|
||||||
{
|
{
|
||||||
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
|
assert(x > genType(0)); // log2 is only defined on the range (0, inf]
|
||||||
return detail::compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
|
return _detail::_compute_log2<detail::float_or_int_trait<genType>::ID>()(x);
|
||||||
}
|
}
|
||||||
|
|
||||||
VECTORIZE_VEC(log2)
|
VECTORIZE_VEC(log2)
|
||||||
|
@ -17,13 +17,15 @@ namespace detail
|
|||||||
struct compute_linearRand
|
struct compute_linearRand
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const
|
GLM_FUNC_QUALIFIER T operator() (T const & Min, T const & Max) const;
|
||||||
|
/*
|
||||||
{
|
{
|
||||||
GLM_STATIC_ASSERT(0, "'linearRand' invalid template parameter type. GLM_GTC_random only supports floating-point template types.");
|
GLM_STATIC_ASSERT(0, "'linearRand' invalid template parameter type. GLM_GTC_random only supports floating-point template types.");
|
||||||
return Min;
|
return Min;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
};
|
};
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
GLM_FUNC_QUALIFIER half compute_linearRand::operator()<half> (half const & Min, half const & Max) const
|
GLM_FUNC_QUALIFIER half compute_linearRand::operator()<half> (half const & Min, half const & Max) const
|
||||||
{
|
{
|
||||||
@ -41,6 +43,12 @@ namespace detail
|
|||||||
{
|
{
|
||||||
return double(std::rand()) / double(RAND_MAX) * (Max - Min) + Min;
|
return double(std::rand()) / double(RAND_MAX) * (Max - Min) + Min;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
template <>
|
||||||
|
GLM_FUNC_QUALIFIER long double compute_linearRand::operator()<long double> (long double const & Min, long double const & Max) const
|
||||||
|
{
|
||||||
|
return (long double)(std::rand()) / (long double)(RAND_MAX) * (Max - Min) + Min;
|
||||||
|
}
|
||||||
}//namespace detail
|
}//namespace detail
|
||||||
|
|
||||||
template <typename genType>
|
template <typename genType>
|
||||||
|
@ -38,7 +38,7 @@ namespace glm
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
||||||
namespace detail
|
namespace _detail
|
||||||
{
|
{
|
||||||
GLM_FUNC_QUALIFIER unsigned int ones32(unsigned int x)
|
GLM_FUNC_QUALIFIER unsigned int ones32(unsigned int x)
|
||||||
{
|
{
|
||||||
@ -55,7 +55,7 @@ namespace detail
|
|||||||
}
|
}
|
||||||
|
|
||||||
template <>
|
template <>
|
||||||
struct compute_log2<float_or_int_value::GLM_INT>
|
struct _compute_log2<detail::float_or_int_value::GLM_INT>
|
||||||
{
|
{
|
||||||
template <typename T>
|
template <typename T>
|
||||||
T operator() (T const & Value) const
|
T operator() (T const & Value) const
|
||||||
@ -67,7 +67,8 @@ namespace detail
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}//namespace detail
|
|
||||||
|
}//namespace _detail
|
||||||
|
|
||||||
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
// Henry Gordon Dietz: http://aggregate.org/MAGIC/
|
||||||
unsigned int floor_log2(unsigned int x)
|
unsigned int floor_log2(unsigned int x)
|
||||||
@ -78,7 +79,7 @@ namespace detail
|
|||||||
x |= (x >> 8);
|
x |= (x >> 8);
|
||||||
x |= (x >> 16);
|
x |= (x >> 16);
|
||||||
|
|
||||||
return(detail::ones32(x) - 1);
|
return(_detail::ones32(x) - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// mod
|
// mod
|
||||||
|
@ -7,12 +7,13 @@
|
|||||||
// File : test/core/func_common.cpp
|
// File : test/core/func_common.cpp
|
||||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
#include <glm/glm.hpp>
|
|
||||||
#include <glm/gtx/epsilon.hpp>
|
|
||||||
#include <cstdio>
|
|
||||||
#include <boost/array.hpp>
|
#include <boost/array.hpp>
|
||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <boost/thread/thread.hpp>
|
#include <boost/thread/thread.hpp>
|
||||||
|
#include <glm/glm.hpp>
|
||||||
|
#include <glm/ext.hpp>
|
||||||
|
#include <glm/gtx/epsilon.hpp>
|
||||||
|
#include <cstdio>
|
||||||
|
|
||||||
int test_modf()
|
int test_modf()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user