aboutsummaryrefslogtreecommitdiffstats
path: root/src/declarative/items/qsgshadereffectmesh.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/declarative/items/qsgshadereffectmesh.cpp')
-rw-r--r--src/declarative/items/qsgshadereffectmesh.cpp42
1 files changed, 39 insertions, 3 deletions
diff --git a/src/declarative/items/qsgshadereffectmesh.cpp b/src/declarative/items/qsgshadereffectmesh.cpp
index 6d3d17e4ff..53fd917e06 100644
--- a/src/declarative/items/qsgshadereffectmesh.cpp
+++ b/src/declarative/items/qsgshadereffectmesh.cpp
@@ -51,8 +51,9 @@ QSGShaderEffectMesh::QSGShaderEffectMesh(QObject *parent)
}
/*!
- \class QSGGridMesh
- \since 5.0
+ \qmlclass GridMesh QSGGridMesh
+ \inqmlmodule QtQuick 2
+ \ingroup qml-utility-elements
\brief GridMesh defines a mesh with vertices arranged in a grid.
GridMesh defines a rectangular mesh consisting of vertices arranged in an
@@ -152,12 +153,47 @@ QSGGeometry *QSGGridMesh::updateGeometry(QSGGeometry *geometry, const QVector<QB
}
/*!
- \property QSGGridMesh::resolution
+ \qmlproperty size QtQuick2::GridMesh::resolution
This property holds the grid resolution. The resolution's width and height
specify the number of cells or spacings between vertices horizontally and
vertically respectively. The minimum and default is 1x1, which corresponds
to four vertices in total, one in each corner.
+ For non-linear vertex transformations, you probably want to set the
+ resolution higher.
+
+ \row
+ \o \image declarative-gridmesh.png
+ \o \qml
+ import QtQuick 2.0
+
+ ShaderEffect {
+ width: 200
+ height: 200
+ mesh: GridMesh {
+ resolution: Qt.size(20, 20)
+ }
+ property variant source: Image {
+ source: "qt-logo.png"
+ sourceSize { width: 200; height: 200 }
+ smooth: true
+ }
+ vertexShader: "
+ uniform highp mat4 qt_Matrix;
+ attribute highp vec4 qt_Vertex;
+ attribute highp vec2 qt_MultiTexCoord0;
+ varying highp vec2 qt_TexCoord0;
+ uniform highp float width;
+ void main() {
+ highp vec4 pos = qt_Vertex;
+ highp float d = .5 * smoothstep(0., 1., qt_MultiTexCoord0.y);
+ pos.x = width * mix(d, 1.0 - d, qt_MultiTexCoord0.x);
+ gl_Position = qt_Matrix * pos;
+ qt_TexCoord0 = qt_MultiTexCoord0;
+ }"
+ }
+ \endqml
+ \endrow
*/
void QSGGridMesh::setResolution(const QSize &res)