Newer
Older
casic-smartcity-well-front / static / Cesium / Shaders / Builtin / Functions / readNonPerspective.glsl
[wangxitong] on 8 Jul 2021 1 KB mars3d总览
/**
 * 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;
}