X-Git-Url: https://git.lukelau.me/?p=opengl.git;a=blobdiff_plain;f=fragment.glsl;fp=fragment.glsl;h=0000000000000000000000000000000000000000;hp=cffd8a01a0abcd4d11f2a708a2820e10b440209b;hb=b64cd5a5ec09e6f051583371045ef7080c69b776;hpb=da829a43b9ab76ce8830bd83760e59f016787727 diff --git a/fragment.glsl b/fragment.glsl deleted file mode 100644 index cffd8a0..0000000 --- a/fragment.glsl +++ /dev/null @@ -1,23 +0,0 @@ -#version 330 -in vec4 color; -in vec3 normal; -in vec3 fragPos; -uniform vec3 lightPos; -uniform vec3 viewPos; -uniform vec4 lightColor; -out vec4 FragColor; - -void main() { - float ambient = 0.1; - float specularStrength = 0.5; - vec3 lightDir = normalize(fragPos - lightPos); - float diffuse = max(0, dot(-normal, lightDir)); - - vec3 viewDir = normalize(fragPos - viewPos); - vec3 reflectDir = reflect(-lightDir, normal); - float specular = pow(max(0, dot(viewDir, reflectDir)), 128); - - vec4 lighting = (ambient + diffuse + specular) * lightColor; - - FragColor = lighting * color; -}