Nav apraksta

12345678910111213141516171819202122232425262728293031323334353637
  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 pos;
  5. layout (location = 2) in vec3 inColor;
  6. layout (location = 3) in vec3 inNormal;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 model;
  11. float gradientPos;
  12. } ubo;
  13. layout (location = 0) out vec3 outNormal;
  14. layout (location = 1) out vec3 outColor;
  15. layout (location = 2) out vec3 outEyePos;
  16. layout (location = 3) out vec3 outLightVec;
  17. layout (location = 4) out vec2 outUV;
  18. out gl_PerVertex
  19. {
  20. vec4 gl_Position;
  21. };
  22. void main()
  23. {
  24. outNormal = inNormal;
  25. outColor = inColor;
  26. outUV = vec2(ubo.gradientPos, 0.0);
  27. gl_Position = ubo.projection * ubo.model * pos;
  28. outEyePos = vec3(ubo.model * pos);
  29. vec4 lightPos = vec4(0.0, 0.0, -5.0, 1.0);// * ubo.model;
  30. outLightVec = normalize(lightPos.xyz - pos.xyz);
  31. }