Merge remote-tracking branch 'upstream/master'

This commit is contained in:
jan p springer
2016-03-14 12:35:35 +00:00
85 changed files with 1263 additions and 1815 deletions

View File

@@ -45,6 +45,7 @@ glmCreateTestGTC(gtx_simd_mat4)
glmCreateTestGTC(gtx_spline)
glmCreateTestGTC(gtx_string_cast)
glmCreateTestGTC(gtx_type_aligned)
glmCreateTestGTC(gtx_type_trait)
glmCreateTestGTC(gtx_vector_angle)
glmCreateTestGTC(gtx_vector_query)
glmCreateTestGTC(gtx_wrap)

View File

@@ -209,10 +209,6 @@ int main()
{
int Error(0);
#ifdef GLM_META_PROG_HELPERS
assert(glm::dualquat::components == glm::dualquat().length());
#endif
Error += test_dual_quat_ctr();
Error += test_dquat_type();
Error += test_scalars();

View File

@@ -30,10 +30,55 @@
///////////////////////////////////////////////////////////////////////////////////
#include <glm/gtx/log_base.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/epsilon.hpp>
#include <glm/exponential.hpp>
namespace test_log
{
int run()
{
int Error = 0;
{
float A = glm::log(10.f, 2.0f);
float B = glm::log2(10.f);
Error += glm::epsilonEqual(A, B, 0.00001f) ? 0 : 1;
}
{
glm::vec1 A = glm::log(glm::vec1(10.f), glm::vec1(2.0f));
glm::vec1 B = glm::log2(glm::vec1(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec1(0.00001f))) ? 0 : 1;
}
{
glm::vec2 A = glm::log(glm::vec2(10.f), glm::vec2(2.0f));
glm::vec2 B = glm::log2(glm::vec2(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec2(0.00001f))) ? 0 : 1;
}
{
glm::vec3 A = glm::log(glm::vec3(10.f), glm::vec3(2.0f));
glm::vec3 B = glm::log2(glm::vec3(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec3(0.00001f))) ? 0 : 1;
}
{
glm::vec4 A = glm::log(glm::vec4(10.f), glm::vec4(2.0f));
glm::vec4 B = glm::log2(glm::vec4(10.f));
Error += glm::all(glm::epsilonEqual(A, B, glm::vec4(0.00001f))) ? 0 : 1;
}
return Error;
}
}//namespace test_log
int main()
{
int Error(0);
Error += test_log::run();
return Error;
}

View File

@@ -29,7 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -253,28 +252,10 @@ int test_compute_gtx()
return 0;
}
int test_static_const() {
int Error(0);
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(1))) == glm::mat4_cast(glm::simdMat4::IDENTITY) ? 0 : 1;
Error += glm::mat4_cast(glm::simdMat4(static_cast<float>(0))) == glm::mat4_cast(glm::simdMat4::ZERO) ? 0 : 1;
return Error;
}
int main()
{
int Error = 0;
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdMat4::rows == glm::simdMat4::row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::col_type::components);
assert(glm::simdMat4::components == glm::simdMat4::pure_type::components);
assert(glm::simdMat4::rows == glm::simdMat4::pure_row_type::components);
assert(glm::simdMat4::cols == glm::simdMat4::pure_col_type::components);
#endif
std::vector<glm::mat4> Data(64 * 64 * 1);
for(std::size_t i = 0; i < Data.size(); ++i)
Data[i] = glm::mat4(
@@ -323,7 +304,6 @@ int main()
Error += test_compute_glm();
Error += test_compute_gtx();
Error += test_static_const();
float Det = glm::determinant(glm::simdMat4(1.0));
Error += Det == 1.0f ? 0 : 1;

View File

@@ -29,8 +29,6 @@
/// @author Christophe Riccio
///////////////////////////////////////////////////////////////////////////////////
#define GLM_STATIC_CONST_MEMBERS
#include <glm/glm.hpp>
#include <glm/gtx/simd_vec4.hpp>
#include <cstdio>
@@ -39,11 +37,6 @@
int main()
{
#ifdef GLM_META_PROG_HELPERS
assert(glm::simdVec4::components == glm::simdVec4::pure_type::components);
#endif
glm::simdVec4 A1(0.0f, 0.1f, 0.2f, 0.3f);
glm::simdVec4 B1(0.4f, 0.5f, 0.6f, 0.7f);
glm::simdVec4 C1 = A1 + B1;

View File

@@ -0,0 +1,79 @@
#include <glm/vec4.hpp>
#include <glm/gtx/type_trait.hpp>
template <typename genType>
struct type_gni
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
/*
template <template <class, glm::precision> class vecType, typename T, glm::precision P>
struct type_gni<vecType, T, P>
{
static bool const is_vec = true;
static bool const is_mat = false;
static bool const is_quat = false;
};
*/
namespace detail
{
template <template <typename, glm::precision> class vec_type>
struct compute_vec_type
{
static bool const is_vec = false;
static GLM_RELAXED_CONSTEXPR glm::length_t components = 0;
};
template <>
struct compute_vec_type<glm::tvec1>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 1;
};
template <>
struct compute_vec_type<glm::tvec2>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 2;
};
template <>
struct compute_vec_type<glm::tvec3>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 3;
};
template <>
struct compute_vec_type<glm::tvec4>
{
static bool const is_vec = false;
//static GLM_RELAXED_CONSTEXPR glm::length_t components = 4;
};
}//namespace detail
/*
template <class gen_type>
struct vec_type
{
static bool const is_vec = detail::compute_vec_type<typename gen_type::vec_type>::is_vec;
//static GLM_RELAXED_CONSTEXPR glm::length_t const components = detail::compute_vec_type<typename gen_type::vec_type>::components;
};
*/
int main()
{
int Error = 0;
//typedef vec_type;
//bool const is_vec = detail::compute_vec_type<>::is_vec;
//Error += vec_type<glm::vec4>::is_vec ? 0 : 1;
//Error += vec_type<glm::vec4>::components == 4 ? 0 : 1;
return Error;
}