Poly3d/shaders/depth_shader.vs

25 lines
551 B
Plaintext
Raw Normal View History

2024-11-27 17:51:31 +00:00
// depth_vertex_shader.vs
#version 330 core
// Vertex Attributes
layout(location = 0) in vec3 aPos;
// Uniform Matrices
uniform mat4 model;
uniform mat4 lightSpaceMatrix;
// Output to Fragment Shader
out vec4 FragPosLightSpace;
void main()
{
// Calculate fragment position in world space
vec3 FragPos = vec3(model * vec4(aPos, 1.0));
// Calculate fragment position in light space
FragPosLightSpace = lightSpaceMatrix * vec4(FragPos, 1.0);
// Final vertex position in clip space
gl_Position = FragPosLightSpace;
}