| 1 |
// Copyright (C) 2014 Klaralvdalens Datakonsult AB (KDAB). |
| 2 |
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only |
| 3 |
|
| 4 |
import Qt3D.Core 2.0 |
| 5 |
import Qt3D.Render 2.0 |
| 6 |
import Qt3D.Input 2.0 |
| 7 |
import Qt3D.Extras 2.0 |
| 8 |
|
| 9 |
Entity { |
| 10 |
id: sceneRoot |
| 11 |
|
| 12 |
Camera { |
| 13 |
id: camera |
| 14 |
projectionType: CameraLens.PerspectiveProjection |
| 15 |
fieldOfView: 45 |
| 16 |
aspectRatio: 16/9 |
| 17 |
nearPlane : 0.1 |
| 18 |
farPlane : 1000.0 |
| 19 |
position: Qt.vector3d( 0.0, 0.0, 20.0 ) |
| 20 |
upVector: Qt.vector3d( 0.0, 1.0, 0.0 ) |
| 21 |
viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 ) |
| 22 |
} |
| 23 |
|
| 24 |
OrbitCameraController { camera: camera } |
| 25 |
|
| 26 |
RenderSettings { |
| 27 |
id : external_forward_renderer |
| 28 |
activeFrameGraph : ForwardRenderer { |
| 29 |
camera: camera |
| 30 |
clearColor: "black" |
| 31 |
} |
| 32 |
} |
| 33 |
|
| 34 |
// Event Source will be set by the Qt3DQuickWindow |
| 35 |
InputSettings { id: inputSettings } |
| 36 |
|
| 37 |
components: [external_forward_renderer, inputSettings] |
| 38 |
|
| 39 |
CylinderMesh { |
| 40 |
id: mesh |
| 41 |
radius: 1 |
| 42 |
length: 3 |
| 43 |
rings: 100 |
| 44 |
slices: 20 |
| 45 |
} |
| 46 |
|
| 47 |
Transform { |
| 48 |
id: transform |
| 49 |
scale: 1.5 |
| 50 |
rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45) |
| 51 |
} |
| 52 |
|
| 53 |
PhongMaterial { |
| 54 |
id: material |
| 55 |
diffuse: "green" |
| 56 |
} |
| 57 |
|
| 58 |
Entity { |
| 59 |
id: mainEntity |
| 60 |
objectName: "mainEntity" |
| 61 |
components: [ mesh, material, transform ] |
| 62 |
} |
| 63 |
} |