No Description

toon.vert 670B

12345678910111213141516171819202122232425262728293031
  1. #version 450
  2. layout (location = 0) in vec3 inPos;
  3. layout (location = 1) in vec3 inColor;
  4. layout (location = 2) in vec3 inNormal;
  5. layout (binding = 0) uniform UBO
  6. {
  7. mat4 projection;
  8. mat4 model;
  9. vec4 lightPos;
  10. } ubo;
  11. layout (location = 0) out vec3 outNormal;
  12. layout (location = 1) out vec3 outColor;
  13. layout (location = 2) out vec3 outLightVec;
  14. out gl_PerVertex
  15. {
  16. vec4 gl_Position;
  17. };
  18. void main()
  19. {
  20. outColor = vec3(1.0, 0.0, 0.0);
  21. gl_Position = ubo.projection * ubo.model * vec4(inPos.xyz, 1.0);
  22. outNormal = mat3(ubo.model) * inNormal;
  23. vec4 pos = ubo.model * vec4(inPos, 1.0);
  24. vec3 lPos = mat3(ubo.model) * ubo.lightPos.xyz;
  25. outLightVec = lPos - pos.xyz;
  26. }