initial commit
This commit is contained in:
27
shaders/mesh/vertex_face.glsl
Normal file
27
shaders/mesh/vertex_face.glsl
Normal file
@@ -0,0 +1,27 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user