Lights
This commit is contained in:
@@ -0,0 +1,61 @@
|
||||
#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 frame_buffer_id;
|
||||
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 = 5) readonly buffer shadow_map_sets
|
||||
{
|
||||
ShadowMapSet shadows[10];
|
||||
};
|
||||
|
||||
|
||||
layout (location=0) in VS_OUT
|
||||
{
|
||||
vec2 vsUV;
|
||||
flat uint vsMaterialID;
|
||||
}vs_in[];
|
||||
|
||||
layout (location=0) out GEOM_OUT
|
||||
{
|
||||
vec2 vsUV;
|
||||
flat uint vsMaterialID;
|
||||
}geom_out;
|
||||
|
||||
void main()
|
||||
{
|
||||
mat4 view = shadows[shadow_idxs].light_space_view[gl_InvocationID];
|
||||
mat4 proj = shadows[shadow_idxs].light_space_proj[gl_InvocationID];
|
||||
|
||||
for (int i = 0; i < 3; ++i)
|
||||
{
|
||||
gl_Layer = gl_InvocationID;
|
||||
vec4 clip_space_pos = proj * view * gl_in[i].gl_Position;
|
||||
|
||||
gl_Position = clip_space_pos;
|
||||
|
||||
geom_out.vsMaterialID = vs_in[gl_InvocationID].vsMaterialID;
|
||||
geom_out.vsUV = vs_in[gl_InvocationID].vsUV;
|
||||
|
||||
EmitVertex();
|
||||
}
|
||||
EndPrimitive();
|
||||
}
|
||||
Reference in New Issue
Block a user