diff options
Diffstat (limited to 'examples/shadereffectitem/Effectoids/Directional4PointBlur.qml')
-rw-r--r-- | examples/shadereffectitem/Effectoids/Directional4PointBlur.qml | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml new file mode 100644 index 0000000..2c8c732 --- /dev/null +++ b/examples/shadereffectitem/Effectoids/Directional4PointBlur.qml @@ -0,0 +1,46 @@ +import QtQuick 2.0 + +ShaderEffectItem +{ + fragmentShader: + "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord2; \n" + + "varying highp vec2 qt_TexCoord3; \n" + + "varying highp vec2 qt_TexCoord4; \n" + + "uniform sampler2D qt_Texture; \n" + + "void main() { \n" + + " gl_FragColor = ( 2. / 6. * texture2D(qt_Texture, qt_TexCoord) \n" + + " + 1. / 6. * texture2D(qt_Texture, qt_TexCoord2) \n" + + " + 2. / 6. * texture2D(qt_Texture, qt_TexCoord3) \n" + + " + 1. / 6. * texture2D(qt_Texture, qt_TexCoord4)); \n" + + "}" + + vertexShader: + "attribute highp vec4 qt_VertexPosition; \n" + + "attribute highp vec2 qt_VertexTexCoord; \n" + + "uniform highp mat4 qt_Matrix; \n" + + "uniform highp float xStep; \n" + + "uniform highp float yStep; \n" + + "uniform highp float spread; \n" + + "varying highp vec2 qt_TexCoord; \n" + + "varying highp vec2 qt_TexCoord2; \n" + + "varying highp vec2 qt_TexCoord3; \n" + + "varying highp vec2 qt_TexCoord4; \n" + + "void main() { \n" + + " highp vec2 shift = vec2(xStep, yStep); \n" + + " qt_TexCoord = 0.7 * spread * shift + qt_VertexTexCoord; \n" + + " qt_TexCoord2 = 2.7 * spread * shift + qt_VertexTexCoord; \n" + + " qt_TexCoord3 = -0.7 * spread * shift + qt_VertexTexCoord; \n" + + " qt_TexCoord4 = -2.7 * spread * shift + qt_VertexTexCoord; \n" + + " gl_Position = qt_Matrix * qt_VertexPosition; \n" + + "}" + + + property real spread: 1; + property real xStep: 0 / width; + property real yStep: 1 / height; + active: spread > 0 + anchors.fill: source + smooth: true + +} |