getLambertDiffuse.glsl 760 B

12345678910111213141516171819202122
  1. /**
  2. * Calculates the intensity of diffusely reflected light.
  3. *
  4. * @name czm_getLambertDiffuse
  5. * @glslFunction
  6. *
  7. * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
  8. * @param {vec3} normalEC The surface normal in eye coordinates.
  9. *
  10. * @returns {float} The intensity of the diffuse reflection.
  11. *
  12. * @see czm_phong
  13. *
  14. * @example
  15. * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
  16. * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
  17. * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
  18. */
  19. float czm_getLambertDiffuse(vec3 lightDirectionEC, vec3 normalEC)
  20. {
  21. return max(dot(lightDirectionEC, normalEC), 0.0);
  22. }