25 lines
555 B
GLSL
25 lines
555 B
GLSL
// emulated noperspective
|
|
#if !defined(LOG_DEPTH)
|
|
in float v_WindowZ;
|
|
#endif
|
|
|
|
/**
|
|
* Emulates GL_DEPTH_CLAMP. Clamps a fragment to the near and far plane
|
|
* by writing the fragment's depth. See czm_depthClamp for more details.
|
|
*
|
|
* @name czm_writeDepthClamp
|
|
* @glslFunction
|
|
*
|
|
* @example
|
|
* out_FragColor = color;
|
|
* czm_writeDepthClamp();
|
|
*
|
|
* @see czm_depthClamp
|
|
*/
|
|
void czm_writeDepthClamp()
|
|
{
|
|
#if (!defined(LOG_DEPTH) && (__VERSION__ == 300 || defined(GL_EXT_frag_depth)))
|
|
gl_FragDepth = clamp(v_WindowZ * gl_FragCoord.w, 0.0, 1.0);
|
|
#endif
|
|
}
|