// __multiversion__
// This signals the loading code to prepend either #version 100 or #version 300 es as apropriate.

#include "vertexVersionSimple.h"
#include "uniformWorldConstants.h"
#include "uniformPerFrameConstants.h"
#include "uniformShaderConstants.h"
#include "uniformRenderChunkConstants.h"

attribute mediump vec4 POSITION;
attribute vec4 COLOR;

varying vec4 color;
varying highp vec3 pos;
const float fogNear = 0.3;

void main()
{
float rain=1.-pow(FOG_CONTROL.y,5.);//雨天检测
float night=pow(max(min(1.-FOG_COLOR.r*1.5,1.),0.),1.2);//夜间检测
float sun=pow(max(min(1.-FOG_COLOR.b*1.2,1.),0.),.5)-night;//日出日落

vec4 skyc=vec4(0.4,0.8,1.3,1.0);
skyc=mix(skyc,vec4(0.2,0.3,0.4,0.5),night);
skyc=mix(skyc,vec4(0.9,0.6,0.3,1.0),sun);
skyc=mix(skyc,vec4(0.3),rain);

vec4 skypos=POSITION; skypos.y-=length(POSITION.xyz)*0.4-0.1;
   gl_Position = WORLDVIEWPROJ * skypos;




pos = POSITION.xyz;


color=mix(skyc,FOG_COLOR,COLOR.r);
}