diff options
author | Kevin Ottens <kevin.ottens@kdab.com> | 2017-05-04 13:00:16 +0200 |
---|---|---|
committer | Jani Heikkinen <jani.heikkinen@qt.io> | 2017-05-05 04:47:57 +0000 |
commit | 043b8bc956eafcf63da88ef011e73bb5dbcc6683 (patch) | |
tree | e25ddb2c88413aece334d5b7619b2cc94991c1e6 /src/extras/geometries/qplanemesh.cpp | |
parent | 6fd0fc4217fe689092957e0bad8a927acb4aa09a (diff) |
Add a new mirrored property to QPlane(Mesh|Geometry)
This is regularly necessary to be able to flip vertically the UV
coordinates on the plane mesh depending if we are using a texture in
model space coords or in window coords. Especially necessary now with
Scene2D which outputs textures in window coords. This property is
necessary to make it usable.
Change-Id: I0fe7d3fdc125f1791492cf39ebe908bbc20f1db2
Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
Diffstat (limited to 'src/extras/geometries/qplanemesh.cpp')
-rw-r--r-- | src/extras/geometries/qplanemesh.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/extras/geometries/qplanemesh.cpp b/src/extras/geometries/qplanemesh.cpp index 5991c5397..4804df024 100644 --- a/src/extras/geometries/qplanemesh.cpp +++ b/src/extras/geometries/qplanemesh.cpp @@ -73,6 +73,13 @@ namespace Qt3DExtras { */ /*! + * \qmlproperty bool PlaneMesh::mirrored + * \since 5.9 + * + * Controls if the UV coordinates of the plane should be flipped vertically. + */ + +/*! * \class Qt3DExtras::QPlaneMesh * \inheaderfile Qt3DExtras/QPlaneMesh * \inmodule Qt3DExtras @@ -92,6 +99,7 @@ QPlaneMesh::QPlaneMesh(QNode *parent) QObject::connect(geometry, &QPlaneGeometry::widthChanged, this, &QPlaneMesh::widthChanged); QObject::connect(geometry, &QPlaneGeometry::heightChanged, this, &QPlaneMesh::heightChanged); QObject::connect(geometry, &QPlaneGeometry::resolutionChanged, this, &QPlaneMesh::meshResolutionChanged); + QObject::connect(geometry, &QPlaneGeometry::mirroredChanged, this, &QPlaneMesh::mirroredChanged); QGeometryRenderer::setGeometry(geometry); } @@ -147,6 +155,22 @@ QSize QPlaneMesh::meshResolution() const return static_cast<QPlaneGeometry *>(geometry())->resolution(); } +void QPlaneMesh::setMirrored(bool mirrored) +{ + static_cast<QPlaneGeometry *>(geometry())->setMirrored(mirrored); +} + +/*! + * \property QPlaneMesh::mirrored + * \since 5.9 + * + * Controls if the UV coordinates of the plane should be flipped vertically. + */ +bool QPlaneMesh::mirrored() const +{ + return static_cast<QPlaneGeometry *>(geometry())->mirrored(); +} + } // namespace Qt3DExtras QT_END_NAMESPACE |