Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 | //This file is automatically rebuilt by the Cesium build process.
export default "/**\n\
* Computes a value that scales with distance. The scaling is clamped at the near and\n\
* far distances, and does not extrapolate. This function works with the\n\
* {@link NearFarScalar} JavaScript class.\n\
*\n\
* @name czm_nearFarScalar\n\
* @glslFunction\n\
*\n\
* @param {vec4} nearFarScalar A vector with 4 components: Near distance (x), Near value (y), Far distance (z), Far value (w).\n\
* @param {float} cameraDistSq The square of the current distance from the camera.\n\
*\n\
* @returns {float} The value at this distance.\n\
*/\n\
float czm_nearFarScalar(vec4 nearFarScalar, float cameraDistSq)\n\
{\n\
float valueAtMin = nearFarScalar.y;\n\
float valueAtMax = nearFarScalar.w;\n\
float nearDistanceSq = nearFarScalar.x * nearFarScalar.x;\n\
float farDistanceSq = nearFarScalar.z * nearFarScalar.z;\n\
\n\
float t = (cameraDistSq - nearDistanceSq) / (farDistanceSq - nearDistanceSq);\n\
\n\
t = pow(clamp(t, 0.0, 1.0), 0.2);\n\
\n\
return mix(valueAtMin, valueAtMax, t);\n\
}\n\
";
|