Final day of opengl. Animations mostly work but there's either a problem with the model or the way it's loaded from assimp.
This commit is contained in:
parent
a629e16fe2
commit
3363921b6b
167 changed files with 17566 additions and 2 deletions
22
53-final-cleanup/shaders/33-shadow_dbg.frag.glsl
Normal file
22
53-final-cleanup/shaders/33-shadow_dbg.frag.glsl
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
#version 330 core
|
||||
out vec4 FragColor;
|
||||
|
||||
in vec2 TexCoords;
|
||||
|
||||
uniform sampler2D shadowMap;
|
||||
uniform float near_plane;
|
||||
uniform float far_plane;
|
||||
|
||||
// required when using a perspective projection matrix
|
||||
float LinearizeDepth(float depth)
|
||||
{
|
||||
float z = depth * 2.0 - 1.0; // Back to NDC
|
||||
return (2.0 * near_plane * far_plane) / (far_plane + near_plane - z * (far_plane - near_plane));
|
||||
}
|
||||
|
||||
void main()
|
||||
{
|
||||
float depthValue = texture(shadowMap, TexCoords).r;
|
||||
// FragColor = vec4(vec3(LinearizeDepth(depthValue) / far_plane), 1.0); // perspective
|
||||
FragColor = vec4(vec3(depthValue), 1.0); // orthographic
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue