Keine Beschreibung

texture.vert 854B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #version 450
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. layout (location = 0) in vec3 inPos;
  5. layout (location = 1) in vec3 inNormal;
  6. layout (location = 2) in vec2 inUV;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 projection;
  10. mat4 model;
  11. mat4 view;
  12. vec4 lightPos;
  13. vec4 viewPos;
  14. vec2 uvOffset;
  15. } ubo;
  16. layout (location = 0) out vec2 outUV;
  17. layout (location = 1) out vec3 outNormal;
  18. layout (location = 2) out vec3 outViewVec;
  19. layout (location = 3) out vec3 outLightVec;
  20. out gl_PerVertex
  21. {
  22. vec4 gl_Position;
  23. };
  24. void main()
  25. {
  26. outUV = inUV + ubo.uvOffset;
  27. vec4 pos = vec4(inPos, 1.0);
  28. gl_Position = ubo.projection * ubo.view * ubo.model * vec4(pos);
  29. outNormal = mat3(ubo.model) * inNormal;
  30. outLightVec = ubo.lightPos.xyz - pos.xyz;
  31. outViewVec = ubo.viewPos.xyz - pos.xyz;
  32. }