Run shadow render pass and compute light position in vertex shaders

This commit is contained in:
Camden Dixie O'Brien committed 2025-10-04 21:27:46 +01:00
1 parent 73340b3a39
commit 633a922e42
6 files changed
+121 -23

No files matched your search

+8 -4
View File
@@ -1,10 +1,12 @@
#version 450
layout(location = 0) out vec3 frag_normal;
layout(location = 1) out vec4 light_pos;
layout(push_constant) uniform vp_t {
mat4 transform;
} vp;
layout(push_constant) uniform push_t {
mat4 vp;
mat4 light_vp;
} push;
vec2 vertices[4] = vec2[](
vec2(-1, -1),
@@ -15,6 +17,8 @@ vec2 vertices[4] = vec2[](
void main() {
const vec2 pos = 3 * vertices[gl_VertexIndex];
gl_Position = vp.transform * vec4(pos.x, 0, pos.y, 1);
const vec4 world_pos = vec4(pos.x, 0, pos.y, 1);
gl_Position = push.vp * world_pos;
frag_normal = vec3(0, 1, 0);
light_pos = push.light_vp * world_pos;
}