copy.frag 959 B

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. /*
  2. * Copyright (C) 2023, Inria
  3. * GRAPHDECO research group, https://team.inria.fr/graphdeco
  4. * All rights reserved.
  5. *
  6. * This software is free for non-commercial, research and evaluation use
  7. * under the terms of the LICENSE.md file.
  8. *
  9. * For inquiries contact sibr@inria.fr and/or George.Drettakis@inria.fr
  10. */
  11. #version 450
  12. layout(location = 0) out vec4 out_color;
  13. layout(std430, binding = 0) buffer colorLayout
  14. {
  15. float data[];
  16. } source;
  17. uniform bool flip = false;
  18. uniform int width = 1000;
  19. uniform int height = 800;
  20. in vec4 texcoord;
  21. void main(void)
  22. {
  23. int x = int(texcoord.x * width);
  24. int y;
  25. if(flip)
  26. y = height - 1 - int(texcoord.y * height);
  27. else
  28. y = int(texcoord.y * height);
  29. float r = source.data[0 * width * height + (y * width + x)];
  30. float g = source.data[1 * width * height + (y * width + x)];
  31. float b = source.data[2 * width * height + (y * width + x)];
  32. vec4 color = vec4(r, g, b, 1);
  33. out_color = color;
  34. }