X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=vertex.glsl;h=341b26a1771d0a0d164b2310f50703427ca9cfe0;hp=e2d30b74d109577a524be5636ecfb94365e7c432;hb=d0c631f46c6db417e013b1bc0edec24cb9c2824a;hpb=526f5c3dc0302e541c95ed2198ce8fdb5cdd0b99 diff --git a/vertex.glsl b/vertex.glsl index e2d30b7..341b26a 100644 --- a/vertex.glsl +++ b/vertex.glsl @@ -2,17 +2,22 @@ in vec3 vPosition; in vec4 vColor; in vec3 vNormal; +in vec2 vTexCoord; uniform mat4 model; uniform mat4 view; uniform mat4 projection; 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; }