Files
quakemapping/tb/shader/TextureBrowser.fragsh
2019-12-30 17:23:05 +01:00

44 lines
1.4 KiB
Plaintext

#version 120
/*
Copyright (C) 2010-2017 Kristian Duske
This file is part of TrenchBroom.
TrenchBroom 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.
TrenchBroom 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 TrenchBroom. If not, see <http://www.gnu.org/licenses/>.
*/
uniform float Brightness;
uniform sampler2D Texture;
uniform bool ApplyTinting;
uniform vec4 TintColor;
uniform bool GrayScale;
void main() {
gl_FragColor = texture2D(Texture, gl_TexCoord[0].st);
gl_FragColor = vec4(vec3(Brightness / 2.0 * gl_FragColor), gl_FragColor.a);
gl_FragColor = clamp(2.0 * gl_FragColor, 0.0, 1.0);
if (GrayScale) {
float gray = dot(gl_FragColor.rgb, vec3(0.299, 0.587, 0.114));
gl_FragColor = vec4(gray, gray, gray, gl_FragColor.a);
}
if (ApplyTinting) {
gl_FragColor = vec4(gl_FragColor.rgb * TintColor.rgb * TintColor.a, gl_FragColor.a);
gl_FragColor = clamp(2.0 * gl_FragColor, 0.0, 1.0);
}
}