summaryrefslogtreecommitdiff
path: root/shaders/bullet_fragment.glsl
blob: 71486ec8a77480d32d1fbb0fb64d9144af384c26 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#version 120

in mat3x4 v_tex_rot;
uniform sampler2D tex;

void main() {
	vec2 l_uv = gl_TexCoord[0].xy;
	l_uv = vec2(v_tex_rot * vec3(l_uv, 0.5));
	gl_FragColor = texture2D(tex, l_uv);
	float M = max(max(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z);
	float C = M - min(min(gl_FragColor.x, gl_FragColor.y), gl_FragColor.z);
	float S = C > 0.0 ? C / M : 0.0;
	gl_FragColor.xyz = M * mix(vec3(1.0, 1.0, 1.0), gl_Color.xyz, S);
}