Merge branch '0.9.5' into 0.9.6

This commit is contained in:
Christophe Riccio 2013-12-26 13:15:20 +01:00
commit 5f1bb47bf2
7 changed files with 40 additions and 28 deletions

View File

@ -37,13 +37,13 @@ namespace glm{
namespace detail
{
template <typename genFIType, bool /*signed*/>
struct Abs_
struct compute_abs
{};
template <typename genFIType>
struct Abs_<genFIType, true>
struct compute_abs<genFIType, true>
{
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
GLM_FUNC_QUALIFIER static genFIType call(genFIType const & x)
{
GLM_STATIC_ASSERT(
std::numeric_limits<genFIType>::is_iec559 || std::numeric_limits<genFIType>::is_signed,
@ -54,9 +54,9 @@ namespace detail
};
template <typename genFIType>
struct Abs_<genFIType, false>
struct compute_abs<genFIType, false>
{
GLM_FUNC_QUALIFIER static genFIType get(genFIType const & x)
GLM_FUNC_QUALIFIER static genFIType call(genFIType const & x)
{
GLM_STATIC_ASSERT(
!std::numeric_limits<genFIType>::is_signed && std::numeric_limits<genFIType>::is_integer,
@ -73,7 +73,7 @@ namespace detail
genFIType const & x
)
{
return detail::Abs_<genFIType, std::numeric_limits<genFIType>::is_signed>::get(x);
return detail::compute_abs<genFIType, std::numeric_limits<genFIType>::is_signed>::call(x);
}
VECTORIZE_VEC(abs)

View File

@ -38,7 +38,7 @@
#define GLM_VERSION_MAJOR 0
#define GLM_VERSION_MINOR 9
#define GLM_VERSION_PATCH 5
#define GLM_VERSION_REVISION 0
#define GLM_VERSION_REVISION 1
///////////////////////////////////////////////////////////////////////////////////////////////////
// Platform

View File

@ -18,10 +18,12 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<genType>::is_iec559, "'angle' only accept floating-point inputs");
genType const Angle(acos(clamp(dot(x, y), genType(0), genType(1))));
#ifdef GLM_FORCE_RADIANS
return acos(dot(x, y));
return Angle;
#else
return degrees(acos(dot(x, y)));
return degrees(Angle);
#endif
}
@ -34,10 +36,12 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'angle' only accept floating-point inputs");
T const Angle(acos(clamp(dot(x, y), T(0), T(1))));
#ifdef GLM_FORCE_RADIANS
return acos(dot(x, y));
return Angle;
#else
return degrees(acos(dot(x, y)));
return degrees(Angle);
#endif
}
@ -51,10 +55,12 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T const Dot = clamp(dot(x, y), T(0), T(1));
#ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y)));
T const Angle(acos(Dot));
#else
T const Angle(degrees(acos(dot(x, y))));
T const Angle(degrees(acos(Dot)));
#endif
detail::tvec2<T, P> const TransformedVector(glm::rotate(x, Angle));
if(all(epsilonEqual(y, TransformedVector, T(0.01))))
@ -73,10 +79,12 @@ namespace glm
{
GLM_STATIC_ASSERT(std::numeric_limits<T>::is_iec559, "'orientedAngle' only accept floating-point inputs");
T const Dot = clamp(dot(x, y), T(0), T(1));
#ifdef GLM_FORCE_RADIANS
T const Angle(acos(dot(x, y)));
T const Angle(acos(Dot));
#else
T const Angle(degrees(acos(dot(x, y))));
T const Angle(degrees(acos(Dot)));
#endif
if(dot(ref, cross(x, y)) < T(0))

View File

@ -36,7 +36,12 @@ GLM is a header only library, there is nothing to build, just include it.
More informations in GLM manual:
http://glm.g-truc.net/glm.pdf
================================================================================s
================================================================================
GLM 0.9.5.1: 2014-XX-XX
--------------------------------------------------------------------------------
- Fixed angle and orientedAngle that sometimes return NaN values (#145)
================================================================================
GLM 0.9.5.0: 2013-12-25
--------------------------------------------------------------------------------
- Added forward declarations (glm/fwd.hpp) for faster compilations

View File

@ -391,19 +391,19 @@ int test_round()
Error += G == 2.0f ? 0 : 1;
#if GLM_LANG >= GLM_LANG_CXX11
float A1 = std::round(0.0f);
float A1 = glm::round(0.0f);
Error += A1 == A ? 0 : 1;
float B1 = std::round(0.5f);
float B1 = glm::round(0.5f);
Error += B1 == B ? 0 : 1;
float C1 = std::round(1.0f);
float C1 = glm::round(1.0f);
Error += C1 == C ? 0 : 1;
float D1 = std::round(0.1f);
float D1 = glm::round(0.1f);
Error += D1 == D ? 0 : 1;
float E1 = std::round(0.9f);
float E1 = glm::round(0.9f);
Error += E1 == E ? 0 : 1;
float F1 = std::round(1.5f);
float F1 = glm::round(1.5f);
Error += F == F ? 0 : 1;
float G1 = std::round(1.9f);
float G1 = glm::round(1.9f);
Error += G1 == G ? 0 : 1;
#endif // GLM_LANG >= GLM_CXX0X
}

View File

@ -135,6 +135,8 @@ int test_ctr()
glm::vec4(8, 9, 10, 11),
glm::vec4(12, 13, 14, 15));
assert(sizeof(m0) == 4 * 4 * 4);
glm::mat4 m1{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15};
glm::mat4 m2{

View File

@ -357,18 +357,15 @@ int test_vec4_perf_SoA(std::size_t Size)
std::clock_t EndTime = std::clock();
std::printf("SoA: %d\n", EndTime - StartTime);
std::printf("SoA: %d\n", EndTime - StartTime);
return Error;
}
int main()
{
//__m128 DataA = swizzle<X, Y, Z, W>(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f));
//__m128 DataB = swizzle<W, Z, Y, X>(glm::vec4(1.0f, 2.0f, 3.0f, 4.0f));
int Error(0);
std::size_t const Size(1000000);
Error += test_vec4_perf_AoS(Size);