Debian Codegraph @

tests/manual/multi-qquickwidgets-scene3d/main.qml

raw
1 // Copyright (C) 2022 Klaralvdalens Datakonsult AB (KDAB).
2 // SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
3
4 import QtQuick 6.0 as QQ2
5 import Qt3D.Core 2.15
6 import Qt3D.Render 2.15
7 import Qt3D.Input 2.15
8 import Qt3D.Extras 2.15
9 import QtQuick.Scene3D 2.15
10
11 QQ2.Item {
12 width: 300
13 height: 300
14
15 Scene3D {
16 id: scene3d
17 anchors.fill: parent
18 aspects: ["render", "input", "logic"]
19
20 Entity {
21 id: sceneRoot
22
23 Camera {
24 id: camera
25 projectionType: CameraLens.PerspectiveProjection
26 fieldOfView: 45
27 aspectRatio: scene3d.width / scene3d.height
28 nearPlane : 0.1
29 farPlane : 1000.0
30 position: Qt.vector3d( 0.0, 0.0, -40.0 )
31 upVector: Qt.vector3d( 0.0, 1.0, 0.0 )
32 viewCenter: Qt.vector3d( 0.0, 0.0, 0.0 )
33 }
34
35 OrbitCameraController {
36 camera: camera
37 }
38
39 components: [
40 RenderSettings {
41 activeFrameGraph: ForwardRenderer {
42 clearColor: Qt.rgba(0.5, 0.0, 1, 1)
43 camera: camera
44 showDebugOverlay: true
45 }
46 renderPolicy: RenderSettings.OnDemand
47 },
48 InputSettings { }
49 ]
50
51 Entity {
52 components: [
53 PhongMaterial {},
54 TorusMesh {
55 radius: 5
56 minorRadius: 1
57 rings: 100
58 slices: 20
59 },
60 Transform {
61 scale3D: Qt.vector3d(1.5, 1, 0.5)
62 rotation: fromAxisAndAngle(Qt.vector3d(1, 0, 0), 45)
63 }
64 ]
65 }
66 }
67 }
68 }