No Description

skysphere.vert 582B

12345678910111213141516171819202122232425262728
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. // Vertex attributes
  5. layout (location = 0) in vec4 inPos;
  6. layout (location = 2) in vec2 inUV;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 modelview;
  11. } ubo;
  12. layout (location = 0) out vec2 outUV;
  13. out gl_PerVertex
  14. {
  15. vec4 gl_Position;
  16. };
  17. void main()
  18. {
  19. outUV = vec2(inUV.s, 1.0-inUV.t);
  20. // Skysphere always at center, only use rotation part of modelview matrix
  21. gl_Position = ubo.projection * mat4(mat3(ubo.modelview)) * vec4(inPos.xyz, 1.0);
  22. }