glm/test/gtc/gtc_noise.cpp

49 lines
1.4 KiB
C++
Raw Permalink Normal View History

2016-11-12 13:19:22 +00:00
#define GLM_ENABLE_EXPERIMENTAL
#include <glm/gtc/noise.hpp>
2017-08-21 08:36:27 +00:00
#include <glm/gtc/type_precision.hpp>
2017-08-08 13:17:25 +00:00
#include <glm/gtx/raw_data.hpp>
2016-11-20 22:02:20 +00:00
2011-09-27 09:22:29 +00:00
int test_simplex()
{
2017-08-08 13:17:25 +00:00
int Error = 0;
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
glm::u8vec4 const PixelSimplex2D(glm::byte(glm::abs(glm::simplex(glm::vec2(0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelSimplex3D(glm::byte(glm::abs(glm::simplex(glm::vec3(0.f, 0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelSimplex4D(glm::byte(glm::abs(glm::simplex(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
return Error;
2011-09-27 09:22:29 +00:00
}
int test_perlin()
{
2017-08-08 13:17:25 +00:00
int Error = 0;
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
glm::u8vec4 const PixelPerlin2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelPerlin3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f))) * 255.f));
glm::u8vec4 const PixelPerlin4D(glm::byte(glm::abs(glm::perlin(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
return Error;
2011-09-27 09:22:29 +00:00
}
int test_perlin_pedioric()
{
2017-08-08 13:17:25 +00:00
int Error = 0;
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
glm::u8vec4 const PixelPeriodic2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f), glm::vec2(2.0f))) * 255.f));
glm::u8vec4 const PixelPeriodic3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f), glm::vec3(2.0f))) * 255.f));
glm::u8vec4 const PixelPeriodic4D(glm::byte(glm::abs(glm::perlin(glm::vec4(0.f, 0.f, 0.f, 0.f), glm::vec4(2.0f))) * 255.f));
2011-09-27 09:22:29 +00:00
2017-08-08 13:17:25 +00:00
return Error;
2011-09-27 09:22:29 +00:00
}
int main()
{
int Error = 0;
2017-08-08 13:17:25 +00:00
Error += test_simplex();
Error += test_perlin();
Error += test_perlin_pedioric();
2011-09-27 09:22:29 +00:00
return Error;
}