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;
}
|