Fixed simplex noise build with double #734

This commit is contained in:
Christophe Riccio
2018-09-26 12:51:31 +02:00
parent 9b0434255f
commit 21d0092f6a
3 changed files with 46 additions and 47 deletions

View File

@@ -3,7 +3,7 @@
#include <glm/gtc/type_precision.hpp>
#include <glm/gtx/raw_data.hpp>
int test_simplex()
static int test_simplex_float()
{
int Error = 0;
@@ -14,7 +14,18 @@ int test_simplex()
return Error;
}
int test_perlin()
static int test_simplex_double()
{
int Error = 0;
glm::u8vec4 const PixelSimplex2D(glm::byte(glm::abs(glm::simplex(glm::dvec2(0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelSimplex3D(glm::byte(glm::abs(glm::simplex(glm::dvec3(0.f, 0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelSimplex4D(glm::byte(glm::abs(glm::simplex(glm::dvec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
return Error;
}
static int test_perlin_float()
{
int Error = 0;
@@ -25,7 +36,18 @@ int test_perlin()
return Error;
}
int test_perlin_pedioric()
static int test_perlin_double()
{
int Error = 0;
glm::u8vec4 const PixelPerlin2D(glm::byte(glm::abs(glm::perlin(glm::dvec2(0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelPerlin3D(glm::byte(glm::abs(glm::perlin(glm::dvec3(0.f, 0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelPerlin4D(glm::byte(glm::abs(glm::perlin(glm::dvec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
return Error;
}
static int test_perlin_pedioric_float()
{
int Error = 0;
@@ -36,13 +58,29 @@ int test_perlin_pedioric()
return Error;
}
static int test_perlin_pedioric_double()
{
int Error = 0;
glm::u8vec4 const PixelPeriodic2D(glm::byte(glm::abs(glm::perlin(glm::dvec2(0.f, 0.f), glm::dvec2(2.0f))) * 255.f));
glm::u8vec4 const PixelPeriodic3D(glm::byte(glm::abs(glm::perlin(glm::dvec3(0.f, 0.f, 0.f), glm::dvec3(2.0f))) * 255.f));
glm::u8vec4 const PixelPeriodic4D(glm::byte(glm::abs(glm::perlin(glm::dvec4(0.f, 0.f, 0.f, 0.f), glm::dvec4(2.0f))) * 255.f));
return Error;
}
int main()
{
int Error = 0;
Error += test_simplex();
Error += test_perlin();
Error += test_perlin_pedioric();
Error += test_simplex_float();
Error += test_simplex_double();
Error += test_perlin_float();
Error += test_perlin_double();
Error += test_perlin_pedioric_float();
Error += test_perlin_pedioric_double();
return Error;
}