/*
        < Leviathan Shader >
   Hey What Are You Doing Here ?
        Please Dont Steal !
       Made By: Eve4640_
*/

#define fc FOG_COLOR
#define fcc FOG_CONTROL
#define cc CURRENT_COLOR

vec3 skyColor(float lp){

vec3 ds = vec3(.1,.4,.8);
vec3 ns = vec3(.0,.1,.2);
vec3 ss = vec3(.37,.52,.56);
vec3 rs = fc.rgb*.9;

vec3 dg = vec3(.6,.8,.9);
vec3 ng = vec3(.0,.3,.6);
vec3 sg = vec3(1.,.8,.3);
vec3 rg = fc.rgb+.4;

vec3 t = vec3(pow(max(min(1.-fc.r*1.5,1.),.0),1.2),clamp((fc.r*1.-fc.b)*20.,.0,1.),smoothstep(.6,.34,fcc.x));
vec3 scs = mix(mix(mix(ds,ns,t.x),ss,t.y),rs,t.z);
vec3 sgcs = mix(mix(mix(dg,ng,t.x),sg,t.y),rg,t.z);
scs = mix(scs,sgcs,smoothstep(.0,1.,lp*2.5));

if(fcc.x==.0)scs=fc.rgb;

return scs;}

vec4 cloudColor(vec4 x,vec4 p,vec4 w,float fn,float rd){

vec3 t = vec3(pow(max(min(1.-fc.r*1.5,1.),.0),1.2),clamp((fc.r*1.-fc.b)*20.,.0,1.),smoothstep(.6,.34,fcc.x));
float dp = mix(length(w.xyz)/rd,length(w.xyz)/rd*2.,t.z);
float f = max(dp-fn,.0);

vec4 c = mix(mix(vec4(.7,.8,.9,.6),vec4(.1,.3,.6,.5),t.x),vec4(.9,.6,.2,.7),t.y);

x=mix(c,vec4(fc.rgb+.3,.4),t.z);
x.rgb+=p.y*.3;
x.a*=1.-f;

return x;}

vec3 fogSet(vec3 x,vec3 t,vec3 w,float r){

float s = mix(mix(mix(clamp(length(-w.xy)/r*1.,.0,.5),clamp(length(-w.xyz)/r*1.5,.0,.6),t.x),clamp(length(-w.xyz)/r*2.,.0,.7),t.y),clamp(length(-w.xz*.65)/r*5.,.0,.9),t.z);

vec3 c = mix(mix(mix(fc.rgb,vec3(.0,.2,.4),t.x),vec3(.9,.6,.2),t.y),fc.rgb+.25,t.z);

return mix(x,c,s);}

vec4 waterSet(vec4 x,vec3 s,vec2 u,float lp,float wo,float fo){

x=vec4(x.rgb,wo);
x=mix(x,vec4(s,fo),lp);
x.rgb*=max(u.x,u.y);

return x;}
