Platformer in OpenGL
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

48 lines
1.4 KiB

5 years ago
  1. #define GLM_ENABLE_EXPERIMENTAL
  2. #include <glm/gtc/noise.hpp>
  3. #include <glm/gtc/type_precision.hpp>
  4. #include <glm/gtx/raw_data.hpp>
  5. int test_simplex()
  6. {
  7. int Error = 0;
  8. glm::u8vec4 const PixelSimplex2D(glm::byte(glm::abs(glm::simplex(glm::vec2(0.f, 0.f))) * 255.f));
  9. glm::u8vec4 const PixelSimplex3D(glm::byte(glm::abs(glm::simplex(glm::vec3(0.f, 0.f, 0.f))) * 255.f));
  10. glm::u8vec4 const PixelSimplex4D(glm::byte(glm::abs(glm::simplex(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
  11. return Error;
  12. }
  13. int test_perlin()
  14. {
  15. int Error = 0;
  16. glm::u8vec4 const PixelPerlin2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f))) * 255.f));
  17. glm::u8vec4 const PixelPerlin3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f))) * 255.f));
  18. glm::u8vec4 const PixelPerlin4D(glm::byte(glm::abs(glm::perlin(glm::vec4(0.f, 0.f, 0.f, 0.f))) * 255.f));
  19. return Error;
  20. }
  21. int test_perlin_pedioric()
  22. {
  23. int Error = 0;
  24. glm::u8vec4 const PixelPeriodic2D(glm::byte(glm::abs(glm::perlin(glm::vec2(0.f, 0.f), glm::vec2(2.0f))) * 255.f));
  25. glm::u8vec4 const PixelPeriodic3D(glm::byte(glm::abs(glm::perlin(glm::vec3(0.f, 0.f, 0.f), glm::vec3(2.0f))) * 255.f));
  26. 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));
  27. return Error;
  28. }
  29. int main()
  30. {
  31. int Error = 0;
  32. Error += test_simplex();
  33. Error += test_perlin();
  34. Error += test_perlin_pedioric();
  35. return Error;
  36. }