#version 330 core
// waterfall frag.shader

smooth in vec2 UV;
smooth in vec4 aPos;


out vec4 color;

uniform sampler2D sprite;
uniform int iflag;


void main(){
	color = texture( sprite, UV).rgba;

	//particles (spark.png):
	if( ( iflag==1 ) && (color.a < 0.3) ) discard; 
	//high threshold necessary for spark.png !

	if( iflag==1 ) color.a *=0.6;


	//ribbon (wfall.png):
	if( iflag==0 ) {
		float distFromEdge = 2.0*min( UV.x, 1.0-UV.x ); // [0..1]
		color.a *= distFromEdge*distFromEdge;
	}
}

