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