diff options
Diffstat (limited to 'src/runtime/shaders/distancefieldtext_dropshadow.frag')
-rw-r--r-- | src/runtime/shaders/distancefieldtext_dropshadow.frag | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/runtime/shaders/distancefieldtext_dropshadow.frag b/src/runtime/shaders/distancefieldtext_dropshadow.frag new file mode 100644 index 0000000..da51c5c --- /dev/null +++ b/src/runtime/shaders/distancefieldtext_dropshadow.frag @@ -0,0 +1,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); +} |