ttt3d/assets/shaders/vertex_shader.glsl
Nicolás A. Ortega Froysa b9360cee57 Fixed the shader
Stupid matrices.
2018-12-17 17:47:13 +01:00

21 lines
458 B
GLSL

#version 330 core
layout(location = 0) in vec3 vert_pos;
layout(location = 1) in vec3 vert_norm;
uniform vec3 col;
uniform vec3 light_col;
uniform mat4 model;
uniform mat4 view;
uniform mat4 proj;
out vec3 frag_pos;
out vec3 frag_col;
out vec3 normal;
void main() {
gl_Position = proj * view * model * vec4(vert_pos, 1);
frag_pos = vec3(model * vec4(vert_pos, 1.0));
frag_col = col * light_col;
normal = mat3(transpose(inverse(model))) * vert_norm;
}