//Butter - shaders

#include "/Input/Clamp.glsl"

varying vec2 texcoord;

/////////////////////////////////////////////////// Fragment

#ifdef infsh

uniform sampler2D colortex0;
uniform sampler2D colortex1;
uniform int worldTime;
uniform int isEyeInWater;
uniform vec3 sunPosition;
uniform mat4 gbufferProjection;
uniform sampler2D depthtex0;
uniform sampler2D depthtex1;
uniform float rainFactor;
uniform vec3 sunVec, upVec;

uniform ivec2 eyeBrightnessSmooth;
uniform sampler2D noisetex;
uniform vec3 cameraPosition;
uniform vec3 worldPos;
uniform float frameTimeCounter;
uniform float far, near;
uniform int visibility;

float eBS = eyeBrightnessSmooth.y / 240.0;
float caveFactor = mix(clamp((cameraPosition.y - 56.0) / 16.0, float(sign(isEyeInWater)), 1.0), 1.0, eBS);
float sunVisibility = clamp00125(dot(sunVec, upVec) + 0.0625) * 8.0;
float moonVisibility = clamp00125(dot(-sunVec, upVec) + 0.0625) * 8.0;

#include "/Input/Const.glsl"
#include "/Input/Bayer.glsl"
#include "/Input/Time.glsl"
#include "/Input/LightShaft.glsl"

void main() {
    vec3 color = texture2D(colortex0, texcoord.st).rgb;
    
    #ifdef LightShaft
    color += getSSGR(texcoord.st);
    #endif
    
/*DRAWBUFFERS:0*/
    gl_FragData[0] = vec4(color, 1.0);
}

#endif

/////////////////////////////////////////////////// Vertex

#ifdef outvsh

// varying vec2 ftransform;

void main(){
	gl_Position = ftransform();
	
	texcoord = gl_MultiTexCoord0.xy;	
}

#endif