mirror of
https://github.com/g-truc/glm.git
synced 2024-11-10 04:31:47 +00:00
Added packHalf2x16 tests
This commit is contained in:
parent
bf76e0af09
commit
64f9e3564d
@ -8,11 +8,26 @@
|
||||
///////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <glm/glm.hpp>
|
||||
#include <glm/gtc/half_float.hpp>
|
||||
#include <vector>
|
||||
|
||||
int test_packHalf2x16()
|
||||
{
|
||||
int Error = 0;
|
||||
|
||||
std::vector<glm::hvec2> A;
|
||||
A.push_back(glm::hvec2(glm::half( 1.0f), glm::half( 2.0f)));
|
||||
A.push_back(glm::hvec2(glm::half(-1.0f), glm::half(-2.0f)));
|
||||
A.push_back(glm::hvec2(glm::half(-1.1f), glm::half( 1.1f)));
|
||||
|
||||
for(std::size_t i = 0; i < A.size(); ++i)
|
||||
{
|
||||
glm::vec2 B(A[i]);
|
||||
glm::uint C = glm::packHalf2x16(B);
|
||||
glm::vec2 D = glm::unpackHalf2x16(C);
|
||||
Error += B == D ? 0 : 1;
|
||||
}
|
||||
|
||||
return Error;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user