|
@ -3,7 +3,7 @@ |
|
|
// Input vertex attributes (from vertex shader) |
|
|
// Input vertex attributes (from vertex shader) |
|
|
in vec3 fragPosition; |
|
|
in vec3 fragPosition; |
|
|
in vec2 fragTexCoord; |
|
|
in vec2 fragTexCoord; |
|
|
//in vec4 fragColor; |
|
|
|
|
|
|
|
|
in vec4 fragColor; |
|
|
in vec3 fragNormal; |
|
|
in vec3 fragNormal; |
|
|
|
|
|
|
|
|
// Input uniform values |
|
|
// Input uniform values |
|
@ -41,6 +41,8 @@ void main() |
|
|
vec3 viewD = normalize(viewPos - fragPosition); |
|
|
vec3 viewD = normalize(viewPos - fragPosition); |
|
|
vec3 specular = vec3(0.0); |
|
|
vec3 specular = vec3(0.0); |
|
|
|
|
|
|
|
|
|
|
|
vec4 tint = colDiffuse * fragColor; |
|
|
|
|
|
|
|
|
// NOTE: Implement here your fragment shader code |
|
|
// NOTE: Implement here your fragment shader code |
|
|
|
|
|
|
|
|
for (int i = 0; i < MAX_LIGHTS; i++) |
|
|
for (int i = 0; i < MAX_LIGHTS; i++) |
|
@ -68,8 +70,8 @@ void main() |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
finalColor = (texelColor*((colDiffuse + vec4(specular, 1.0))*vec4(lightDot, 1.0))); |
|
|
|
|
|
finalColor += texelColor*(ambient/10.0)*colDiffuse; |
|
|
|
|
|
|
|
|
finalColor = (texelColor*((tint + vec4(specular, 1.0))*vec4(lightDot, 1.0))); |
|
|
|
|
|
finalColor += texelColor*(ambient/10.0)*tint; |
|
|
|
|
|
|
|
|
// Gamma correction |
|
|
// Gamma correction |
|
|
finalColor = pow(finalColor, vec4(1.0/2.2)); |
|
|
finalColor = pow(finalColor, vec4(1.0/2.2)); |
|
|