File: rocketui-f.sdr

package info (click to toggle)
freespace2 24.2.0%2Brepack-1
  • links: PTS, VCS
  • area: non-free
  • in suites: forky, sid
  • size: 43,716 kB
  • sloc: cpp: 595,001; ansic: 21,741; python: 1,174; sh: 457; makefile: 248; xml: 181
file content (41 lines) | stat: -rw-r--r-- 822 bytes parent folder | download | duplicates (2)
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
30
31
32
33
34
35
36
37
38
39
40
41

in vec2 fragTexCoord;
in vec4 fragColor;
in vec2 fragScreenPosition;

out vec4 fragOut0;

uniform sampler2DArray baseMap;

layout (std140) uniform genericData {
	mat4 projMatrix;

	vec2 offset;
	bool textured;
	int baseMapIndex;

	float horizontalSwipeOffset;
};

void main() {
	if (fragScreenPosition.x > horizontalSwipeOffset) {
		discard;
	}

	float distance = horizontalSwipeOffset - fragScreenPosition.x;

	vec4 color;
	if (textured) {
		color = texture(baseMap, vec3(fragTexCoord, float(baseMapIndex))) * fragColor;
	} else {
		color = fragColor;
	}

	// Hard-coded for now but can be easily made configurable should that be needed at some point
	if (distance < 10.f) {
		// Only change the colors but not the alpha channel to preserve the transparent part of text
		color.xyz = vec3(1.0);
	}

	fragOut0 = color;
}