ttt3d/assets/shaders/vertex_shader.glsl

21 lines
458 B
Plaintext
Raw Permalink Normal View History

2018-12-17 10:27:54 +00:00
#version 330 core
layout(location = 0) in vec3 vert_pos;
2018-12-17 14:38:39 +00:00
layout(location = 1) in vec3 vert_norm;
2018-12-17 10:27:54 +00:00
uniform vec3 col;
2018-12-17 14:38:39 +00:00
uniform vec3 light_col;
uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;
out vec3 frag_pos;
2018-12-17 10:27:54 +00:00
out vec3 frag_col;
2018-12-17 14:38:39 +00:00
out vec3 normal;
2018-12-17 10:27:54 +00:00
void main() {
2018-12-17 16:47:13 +00:00
gl_Position = proj * view * model * vec4(vert_pos, 1);
2018-12-17 14:38:39 +00:00
frag_pos = vec3(model * vec4(vert_pos, 1.0));
frag_col = col * light_col;
normal = mat3(transpose(inverse(model))) * vert_norm;
2018-12-17 10:27:54 +00:00
}