赣州市洪水风险预警系统三维版本
guoshilong
2023-02-27 4d8c6dd77427e8e581fda17b6b65ba86bfb7a815
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// emulated noperspective
#ifndef LOG_DEPTH
varying float v_WindowZ;
#endif
 
/**
 * Clamps a vertex to the far plane.
 *
 * @name czm_depthClampFarPlane
 * @glslFunction
 *
 * @param {vec4} coords The vertex in clip coordinates.
 * @returns {vec4} The vertex clipped to the far plane.
 *
 * @example
 * gl_Position = czm_depthClampFarPlane(czm_modelViewProjection * vec4(position, 1.0));
 *
 * @see czm_writeDepthClampedToFarPlane
 */
vec4 czm_depthClampFarPlane(vec4 coords)
{
#ifndef LOG_DEPTH
    v_WindowZ = (0.5 * (coords.z / coords.w) + 0.5) * coords.w;
    coords.z = min(coords.z, coords.w);
#endif
    return coords;
}