unpackDepth.js 630 B

123456789101112131415161718
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Unpacks a vec4 depth value to a float in [0, 1) range.\n\
  4. *\n\
  5. * @name czm_unpackDepth\n\
  6. * @glslFunction\n\
  7. *\n\
  8. * @param {vec4} packedDepth The packed depth.\n\
  9. *\n\
  10. * @returns {float} The floating-point depth in [0, 1) range.\n\
  11. */\n\
  12. float czm_unpackDepth(vec4 packedDepth)\n\
  13. {\n\
  14. // See Aras Pranckevičius' post Encoding Floats to RGBA\n\
  15. // http://aras-p.info/blog/2009/07/30/encoding-floats-to-rgba-the-final/\n\
  16. return dot(packedDepth, vec4(1.0, 1.0 / 255.0, 1.0 / 65025.0, 1.0 / 16581375.0));\n\
  17. }\n\
  18. ";