No Description

gears.vert 863B

12345678910111213141516171819202122232425262728293031323334
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. layout (location = 0) in vec4 inPos;
  5. layout (location = 1) in vec3 inNormal;
  6. layout (location = 2) in vec3 inColor;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 model;
  11. mat4 normal;
  12. mat4 view;
  13. vec3 lightpos;
  14. } ubo;
  15. layout (location = 0) out vec3 outNormal;
  16. layout (location = 1) out vec3 outColor;
  17. layout (location = 2) out vec3 outEyePos;
  18. layout (location = 3) out vec3 outLightVec;
  19. void main()
  20. {
  21. outNormal = normalize(mat3(ubo.normal) * inNormal);
  22. outColor = inColor;
  23. mat4 modelView = ubo.view * ubo.model;
  24. vec4 pos = modelView * inPos;
  25. outEyePos = vec3(modelView * pos);
  26. vec4 lightPos = vec4(ubo.lightpos, 1.0) * modelView;
  27. outLightVec = normalize(lightPos.xyz - outEyePos);
  28. gl_Position = ubo.projection * pos;
  29. }