writeLogDepth.js 586 B

123456789101112131415161718192021
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "#ifdef LOG_DEPTH\n\
  3. varying float v_logZ;\n\
  4. #endif\n\
  5. void czm_writeLogDepth(float logZ)\n\
  6. {\n\
  7. #if defined(GL_EXT_frag_depth) && defined(LOG_DEPTH) && !defined(DISABLE_LOG_DEPTH_FRAGMENT_WRITE)\n\
  8. float halfLogFarDistance = czm_log2FarDistance * 0.5;\n\
  9. float depth = log2(logZ);\n\
  10. if (depth < czm_log2NearDistance) {\n\
  11. discard;\n\
  12. }\n\
  13. gl_FragDepthEXT = depth * halfLogFarDistance;\n\
  14. #endif\n\
  15. }\n\
  16. void czm_writeLogDepth() {\n\
  17. #ifdef LOG_DEPTH\n\
  18. czm_writeLogDepth(v_logZ);\n\
  19. #endif\n\
  20. }\n\
  21. ";