normalRenderer.vp 763 B

1234567891011121314151617181920212223242526272829303132
  1. /*
  2. * Copyright (C) 2020, 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 420
  12. uniform mat4 MVP;
  13. uniform mat4 M;
  14. uniform mat4 V;
  15. uniform bool imSpaceNormals;
  16. layout(location = 0) in vec3 in_vertex;
  17. layout(location = 3) in vec3 in_normal;
  18. out vec3 GtoF_normal;
  19. void main(void) {
  20. gl_Position = MVP * vec4(in_vertex,1.0);
  21. if(imSpaceNormals)
  22. GtoF_normal = normalize((inverse(transpose(V*M)) * vec4(in_normal,0.0)).xyz);
  23. else
  24. GtoF_normal = normalize((inverse(transpose(M)) * vec4(in_normal,0.0)).xyz);
  25. }