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.
 
 
 

40 regels
873 B

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright © 2004—2017 Sam Hocevar <sam@hocevar.net>
  5. //
  6. // Lol Engine 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. #include <lol/engine-internal.h>
  13. /*
  14. * Noise rendering functions
  15. */
  16. namespace lol
  17. {
  18. bool image::RenderRandom(ivec2 size)
  19. {
  20. resize(size);
  21. vec4 *pixels = lock<PixelFormat::RGBA_F32>();
  22. for (int n = 0; n < size.x * size.y; ++n)
  23. pixels[n] = vec4(lol::rand(1.f),
  24. lol::rand(1.f),
  25. lol::rand(1.f),
  26. 1.f);
  27. unlock(pixels);
  28. return true;
  29. }
  30. } /* namespace lol */