summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2015-11-11 16:35:30 +0000
committerSean Harmer <sean.harmer@kdab.com>2015-11-20 18:28:13 +0000
commit8f6462aa1f0f29c8f39d25214c4ccf802824f2d5 (patch)
tree87810d10c3882480a402be1130a29a66e87a6e06
parenta081396ccea6903ee9bd9c07a3c0694f92f91e1f (diff)
Adapt examples to use new quaternion helpers
Change-Id: If9100fbc1870c09d90c9c1df102cf9c0503b96cb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
-rw-r--r--examples/qt3d/anaglyph-rendering/main.qml29
-rw-r--r--examples/qt3d/controls/Logo.qml9
-rw-r--r--examples/qt3d/gltf/Wine.qml12
-rw-r--r--examples/qt3d/loader-qml/main.qml8
-rw-r--r--examples/qt3d/materials/TrefoilKnot.qml11
-rw-r--r--examples/qt3d/transforms-qml/TrefoilKnot.qml12
-rw-r--r--examples/qt3d/wave/Wave.qml11
-rw-r--r--examples/qt3d/wireframe/TrefoilKnot.qml11
8 files changed, 26 insertions, 77 deletions
diff --git a/examples/qt3d/anaglyph-rendering/main.qml b/examples/qt3d/anaglyph-rendering/main.qml
index 54902d777..cb852a675 100644
--- a/examples/qt3d/anaglyph-rendering/main.qml
+++ b/examples/qt3d/anaglyph-rendering/main.qml
@@ -88,15 +88,7 @@ Entity {
id: cylinderTransform
property real theta: 0.0
property real phi: 0.0
- property real userScale: 1.0
-
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(phi, Qt.vector3d(0.0, 1.0, 0.0));
- m.rotate(theta, Qt.vector3d(1.0, 0.0, 0.0));
- m.scale(userScale);
- return m;
- }
+ rotation: fromEulerAngles(theta, phi, 0)
}
property Material phong: PhongMaterial {}
@@ -106,14 +98,14 @@ Entity {
QQ2.SequentialAnimation {
QQ2.NumberAnimation {
target: cylinderTransform
- property: "userScale"
+ property: "scale"
from: 5; to: 45
duration: 2000
easing.type: QQ2.Easing.OutInQuad
}
QQ2.NumberAnimation {
target: cylinderTransform
- property: "userScale"
+ property: "scale"
from: 45; to: 5
duration: 2000
easing.type: QQ2.Easing.InOutQuart
@@ -145,16 +137,11 @@ Entity {
Transform {
id: planeTransform
property real rollAngle: 0.0
-
- matrix: {
- var m = Qt.matrix4x4();
- m.translate(Qt.vector3d(Math.sin(stereoCamera.circleRotation * -2) * obstaclesRepeater.radius,
- 0.0,
- Math.cos(stereoCamera.circleRotation * -2) * obstaclesRepeater.radius))
- m.rotate(stereoCamera.circleRotation * -2 * 180 / Math.PI + 180, Qt.vector3d(0.0, 1.0, 0.0));
- m.rotate(planeTransform.rollAngle, Qt.vector3d(1.0, 0.0, 0.0));
- return m;
- }
+ translation: Qt.vector3d(Math.sin(stereoCamera.circleRotation * -2) * obstaclesRepeater.radius,
+ 0.0,
+ Math.cos(stereoCamera.circleRotation * -2) * obstaclesRepeater.radius)
+ rotation: fromAxesAndAngles(Qt.vector3d(1.0, 0.0, 0.0), planeTransform.rollAngle,
+ Qt.vector3d(0.0, 1.0, 0.0), stereoCamera.circleRotation * -2 * 180 / Math.PI + 180)
},
PhongMaterial {
shininess: 20.0
diff --git a/examples/qt3d/controls/Logo.qml b/examples/qt3d/controls/Logo.qml
index b3f082973..dbf9d3415 100644
--- a/examples/qt3d/controls/Logo.qml
+++ b/examples/qt3d/controls/Logo.qml
@@ -75,14 +75,7 @@ Entity {
Transform {
id: logoTransform
-
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(rotation_z.value, Qt.vector3d(0, 0, 1));
- m.rotate(rotation_y.value, Qt.vector3d(0, 1, 0));
- m.rotate(rotation_x.value, Qt.vector3d(1, 0, 0));
- return m;
- }
+ rotation: fromEulerAngles( rotation_x.value, rotation_y.value, rotation_z.value )
}
Mesh {
diff --git a/examples/qt3d/gltf/Wine.qml b/examples/qt3d/gltf/Wine.qml
index 676cffb77..e743ad2d9 100644
--- a/examples/qt3d/gltf/Wine.qml
+++ b/examples/qt3d/gltf/Wine.qml
@@ -48,15 +48,9 @@ Entity {
components: [
Transform {
- matrix: {
- var m = Qt.matrix4x4();
- 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;
- }
+ translation: root.position
+ rotation: fromEulerAngles(root.angleX, root.angleY, root.angleZ)
+ scale: root.scale
},
SceneLoader {
source: "qrc:/assets/gltf/wine/wine.gltf"
diff --git a/examples/qt3d/loader-qml/main.qml b/examples/qt3d/loader-qml/main.qml
index 791acc600..76b7d3378 100644
--- a/examples/qt3d/loader-qml/main.qml
+++ b/examples/qt3d/loader-qml/main.qml
@@ -81,12 +81,8 @@ Entity {
Transform {
id: torusTransform
- matrix: {
- var m = Qt.matrix4x4();
- m.rotate(45, Qt.vector3d(1, 0, 0));
- m.scale(Qt.vector3d(1.5, 1, 0.5));
- return m;
- }
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
}
Entity {
diff --git a/examples/qt3d/materials/TrefoilKnot.qml b/examples/qt3d/materials/TrefoilKnot.qml
index 26894f17c..dc124480b 100644
--- a/examples/qt3d/materials/TrefoilKnot.qml
+++ b/examples/qt3d/materials/TrefoilKnot.qml
@@ -52,14 +52,9 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4();
- m.translate(Qt.vector3d(root.x, root.y, root.z));
- m.rotate(phi, Qt.vector3d(0, 1, 0));
- m.rotate(theta, Qt.vector3d(1, 0, 0));
- m.scale(root.scale);
- return m;
- }
+ translation: Qt.vector3d(root.x, root.y, root.z)
+ rotation: fromEulerAngles(theta, phi, 0)
+ scale: root.scale
}
Mesh {
diff --git a/examples/qt3d/transforms-qml/TrefoilKnot.qml b/examples/qt3d/transforms-qml/TrefoilKnot.qml
index 10028ded0..a53a45dd6 100644
--- a/examples/qt3d/transforms-qml/TrefoilKnot.qml
+++ b/examples/qt3d/transforms-qml/TrefoilKnot.qml
@@ -50,15 +50,9 @@ Entity {
Transform {
id: transform
-
- matrix: {
- var m = Qt.matrix4x4();
- m.translate( root.translation );
- m.rotate( root.theta, Qt.vector3d( 1.0, 0.0, 0.0 ) );
- m.rotate( root.phi, Qt.vector3d( 0.0, 1.0, 0.0 ) );
- m.scale( root.scale );
- return m;
- }
+ translation: root.translation
+ rotation: fromEulerAngles(theta, phi, 0)
+ scale: root.scale
}
Mesh {
diff --git a/examples/qt3d/wave/Wave.qml b/examples/qt3d/wave/Wave.qml
index 0ec12db10..3af082ded 100644
--- a/examples/qt3d/wave/Wave.qml
+++ b/examples/qt3d/wave/Wave.qml
@@ -59,14 +59,9 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4();
- m.translate(Qt.vector3d(root.x, root.y, root.z));
- m.rotate(root.phi, Qt.vector3d(0, 1, 0));
- m.rotate(root.theta, Qt.vector3d(1, 0, 0));
- m.scale(root.scale);
- return m;
- }
+ translation: Qt.vector3d(root.x, root.y, root.z);
+ rotation: fromEulerAngles(root.theta, root.phi)
+ scale: root.scale
}
WaveMaterial {
diff --git a/examples/qt3d/wireframe/TrefoilKnot.qml b/examples/qt3d/wireframe/TrefoilKnot.qml
index dbdae18dc..dc124480b 100644
--- a/examples/qt3d/wireframe/TrefoilKnot.qml
+++ b/examples/qt3d/wireframe/TrefoilKnot.qml
@@ -52,14 +52,9 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4();
- m.translate(Qt.vector3d(root.x, root.y, root.z));
- m.rotate(root.phi, Qt.vector3d(0, 1, 0));
- m.rotate(root.theta, Qt.vector3d(1, 0, 0));
- m.scale(root.scale);
- return m;
- }
+ translation: Qt.vector3d(root.x, root.y, root.z)
+ rotation: fromEulerAngles(theta, phi, 0)
+ scale: root.scale
}
Mesh {