From 26a118cfbce29014864f6cdddae66cccb65ffb4f Mon Sep 17 00:00:00 2001 From: Sean Harmer Date: Sat, 7 Nov 2015 19:02:14 +0000 Subject: Remove transforms property of QTransform Compound transformations are now built up using QMatrix4x4 in both QML and C++. Updating examples accordingly. Change-Id: I03c9abf1f6cdd1b56226dc0e16a7ad5ce84516dd Reviewed-by: Paul Lemire --- examples/qt3d/simple-qml/main.qml | 34 ++++++++++++++++++++-------------- 1 file changed, 20 insertions(+), 14 deletions(-) (limited to 'examples/qt3d/simple-qml/main.qml') diff --git a/examples/qt3d/simple-qml/main.qml b/examples/qt3d/simple-qml/main.qml index 517ffa3a5..559aec1e8 100644 --- a/examples/qt3d/simple-qml/main.qml +++ b/examples/qt3d/simple-qml/main.qml @@ -34,9 +34,9 @@ ** ****************************************************************************/ +import QtQuick 2.2 as QQ2 import Qt3D.Core 2.0 import Qt3D.Render 2.0 -import QtQuick 2.2 as QQ2 Entity { id: sceneRoot @@ -80,10 +80,14 @@ Entity { Transform { id: torusTransform - Scale { scale3D: Qt.vector3d(1.5, 1, 0.5) } - Rotate { - angle: 45 - axis: Qt.vector3d(1, 0, 0) + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.scale(Qt.vector3d(1.5, 1, 0.5)); + m.rotate(45, Qt.vector3d(1, 0, 0)); + return m; } } @@ -99,19 +103,21 @@ Entity { Transform { id: sphereTransform - Translate { - translation: Qt.vector3d(20, 0, 0) - } - - Rotate { - id: sphereRotation - axis: Qt.vector3d(0, 1, 0) + property real userAngle: 0.0 + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.rotate(userAngle, Qt.vector3d(0, 1, 0)); + m.translate(Qt.vector3d(20, 0, 0)); + return m; } } QQ2.NumberAnimation { - target: sphereRotation - property: "angle" + target: sphereTransform + property: "userAngle" duration: 10000 from: 0 to: 360 -- cgit v1.2.3