summaryrefslogtreecommitdiffstats
path: root/src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert
diff options
context:
space:
mode:
authorJere Tuliniemi <jere.tuliniemi@qt.io>2019-05-20 13:12:37 +0300
committerJere Tuliniemi <jere.tuliniemi@qt.io>2019-05-20 14:12:47 +0300
commitd7bbf9d82e9f129877e6d304b527071155348c59 (patch)
tree361b362deb1752274112f63890d04c9ae8a0b6d0 /src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert
parent52092eb06cb659f661d757ae6c2351e58ebbdc1b (diff)
Copy distance field shader changes to OpenGL runtime
Also fixes the OpenGL runtime to use alpha channel for the glyph texture when using ES2. Task-number: QT3DS-3343 Change-Id: Ia37c341802e504da21ebeaff6f3f1f5b50bd1bfe Reviewed-by: Mahmoud Badri <mahmoud.badri@qt.io> Reviewed-by: Miikka Heikkinen <miikka.heikkinen@qt.io> Reviewed-by: Antti Määttä <antti.maatta@qt.io>
Diffstat (limited to 'src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert')
-rw-r--r--src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert28
1 files changed, 0 insertions, 28 deletions
diff --git a/src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert b/src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert
index 9be245b8..7d9736e5 100644
--- a/src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert
+++ b/src/Runtime/res/effectlib/distancefieldtext_dropshadow_core.vert
@@ -5,7 +5,6 @@ in vec4 textureBounds;
out vec2 sampleCoord;
out vec2 shadowSampleCoord;
-out vec2 alphas;
out vec4 normalizedTextureBounds;
uniform mat4 mvp;
@@ -14,35 +13,8 @@ uniform int textureHeight;
uniform float fontScale;
uniform vec2 shadowOffset;
-float thresholdFunc(float scale)
-{
- float base = 0.5;
- float baseDev = 0.065;
- float devScaleMin = 0.15;
- float devScaleMax = 0.3;
- return base - ((clamp(scale, devScaleMin, devScaleMax) - devScaleMin)
- / (devScaleMax - devScaleMin) * -baseDev + baseDev);
-}
-
-float spreadFunc(float scale)
-{
- return 0.06 / scale;
-}
-
-vec2 alphaRange(float scale)
-{
- float base = thresholdFunc(scale);
- float range = spreadFunc(scale);
- float alphaMin = max(0.0, base - range);
- float alphaMax = min(base + range, 1.0);
- return vec2(alphaMin, alphaMax);
-}
-
void main()
{
- float scale = fontScale * sqrt(abs(determinant(mvp)));
- alphas = alphaRange(scale);
-
vec2 textureSizeMultiplier = vec2(1.0 / float(textureWidth), 1.0 / float(textureHeight));
sampleCoord = tCoord * textureSizeMultiplier;