X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=vertex.glsl;h=e7a74dd8f1adfc9bf818565b7778b02a79900199;hp=3bf0a4836bbe79ba552fb749ef5bbf12ba322266;hb=5a4d005b668b98d44ef20391ecddaf6bfc2ee70f;hpb=616b478aff3a11f38ab379008c43a179718333f8 diff --git a/vertex.glsl b/vertex.glsl index 3bf0a48..e7a74dd 100644 --- a/vertex.glsl +++ b/vertex.glsl @@ -1,12 +1,20 @@ #version 330 in vec3 vPosition; in vec4 vColor; +in vec3 vNormal; uniform mat4 model; uniform mat4 view; uniform mat4 projection; out vec4 color; +out vec3 normal; +out vec3 fragPos; +out vec3 normalEye; void main() { - gl_Position = projection * view * model * vec4(vPosition, 1.f); + vec4 pos = model * vec4(vPosition, 1.f); + gl_Position = projection * view * pos; + fragPos = vec3(pos); color = vColor; + normal = vNormal; + normalEye = vec3(view * vec4(normal, 0.0)); }