45 lines
853 B
GLSL
45 lines
853 B
GLSL
#version 450
|
|||
|
|
|
||
|
|
layout(triangles, invocations = 6) in;
|
||
|
|
layout(triangle_strip, max_vertices = 3) out;
|
||
|
|
|
||
|
|
struct ShadowMapSet
|
||
|
|
{
|
||
|
|
uint entity_id;
|
||
|
|
uint cascade_count;
|
||
|
|
uint shadow_texture_id;
|
||
|
|
uint padding0;
|
||
|
|
float near_plane[8];
|
||
|
|
float far_plane[8];
|
||
|
|
mat4 light_space_proj[6];
|
||
|
|
mat4 light_space_view[6];
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
|
||
|
|
//Push constants updated for each light
|
||
|
|
layout(binding = 0) uniform shadow_per_frame
|
||
|
|
{
|
||
|
|
vec3 camera_pos;
|
||
|
|
uint shadow_idxs;
|
||
|
|
};
|
||
|
|
|
||
|
|
|
||
|
|
layout(std430, binding = 0) readonly buffer ShadowMapSets
|
||
|
|
{
|
||
|
|
ShadowMapSet shadows[10];
|
||
|
|
};
|
||
|
|
|
||
|
|
void main()
|
||
|
|
{
|
||
|
|
for (int i = 0; i < 3; ++i)
|
||
|
|
{
|
||
|
|
|
||
|
|
gl_Position = shadows[shadow_idxs].light_space_proj[gl_InvocationID] *
|
||
|
|
shadows[shadow_idxs].light_space_view[gl_InvocationID] *
|
||
|
|
gl_in[i].gl_Position;
|
||
|
|
gl_Layer = gl_InvocationID;
|
||
|
|
EmitVertex();
|
||
|
|
}
|
||
|
|
EndPrimitive();
|
||
|
|
}
|