summaryrefslogtreecommitdiffstats
path: root/examples/qt3d
diff options
context:
space:
mode:
Diffstat (limited to 'examples/qt3d')
-rw-r--r--examples/qt3d/anaglyph-rendering/main.qml15
-rw-r--r--examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml11
-rw-r--r--examples/qt3d/custom-mesh-qml/main.qml11
-rw-r--r--examples/qt3d/cylinder-qml/main.qml11
-rw-r--r--examples/qt3d/deferred-renderer-qml/main.qml9
-rw-r--r--examples/qt3d/loader-qml/CuboidEntity.qml11
-rw-r--r--examples/qt3d/materials/RenderableEntity.qml13
-rw-r--r--examples/qt3d/multiviewport/main.qml9
-rw-r--r--examples/qt3d/plasma/main.qml9
-rw-r--r--examples/qt3d/scene3d-loader/AnimatedEntity.qml22
-rw-r--r--examples/qt3d/scene3d-loader/Scene2.qml11
-rw-r--r--examples/qt3d/scene3d/AnimatedEntity.qml18
-rw-r--r--examples/qt3d/shadow-map-qml/Trefoil.qml9
-rw-r--r--examples/qt3d/simple-qml/main.qml11
-rw-r--r--examples/qt3d/tessellation-modes/TessellatedQuad.qml13
-rw-r--r--examples/qt3d/torus-qml/main.qml11
-rw-r--r--examples/qt3d/wave/Background.qml9
17 files changed, 37 insertions, 166 deletions
diff --git a/examples/qt3d/anaglyph-rendering/main.qml b/examples/qt3d/anaglyph-rendering/main.qml
index c6185048c..54902d777 100644
--- a/examples/qt3d/anaglyph-rendering/main.qml
+++ b/examples/qt3d/anaglyph-rendering/main.qml
@@ -204,17 +204,10 @@ Entity {
Transform {
id: transform
readonly property real angle: Math.PI * 2.0 * index * obstaclesRepeater.det
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.translate(Qt.vector3d(obstaclesRepeater.radius * Math.cos(transform.angle),
- 0.0,
- obstaclesRepeater.radius * Math.sin(transform.angle)))
- m.rotate(transform.angle * 180 / Math.PI, Qt.vector3d(0.0, 1.0, 0.0));
- return m;
- }
+ translation: Qt.vector3d(obstaclesRepeater.radius * Math.cos(transform.angle),
+ 0.0,
+ obstaclesRepeater.radius * Math.sin(transform.angle))
+ rotation: fromAxisAndAngle(Qt.vector3d(0.0, 1.0, 0.0), transform.angle * 180 / Math.PI)
},
PhongMaterial {
diffuse: Qt.rgba(Math.abs(Math.cos(transform.angle)), 204 / 255, 75 / 255, 1)
diff --git a/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml b/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml
index cccab558c..f7f963c7b 100644
--- a/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml
+++ b/examples/qt3d/clip-planes-qml/ClipPlaneEntity.qml
@@ -60,15 +60,8 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.translate(root.center);
- m.rotate(root.rotateAngle, root.rotateAxis);
- return m;
- }
+ translation: root.center
+ rotation: fromAxisAndAngle(root.rotateAxis, root.rotateAngle)
}
property Layer layer: Layer {
diff --git a/examples/qt3d/custom-mesh-qml/main.qml b/examples/qt3d/custom-mesh-qml/main.qml
index 05b45f793..74272f83a 100644
--- a/examples/qt3d/custom-mesh-qml/main.qml
+++ b/examples/qt3d/custom-mesh-qml/main.qml
@@ -208,15 +208,8 @@ Entity {
Transform {
id: meshTransform
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.scale(10);
- return m;
- }
+ scale: 10
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
}
QQ2.NumberAnimation {
diff --git a/examples/qt3d/cylinder-qml/main.qml b/examples/qt3d/cylinder-qml/main.qml
index 82d535e83..4c68d6054 100644
--- a/examples/qt3d/cylinder-qml/main.qml
+++ b/examples/qt3d/cylinder-qml/main.qml
@@ -76,15 +76,8 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.rotate(45, Qt.vector3d(1, 0, 0));
- m.scale(1.5);
- return m;
- }
+ scale: 1.5
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
}
Material {
diff --git a/examples/qt3d/deferred-renderer-qml/main.qml b/examples/qt3d/deferred-renderer-qml/main.qml
index 304320c49..85d6094c1 100644
--- a/examples/qt3d/deferred-renderer-qml/main.qml
+++ b/examples/qt3d/deferred-renderer-qml/main.qml
@@ -69,14 +69,7 @@ Entity {
meshResolution: Qt.size(2, 2)
},
Transform { // We rotate the plane so that it faces us
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.rotate(90, Qt.vector3d(1, 0, 0));
- return m;
- }
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
},
Material {
parameters : [
diff --git a/examples/qt3d/loader-qml/CuboidEntity.qml b/examples/qt3d/loader-qml/CuboidEntity.qml
index f355e30d3..e359ad985 100644
--- a/examples/qt3d/loader-qml/CuboidEntity.qml
+++ b/examples/qt3d/loader-qml/CuboidEntity.qml
@@ -55,15 +55,8 @@ Entity {
Transform {
id: transform
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.scale(4);
- return m;
- }
+ scale: 4
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
}
QQ2.ColorAnimation {
diff --git a/examples/qt3d/materials/RenderableEntity.qml b/examples/qt3d/materials/RenderableEntity.qml
index e309ec8ba..f6883be3a 100644
--- a/examples/qt3d/materials/RenderableEntity.qml
+++ b/examples/qt3d/materials/RenderableEntity.qml
@@ -51,16 +51,9 @@ Entity {
Transform {
id: transform
- 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.rotationAngle, root.rotationAxis);
- m.scale(root.scale);
- return m;
- }
+ scale: root.scale
+ rotation: fromAxisAndAngle(root.rotationAxis, root.rotationAngle)
+ translation: root.position
}
Mesh {
diff --git a/examples/qt3d/multiviewport/main.qml b/examples/qt3d/multiviewport/main.qml
index 9c4626eb4..cfdd7a1a5 100644
--- a/examples/qt3d/multiviewport/main.qml
+++ b/examples/qt3d/multiviewport/main.qml
@@ -117,14 +117,7 @@ Entity {
Entity {
components: [
Transform {
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.rotate(-sceneRoot.rotationAngle, Qt.vector3d(0, 0, 1));
- return m;
- }
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 0, 1), -sceneRoot.rotationAngle)
},
SceneLoader {
source: "qrc:/assets/test_scene.dae"
diff --git a/examples/qt3d/plasma/main.qml b/examples/qt3d/plasma/main.qml
index a15287b41..96aad76f5 100644
--- a/examples/qt3d/plasma/main.qml
+++ b/examples/qt3d/plasma/main.qml
@@ -51,14 +51,7 @@ Entity {
},
Transform { // Rotate the plane so that it faces us
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.rotate(90, Qt.vector3d(1.0, 0.0, 0.0));
- return m;
- }
+ rotation: fromAxisAndAngle(Qt.vector3d(1.0, 0.0, 0.0), 90)
},
Material {
diff --git a/examples/qt3d/scene3d-loader/AnimatedEntity.qml b/examples/qt3d/scene3d-loader/AnimatedEntity.qml
index 5431db8ea..ec7cd7fc8 100644
--- a/examples/qt3d/scene3d-loader/AnimatedEntity.qml
+++ b/examples/qt3d/scene3d-loader/AnimatedEntity.qml
@@ -92,15 +92,8 @@ Entity {
Transform {
id: torusTransform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- 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 {
@@ -116,15 +109,8 @@ Entity {
Transform {
id: sphereTransform
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.translate(Qt.vector3d(20, 0, 0));
- m.rotate(userAngle, Qt.vector3d(0, 1, 0))
- return m;
- }
+ translation: Qt.vector3d(20, 0, 0)
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
}
QQ2.NumberAnimation {
diff --git a/examples/qt3d/scene3d-loader/Scene2.qml b/examples/qt3d/scene3d-loader/Scene2.qml
index 8280b1bb3..df74571c4 100644
--- a/examples/qt3d/scene3d-loader/Scene2.qml
+++ b/examples/qt3d/scene3d-loader/Scene2.qml
@@ -82,15 +82,8 @@ Scene3D {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- 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)
}
Material {
diff --git a/examples/qt3d/scene3d/AnimatedEntity.qml b/examples/qt3d/scene3d/AnimatedEntity.qml
index 5431db8ea..68871f04b 100644
--- a/examples/qt3d/scene3d/AnimatedEntity.qml
+++ b/examples/qt3d/scene3d/AnimatedEntity.qml
@@ -92,15 +92,8 @@ Entity {
Transform {
id: torusTransform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- 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 {
@@ -117,12 +110,9 @@ Entity {
id: sphereTransform
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.translate(Qt.vector3d(20, 0, 0));
+ var m = Qt.matrix4x4();
m.rotate(userAngle, Qt.vector3d(0, 1, 0))
+ m.translate(Qt.vector3d(20, 0, 0));
return m;
}
}
diff --git a/examples/qt3d/shadow-map-qml/Trefoil.qml b/examples/qt3d/shadow-map-qml/Trefoil.qml
index 4691adbd3..315e23a8f 100644
--- a/examples/qt3d/shadow-map-qml/Trefoil.qml
+++ b/examples/qt3d/shadow-map-qml/Trefoil.qml
@@ -50,14 +50,7 @@ Entity {
Transform {
id: trefoilMeshTransform
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));
- return m;
- }
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), userAngle)
}
QQ2.NumberAnimation {
diff --git a/examples/qt3d/simple-qml/main.qml b/examples/qt3d/simple-qml/main.qml
index 0ee3ab2a8..3f1236c44 100644
--- a/examples/qt3d/simple-qml/main.qml
+++ b/examples/qt3d/simple-qml/main.qml
@@ -80,15 +80,8 @@ Entity {
Transform {
id: torusTransform
- 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;
- }
+ scale3D: Qt.vector3d(1.5, 1, 0.5)
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
}
Entity {
diff --git a/examples/qt3d/tessellation-modes/TessellatedQuad.qml b/examples/qt3d/tessellation-modes/TessellatedQuad.qml
index b5945ed6c..363b43710 100644
--- a/examples/qt3d/tessellation-modes/TessellatedQuad.qml
+++ b/examples/qt3d/tessellation-modes/TessellatedQuad.qml
@@ -53,16 +53,9 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.translate(Qt.vector3d(root.x, root.y, root.z));
- m.rotate(root.theta, Qt.vector3d(0, 1, 0));
- m.scale(root.scale)
- return m;
- }
+ translation: Qt.vector3d(root.x, root.y, root.z)
+ rotation: fromAxisAndAngle(Qt.vector3d(0, 1, 0), root.theta)
+ scale: root.scale
}
TessellatedQuadMesh {
diff --git a/examples/qt3d/torus-qml/main.qml b/examples/qt3d/torus-qml/main.qml
index 59023189d..127106437 100644
--- a/examples/qt3d/torus-qml/main.qml
+++ b/examples/qt3d/torus-qml/main.qml
@@ -76,15 +76,8 @@ Entity {
Transform {
id: transform
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- 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)
}
Material {
diff --git a/examples/qt3d/wave/Background.qml b/examples/qt3d/wave/Background.qml
index 7c6ed4952..c475b0e9a 100644
--- a/examples/qt3d/wave/Background.qml
+++ b/examples/qt3d/wave/Background.qml
@@ -72,14 +72,7 @@ Entity {
Transform {
// Rotate the plane so that it faces us
- matrix: {
- var m = Qt.matrix4x4(1, 0, 0, 0,
- 0, 1, 0, 0,
- 0, 0, 1, 0,
- 0, 0, 0, 1);
- m.rotate(90, Qt.vector3d(1, 0, 0));
- return m;
- }
+ rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 90)
},
Material {