Update models
[opengl.git] / vertex.glsl
1 #version 330
2 in vec3 vPosition;
3 in vec4 vColor;
4 in vec3 vNormal;
5 in vec2 vTexCoord;
6 uniform mat4 model;
7 uniform mat4 view;
8 uniform mat4 projection;
9 out vec4 color;
10 out vec3 normal;
11 out vec3 fragPos;
12 out vec3 normalEye;
13 out vec2 texCoord;
14
15 void main() {
16         vec4 pos = model * vec4(vPosition, 1.f);
17         gl_Position = projection * view * pos;
18         fragPos = vec3(pos);
19         color = vColor;
20         normal = mat3(transpose(inverse(model))) * vNormal;
21         normalEye = vec3(view * vec4(normal, 0.0));
22         texCoord = vTexCoord;
23 }