Code and content re-work: advanced OpenGL and advanced lighting.

This commit is contained in:
Joey de Vries
2017-06-01 22:04:34 +02:00
parent 49d8d895ae
commit f844f7c541
32 changed files with 184 additions and 144 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;
}