diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-11-11 10:48:48 +0000 |
---|---|---|
committer | Sean Harmer <sean.harmer@kdab.com> | 2015-11-11 22:12:35 +0000 |
commit | ded64d03686268b9ead0f0b5c9299683859a1160 (patch) | |
tree | df61b16b813c8bd3e58dbd5b14dd446dff862646 | |
parent | 15a07dbd30e3b242a0495eb6a3316411b493fab3 (diff) |
Make the qml/js matrix4x4 type more useful
This is used in Qt3D. We also added these additional functions there
but for a nice user experience that doesn't kick up errors depending
upon the order in which QML modules are imported it would be useful to
add these new functions here too.
In the long term it would be nice if these QtGui type wrappers were in
a qtqmlgui module that was implicitly imported by both QtQuick and Qt3D.
Change-Id: Iab03bb6c79b89bcecb4b3204cd0cb01d71f36701
Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
-rw-r--r-- | src/quick/util/qquickvaluetypes_p.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/src/quick/util/qquickvaluetypes_p.h b/src/quick/util/qquickvaluetypes_p.h index 3b196da206..4c2b488660 100644 --- a/src/quick/util/qquickvaluetypes_p.h +++ b/src/quick/util/qquickvaluetypes_p.h @@ -255,6 +255,13 @@ public: void setM43(qreal value) { v(3, 2) = value; } void setM44(qreal value) { v(3, 3) = value; } + Q_INVOKABLE void translate(const QVector3D &t) { v.translate(t); } + Q_INVOKABLE void rotate(float angle, const QVector3D &axis) { v.rotate(angle, axis); } + Q_INVOKABLE void scale(float s) { v.scale(s); } + Q_INVOKABLE void scale(float sx, float sy, float sz) { v.scale(sx, sy, sz); } + Q_INVOKABLE void scale(const QVector3D &s) { v.scale(s); } + Q_INVOKABLE void lookAt(const QVector3D &eye, const QVector3D ¢er, const QVector3D &up) { v.lookAt(eye, center, up); } + Q_INVOKABLE QMatrix4x4 times(const QMatrix4x4 &m) const; Q_INVOKABLE QVector4D times(const QVector4D &vec) const; Q_INVOKABLE QVector3D times(const QVector3D &vec) const; |