enve/examples/shaderEffects/eBrightnessContrast.frag

30 lines
1.0 KiB
GLSL
Raw Permalink Normal View History

2019-08-24 15:07:28 +00:00
// enve - 2D animations software
2020-01-02 19:46:10 +00:00
// Copyright (C) 2016-2020 Maurycy Liebner
2019-08-24 15:07:28 +00:00
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
2019-08-12 10:25:38 +00:00
#version 330 core
layout(location = 0) out vec4 fragColor;
2019-08-12 10:25:38 +00:00
in vec2 texCoord;
uniform sampler2D texture;
uniform float brightness;
uniform float contrast;
void main(void) {
vec4 color = texture2D(texture, texCoord);
2020-05-25 13:32:39 +00:00
fragColor = vec4((color.rgb - 0.5*color.a) * (contrast + 1) + color.a*(0.5 + brightness), color.a);
2019-08-12 10:25:38 +00:00
}