Fix refelctivity + refraction
[opengl.git] / vertex.glsl
index e7a74dd8f1adfc9bf818565b7778b02a79900199..341b26a1771d0a0d164b2310f50703427ca9cfe0 100644 (file)
@@ -2,6 +2,7 @@
 in vec3 vPosition;
 in vec4 vColor;
 in vec3 vNormal;
+in vec2 vTexCoord;
 uniform mat4 model;
 uniform mat4 view;
 uniform mat4 projection;
@@ -9,12 +10,14 @@ out vec4 color;
 out vec3 normal;
 out vec3 fragPos;
 out vec3 normalEye;
+out vec2 texCoord;
 
 void main() {
        vec4 pos = model * vec4(vPosition, 1.f);
        gl_Position = projection * view * pos;
        fragPos = vec3(pos);
        color = vColor;
-       normal = vNormal;
+       normal = mat3(transpose(inverse(model))) * vNormal;
        normalEye = vec3(view * vec4(normal, 0.0));
+       texCoord = vTexCoord;
 }