added files
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
#version 330 core
|
||||
in vec3 vNormal;
|
||||
in vec3 vWorldPos;
|
||||
|
||||
uniform vec3 uBaseColor;
|
||||
uniform vec3 uLightDir;
|
||||
uniform vec3 uViewPos;
|
||||
|
||||
out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
vec3 normal = normalize(vNormal);
|
||||
vec3 lightDir = normalize(-uLightDir);
|
||||
|
||||
float diffuse = max(dot(normal, lightDir), 0.0);
|
||||
float ambient = 0.12;
|
||||
|
||||
vec3 viewDir = normalize(uViewPos - vWorldPos);
|
||||
vec3 halfway = normalize(lightDir + viewDir);
|
||||
float specular = pow(max(dot(normal, halfway), 0.0), 32.0) * 0.3;
|
||||
|
||||
vec3 color = uBaseColor * (ambient + diffuse) + vec3(specular);
|
||||
fragColor = vec4(color, 1.0);
|
||||
}
|
||||
Reference in New Issue
Block a user