Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

38 Zeilen
949 B

  1. //
  2. // bluenoise — create a N×N blue noise kernel
  3. //
  4. // Copyright © 2016—2020 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // This program is free software. It comes without any warranty, to
  7. // the extent permitted by applicable law. You can redistribute it
  8. // and/or modify it under the terms of the Do What the Fuck You Want
  9. // to Public License, Version 2, as published by the WTFPL Task Force.
  10. // See http://www.wtfpl.net/ for more details.
  11. //
  12. #if HAVE_CONFIG_H
  13. # include "config.h"
  14. #endif
  15. #include <lol/engine.h>
  16. using namespace lol;
  17. int main(int, char **)
  18. {
  19. ivec2 const size(64);
  20. auto const &kernel = image::kernel::blue_noise(size, ivec2(8));
  21. image im(size.xy);
  22. array2d<vec4> &data = im.lock2d<PixelFormat::RGBA_F32>();
  23. for (int j = 0; j < size.y; ++j)
  24. for (int i = 0; i < size.x; ++i)
  25. data[i][j] = vec4(vec3(kernel[i][j]), 1.0f);
  26. im.unlock2d(data);
  27. im.save("bluenoise.png");
  28. return 0;
  29. }