All files / engine/Source/Shaders/Builtin/Functions fog.js

0% Statements 0/0
0% Branches 0/0
0% Functions 0/0
0% Lines 0/0

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 30 31 32 33 34 35 36 37 38 39 40 41                                                                                 
//This file is automatically rebuilt by the Cesium build process.
export default "/**\n\
 * Gets the color with fog at a distance from the camera.\n\
 *\n\
 * @name czm_fog\n\
 * @glslFunction\n\
 *\n\
 * @param {float} distanceToCamera The distance to the camera in meters.\n\
 * @param {vec3} color The original color.\n\
 * @param {vec3} fogColor The color of the fog.\n\
 *\n\
 * @returns {vec3} The color adjusted for fog at the distance from the camera.\n\
 */\n\
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor)\n\
{\n\
    float scalar = distanceToCamera * czm_fogDensity;\n\
    float fog = 1.0 - exp(-(scalar * scalar));\n\
    return mix(color, fogColor, fog);\n\
}\n\
\n\
/**\n\
 * Gets the color with fog at a distance from the camera.\n\
 *\n\
 * @name czm_fog\n\
 * @glslFunction\n\
 *\n\
 * @param {float} distanceToCamera The distance to the camera in meters.\n\
 * @param {vec3} color The original color.\n\
 * @param {vec3} fogColor The color of the fog.\n\
 * @param {float} fogModifierConstant A constant to modify the appearance of fog.\n\
 *\n\
 * @returns {vec3} The color adjusted for fog at the distance from the camera.\n\
 */\n\
vec3 czm_fog(float distanceToCamera, vec3 color, vec3 fogColor, float fogModifierConstant)\n\
{\n\
    float scalar = distanceToCamera * czm_fogDensity;\n\
    float fog = 1.0 - exp(-((fogModifierConstant * scalar + fogModifierConstant) * (scalar * (1.0 + fogModifierConstant))));\n\
    return mix(color, fogColor, fog);\n\
}\n\
";