summaryrefslogtreecommitdiff
path: root/advanced_lighting/3.2.point_shadows/shaders/depth.gs
diff options
context:
space:
mode:
authorpryazha <pryadeiniv@mail.ru>2025-02-06 12:38:09 +0500
committerpryazha <pryadeiniv@mail.ru>2025-02-06 12:38:09 +0500
commit926cbd0d49890772f911e6a6bedb7835605ced89 (patch)
treeea27e2c84e32ab6d8d29af9e61cd432e30a46bc6 /advanced_lighting/3.2.point_shadows/shaders/depth.gs
parentbf1c59565096ac9774493846cfb15e259d3b0e66 (diff)
change
Diffstat (limited to 'advanced_lighting/3.2.point_shadows/shaders/depth.gs')
-rw-r--r--advanced_lighting/3.2.point_shadows/shaders/depth.gs27
1 files changed, 27 insertions, 0 deletions
diff --git a/advanced_lighting/3.2.point_shadows/shaders/depth.gs b/advanced_lighting/3.2.point_shadows/shaders/depth.gs
new file mode 100644
index 0000000..638e2b9
--- /dev/null
+++ b/advanced_lighting/3.2.point_shadows/shaders/depth.gs
@@ -0,0 +1,27 @@
+#version 330 core
+layout(triangles) in;
+layout(triangle_strip, max_vertices=18) out;
+
+uniform mat4 shadow_transforms[6];
+
+out vec4 frag_pos;
+
+void
+main(void)
+{
+ for (int face = 0;
+ face < 6;
+ ++face)
+ {
+ gl_Layer = face;
+ for (int vertex = 0;
+ vertex < 3;
+ ++vertex)
+ {
+ frag_pos = gl_in[vertex].gl_Position;
+ gl_Position = shadow_transforms[face]*frag_pos;
+ EmitVertex();
+ }
+ EndPrimitive();
+ }
+}