Code re-work: shadow mapping.

This commit is contained in:
Joey de Vries
2017-04-23 12:52:47 +02:00
parent c8431d9498
commit 919084ba39
19 changed files with 561 additions and 677 deletions

View File

@@ -0,0 +1,16 @@
#version 330 core
in vec4 FragPos;
uniform vec3 lightPos;
uniform float far_plane;
void main()
{
float lightDistance = length(FragPos.xyz - lightPos);
// map to [0;1] range by dividing by far_plane
lightDistance = lightDistance / far_plane;
// write this as modified depth
gl_FragDepth = lightDistance;
}