summaryrefslogtreecommitdiffstats
path: root/tests/qmldynamicdata
diff options
context:
space:
mode:
authorMiikka Heikkinen <miikka.heikkinen@digia.com>2014-02-07 15:30:53 +0200
committerMiikka Heikkinen <miikka.heikkinen@digia.com>2014-02-10 08:25:28 +0200
commit61c84e2d9c46de40d22f6fafbdd23d4015025516 (patch)
tree13c04fa5a90e75d5730babd6ab1cefef54b54417 /tests/qmldynamicdata
parentffc2e2039f58de256a98da395b5d0e87d5a176fc (diff)
Mostly revert the rotations refactor
Quaternions are actually easier to use in most use cases. Added some convenience functionality for QML to enable using axis/angle combinations, too. Change-Id: I61c76e0967b4808aa9adaf43dfe6f4596c9ce353 Reviewed-by: Tomi Korpipää <tomi.korpipaa@digia.com>
Diffstat (limited to 'tests/qmldynamicdata')
-rw-r--r--tests/qmldynamicdata/qml/qmldynamicdata/main.qml22
1 files changed, 10 insertions, 12 deletions
diff --git a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml
index 03bf4b2d..ff5ea16d 100644
--- a/tests/qmldynamicdata/qml/qmldynamicdata/main.qml
+++ b/tests/qmldynamicdata/qml/qmldynamicdata/main.qml
@@ -28,8 +28,8 @@ Item {
ListModel {
id: graphModel
- ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotationAxis: "1.0,1.0,1.0"; rotationAngle: 45 }
- ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0; rotationAxis: "1.0,1.0,1.0"; rotationAngle: 45 }
+ ListElement{ xPos: 0.0; yPos: 0.0; zPos: 0.0; rotation: "0.92388, 0.220942, 0.220942, 0.220942"}
+ ListElement{ xPos: 1.0; yPos: 1.0; zPos: 1.0; rotation: "@45,1.0,1.0,1.0" }
}
Timer {
@@ -38,24 +38,23 @@ Item {
running: true
repeat: true
property bool isIncreasing: true
+ property real rotationAngle: 0
- function generateAngle() {
- return Math.random() * 360
- }
-
- function generateAxis() {
- return Math.random() + "," + Math.random() + "," + Math.random()
+ function generateQuaternion() {
+ return "@" + Math.random() * 360 + "," + Math.random() + "," + Math.random() + "," + Math.random()
}
function appendRow() {
graphModel.append({"xPos": Math.random(),
"yPos": Math.random(),
"zPos": Math.random(),
- "rotationAxis": generateAxis(),
- "rotationAngle": generateAngle()});
+ "rotation": generateQuaternion()
+ });
}
onTriggered: {
+ rotationAngle = rotationAngle + 1
+ scatterSeries.setMeshAxisAndAngle(Qt.vector3d(1,1,1), rotationAngle)
if (isIncreasing) {
appendRow()
appendRow()
@@ -130,8 +129,7 @@ Item {
xPosRole: "xPos"
yPosRole: "yPos"
zPosRole: "zPos"
- rotationAxisRole: "rotationAxis"
- rotationAngleRole: "rotationAngle"
+ rotationRole: "rotation"
}
}
}