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.

32 lines
821 B

  1. /*******************************************************************************************
  2. *
  3. * rPBR [shader] - Background skybox vertex shader
  4. *
  5. * Copyright (c) 2017 Victor Fisac
  6. *
  7. **********************************************************************************************/
  8. #version 330
  9. // Input vertex attributes
  10. in vec3 vertexPosition;
  11. // Input uniform values
  12. uniform mat4 projection;
  13. uniform mat4 view;
  14. // Output vertex attributes (to fragment shader)
  15. out vec3 fragPos;
  16. void main()
  17. {
  18. // Calculate fragment position based on model transformations
  19. fragPos = vertexPosition;
  20. // Remove translation from the view matrix
  21. mat4 rotView = mat4(mat3(view));
  22. vec4 clipPos = projection*rotView*vec4(vertexPosition, 1.0);
  23. // Calculate final vertex position
  24. gl_Position = clipPos.xyww;
  25. }