summaryrefslogtreecommitdiff
path: root/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs
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.1.shadow_mapping/shaders/shadow.vs
parentbf1c59565096ac9774493846cfb15e259d3b0e66 (diff)
change
Diffstat (limited to 'advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs')
-rw-r--r--advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs26
1 files changed, 26 insertions, 0 deletions
diff --git a/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs
new file mode 100644
index 0000000..3ecd5b1
--- /dev/null
+++ b/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vs
@@ -0,0 +1,26 @@
+#version 330 core
+layout(location = 0) in vec3 apos;
+layout(location = 1) in vec3 anormal;
+layout(location = 2) in vec2 atex_coords;
+
+out VS_OUT {
+ vec4 frag_pos_light_space;
+ vec3 frag_pos;
+ vec3 normal;
+ vec2 tex_coords;
+} vs_out;
+
+uniform mat4 projection;
+uniform mat4 view;
+uniform mat4 model;
+uniform mat4 light_space_matrix;
+
+void
+main(void)
+{
+ vs_out.frag_pos = vec3(model*vec4(apos, 1.0));
+ vs_out.frag_pos_light_space = light_space_matrix*vec4(vs_out.frag_pos, 1.0);
+ vs_out.normal = mat3(transpose(inverse(model)))*anormal;
+ vs_out.tex_coords = atex_coords;
+ gl_Position = projection*view*vec4(vs_out.frag_pos, 1.0);
+}