-
-
Save rgngl/c6849beed2d56e80fdbe to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#define DIRECTIONAL_LIGHT_COUNT 1 | |
vec3 computeLighting(vec3 normalVector, vec3 lightDirection, vec3 lightColor, float attenuation) { | |
float diffuse = max(dot(normalVector, lightDirection), 0.0); | |
vec3 diffuseColor = lightColor * _baseColor.rgb * diffuse * attenuation; | |
return diffuseColor; | |
} | |
// Directional light contribution | |
#if (DIRECTIONAL_LIGHT_COUNT > 0) | |
for (int i = 0; i < DIRECTIONAL_LIGHT_COUNT; ++i) | |
{ | |
vec3 lightDirection = normalize(u_directionalLightDirection[i]); | |
combinedColor += computeLighting(normalVector, -lightDirection, u_directionalLightColor[i], 1.0); | |
} | |
#endif |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment