Files
Z3D/shaders/mesh/vertex_face.glsl
2024-12-10 13:50:21 +01:00

28 lines
716 B
GLSL

layout (location = 0) uniform mat4 mvp_matrix;
layout (location = 0) in vec3 vertex_position;
#ifdef LIGHTING
layout (location = 1) uniform mat4 model_matrix;
layout (location = 1) in vec3 vertex_normal;
layout (location = 0) out vec3 frag_position;
layout (location = 1) out vec3 frag_normal;
#endif
#ifdef TEXTURE
layout (location = 2) in vec2 vertex_tex_coord;
layout (location = 2) out vec2 frag_tex_coord;
#endif
void main() {
gl_Position = mvp_matrix * vec4(vertex_position, 1.0);
#ifdef LIGHTING
frag_position = (model_matrix * vec4(vertex_position, 1.0)).xyz;
frag_normal = normalize(mat3(model_matrix) * vertex_normal);
#endif
#ifdef TEXTURE
frag_tex_coord = vertex_tex_coord;
#endif
}