-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathScreenBlit.frag
More file actions
27 lines (21 loc) · 816 Bytes
/
ScreenBlit.frag
File metadata and controls
27 lines (21 loc) · 816 Bytes
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
#version 300 es
precision highp float;
precision highp sampler2D;
in highp vec2 textureUV;
out highp vec4 FragColor;
uniform highp sampler2D rteTexture;
uniform highp sampler2D rteGUITexture;
vec4 texture2DAA(sampler2D tex, vec2 uv) {
vec2 texsize = vec2(textureSize(tex, 0));
vec2 uv_texspace = uv * texsize;
vec2 seam = floor(uv_texspace + .5);
uv_texspace = (uv_texspace - seam) / fwidth(uv_texspace) + seam;
uv_texspace = clamp(uv_texspace, seam - .5, seam + .5);
return texture(tex, uv_texspace / texsize);
}
void main() {
vec4 guiColor = texture2DAA(rteGUITexture, textureUV);
float guiSolid = step(0.00000001, guiColor.r + guiColor.g + guiColor.b);
float blendRatio = max(guiColor.a, guiSolid);
FragColor = (texture2DAA(rteTexture, textureUV) * (1.0F - blendRatio)) + guiColor * blendRatio;
}