
#ifdef VERTEX

out vec2 vTexcoord;

void main() {
	gl_Position = ftransform();
	vTexcoord = (gl_TextureMatrix[0] * gl_MultiTexCoord0).xy;
}

#endif

#ifdef FRAGMENT

uniform sampler2D colortex0;
uniform sampler2D colortex15;
uniform sampler2D colortex12;
uniform sampler2D colortex13;
uniform sampler2D colortex11;
uniform sampler2D depthtex0;
uniform sampler2D colortex10;

const float sunPathRotation = 40.0;


uniform mat4 gbufferModelView;
uniform mat4 gbufferProjectionInverse;
uniform mat4 gbufferModelViewInverse;
uniform vec3 sunPosition,moonPosition;
uniform vec3 cameraPosition;


uniform int worldTime;
uniform float rainStrength;

//>>IN-OUT<<//
in vec2 vTexcoord;

//>>INCLUDES<<//
#include "/lib/Color/Luminance.glsl"
#include "/lib/Conf/Color_Conf.glsl"
#include "/lib/Color/Saturation.glsl"
#include "/lib/Conf/ToneMapper_Conf.glsl"
#include "/lib/Color/ToneMappers.glsl"
#include "/lib/Color/Contrast.glsl"
#include "/lib/Conf/Contrast_conf.glsl"



uniform float viewWidth, viewHeight;
uniform float frameTimeCounter;

uniform float fogStart;
uniform float fogEnd;
uniform float far;
uniform float near;

#include "/lib/blur/KawaseBlur.glsl"
#include "/lib/Conf/Sharp_conf.glsl"

#include "/lib/Post/FilmGrain.glsl"
#include "/lib/Conf/FilmGrain_conf.glsl"


#include "/lib/Conf/Sky_conf.glsl"
#include "/lib/util/time.glsl"
#include "/lib/sky/Sky_Palet.glsl"
#include "/lib/sky/Phases.glsl"
#include "/lib/sky/SunLight.glsl"

#include "/lib/util/transformations.glsl"

#include "/lib/sky/Sky_Saturation.glsl"

#include "/lib/util/cave.glsl"

#include "/lib/sky/SUN_MOON_UV.glsl"
#include "/lib/sky/VelpixSun.glsl"
#include "/lib/util/rainVisibility.glsl"
#include "/lib/sky/RenderSky.glsl"
#include "/lib/sky/Fog.glsl"





void main() {
	
	vec2 texelSize = vec2(1.0 / viewWidth,1.0 / viewHeight);

	float aspect = viewWidth / viewHeight; 

	vec3 vColor = texture2D(colortex0, vTexcoord).rgb; // >>> Main color

	float vpLuma = vpGetLuminance(vColor);


	#ifdef SHARPNESS
	vColor = vpSharpen(colortex0, vTexcoord, texelSize, SHARPNESS_STRENGHT);
	#endif
	
	#ifdef Color_ToneMapper
	vColor = Tonemap(vColor);
	#endif

	#ifdef Contrast
	vColor = vpContrast(vColor,Contrast_Strength);
	#endif
	
	#ifdef Color_FilmGrain
	vColor = vpFilmGrain(vColor, vTexcoord,FilmGrain_Strength, aspect);
	#endif 
	
	
	#ifdef Color_Saturation
	vColor = vpSaturation(vColor);
	#endif

	#ifdef OVERWORLD
	#ifdef ARTISTIC_FOG
	vColor = vpFog(vColor);
	#endif
	#endif

	#ifdef NETHER
	vColor = vpNetherFog(vColor);
	#endif

	#ifdef END
	vColor = vpEndFog(vColor);
	#endif
	
/* DRAWBUFFERS:0 */
	gl_FragData[0] = vec4(vColor,1.); //gcolor
}
#endif

