diff options
author | Sean Harmer <sean.harmer@kdab.com> | 2015-11-07 19:02:14 +0000 |
---|---|---|
committer | Paul Lemire <paul.lemire@kdab.com> | 2015-11-17 19:41:18 +0000 |
commit | 26a118cfbce29014864f6cdddae66cccb65ffb4f (patch) | |
tree | daea9f2fc41c1df586c35cd56daa61f920ce5b58 /examples/qt3d/gltf | |
parent | ace675a084ab944a245500b9f54be653126c3147 (diff) |
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 <paul.lemire@kdab.com>
Diffstat (limited to 'examples/qt3d/gltf')
-rw-r--r-- | examples/qt3d/gltf/Wine.qml | 43 | ||||
-rw-r--r-- | examples/qt3d/gltf/main.qml | 8 |
2 files changed, 19 insertions, 32 deletions
diff --git a/examples/qt3d/gltf/Wine.qml b/examples/qt3d/gltf/Wine.qml index 6e9b1a4c9..7a1506ba5 100644 --- a/examples/qt3d/gltf/Wine.qml +++ b/examples/qt3d/gltf/Wine.qml @@ -40,37 +40,28 @@ import Qt3D.Render 2.0 Entity { id: root - property alias x: wineTranslate.dx - property alias y: wineTranslate.dy - property alias z: wineTranslate.dz - property alias angleX: rotateX.angle - property alias angleY: rotateY.angle - property alias angleZ: rotateZ.angle - property alias scale: wineScale.scale + property vector3d position: Qt.vector3d(0, 0, 0) + property real angleX: 0 + property real angleY: 0 + property real angleZ: 0 + property real scale: 1 components: [ Transform { - Rotate { - id: rotateX - axis: Qt.vector3d(1, 0, 0) - } - Rotate { - id: rotateY - axis: Qt.vector3d(0, 1, 0) - } - Rotate { - id: rotateZ - axis: Qt.vector3d(0, 0, 1) - } - Translate { - id: wineTranslate - } - Scale { - id: wineScale + matrix: { + var m = Qt.matrix4x4(1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1); + m.translate(root.position); + m.rotate(root.angleX, Qt.vector3d(1, 0, 0)) + m.rotate(root.angleY, Qt.vector3d(0, 1, 0)) + m.rotate(root.angleZ, Qt.vector3d(0, 0, 1)) + m.scale(root.scale); + return m; } }, - SceneLoader - { + SceneLoader { source: "qrc:/assets/gltf/wine/wine.gltf" } ] diff --git a/examples/qt3d/gltf/main.qml b/examples/qt3d/gltf/main.qml index 87a05c15d..c244c24f8 100644 --- a/examples/qt3d/gltf/main.qml +++ b/examples/qt3d/gltf/main.qml @@ -50,7 +50,7 @@ Entity { farPlane : 1000.0 position: Qt.vector3d( 0.0, 20.0, -120.0 ) upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) - viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) + viewCenter: Qt.vector3d( 0.0, 10.0, 0.0 ) } Configuration { @@ -79,11 +79,7 @@ Entity { Wine { id: wineRack - scale: 1 - x: -60.0 - y: -20.0 - z: 0.0 + position: Qt.vector3d(-60.0, 0.0, 50.0) angleX: 180 } - } |