Fixed and tested all packing functions

This commit is contained in:
Christophe Riccio
2011-09-14 10:21:04 +01:00
parent 321f89ff7a
commit 406bb666ea
2 changed files with 16 additions and 15 deletions

View File

@@ -27,7 +27,7 @@ int test_packUnorm2x16()
glm::vec2 B(A[i]);
glm::uint32 C = glm::packUnorm2x16(B);
glm::vec2 D = glm::unpackUnorm2x16(C);
Error += glm::all(glm::equalEpsilon(B, D, 0.0001f)) ? 0 : 1;
Error += glm::all(glm::equalEpsilon(B, D, 1.0f / 65535.f)) ? 0 : 1;
assert(!Error);
}
@@ -48,8 +48,8 @@ int test_packSnorm2x16()
glm::vec2 B(A[i]);
glm::uint32 C = glm::packSnorm2x16(B);
glm::vec2 D = glm::unpackSnorm2x16(C);
Error += glm::all(glm::equalEpsilon(B, D, 0.0001f)) ? 0 : 1;
//assert(!Error);
Error += glm::all(glm::equalEpsilon(B, D, 1.0f / 32767.0f * 2.0f)) ? 0 : 1;
assert(!Error);
}
return Error;
@@ -68,7 +68,7 @@ int test_packUnorm4x8()
glm::vec4 B(A[i]);
glm::uint32 C = glm::packUnorm4x8(B);
glm::vec4 D = glm::unpackUnorm4x8(C);
Error += glm::all(glm::equalEpsilon(B, D, 0.0001f)) ? 0 : 1;
Error += glm::all(glm::equalEpsilon(B, D, 1.0f / 255.f)) ? 0 : 1;
assert(!Error);
}
@@ -88,8 +88,8 @@ int test_packSnorm4x8()
glm::vec4 B(A[i]);
glm::uint32 C = glm::packSnorm4x8(B);
glm::vec4 D = glm::unpackSnorm4x8(C);
Error += glm::all(glm::equalEpsilon(B, D, 0.0001f)) ? 0 : 1;
//assert(!Error);
Error += glm::all(glm::equalEpsilon(B, D, 1.0f / 127.f)) ? 0 : 1;
assert(!Error);
}
return Error;