diff --git a/shaders/empty.frag b/shaders/empty.frag new file mode 100644 index 0000000..0f8d755 --- /dev/null +++ b/shaders/empty.frag @@ -0,0 +1,6 @@ +#version 330 core + +void main() +{ + +} \ No newline at end of file diff --git a/shaders/sun_shadow.geom b/shaders/sun_shadow.geom new file mode 100644 index 0000000..4912b94 --- /dev/null +++ b/shaders/sun_shadow.geom @@ -0,0 +1,22 @@ +#version 420 core + +layout(triangles, invocations = 4) in; // здесь invocations должно соответствовать количеству каскадов +layout(triangle_strip, max_vertices = 3) out; + +layout(std140, binding = 3) uniform Sun +{ + vec3 direction; + vec3 color; + mat4 vp[4]; +} sun; + +void main() +{ + for (int i = 0; i < 3; ++i) + { + gl_Position = sun.vp[gl_InvocationID] * gl_in[i].gl_Position; + gl_Layer = gl_InvocationID; + EmitVertex(); + } + EndPrimitive(); +} \ No newline at end of file diff --git a/shaders/sun_shadow.vert b/shaders/sun_shadow.vert index 05306dc..cbe3f11 100644 --- a/shaders/sun_shadow.vert +++ b/shaders/sun_shadow.vert @@ -4,14 +4,7 @@ layout (location = 0) in vec3 pos; uniform mat4 model; -layout(std140, binding = 3) uniform Sun -{ - vec3 direction; - vec3 color; - mat4 vp; -} sun; - void main() { - gl_Position = sun.vp * model * vec4(pos, 1.0); + gl_Position = model * vec4(pos, 1.0); }