yzt
2023-05-26 de4278af2fd46705a40bac58ec01122db6b7f3d7
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
28
29
30
31
/**
 * Reads a value previously transformed with {@link czm_writeNonPerspective}
 * by dividing it by `w`, the value used in the perspective divide.
 * This function is intended to be called in a fragment shader to access a
 * `varying` that should not be subject to perspective interpolation.
 * For example, screen-space texture coordinates. The value should have been
 * previously written in the vertex shader with a call to
 * {@link czm_writeNonPerspective}.
 *
 * @name czm_readNonPerspective
 * @glslFunction
 *
 * @param {float|vec2|vec3|vec4} value The non-perspective value to be read.
 * @param {float} oneOverW One over the perspective divide value, `w`. Usually this is simply `gl_FragCoord.w`.
 * @returns {float|vec2|vec3|vec4} The usable value.
 */
float czm_readNonPerspective(float value, float oneOverW) {
    return value * oneOverW;
}
 
vec2 czm_readNonPerspective(vec2 value, float oneOverW) {
    return value * oneOverW;
}
 
vec3 czm_readNonPerspective(vec3 value, float oneOverW) {
    return value * oneOverW;
}
 
vec4 czm_readNonPerspective(vec4 value, float oneOverW) {
    return value * oneOverW;
}