설명 없음

sphere.vert 625B

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