No Description

shadow.geom 668B

123456789101112131415161718192021222324252627282930
  1. #version 420
  2. #extension GL_ARB_separate_shader_objects : enable
  3. #extension GL_ARB_shading_language_420pack : enable
  4. #define LIGHT_COUNT 3
  5. layout (triangles, invocations = LIGHT_COUNT) in;
  6. layout (triangle_strip, max_vertices = 3) out;
  7. layout (binding = 0) uniform UBO
  8. {
  9. mat4 mvp[LIGHT_COUNT];
  10. vec4 instancePos[3];
  11. } ubo;
  12. layout (location = 0) in int inInstanceIndex[];
  13. void main()
  14. {
  15. vec4 instancedPos = ubo.instancePos[inInstanceIndex[0]];
  16. for (int i = 0; i < gl_in.length(); i++)
  17. {
  18. gl_Layer = gl_InvocationID;
  19. vec4 tmpPos = gl_in[i].gl_Position + instancedPos;
  20. gl_Position = ubo.mvp[gl_InvocationID] * tmpPos;
  21. EmitVertex();
  22. }
  23. EndPrimitive();
  24. }