translucentPhong.js 1.1 KB

1234567891011121314151617181920212223242526272829
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * @private\n\
  4. */\n\
  5. vec4 czm_translucentPhong(vec3 toEye, czm_material material, vec3 lightDirectionEC)\n\
  6. {\n\
  7. // Diffuse from directional light sources at eye (for top-down and horizon views)\n\
  8. float diffuse = czm_getLambertDiffuse(vec3(0.0, 0.0, 1.0), material.normal);\n\
  9. \n\
  10. if (czm_sceneMode == czm_sceneMode3D) {\n\
  11. // (and horizon views in 3D)\n\
  12. diffuse += czm_getLambertDiffuse(vec3(0.0, 1.0, 0.0), material.normal);\n\
  13. }\n\
  14. \n\
  15. diffuse = clamp(diffuse, 0.0, 1.0);\n\
  16. \n\
  17. float specular = czm_getSpecular(lightDirectionEC, toEye, material.normal, material.shininess);\n\
  18. \n\
  19. // Temporary workaround for adding ambient.\n\
  20. vec3 materialDiffuse = material.diffuse * 0.5;\n\
  21. \n\
  22. vec3 ambient = materialDiffuse;\n\
  23. vec3 color = ambient + material.emission;\n\
  24. color += materialDiffuse * diffuse * czm_lightColor;\n\
  25. color += material.specular * specular * czm_lightColor;\n\
  26. \n\
  27. return vec4(color, material.alpha);\n\
  28. }\n\
  29. ";