#ifndef c0
float scatterIntegral(float transmittance, const float coeff) {
    float a   = -1.0/coeff;
    return transmittance * a - a;
}
#endif
vec2 vc_rotatePos(vec2 coord, float angle){
    return vec2(
        cos(angle) * (coord.x) + sin(angle) * (coord.y),
        cos(angle) * (coord.y) - sin(angle) * (coord.x));
}


const float vc_lowEdge  = s_vcAltitude;
const float vc_highEdge = s_vcAltitude+s_vcThickness;

const float vc_size = (1.0/s_vcAltitude)*s_vcSize*0.66;
float vc_tick      = frameTimeCounter*16.66*vc_size;

float vc_daytimeCoverage = -0.03*timeSunrise-0.017*timeSunset-0.012*timeNight;

#define vc_shapeSize 0.85

#ifdef s_biomeDynamics
uniform vec2 vcData;

float vc_biomeCoverage = vcData.x;
#endif

float fbm(in vec3 pos, vec3 offset, const float persistence, const float scale, const int octaves) {
    float noise = 1.0;
    float a = 0.5;
    vec3 shift = offset;
    float div = a;

    //pos += shift*0.25;

    for (int i = 0; i<octaves; ++i) {
        noise += getValue3D(pos.xyz + shift*(1.0+(float(i)/octaves)*0.25))*a;
        pos.xz = vc_rotatePos(pos.xz, 0.3*pi);
        pos *= scale;
        a   *= persistence;
        div += a;
    }
    return noise/div;
}