File: fixScaleSprite.frag

package info (click to toggle)
sludge 2.2.2-5
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,852 kB
  • sloc: cpp: 32,432; sh: 1,237; makefile: 634; xml: 284
file content (29 lines) | stat: -rw-r--r-- 678 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
uniform sampler2D tex0;
uniform sampler2D tex1;
uniform sampler2D tex2;
uniform bool useLightTexture;

varying vec2 varCoord0;
varying vec2 varCoord1;
varying vec2 varCoord2;

varying vec4 color;
varying vec4 secondaryColor;

void main()
{
	vec4 texture = texture2D (tex0, varCoord0);
	vec4 texture2 = texture2D (tex2, varCoord2);
	vec3 col;
	if (useLightTexture) {
		vec4 texture1 = texture2D (tex1, varCoord1);
		col = texture1.rgb * texture.rgb;
	} else {
		col = color.rgb * texture.rgb;
	}
	col += vec3(secondaryColor);
	vec4 color = vec4 (col, color.a * texture.a);
	col = mix (texture2.rgb, color.rgb, color.a);
	gl_FragColor = vec4 (col, max(texture.a, texture2.a));
}