v4k-git-backup/engine/art/shaders/rect_2d.fs

17 lines
428 B
Forth
Raw Normal View History

2023-11-26 15:27:33 +00:00
uniform sampler2D texture0; /*unit0*/
uniform float u_inv_gamma;
uniform vec4 u_tint;
uniform int u_has_tex;
in vec2 uv;
out vec4 fragcolor;
void main() {
vec4 texel = texture( texture0, uv );
if (u_has_tex > 0) {
fragcolor = vec4(texel.xyz*u_tint.xyz, texel.a*u_tint.a);
} else {
fragcolor = u_tint;
}
fragcolor.rgb = pow( fragcolor.rgb, vec3( u_inv_gamma ) ); // defaults: 1.0/2.2 gamma
}