summaryrefslogtreecommitdiffstats
path: root/src/Runtime/res/effectlib/distancefieldtext_dropshadow.frag
blob: da51c5c28ea41156f3d9a4f32f55da74d02a889d (plain)
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
varying highp vec2 sampleCoord;
varying highp vec2 alphas;
varying highp vec2 shadowSampleCoord;
varying highp vec4 normalizedTextureBounds;

uniform sampler2D _qt_texture;
uniform highp vec4 color;
uniform highp vec4 shadowColor;

void main()
{
    highp float shadowAlpha = smoothstep(alphas.x,
                                         alphas.y,
                                         texture2D(_qt_texture,
                                                   clamp(shadowSampleCoord,
                                                         normalizedTextureBounds.xy,
                                                         normalizedTextureBounds.zw)).a);
    highp vec4 shadowPixel = shadowColor * shadowAlpha;

    highp float textAlpha = smoothstep(alphas.x,
                                       alphas.y,
                                       texture2D(_qt_texture,
                                                 clamp(sampleCoord,
                                                       normalizedTextureBounds.xy,
                                                       normalizedTextureBounds.zw)).a);
    highp vec4 textPixel = color * textAlpha;

    gl_FragColor = mix(shadowPixel, textPixel, textPixel.a);
}