opengl-playground/shaders/mesh-vertex.glsl

25 lines
620 B
GLSL

#version 330 core
layout (location = 0) in vec3 aInputPosition;
layout (location = 1) in vec3 aInputNormal;
layout (location = 2) in vec2 aTextureCoord;
uniform mat4 model_matrix;
uniform mat4 normal_matrix;
uniform mat4 projection_view_matrix;
uniform vec3 camera_position;
out vec3 Normal;
out vec3 FragPos;
out vec2 TexCoord;
out vec3 ViewPos;
void main()
{
gl_Position = projection_view_matrix * model_matrix * vec4(aInputPosition, 1.0);
Normal = vec3(normal_matrix * vec4(aInputNormal, 0.0));
FragPos = vec3(model_matrix * vec4(aInputPosition, 1.0));
TexCoord = aTextureCoord;
ViewPos = camera_position;
}