writeDepthClamp.js 806 B

1234567891011121314151617181920212223242526272829
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "// emulated noperspective\n\
  3. #if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n\
  4. varying float v_WindowZ;\n\
  5. #endif\n\
  6. \n\
  7. /**\n\
  8. * Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane\n\
  9. * by writing the fragment's depth. See czm_depthClamp for more details.\n\
  10. * <p>\n\
  11. * The shader must enable the GL_EXT_frag_depth extension.\n\
  12. * </p>\n\
  13. *\n\
  14. * @name czm_writeDepthClamp\n\
  15. * @glslFunction\n\
  16. *\n\
  17. * @example\n\
  18. * gl_FragColor = color;\n\
  19. * czm_writeDepthClamp();\n\
  20. *\n\
  21. * @see czm_depthClamp\n\
  22. */\n\
  23. void czm_writeDepthClamp()\n\
  24. {\n\
  25. #if defined(GL_EXT_frag_depth) && !defined(LOG_DEPTH)\n\
  26. gl_FragDepthEXT = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);\n\
  27. #endif\n\
  28. }\n\
  29. ";