25 lines
551 B
Plaintext
25 lines
551 B
Plaintext
|
// 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;
|
||
|
}
|