udemy_opengl/shaders/shader.vert
2025-07-07 20:00:35 -06:00

23 lines
531 B
GLSL

#version 460 core
layout (location = 0) in vec3 pos;
layout (location = 1) in vec2 tex;
layout (location = 2) in vec3 norm;
out vec4 vertex_color;
out vec2 texture_coord;
out vec3 normal;
out vec3 frag_pos;
uniform mat4 projection;
uniform mat4 model;
uniform mat4 view;
void main() {
gl_Position = projection * view * model * vec4(pos, 1.0);
vertex_color = vec4(clamp(pos, 0.0f, 1.0f), 1.0f);
texture_coord = tex;
normal = mat3(transpose(inverse(model))) * norm;
frag_pos = (model * vec4(pos, 1.0)).xyz;
}