diff options
author | Craig Scott <craig.scott@qt.io> | 2021-05-31 16:40:54 +1000 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2021-06-05 12:52:00 +0200 |
commit | 5e8feb64d6a3cf50360c066e4595e41021bd0f9c (patch) | |
tree | c7901024f6c082dab14c97d109853ab5a64db1e1 /src/quickcontrols2/material/shaders/RectangularGlow.frag | |
parent | 284936db8327f030473c0533041ee850f5369bdd (diff) |
Update to latest qml CMake API
The new qml CMake API places a closer relationship between
the backing target and the plugin target. Both are typically
created together and they share a lot of common details.
Instead of creating them in different parts of the source
tree, they are now specified together. The src/imports
area has effectively been absorbed into the other
corresponding subdirectories below src with this change.
Task-number: QTBUG-91621
Change-Id: I9bd32e9eb78c198ccc9db04e2829303cac323502
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Diffstat (limited to 'src/quickcontrols2/material/shaders/RectangularGlow.frag')
-rw-r--r-- | src/quickcontrols2/material/shaders/RectangularGlow.frag | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/quickcontrols2/material/shaders/RectangularGlow.frag b/src/quickcontrols2/material/shaders/RectangularGlow.frag new file mode 100644 index 00000000..40bab580 --- /dev/null +++ b/src/quickcontrols2/material/shaders/RectangularGlow.frag @@ -0,0 +1,19 @@ +uniform highp float qt_Opacity; +uniform mediump float relativeSizeX; +uniform mediump float relativeSizeY; +uniform mediump float spread; +uniform lowp vec4 color; +varying highp vec2 qt_TexCoord0; + +highp float linearstep(highp float e0, highp float e1, highp float x) { + return clamp((x - e0) / (e1 - e0), 0.0, 1.0); +} + +void main() { + lowp float alpha = + smoothstep(0.0, relativeSizeX, 0.5 - abs(0.5 - qt_TexCoord0.x)) * + smoothstep(0.0, relativeSizeY, 0.5 - abs(0.5 - qt_TexCoord0.y)); + + highp float spreadMultiplier = linearstep(spread, 1.0 - spread, alpha); + gl_FragColor = color * qt_Opacity * spreadMultiplier * spreadMultiplier; +} |