2016-05-01 13:59:17 +00:00
|
|
|
uniform sampler2D tex;
|
|
|
|
|
|
|
|
in vec4 vTexCoord;
|
2016-05-02 07:35:38 +00:00
|
|
|
in vec4 vColor;
|
2016-05-01 13:59:17 +00:00
|
|
|
|
|
|
|
void main()
|
|
|
|
{
|
2016-05-02 07:35:38 +00:00
|
|
|
vec3 color = texture(tex, vTexCoord.st).rgb;
|
2016-05-01 13:59:17 +00:00
|
|
|
|
|
|
|
// /* DEBUG */ if (vTexCoord.x > 0.5)
|
|
|
|
{
|
2016-05-02 07:35:38 +00:00
|
|
|
// Apply contrast
|
|
|
|
float contrast = clamp(vColor.y, 0.1, 3.0);
|
|
|
|
color = color.rgb * contrast - (contrast - 1.0) * 0.5;
|
|
|
|
|
|
|
|
// Apply gamma
|
|
|
|
float gamma = clamp(vColor.x, 0.1, 4.0);
|
|
|
|
color = sign(color) * pow(abs(color), vec3(1.0 / gamma));
|
|
|
|
|
|
|
|
// Apply brightness
|
|
|
|
float brightness = clamp(vColor.z, -0.8, 0.8);
|
|
|
|
color += brightness * 0.5;
|
|
|
|
|
|
|
|
color = clamp(color, 0.0, 1.0);
|
2016-05-01 13:59:17 +00:00
|
|
|
}
|
2016-05-02 07:35:38 +00:00
|
|
|
|
|
|
|
FragColor = vec4(color, 1.0);
|
2016-05-01 13:59:17 +00:00
|
|
|
}
|