Nenhuma descrição

mesh.vert 840B

1234567891011121314151617181920212223242526272829303132333435363738
  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 (set = 0, binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 model;
  11. } ubo;
  12. layout (location = 0) out vec3 outNormal;
  13. layout (location = 1) out vec3 outColor;
  14. layout (location = 2) out vec3 outViewVec;
  15. layout (location = 3) out vec3 outLightVec;
  16. out gl_PerVertex
  17. {
  18. vec4 gl_Position;
  19. };
  20. void main()
  21. {
  22. outNormal = inNormal;
  23. outColor = inColor;
  24. gl_Position = ubo.projection * ubo.model * inPos;
  25. vec4 pos = ubo.model * vec4(inPos.xyz, 1.0);
  26. outNormal = mat3(ubo.model) * inNormal;
  27. vec3 lightPos = vec3(1.0f, -1.0f, 1.0f);
  28. outLightVec = lightPos.xyz - pos.xyz;
  29. outViewVec = -pos.xyz;
  30. }