選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

38 行
788 B

  1. //
  2. // Lol Engine
  3. //
  4. // Copyright: (c) 2004-2014 Sam Hocevar <sam@hocevar.net>
  5. // This program is free software; you can redistribute it and/or
  6. // modify it under the terms of the Do What The Fuck You Want To
  7. // Public License, Version 2, as published by Sam Hocevar. See
  8. // http://www.wtfpl.net/ for more details.
  9. //
  10. #include <lol/engine-internal.h>
  11. /*
  12. * Noise rendering functions
  13. */
  14. namespace lol
  15. {
  16. bool Image::RenderRandom(ivec2 size)
  17. {
  18. SetSize(size);
  19. vec4 *pixels = Lock<PixelFormat::RGBA_F32>();
  20. for (int n = 0; n < size.x * size.y; ++n)
  21. pixels[n] = vec4(lol::rand(1.f),
  22. lol::rand(1.f),
  23. lol::rand(1.f),
  24. 1.f);
  25. Unlock(pixels);
  26. return true;
  27. }
  28. } /* namespace lol */