summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/anaglyph-rendering/StereoCamera.qml
diff options
context:
space:
mode:
authorSean Harmer <sean.harmer@kdab.com>2018-01-25 14:43:15 +0000
committerSean Harmer <sean.harmer@kdab.com>2018-01-25 14:44:35 +0000
commit0851956b9b5bf17a8be097cdd0161eb708629070 (patch)
tree0a307aab7936afa97724d745781a8765875e7c49 /examples/qt3d/anaglyph-rendering/StereoCamera.qml
parent09c344d28017e06af6b34bc3c7b781902d052059 (diff)
parente680fe041700296be5e6e4a132e2cfc6f54d4e77 (diff)
Merge branch '5.9' into 5.10
Conflicts: src/render/backend/cameralens.cpp src/render/backend/cameralens_p.h src/render/jobs/pickboundingvolumejob.cpp src/render/jobs/updatelevelofdetailjob.cpp Change-Id: I5433dde8ace462d11f037742d45f555c87235ffe
Diffstat (limited to 'examples/qt3d/anaglyph-rendering/StereoCamera.qml')
-rw-r--r--examples/qt3d/anaglyph-rendering/StereoCamera.qml24
1 files changed, 14 insertions, 10 deletions
diff --git a/examples/qt3d/anaglyph-rendering/StereoCamera.qml b/examples/qt3d/anaglyph-rendering/StereoCamera.qml
index c8db4c0a9..ea013c0b0 100644
--- a/examples/qt3d/anaglyph-rendering/StereoCamera.qml
+++ b/examples/qt3d/anaglyph-rendering/StereoCamera.qml
@@ -62,6 +62,7 @@ Entity {
property vector3d viewCenter: Qt.vector3d(0.0, 0.0, 0.0)
property vector3d position: Qt.vector3d(0.0, 0.0, 1.0)
+ property vector3d upVector: Qt.vector3d(0.0, 1.0, 0.0)
readonly property real _fov2: Math.tan(fieldOfView * Math.PI / 180 * 0.5)
readonly property real top: nearPlane * _fov2
@@ -94,23 +95,26 @@ Entity {
matrix: {
var m = Qt.matrix4x4();
- m.lookAt(root.position, root.viewCenter, Qt.vector3d(0.0, 1.0, 0.0));
- return m;
+ m.translate(root.position)
+ var zAxis = root.position.minus(root.viewCenter).normalized()
+ var xAxis = root.upVector.crossProduct(zAxis).normalized();
+ var yAxis = zAxis.crossProduct(xAxis);
+ var r = Qt.matrix4x4(xAxis.x, yAxis.x, zAxis.x, 0,
+ xAxis.y, yAxis.y, zAxis.y, 0,
+ xAxis.z, yAxis.z, zAxis.z, 0,
+ 0, 0, 0, 1)
+ return m.times(r);
}
}
+ components: [ eyeTransform ]
+
property Entity leftCamera: Entity {
- components: [
- leftEyeLens,
- eyeTransform
- ]
+ components: [ leftEyeLens ]
}
property Entity rightCamera: Entity {
id: rightCameraEntity
- components: [
- rightEyeLens,
- eyeTransform
- ]
+ components: [ rightEyeLens ]
}
}