Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #if (numPointLights > 0) && defined(normalFlag)
- for (int i = 0; i < numPointLights; i++) {
- vec3 lightDir = u_pointLights[i].position - pos.xyz;
- float dist2 = dot(lightDir, lightDir);
- lightDir *= inversesqrt(dist2);
- float NdotL = clamp(dot(normal, lightDir), 0.0, 1.0);
- vec3 value = u_pointLights[i].color * (NdotL / (1.0 + dist2));
- v_lightDiffuse += value;
- #ifdef specularFlag
- float halfDotView = max(0.0, dot(normal, normalize(lightDir + viewVec)));
- v_lightSpecular += value * pow(halfDotView, u_shininess);
- #endif // specularFlag
- }
- #endif // numPointLights
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement