No Description

cloth.vert 721B

1234567891011121314151617181920212223242526272829303132333435
  1. #version 450
  2. layout (location = 0) in vec3 inPos;
  3. layout (location = 1) in vec2 inUV;
  4. layout (location = 2) in vec3 inNormal;
  5. layout (location = 0) out vec2 outUV;
  6. layout (location = 1) out vec3 outNormal;
  7. layout (location = 2) out vec3 outViewVec;
  8. layout (location = 3) out vec3 outLightVec;
  9. layout (binding = 0) uniform UBO
  10. {
  11. mat4 projection;
  12. mat4 modelview;
  13. vec4 lightPos;
  14. } ubo;
  15. out gl_PerVertex
  16. {
  17. vec4 gl_Position;
  18. };
  19. void main ()
  20. {
  21. outUV = inUV;
  22. outNormal = inNormal.xyz;
  23. vec4 eyePos = ubo.modelview * vec4(inPos.x, inPos.y, inPos.z, 1.0);
  24. gl_Position = ubo.projection * eyePos;
  25. vec4 pos = vec4(inPos, 1.0);
  26. vec3 lPos = ubo.lightPos.xyz;
  27. outLightVec = lPos - pos.xyz;
  28. outViewVec = -pos.xyz;
  29. }