| 1 |
// Copyright (C) 2019 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import QtQuick 2.14 |
| 5 |
import Qt3D.Core 2.14 |
| 6 |
import Qt3D.Render 2.14 |
| 7 |
import Qt3D.Input 2.14 |
| 8 |
import Qt3D.Extras 2.14 |
| 9 |
|
| 10 |
Entity { |
| 11 |
id: rootNode |
| 12 |
components: [frameGraph] |
| 13 |
|
| 14 |
FrameGraph { |
| 15 |
id: frameGraph |
| 16 |
leftCamera: camera1 |
| 17 |
rightCamera: camera2 |
| 18 |
} |
| 19 |
|
| 20 |
CameraLens { |
| 21 |
id: cameraLens |
| 22 |
projectionType: CameraLens.PerspectiveProjection |
| 23 |
fieldOfView: 45 |
| 24 |
aspectRatio: 16/9 |
| 25 |
nearPlane: 0.01 |
| 26 |
farPlane: 1000.0 |
| 27 |
} |
| 28 |
|
| 29 |
SimpleCamera { |
| 30 |
id: camera1 |
| 31 |
lens: cameraLens |
| 32 |
position: Qt.vector3d(10.0, 1.0, 10.0) |
| 33 |
viewCenter: Qt.vector3d(0.0, 1.0, 0.0) |
| 34 |
} |
| 35 |
|
| 36 |
SimpleCamera { |
| 37 |
id: camera2 |
| 38 |
lens: cameraLens |
| 39 |
position: Qt.vector3d(0.0, 0.0, 5.0) |
| 40 |
viewCenter: Qt.vector3d(0.0, 0.0, 0.0) |
| 41 |
} |
| 42 |
|
| 43 |
Entity { |
| 44 |
id: sceneRoot |
| 45 |
property real rotationAngle: 0 |
| 46 |
|
| 47 |
SequentialAnimation { |
| 48 |
running: true |
| 49 |
loops: Animation.Infinite |
| 50 |
NumberAnimation { target: sceneRoot; property: "rotationAngle"; to: 360; duration: 4000; } |
| 51 |
} |
| 52 |
|
| 53 |
Entity { |
| 54 |
components: [ |
| 55 |
Transform { |
| 56 |
rotation: fromAxisAndAngle(Qt.vector3d(0, 0, 1), -sceneRoot.rotationAngle) |
| 57 |
}, |
| 58 |
CylinderMesh { }, |
| 59 |
MetalRoughMaterial { } |
| 60 |
] |
| 61 |
} |
| 62 |
} // sceneRoot |
| 63 |
} // rootNode |