point_light.frag 723 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #version 450
  2. layout(location = 0) in vec2 frag_offset;
  3. layout(location = 0) out vec4 out_color;
  4. struct PointLight
  5. {
  6. vec4 position; // w is radius
  7. vec4 color; // w is intensity
  8. };
  9. layout (set = 0, binding = 0) uniform GlobalUBO
  10. {
  11. // MATRICES
  12. mat4 view;
  13. mat4 viewInverse;
  14. mat4 viewProjection;
  15. // LIGHTING
  16. vec4 globalLightDirection;
  17. vec4 ambientLighting;
  18. // POINT LIGHTS
  19. PointLight pointLights[8];
  20. int numLights;
  21. } ubo;
  22. layout(push_constant) uniform Push
  23. {
  24. vec4 position; // w is radius
  25. vec4 color; // w is intensity
  26. } push;
  27. void main()
  28. {
  29. float dist = sqrt(dot(frag_offset, frag_offset));
  30. if(dist >= 1.f)
  31. discard;
  32. out_color = vec4(push.color.xyz, 1.f);
  33. }