Clean up GLM_FORCE_NO_CTOR_INIT and fixed tests

This commit is contained in:
Christophe Riccio
2017-07-25 22:15:55 +02:00
parent f2cb4a3fdf
commit c933f6e591
9 changed files with 37 additions and 32 deletions

View File

@@ -1,4 +1,3 @@
#define GLM_FORCE_NO_CTOR_INIT
#include <glm/glm.hpp>
#include <glm/gtc/vec1.hpp>
#include <glm/gtc/quaternion.hpp>
@@ -76,14 +75,6 @@ int test_vec4_ctor()
{
int Error = 0;
# ifndef GLM_FORCE_NO_CTOR_INIT
{
glm::vec4 A;
glm::vec4 B(0);
Error += glm::all(glm::equal(A, B)) ? 0 : 1;
}
# endif//GLM_FORCE_NO_CTOR_INIT
# if GLM_HAS_DEFAULTED_FUNCTIONS
{
union pack
@@ -316,7 +307,7 @@ int test_quat_ctor()
{
int Error = 0;
# if GLM_HAS_DEFAULTED_FUNCTIONS && defined(GLM_FORCE_NO_CTOR_INIT)
# if GLM_HAS_DEFAULTED_FUNCTIONS
{
union pack
{

View File

@@ -135,7 +135,7 @@ int test_quat_slerp()
float const Epsilon = 0.0001f;//glm::epsilon<float>();
float sqrt2 = sqrt(2.0f)/2.0f;
glm::quat id;
glm::quat id(static_cast<float>(1), static_cast<float>(0), static_cast<float>(0), static_cast<float>(0));
glm::quat Y90rot(sqrt2, 0.0f, sqrt2, 0.0f);
glm::quat Y180rot(0.0f, 0.0f, 1.0f, 0.0f);
@@ -211,16 +211,12 @@ int test_quat_mul()
glm::quat temp5 = glm::normalize(temp1 * temp2);
glm::vec3 temp6 = temp5 * glm::vec3(0.0, 1.0, 0.0) * glm::inverse(temp5);
# ifndef GLM_FORCE_NO_CTOR_INIT
{
glm::quat temp7;
glm::quat temp7(1.0f, glm::vec3(0.0, 1.0, 0.0));
temp7 *= temp5;
temp7 *= glm::inverse(temp5);
temp7 *= temp5;
temp7 *= glm::inverse(temp5);
Error += temp7 != glm::quat();
}
# endif
Error += temp7 != glm::quat(1.0f, glm::vec3(0.0, 1.0, 0.0));
return Error;
}

View File

@@ -22,10 +22,10 @@ float myfrand() // returns values from -1 to 1 inclusive
int test_dquat_type()
{
glm::dvec3 vA;
glm::dquat dqA,dqB;
glm::ddualquat C(dqA,dqB);
glm::dquat dqA, dqB;
glm::ddualquat C(dqA, dqB);
glm::ddualquat B(dqA);
glm::ddualquat D(dqA,vA);
glm::ddualquat D(dqA, vA);
return 0;
}
@@ -67,7 +67,7 @@ int test_inverse()
float const Epsilon = 0.0001f;
glm::dualquat dqid;
glm::dualquat dqid = glm::dual_quat_identity<float, glm::defaultp>();
glm::mat4x4 mid(1.0f);
for (int j = 0; j < 100; ++j)