Added RGBM encoding in GTC_packing #420

This commit is contained in:
Christophe Riccio
2016-10-16 16:40:49 +02:00
parent 9d4f0ba758
commit e4c559b29b
4 changed files with 61 additions and 2 deletions

View File

@@ -239,7 +239,7 @@ int test_F3x9_E1x5()
Tests.push_back(glm::vec3(0.5f));
Tests.push_back(glm::vec3(0.9f));
for (std::size_t i = 0; i < Tests.size(); ++i)
for(std::size_t i = 0; i < Tests.size(); ++i)
{
glm::uint32 p0 = glm::packF3x9_E1x5(Tests[i]);
glm::vec3 v0 = glm::unpackF3x9_E1x5(p0);
@@ -251,6 +251,22 @@ int test_F3x9_E1x5()
return Error;
}
int test_RGBM()
{
int Error = 0;
for(std::size_t i = 0; i < 1024; ++i)
{
glm::vec3 const Color(i);
glm::vec4 const RGBM = glm::packRGBM(Color);
glm::vec3 const Result= glm::unpackRGBM(RGBM);
Error += glm::all(glm::epsilonEqual(Color, Result, 0.01f)) ? 0 : 1;
}
return Error;
}
int test_packUnorm1x16()
{
int Error = 0;
@@ -671,6 +687,7 @@ int main()
Error += test_F2x11_1x10();
Error += test_F3x9_E1x5();
Error += test_RGBM();
Error += test_Snorm3x10_1x2();
Error += test_Unorm3x10_1x2();
Error += test_I3x10_1x2();