luminance.js 587 B

12345678910111213141516171819202122
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Computes the luminance of a color. \n\
  4. *\n\
  5. * @name czm_luminance\n\
  6. * @glslFunction\n\
  7. *\n\
  8. * @param {vec3} rgb The color.\n\
  9. * \n\
  10. * @returns {float} The luminance.\n\
  11. *\n\
  12. * @example\n\
  13. * float light = czm_luminance(vec3(0.0)); // 0.0\n\
  14. * float dark = czm_luminance(vec3(1.0)); // ~1.0 \n\
  15. */\n\
  16. float czm_luminance(vec3 rgb)\n\
  17. {\n\
  18. // Algorithm from Chapter 10 of Graphics Shaders.\n\
  19. const vec3 W = vec3(0.2125, 0.7154, 0.0721);\n\
  20. return dot(rgb, W);\n\
  21. }\n\
  22. ";