summaryrefslogtreecommitdiff
path: root/advanced_lighting/3.1.shadow_mapping/shaders/shadow.vert
blob: 3f14663ab7dd159f0616d648e8a3d53b1ada0e9b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#version 330 core
layout(location = 0) in vec3 apos;
layout(location = 1) in vec3 anormal;
layout(location = 2) in vec2 atex_coords;

out VS_OUT {
    vec4 frag_pos_light_space;
    vec3 frag_pos;
    vec3 normal;
    vec2 tex_coords;
} vs_out;

uniform mat4 proj;
uniform mat4 view;
uniform mat4 model;
uniform mat4 light_space_matrix;

void main(void)
{
    vs_out.frag_pos = vec3(model*vec4(apos, 1.0));
    vs_out.frag_pos_light_space = light_space_matrix*vec4(vs_out.frag_pos, 1.0);
    vs_out.normal = mat3(transpose(inverse(model)))*anormal;
    vs_out.tex_coords = atex_coords;
    gl_Position = proj*view*vec4(vs_out.frag_pos, 1.0);
}